wiz-lang / wiz

A high-level assembly language for writing homebrew software and games on retro console platforms.
http://wiz-lang.org/
Other
409 stars 40 forks source link

Synthesize clear instructions. #97

Open Bananattack opened 4 years ago

Bananattack commented 4 years ago

On platforms that support stz for clearing memory addresses, synthesize forms for larger operands automatically. So this way, when assigning a 32-bit value to 0, we can synthesize it from either 8-bit or 16-bit STZ instructions, without needing to split it into multiple operations by hand. Note that for 65816, if the size of the operand isn't evenly divisible by the memory size used by the clear instruction (eg. clearing a u24 when in mem16 mode), it is an error, because it is no longer possible to synthesize a larger clear instruction transparently.