ASM: fix forward ref bug

This commit is contained in:
burniouf 2023-07-22 15:43:25 +02:00
parent e3246c9c83
commit 9c547bcd35
4 changed files with 47 additions and 47 deletions

View File

@ -18,7 +18,7 @@ FIO.Init >LDYAI 256
>STYA ZPTmpBuf >STYA ZPTmpBuf
txa txa
>STA.G SRC.hTmpBuf >STA.G SRC.hTmpBuf
>LDYA L.ASM.6502 >LDYA L.ASM.6502
FIO.LOAD.CPU >STYA ZPPtr2 FIO.LOAD.CPU >STYA ZPPtr2
@ -29,7 +29,7 @@ FIO.LOAD.CPU >STYA ZPPtr2
>STYA ZPPtr1 >STYA ZPPtr1
ldy #$ff ldy #$ff
ldx #$ff ldx #$ff
.1 iny .1 iny
inx inx
lda (ZPPtr1),y lda (ZPPtr1),y
@ -45,24 +45,24 @@ FIO.LOAD.CPU >STYA ZPPtr2
lda (ZPPtr2),y lda (ZPPtr2),y
jsr SRC.IsLetterOrDigit jsr SRC.IsLetterOrDigit
bcs .3 bcs .3
sta ASM.CPU.FILE,x sta ASM.CPU.FILE,x
bra .2 bra .2
.3 stz ASM.CPU.FILE,x .3 stz ASM.CPU.FILE,x
>LDA.G ASM.hCPUFILE >LDA.G ASM.hCPUFILE
beq .4 beq .4
>SYSCALL FreeMem >SYSCALL FreeMem
>STZ.G ASM.hCPUFILE >STZ.G ASM.hCPUFILE
.4 >PUSHW L.MSG.CPU.FILE .4 >PUSHW L.MSG.CPU.FILE
>PUSHW L.ASM.CPU.FILE >PUSHW L.ASM.CPU.FILE
>PUSHBI 2 >PUSHBI 2
jsr OUT.Print jsr OUT.Print
>PUSHW L.ASM.CPU.FILE >PUSHW L.ASM.CPU.FILE
>PUSHBI O.RDONLY >PUSHBI O.RDONLY
>PUSHBI S.FI.T.BIN >PUSHBI S.FI.T.BIN
@ -72,7 +72,7 @@ FIO.LOAD.CPU >STYA ZPPtr2
txa txa
>STA.G ASM.hCPUFILE >STA.G ASM.hCPUFILE
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
>STYA ZPPtr1 >STYA ZPPtr1
@ -110,20 +110,20 @@ FIO.OpenFile >STYA ZPPtr1
>PUSHW ZPPtr1 >PUSHW ZPPtr1
>PUSHBI 2 >PUSHBI 2
jsr OUT.Print jsr OUT.Print
>LDA.G SRC.Depth >LDA.G SRC.Depth
cmp #IN.MAXDEPTH cmp #IN.MAXDEPTH
bne .1 bne .1
lda #E.SRC.TOO.MANY.IN lda #E.SRC.TOO.MANY.IN
sec sec
rts rts
.1 >PUSHW ZPPtr1 .1 >PUSHW ZPPtr1
>PUSHW ZPTmpBuf >PUSHW ZPTmpBuf
>SYSCALL Stat >SYSCALL Stat
bcs .99 bcs .99
ldy #S.STAT.P.TYPE ldy #S.STAT.P.TYPE
lda (ZPTmpBuf),y lda (ZPTmpBuf),y
cmp #S.FI.T.TXT cmp #S.FI.T.TXT
@ -131,12 +131,12 @@ FIO.OpenFile >STYA ZPPtr1
ldx #O.RDONLY+O.TEXT ldx #O.RDONLY+O.TEXT
bra .3 bra .3
.2 cmp #$FA S-C/BAS? .2 cmp #$FA S-C/BAS?
bne .98 bne .98
ldx #O.RDONLY ldx #O.RDONLY
.3 >PUSHW ZPPtr1 .3 >PUSHW ZPPtr1
txa txa
>PUSHA >PUSHA
@ -146,10 +146,10 @@ FIO.OpenFile >STYA ZPPtr1
>PUSHWZ >PUSHWZ
>SYSCALL FOpen >SYSCALL FOpen
bcs .99 bcs .99
pha pha
>INC.G SRC.Depth >INC.G SRC.Depth
clc clc
adc #SRC.hFILES-1 adc #SRC.hFILES-1
tay tay
@ -170,10 +170,10 @@ FIO.OpenFile >STYA ZPPtr1
>STA.G SRC.LINENUM >STA.G SRC.LINENUM
iny iny
sta (pData),y sta (pData),y
clc clc
rts rts
.98 lda #E.SRC.INV.TYPE .98 lda #E.SRC.INV.TYPE
sec sec
.99 rts .99 rts
@ -189,7 +189,7 @@ FIO.ReadLine >LDA.G SRC.Depth
>PUSHW ZPLineBuf >PUSHW ZPLineBuf
>PUSHWI 256 >PUSHWI 256
jsr FIO.ReadFromFile jsr FIO.ReadFromFile
bcs .19 bcs .19
tya tya
beq .13 beq .13
@ -214,7 +214,7 @@ FIO.ReadLine >LDA.G SRC.Depth
>PUSHW ZPTmpBuf >PUSHW ZPTmpBuf
>PUSHWI 3 >PUSHWI 3
jsr FIO.ReadFromFile jsr FIO.ReadFromFile
bcs .19 bcs .19
ldy #1 ldy #1
lda (ZPTmpBuf),y lda (ZPTmpBuf),y
@ -231,7 +231,7 @@ FIO.ReadLine >LDA.G SRC.Depth
lda #0 LENHI = 0 lda #0 LENHI = 0
>PUSHA >PUSHA
lda (ZPTmpBuf) LEN lda (ZPTmpBuf) LEN
sec sec
sbc #3 sbc #3
@ -327,16 +327,16 @@ FIO.ReadFromFile
*--------------------------------------- *---------------------------------------
FIO.FileClose >LDA.G SRC.Depth FIO.FileClose >LDA.G SRC.Depth
beq .8 beq .8
dec dec
sta (pData),y sta (pData),y
sec sec
adc #SRC.hFILES-1 adc #SRC.hFILES-1
tay tay
lda (pData),y lda (pData),y
>SYSCALL FClose >SYSCALL FClose
.8 clc .8 clc
rts rts
*--------------------------------------- *---------------------------------------

View File

@ -566,17 +566,17 @@ SRC.ComputeRel phy
lda #0 lda #0
adc (pData),y adc (pData),y
sta SRC.ARG+1 sta SRC.ARG+1
iny iny
lda #0 lda #0
adc (pData),y adc (pData),y
sta SRC.ARG+2 sta SRC.ARG+2
iny iny
lda #0 lda #0
adc (pData),y adc (pData),y
sta SRC.ARG+3 sta SRC.ARG+3
sec sec
lda SRC.ACC lda SRC.ACC
sbc SRC.ARG sbc SRC.ARG
@ -595,7 +595,7 @@ SRC.ComputeRel phy
sta SRC.ACC+3 sta SRC.ACC+3
ply ply
rts rts
*--------------------------------------- *---------------------------------------
SRC.GetDecimal8 jsr SRC.GetDecimal SRC.GetDecimal8 jsr SRC.GetDecimal
bcs .9 bcs .9
@ -975,7 +975,7 @@ SRC.IsLetter cmp #'_'
cmp #'z'+1 cmp #'z'+1
rts CC if lowercase rts CC if lowercase
.8 clc .8 clc
rts rts
@ -1041,7 +1041,7 @@ SRC.SkipXp1 sec
bcc .8 bcc .8
inc ZPLinePtr+1 inc ZPLinePtr+1
.8 rts .8 rts
*--------------------------------------- *---------------------------------------
SRC.GetNextCharNB SRC.GetNextCharNB
@ -1137,7 +1137,7 @@ SRC.GetACCSize lda SRC.ACC.F
.1 ldx SRC.ACC.SIZE .1 ldx SRC.ACC.SIZE
beq * SHOULD NEVER APPEND beq * SHOULD NEVER APPEND
.2 lda SRC.ACC-1,x .2 lda SRC.ACC-1,x
bne .8 bne .8

View File

@ -80,7 +80,7 @@ SYM.NewGlobal >LDA.G ASM.PASS
sta (ZPSymbolBuf),y sta (ZPSymbolBuf),y
phx phx
jsr SYM.LookupFWFef jsr SYM.LookupFWFef
bcs .1 bcs .1
@ -125,11 +125,11 @@ SYM.GetGlobal >PUSHB.G SYM.hList Pass #2: should be already defined...
lda (ZPSymbolBuf) #SYMG.F lda (ZPSymbolBuf) #SYMG.F
bit #SYMG.F.EQU bit #SYMG.F.EQU
bne .8 bne .8
* bit #SYMG.F.FWREF * bit #SYMG.F.FWREF
* beq .2 * beq .2
* >DEBUG * >DEBUG
.2 >LDA.G ASM.PC .2 >LDA.G ASM.PC
ldy #SYMG.V ldy #SYMG.V
@ -178,7 +178,7 @@ SYM.LookupGlobal
lda #$FF lda #$FF
sta SRC.ACC sta SRC.ACC
sta SRC.ACC+1 sta SRC.ACC+1
jmp SYM.AddFWFef jmp SYM.AddFWFef
.10 >STYA ZPPtr1 KeyID .10 >STYA ZPPtr1 KeyID
@ -571,7 +571,7 @@ SYM.Dump.G ldx #8
.10 lda (ZPSymbolBuf),y .10 lda (ZPSymbolBuf),y
bne .1 bne .1
dey dey
dex dex
dex dex
@ -580,7 +580,7 @@ SYM.Dump.G ldx #8
.1 txa .1 txa
lsr lsr
pha pha
>PUSHB L.MSG.EQU0+1,x >PUSHB L.MSG.EQU0+1,x
>PUSHB L.MSG.EQU0,x >PUSHB L.MSG.EQU0,x
@ -589,7 +589,7 @@ SYM.Dump.G ldx #8
pha pha
tax byte count tax byte count
clc clc
adc #SYMG.V adc #SYMG.V
@ -628,7 +628,7 @@ SYM.Dump.LP ldy #SYMG
>PUSHW L.MSG.LSYMBOL >PUSHW L.MSG.LSYMBOL
txa txa
>PUSHA >PUSHA
* >DEBUG
jsr SYM.Dump.PushValueY jsr SYM.Dump.PushValueY
lda #5 lda #5

View File

@ -211,7 +211,7 @@ CS.RUN.SETUP
.7 jsr DHCP.RUN .7 jsr DHCP.RUN
bcc .8 bcc .8
dec RetryCount dec RetryCount
bne .7 bne .7
@ -230,13 +230,13 @@ CS.RUN.SETUP.RTS
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.DUMP >LEA.G DCB.NIC CS.RUN.DUMP >LEA.G DCB.NIC
ldx #S.IOCTL.S.GETDCB ldx #S.IOCTL.S.GETDCB
jsr CS.RUN.IOCTL jsr CS.RUN.IOCTL
bcs CS.RUN.SETUP.RTS bcs CS.RUN.SETUP.RTS
>LEA.G DIB >LEA.G DIB
ldx #S.IOCTL.S.GETDIB ldx #S.IOCTL.S.GETDIB
jsr CS.RUN.IOCTL jsr CS.RUN.IOCTL
bcs CS.RUN.SETUP.RTS bcs CS.RUN.SETUP.RTS
@ -247,7 +247,7 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
>PUSHA >PUSHA
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
pha pha
tya tya
clc clc