ra4king / CircuitSim

Basic Circuit Simulator
https://ra4king.github.io/CircuitSim
BSD 3-Clause "New" or "Revised" License
76 stars 28 forks source link

gui/Properties: Don't expand memory patterns too far #20

Closed ausbin closed 6 years ago

ausbin commented 6 years ago

Currently, when you place a new ROM component, it defaults to having an 8-bit address, so the component has its Contents property set to 256-0 since 19b5fa8ade. However, if you then set the component's address bits to 4, PropertyMemoryValidator.parse() attempt to expand this 256-0 pattern past the end of the backing array of size 16, raising an ArrayIndexOutOfBoundsException. This makes it impossible to shrink the address bits of a ROM component.

So stop expanding a memory pattern thing when the backing array is full.