diff options
| author | uvok | 2026-01-07 18:41:13 +0100 |
|---|---|---|
| committer | uvok | 2026-01-07 18:41:39 +0100 |
| commit | 3ba356cf0727817a431b28e01dd6d5d7b68d30ef (patch) | |
| tree | 27e15a4c3303a2d53e1f16ba2928e27dcaf75e81 | |
| parent | 9e31c197d825663dbc86877622f1b94638d6ed27 (diff) | |
fix endianness of binary creator
| -rwxr-xr-x | nandgame/assembler/createbin.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nandgame/assembler/createbin.py b/nandgame/assembler/createbin.py index 3fd1bba..23f9979 100755 --- a/nandgame/assembler/createbin.py +++ b/nandgame/assembler/createbin.py @@ -6,18 +6,21 @@ or rather, 15-bit, to have valid nandgame instructions, skip reserved bits. """ +#ENDIANNESS = 'big' +ENDIANNESS = 'little' + with open("allins.bin", "wb") as f: ins=0x0000 # ldi A, 0 - f.write(ins.to_bytes(2)) + f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) ins=0x00ff # ldi A, 255 - f.write(ins.to_bytes(2)) + f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) for ins in range(0x8000, 0xffff + 1): # unused bytes, force 1 if (ins & 0x6800) != 0x6800: continue - f.write(ins.to_bytes(2)) + f.write(ins.to_bytes(2, byteorder = ENDIANNESS)) |
