KnightOS icon indicating copy to clipboard operation
KnightOS copied to clipboard

scas misassembles castle

Open pixelherodev opened this issue 5 years ago • 4 comments

scas currently misassembles castle, in a seriously bad way. This is likely an issue with either macros, conditional assembly, or relative jumps.

pixelherodev avatar Oct 14 '20 12:10 pixelherodev

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 avatar Oct 14 '20 16:10 aviallon

@aviallon It's entirely possible.

You can try using sass, but I'm not sure if that works with kcc output.

pixelherodev avatar May 02 '21 23:05 pixelherodev

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 avatar May 11 '21 19:05 aviallon

@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.

pixelherodev avatar May 11 '21 19:05 pixelherodev