rom_size = 32768 rom = bytearray([0xea] * rom_size) rom[0] = 0xa9 # load to a Register rom[1] = 0x42 rom[2] = 0x8d # write a register to memory # address 6000 rom[3] = 0x00 rom[4] = 0x60 # address 8000 - little endien rom[0x7ffc] = 0x00 rom[0x7ffd] = 0x80 with open("rom.bin", "wb") as file: file.write(rom)