Monday, April 9, 2018

Patching the CoCo ROM Part 5

In order to shorten the size of the patch for the new parser address, I'm going to attempt patching everything in the ROM area that matches a call to CHRGET and CHRGOT.
Fraught with peril may be the best way to describe this, as it may patch code or data that just happens to have the same byte sequence.  However, it may require less code to come up with a list of exclusions not to patch, than a list of addresses to patch.  CHRGET has 32 hits, and CHRGOT has 29 hits in the Color BASIC disassembly alone.

The way the ROM would be patched, is simply to look for the opcode for a JSR or JMP to the direct page at address $9F (CHRGET) and $A5 (CHRGOT).  The opcode for a JSR using direct addressing is $9D, and the opcode for JMP is $0E.  So it's just a matter of searching through the ROM in a loop looking for those values followed by $9F or $A5.  To make sure it won't patch something it shouldn't, I'll perform a search for those byte sequences in the ROM binaries using a hex editor, then look at what is at the address in the ROM disassembly.  Anything that shouldn't be patched will be added to a list of addresses to exclude.

No comments:

Post a Comment