6502 command stream player, part 11

don't relocate on byte read routine
This commit is contained in:
tildearrow 2025-04-19 04:29:10 -05:00
parent ffb4b9e640
commit de86a7f742

View file

@ -191,10 +191,13 @@ fcsOptPlaceholder:
rts rts
fcsCallI: fcsCallI:
; get address ; get address and relocate it
jsr fcsReadNext jsr fcsReadNext
clc
adc #<fcsPtr
pha pha
jsr fcsReadNext jsr fcsReadNext
adc #>fcsPtr
pha pha
; ignore next two bytes ; ignore next two bytes
jsr fcsIgnoreNext jsr fcsIgnoreNext
@ -219,10 +222,13 @@ fcsFullCmd:
rts rts
fcsCall: fcsCall:
; get address ; get address and relocate it
jsr fcsReadNext jsr fcsReadNext
clc
adc #<fcsPtr
pha pha
jsr fcsReadNext jsr fcsReadNext
adc #>fcsPtr
pha pha
jsr fcsPushCall jsr fcsPushCall
pla pla
@ -260,10 +266,13 @@ fcsRet:
rts rts
fcsJump: fcsJump:
; get address ; get address and relocate it
jsr fcsReadNext jsr fcsReadNext
clc
adc #<fcsPtr
pha pha
jsr fcsReadNext jsr fcsReadNext
adc #>fcsPtr
pha pha
; ignore next two bytes ; ignore next two bytes
jsr fcsIgnoreNext jsr fcsIgnoreNext
@ -328,24 +337,14 @@ fcsDispatchCmd:
; x: channel*2 ; x: channel*2
; a is set to next byte ; a is set to next byte
fcsReadNext: fcsReadNext:
; a=chanPC[x]+fcsPtr ; a=chanPC[x]
clc lda (chanPC,x)
lda chanPC,x php
adc #<fcsPtr
sta fcsTempPtr
lda chanPC+1,x
adc #>fcsPtr
sta fcsTempPtr+1
; increase PC ; increase PC
inc chanPC,x inc chanPC,x
bne + bne +
inc chanPC+1,x inc chanPC+1,x
+ plp
; read byte and put it into a
; this is at the end to ensure flags are set properly
+ ldy #0
lda (fcsTempPtr),y
rts rts
; x: channel*2 ; x: channel*2
@ -498,6 +497,20 @@ fcsInit:
cpx #0 cpx #0
bne - bne -
; relocate program counters
ldx #0
- clc
lda chanPC,x
adc #<fcsPtr
sta chanPC,x
inx
lda chanPC,x
adc #>fcsPtr
sta chanPC,x
inx
cpx #(FCS_MAX_CHAN*2)
bne -
; initialize channel stacks ; initialize channel stacks
lda #0 lda #0
ldx #0 ldx #0