Closed Centurion256 closed 3 years ago
Thanks for submitting this issue. I will have a look. I assume that it has something to do with the ZX spectrum configuration. zsim should be first a Z80 simulator with some extensions for ZX Spectrum. I.e. it should allow to load data also in 0x0000-0x3FFF area (which is ROM in ZX Spectrum) if "loadZxRom" is false.
BTW you are the first one I know of that really has taken the unit tests into use. Nice to see it in action for someone else.
Please try the fix here: https://github.com/maziac/DeZog/releases/tag/v1.4.9 and let me know if it helps.
Yes, it indeed works now. Both unit tests pass. Thank you!
I'm curious, what was the cause of such weird behavior? Perhaps there was some implicit memory protection done by zsim? I'll have a look at the source code.
Regarding unit tests, I always prefer to ensure the correctness of my code, and it was very difficult and tedious to do so for Z80 Assembly, since I had to flash the ROM of my computer each time. I'm developing my custom Z80 Based computer with support for virtual memory and it's own custom BIOS/OS (You can check it out here if you're interested), and this means that assuring the validity of the source code before uploading it is crucial. I have a few other suggestions for this extension that would help improve the experience for native Z80, such as custom I/O, but I think I'll post that in a different thread. Again, thank you for addressing this issue.
The root cause was that "loadZxRom" only handled the loading of the ROM data. Even if not loaded, the area was still ROM. As it is for the Spectrum.
Seems you have an interesting project there.
If you have further suggestions please let me know.
Describe the bug If a load instruction to an address in the range of 0x0000 and 0x3FFF is executed, the data in that memory cell will not change. This will happen regardless of the "loadZxRom" option in launch.json. A similar problem is encountered if the stack pointer is set in this range.
To Reproduce
high_addr: equ 0x4000 ;can be any value >= 0x4000 .db 00 ;.... ld hl, high_addr ld a, 0xFF ;can be any other value ld (hl), a ;...