Skip to content

Commit

Permalink
fix instructions in README and fix ROM builder script to work for eit…
Browse files Browse the repository at this point in the history
…her LoRAM or HiRAM configurations
  • Loading branch information
richard42 committed Apr 21, 2020
1 parent 389fe7b commit 21db8d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ RAM in the high space, do the following:
- In the code block following the comment "decompress Splash screen":
- change the instruction: "LDI $C9" to: "LDI $49"
- change the instruction: "ADCI $C9" to: "ADCI $49"
- change the *second* instruction like "LDI $00" to: "LDI $80"
- change the instruction: "LDI $00" to: "LDI $80"
- change the instruction: "ADCI $00" to: "ADCI $80"
- In the code block following the comment "print the splash screen":
- change the instruction: "LDI $00" to: "LDI $80"
- In the code block following the comment "decompress Adventureland program":
- change the *first* instruction like "LDI $00" to: "LDI $80"
- change the instruction: "LDI $00" to: "LDI $80"
- change the instruction: "ADCI $00" to: "ADCI $80"
- In the code block following the "Exit" label:
- change the instruction: "LDI $8B" to: "LDI $0B"
Expand Down
5 changes: 3 additions & 2 deletions build_rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
if ord(binData[0]) != 0xC0:
print("Invalid game core binary: missing starting LBR")
sys.exit(1)
sizeProgram = ord(binData[1]) * 256 + ord(binData[2]) - 0x10
endProgram = ord(binData[1]) * 256 + ord(binData[2])
sizeProgram = (endProgram & 0x7FFF) - 0x10
if sizeProgram + 3 > len(binData):
print("Invalid game core binary: file data length %i is less than required program size %i" % (len(binData), sizeProgram + 3))
sys.exit(1)
if ord(binData[sizeProgram]) != 0xC0:
print("Invalid game core binary: missing ending LBR")
sys.exit(1)
addrGameStart = ord(binData[sizeProgram+1]) * 256 + ord(binData[sizeProgram+2])
if addrGameStart < 0x10 or addrGameStart >= sizeProgram + 0x10:
if (addrGameStart & 0x7FFF) < 0x10 or (addrGameStart & 0x7FFF) >= sizeProgram + 0x10:
print("Invalid game core binary: game start address %x is invalid" % addrGameStart)
sys.exit(1)
binData = binData[3:sizeProgram]
Expand Down

0 comments on commit 21db8d7

Please sign in to comment.