scas misassembles castle
pixelherodev opened this issue · 4 comments
scas currently misassembles castle, in a seriously bad way. This is likely an issue with either macros, conditional assembly, or relative jumps.
Do you think that the corrupted kalculator I have may be caused by that?
Perhaps assembling compiler output my be a good "completeness" test as the compiler produces unoptimized things.
@aviallon It's entirely possible.
You can try using sass, but I'm not sure if that works with kcc output.
I also think that I'll simply end up writing my calculator in assembly. This way I'm sure it'll work.
Also, I think C is badly suited for the z80e, so another language might be better for that (one that natively supports 16 bit data type and which has less undefined behavior)
@aviallon Of all the pieces of KnightOS that need work, z80e is not - to my knowledge - one of them. It definitely doesn't need to be rewritten in any other language, and I guarantee you that doing so will create more bugs than it fixes. Also, C has very good 16-bit (and 8-bit) support with stdint.h, which I highly recommend using for all integers in C. Using "raw" types (int / short / long / etc) is almost always a mistake for portable code.
z80e isn't perfect, but it's very good. What we really need is a way to automatically test it against a real calculator, but that's a lot harder. Testing the CPU is trivial - the CPU emulation is perfect[ly correct], but it's a z80 so that's not particularly challenging - but testing the rest of the ASIC is not.