6502-asm/link.py
Zack Buhman b5e460048d add end_l/end_h
I don't remember why I did this.
2023-06-15 17:02:04 +00:00

30 lines
415 B
Python

import sys
assert len(sys.argv) > 2
mem = bytearray(2 ** 15)
with open(sys.argv[1], 'rb') as f:
l = f.read()
for i, a in enumerate(l):
mem[i + 0x4000] = a
# NMIB
mem[0xfffa - 0x8000] = 0x00
mem[0xfffb - 0x8000] = 0xc0
# RESB
mem[0xfffc - 0x8000] = 0x00
mem[0xfffd - 0x8000] = 0xc0
# IRQB
mem[0xfffe - 0x8000] = 0x02
mem[0xffff - 0x8000] = 0xc0
with open(sys.argv[2], 'wb') as f:
f.write(mem)