Closed jon-axon closed 1 year ago
Based on the memory map in the VIP documentation, I agree with your reasoning. Not sure how this mistake was initially introduced. This will also need to be corrected in https://github.com/JohnEarnest/c-octo.
You work extremely quickly - many thanks!
Well, thank our lucky stars the incorrect value was too small. Otherwise we'd really be in trouble.
Yes, I was thinking that! :smile:
I'm sure people will be able to come up with some ingenious ways to make use of an extra 16 bytes now ...
Almost every source of documentation I can find (for example CHIP-8 Extensions and Compatibility and Laurence Scotford's CHIP-8 RAM) states that on an original COSMAC VIP with 4k of RAM, memory addresses from 0xE90 onwards are reserved (in addition to the first 512 bytes of memory), leaving just 3216 bytes for programs. Octo also unsurprisingly implements this restriction in VIP compatibility mode.
I'm not sure which is the original source of this information but I imagine it has been copied and used many times over the years without anyone double-checking it - and on closer inspection now I've realised it seems to be wrong, containing a slight miscalculation. Specifically:
All sources agree the final 352 bytes are reserved, and comprise:
However, it's a straightforward calculation to see that a contiguous block of 352 bytes at the end of 4096 byte memory space would start at address 0xEA0 and leave 3232 bytes of memory for programs above the 0x0 to 0x1FF initial reserved block, rather than the 0xE90 and 3216 bytes that's almost universally cited.
As further evidence, page 36 of the original COSMAC VIP manual (which can be found online in many places e.g. chipce/docs/CHIP-8) contains a memory map that corroborates a 0xEA0 starting address for a system with 4k of RAM:
Finally, I have discussed this issue on an other unrelated PR here: Timendus/chip8-test-suite, where user @gulrak has also now checked and corroborated this.
So, maybe this is something you would consider correcting in Octo, unless you have information to the contrary?