A2osX/BIN/ASM.S.DIR.txt

514 lines
8.8 KiB
Plaintext
Raw Normal View History

NEW
2019-09-02 06:09:28 +00:00
AUTO 3,1
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.Reset lda #$80
ldy #ASM.LI.ON
sta (pData),y
lda #0
ldy #ASM.LI.CON
sta (pData),y
ldy #ASM.LI.MON
sta (pData),y
ldy #ASM.LI.XON
sta (pData),y
rts
2015-12-04 16:33:33 +00:00
*---------------------------------------
DIR.AC clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AT sec
.HS 90 BCC
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AS clc
lda #0
ror
sta DIR.Byte Save b7 of last char in string
jsr SRC.GetNextChar
bcs .9
cmp #'-'
bne .1
lda #$40 save b7 status of ALL chars
tsb DIR.Byte
jsr SRC.GetNextChar
bcs .9
.1 sta DIR.Word Save delimiter....
sta DIR.Word+1 Save also in prev char..
.2 jsr SRC.GetNextChar
bcs .8
cmp DIR.Word delimiter ?
beq .8
ldx DIR.Word+1 Get prev char
sta DIR.Word+1 replace it with new
txa
cmp DIR.Word is it the starting delimiter
beq .2 yes, skip
bit DIR.Byte
bvc .3
ora #$80
.3 jsr OUT.EmitByte no, emit prev char
bcc .2
2019-03-25 07:04:40 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
2018-02-01 07:16:35 +00:00
.8 lda DIR.Word+1 Get prev char
cmp DIR.Word someone typed .AS "" ?
beq .88
bit DIR.Byte
bpl .81
eor #$80
2018-02-01 07:16:35 +00:00
.81 jmp OUT.EmitByte
.88 clc
2019-10-03 06:25:27 +00:00
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AZ jsr DIR.AS
bcs .9
lda #0
jmp OUT.EmitByte
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.BS jsr SRC.GetNextCharNB
bcs .98
jsr EXP.Eval
bcs .9
lda SRC.ACC+3
ora SRC.ACC+2
bne .99
lda SRC.ACC
eor #$ff
sta DIR.Word
lda SRC.ACC+1
eor #$ff
sta DIR.Word+1
stz DIR.Byte
jsr SRC.GetNextChar
bcs .1
cmp #' '
beq .1
cmp #','
bne .98
jsr EXP.Eval
bcs .9
lda SRC.ACC+3
ora SRC.ACC+2
ora SRC.ACC+1
bne .99
lda SRC.ACC
sta DIR.Byte
.1 inc DIR.Word
bne .2
inc DIR.Word+1
beq .8
.2 lda DIR.Byte
jsr OUT.EmitByte
bcc .1
rts
.8 clc
.9 rts
2019-03-25 07:04:40 +00:00
.99 lda #E.RANGE
sec
rts
2019-03-25 07:04:40 +00:00
.98 lda #E.SYNTAX.ERROR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.DA jsr SRC.GetNextCharNB
bcs .98
.1 jsr EXP.Eval
bcs .9
ldx SRC.ACC.SIZE
bne .10
2018-03-19 16:48:41 +00:00
ldx #2
.10 ldy #0
.2 lda SRC.ACC,y
jsr OUT.EmitByte
bcs .9
iny
dex
bne .2
.3 jsr SRC.GetNextChar
bcs .8
cmp #' '
beq .8
cmp #','
bne .98
jsr SRC.GetNextChar
bcc .1
2019-03-25 07:04:40 +00:00
.98 lda #E.SYNTAX.ERROR
clc
.9 rts
.8 clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.DO >LDA.G ASM.DO.StackPtr
inc
cmp #DO.MAXDEPTH
bcs .98
jsr SRC.GetNextCharNB
bcs .99
jsr EXP.Eval
bcs .99
>INC.G ASM.DO.StackPtr
* clc ok from bcs .99
adc #ASM.DO.Stack-1
tay
lda SRC.ACC
ora SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
beq .1
lda #$ff
2019-10-03 06:25:27 +00:00
.1 sta (pData),y
lda #$FF
>STA.G ASM.DO.ON
clc
rts
2019-03-25 07:04:40 +00:00
.98 lda #E.TOO.MANY.DO
sec
.99 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.DU >LDA.G ASM.DU.ON
bmi DIR.DU.ERR
lda #$80
sta (pData),y
ldy #ASM.PC.DU
jsr DIR.SavePC
clc
rts
2019-03-25 07:04:40 +00:00
DIR.DU.ERR lda #E.INV.DIR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.ED >LDA.G ASM.DU.ON
bpl DIR.DU.ERR
lda #0
sta (pData),y
ldy #ASM.PC.DU
jsr DIR.RestorePC
clc
rts
2019-03-25 07:04:40 +00:00
.9 lda #E.INV.DIR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.EL >LDA.G ASM.DO.StackPtr
beq .9
clc
adc #ASM.DO.Stack-1
tay
lda (pData),y
eor #$ff
sta (pData),y
clc
rts
2019-03-25 07:04:40 +00:00
.9 lda #E.ELSE.WITHOUT.DO
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-25 07:04:40 +00:00
DIR.EM lda #E.MACRO.INV.DEF
sec
rts
2019-10-03 06:25:27 +00:00
*---------------------------------------
DIR.EN clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.EP >LDA.G ASM.PH.ON
bpl .9
lda #0
sta (pData),y
ldy #ASM.PC.PH
jsr DIR.RestorePC
clc
rts
2019-03-25 07:04:40 +00:00
.9 lda #E.INV.DIR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.SE sec
.HS 90 BCC
*---------------------------------------
2019-03-21 16:37:02 +00:00
DIR.EQ clc
2019-03-22 16:47:33 +00:00
>LDA.G SYM.bInGlobal
2019-03-19 16:52:08 +00:00
bpl .99
jsr SRC.GetNextCharNB
bcs .99
2018-01-12 16:05:04 +00:00
2019-03-21 16:37:02 +00:00
lda #$ff
>STA.G OUT.bEquate
2019-03-22 16:47:33 +00:00
>LDA.G ASM.PASS
bne .2
jsr EXP.Eval PASS#1
bcs .9
2019-03-20 16:55:26 +00:00
jsr SYM.Acc2Global
jmp SYM.StoreGlobal
2019-10-03 06:25:27 +00:00
.2
lda (ZPSymbolBuf) PASS#2
2019-03-22 16:47:33 +00:00
and #SYMG.F.FWREF
beq .3
jsr EXP.Eval
bcs .9
jmp SYM.UpdateGlobal
.3 ldy #SYMG-1 copy back value for OUT.Print
2019-03-29 16:21:30 +00:00
.4 lda (ZPSymbolBuf),y
2019-03-22 16:47:33 +00:00
sta SRC.ACC.F,y
dey
bpl .4
clc
rts
2018-01-12 16:05:04 +00:00
2019-03-25 07:04:40 +00:00
.99 lda #E.SYNTAX.ERROR
sec
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.FI ldy #ASM.DO.StackPtr
lda (pData),y
beq .99
dec
sta (pData),y
bne .1
lda #$0
ldy #ASM.DO.ON
sta (pData),y
.1 clc
rts
2019-03-25 07:04:40 +00:00
.99 lda #E.INV.DIR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.HS jsr SRC.GetNextCharNB
bcs .99
jsr SRC.IsDigit16
bcs .99
.1 >STA.G DIR.Byte
jsr SRC.GetNextChar
bcc .2
2019-10-03 06:25:27 +00:00
jmp OUT.EmitByte
.2 jsr SRC.IsDigit16
bcc .3
cmp #','
beq .22
cmp #'.'
bne .99
.22 >LDA.G DIR.Byte
jsr OUT.EmitByte
bcc .5
rts
.3 pha
>LDA.G DIR.Byte
asl
asl
asl
asl
>STA.G DIR.Byte
pla
>ORA.G DIR.Byte
.4 jsr OUT.EmitByte
bcs .9
jsr SRC.GetNextChar
bcs .8
cmp #' '
beq .8
jsr SRC.IsDigit16
bcc .1
cmp #','
beq .5
cmp #'.'
bne .99
.5 jsr SRC.GetNextChar
bcs .99
jsr SRC.IsDigit16
bcc .1
2019-03-25 07:04:40 +00:00
.99 lda #E.SYNTAX.ERROR
sec
2019-10-03 06:25:27 +00:00
.9 rts
.8 clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.IN jsr SRC.GetNextCharNB
bcs .9
>LDYA ZPLinePtr
2019-04-01 06:07:56 +00:00
jmp FIO.OpenFile
2019-03-25 07:04:40 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
2015-10-06 16:14:48 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.LI jsr SRC.GetNextChar
bcs .9
2018-01-11 16:34:09 +00:00
>LDYA L.T.LI
jsr SRC.GetKeyword
bcs .9
jsr .7
jsr SRC.GetChar
bcs .8
cmp #','
beq DIR.LI
cmp #' '
beq .8
2019-03-25 07:04:40 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
.7 jmp (J.LI,x)
.8 clc
rts
DIR.LI.ON ldy #ASM.LI.ON
sec
bra DIR.LI.APPLY
DIR.LI.OFF ldy #ASM.LI.ON
clc
bra DIR.LI.APPLY
DIR.LI.CON ldy #ASM.LI.CON
sec
bra DIR.LI.APPLY
DIR.LI.COFF ldy #ASM.LI.CON
clc
bra DIR.LI.APPLY
DIR.LI.MON ldy #ASM.LI.MON
sec
bra DIR.LI.APPLY
DIR.LI.MOFF ldy #ASM.LI.MON
clc
bra DIR.LI.APPLY
DIR.LI.XON ldy #ASM.LI.XON
sec
bra DIR.LI.APPLY
DIR.LI.XOFF ldy #ASM.LI.XON
clc
DIR.LI.APPLY lda #0
ror
2015-11-20 16:31:14 +00:00
sta (pData),y
rts
2015-10-06 16:14:48 +00:00
*---------------------------------------
DIR.MA >LDA.G ASM.MA.ON
bmi .9
2015-10-28 16:55:12 +00:00
>LDA.G ASM.PASS If Pass#2, ignore
bne .8
2015-10-28 16:55:12 +00:00
jsr SRC.GetNextCharNB
beq DIR.OP.SYNERR
2019-03-18 16:48:16 +00:00
>PUSHW ZPLinePtr
2019-03-29 16:21:30 +00:00
>LDA.G MAC.hList
2019-03-18 16:48:16 +00:00
>SYSCALL SListNewKey
bcs .99
2019-03-29 16:21:30 +00:00
>STYA.G MAC.ID
.8 lda #$ff
>STA.G ASM.MA.ON
clc
rts
2019-03-25 07:04:40 +00:00
.9 lda #E.MACRO.INV.DEF
sec
.99 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.OP jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR
>LDYA ZPLinePtr
jmp FIO.LOAD.ASM.T
2019-03-25 07:04:40 +00:00
DIR.OP.SYNERR lda #E.SYNTAX.ERROR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.OR jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR
jsr EXP.Eval
bcs .9
ldy #ASM.PC
ldx #0
.1 lda SRC.ACC,x
sta (pData),y
inx
iny
cpx #4
bne .1
clc
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.PG clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.PH >LDA.G ASM.PH.ON
bmi .9
lda #$80
sta (pData),y
ldy #ASM.PC.PH
jsr DIR.SavePC
2015-12-04 16:33:33 +00:00
jmp DIR.OR
2019-03-25 07:04:40 +00:00
.9 lda #E.INV.DIR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.TA clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.TF clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.TI clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.US clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-21 16:37:02 +00:00
DIR.SavePC phy
plx
ldy #ASM.PC+3
.1 lda (pData),y
pha
dey
2019-03-21 16:37:02 +00:00
cpy #ASM.PC-1
bne .1
phx
ply
ldx #3
.2 pla
sta (pData),y
iny
dex
bpl .2
rts
*---------------------------------------
DIR.RestorePC ldx #3
.1 lda (pData),y
pha
iny
dex
bpl .1
ldy #ASM.PC+3
ldx #3
.2 pla
sta (pData),y
dey
dex
bpl .2
rts
*---------------------------------------
2015-10-04 20:55:51 +00:00
MAN
2019-01-28 07:44:37 +00:00
SAVE USR/SRC/BIN/ASM.S.DIR
LOAD USR/SRC/BIN/ASM.S
2015-10-04 20:55:51 +00:00
ASM