Thursday, April 5, 2018

Patching the CoCo ROM Part 2

After some research, it appears that the CHRGET and CHRGOT functions are followed immediately by system variables.  This means the default location cannot be used. 
There are 13 unused bytes at $F3, but it isn't enough space for the full patch.  The shorter version could be moved there though, and the JMP #### could be replaced with a BRA ##.  It would be faster, but not as fast as the MC-10 patch due to the extra BRA.  It still saves clock cycles but I'm guessing it will be less than 1%, where the MC-10 patch saved 1.2% or more.

   org $A8
   bra  $F3


   org $F3
cmpa #'9+1 ; IS THIS CHARACTER >=(ASCII 9)+1?
bcs PARSER2 ; (BHS is the same as BCC, reverse is BCS)
rts ; return if character >= (ASCII 9) +1
PARSER2
jmp >BROMHK+4


A rewrite of the ROM would let us move CHRGET to right before $F3 and the entire function could fit.  But compatibility would be sacrificed.  Why Microsoft didn't do this in the first place we'll never know, but it seems odd.

No comments:

Post a Comment