diff options
Diffstat (limited to 'nandgame/assembler/createbin.py')
| -rwxr-xr-x | nandgame/assembler/createbin.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/nandgame/assembler/createbin.py b/nandgame/assembler/createbin.py index c8559a5..9f1105d 100755 --- a/nandgame/assembler/createbin.py +++ b/nandgame/assembler/createbin.py @@ -6,25 +6,27 @@ or rather, 15-bit, to have valid nandgame instructions, skip reserved bits. """ -#ENDIANNESS = 'big' -ENDIANNESS = 'little' +# ENDIANNESS = 'big' +ENDIANNESS = "little" + def main(): with open("allins.bin", "wb") as f: - ins=0x0000 + ins = 0x0000 # ldi A, 0 - f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) + f.write(ins.to_bytes(2, byteorder=ENDIANNESS)) - ins=0x00ff + ins = 0x00FF # ldi A, 255 - f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) + f.write(ins.to_bytes(2, byteorder=ENDIANNESS)) - for ins in range(0x8000, 0xffff + 1): + for ins in range(0x8000, 0xFFFF + 1): # unused bytes, force 1 if (ins & 0x6800) != 0x6800: continue - f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) + f.write(ins.to_bytes(2, byteorder=ENDIANNESS)) + import sys @@ -36,4 +38,3 @@ if __name__ == "__main__": ENDIANNESS = "big" print(f"Use Endianness: {ENDIANNESS}") main() - |
