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