Updating pattern table and name table at the same time?

صفحة 3/3
1 | 2 |

بواسطة Micha

Expert (103)

صورة Micha

20-10-2022, 20:27

I see you are using code like:

LD DE, SCROLL_SET+07*8

This is really really dangerous. The 07 (zero seven) will be regarded as an octal number by most compilers. Because 7 is smaller than 8 this will cause no troubles. But if you would have used 09 (zero nine) there than the compiler probably would have translated that into 0, without even a compiler warning (at least not in vAsm)
So don't use trailing zeros, except when using hexadecimal numbers with a $ at the beginning or an H at the end, or binary numbers with a % or a b.

Some other examples (from vAsm):
ld a,09+12 will load a with 0
ld a,12+09 will load a with 12
db 006,007,008,009,010,011,012,013 will compile into 6 7 0 0 8 9 10 11

Most C compilers do it also like this by the way... So if your microwave or your plane crashes, you now know what the cause is... I think most programmers don't know this.

صفحة 3/3
1 | 2 |