Posted By
Mad on 20171207 13:36:20
 Re: Does the Plus/4 support some form of VARPTR() command?
I am not sure about this. But for me it seems, that this code from CHRGOT/CHRGET:
SEC ; prepare subtraction ... SBC #$30 ; Petscii "0" SEC ; now invert carry... (letters are >=0) SBC #$D0 ; subtraction retour, lesser "0", CarryFlag=1 RTS ; ZeroFlag=1 end of instruction, CarryFlag=1 no digit
could be replaced by a slightly faster version..
this takes 8 cycles without the rts
perhaps it can be replaced with this:
cmp #$30 ; 2 cycles bcc invertcarry ; 2 cycles if >= $30, 3 cycles if < $30 cmp #$ff ; set carry to 0 and zero flag to 0 (bytes should not be $ff); 2 cycles rts ; 6 cycles here invertcarry: cmp #$00 ; 2 + (2+3) cycles; carry is now 1 and zero flag is only 1 if a zero byte was encountered (like above) rts ; 7 cycles here
I don't know if it's an improvement perhaps it's not worth the hussle anyways.. I hope I did not make a mistake there..
Have fun!
p.s.: Seems a $ff cannot occur there because of a bcs directly before: CMP #$3A ; ":" (colon) BCS L8143 ; if colon, exit
edit: i think you can rewrite the routine like this, sparing some more bytes and gain some performance: edit2: perhaps it's not a good idea to use this version here below. The cmp #$3a comes later in the code path, so most probably it's slower in most cases, the version above should be cool anyways.
LDY #$00 LDA (LastBasicLineNo),y ; $3b CMP #$20 ; " " (space) BEQ $0473 ; if space, get NEXT byte from basic cmp #$30 ; 2 cycles bcc invertcarry ; 2 cycles if >= $30, 3 cycles if < $30 cmp #$3a ; set carry to 0 and zero flag to 0 (if not $3a, if below $3a then the >=$3a procedure from the old code is processed here); 2 cycles rts ; 6 cycles here invertcarry: cmp #$00 ; 2 + (2+3) cycles; carry is now 1 and zero flag is only 1 if a zero byte was encountered (like above) rts ; 7 cycles here
so the $3a call is also included in this.. I hope it works.. It's just a quick guess at optimizing it..
Just some thoughts... Don't take this to serious!
