A2osX/BIN/ASM.S.DIR.txt

733 lines
11 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
*---------------------------------------
2020-03-02 06:53:19 +00:00
DIR.Reset lda #$ff
2020-02-27 16:46:40 +00:00
>STA.G ASM.LI.ON
2020-03-02 06:53:19 +00:00
iny #ASM.LI.CON
sta (pData),y
2020-02-27 16:46:40 +00:00
iny #ASM.LI.MON
sta (pData),y
2020-02-27 16:46:40 +00:00
iny #ASM.LI.XON
sta (pData),y
2020-02-25 07:28:30 +00:00
>STA.G MAC.StkPtr
rts
2015-12-04 16:33:33 +00:00
*---------------------------------------
DIR.AC clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AT sec
2020-02-28 16:30:16 +00:00
.HS 90 BCC
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AS clc
lda #0
ror
2020-02-28 16:30:16 +00:00
sta DIR.Byte Save b7 of last char in string
jsr SRC.GetNextChar
bcs .9
2020-08-17 13:03:39 +00:00
cmp #'-'
bne .1
2020-08-17 13:03:39 +00:00
2020-02-28 16:30:16 +00:00
lda #$40 save b7 status of ALL chars
tsb DIR.Byte
2020-08-17 13:03:39 +00:00
jsr SRC.GetNextChar
bcs .9
2020-08-17 13:03:39 +00:00
2020-02-28 16:30:16 +00:00
.1 sta DIR.Word Save delimiter....
sta DIR.Word+1 Save also in prev char..
2020-08-17 13:03:39 +00:00
.2 jsr SRC.GetNextChar
bcs .8
2020-08-17 13:03:39 +00:00
2020-02-28 16:30:16 +00:00
cmp DIR.Word delimiter ?
beq .8
2020-08-17 13:03:39 +00:00
2020-02-28 16:30:16 +00:00
ldx DIR.Word+1 Get prev char
sta DIR.Word+1 replace it with new
txa
2020-02-28 16:30:16 +00:00
cmp DIR.Word is it the starting delimiter
beq .2 yes, skip
2020-08-17 13:03:39 +00:00
bit DIR.Byte
bvc .3
2020-08-17 13:03:39 +00:00
ora #$80
2020-08-17 13:03:39 +00:00
2020-02-28 16:30:16 +00:00
.3 jsr OUT.EmitByte no, emit prev char
bcc .2
2020-08-17 13:03:39 +00:00
2019-03-25 07:04:40 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
2018-02-01 07:16:35 +00:00
2020-02-28 16:30:16 +00:00
.8 lda DIR.Word+1 Get prev char
cmp DIR.Word someone typed .AS "" ?
beq .88
2020-08-17 13:03:39 +00:00
bit DIR.Byte
bpl .81
2020-08-17 13:03:39 +00:00
eor #$80
2018-02-01 07:16:35 +00:00
.81 jmp OUT.EmitByte
.88 clc
2020-08-17 13:03:39 +00:00
DIR.AS.RTS rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.AZ jsr DIR.AS
2020-08-17 13:03:39 +00:00
bcs DIR.AS.RTS
lda #0
jmp OUT.EmitByte
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.BS jsr SRC.GetNextCharNB
bcs .98
2020-03-06 16:20:29 +00:00
jsr EXP.ResetAcc
jsr EXP.Eval
bcs .9
2020-02-26 16:34:13 +00:00
lda SRC.ACC+3
ora SRC.ACC+2
bne .99
2020-02-26 16:34:13 +00:00
lda SRC.ACC
eor #$ff
sta DIR.Word
2020-02-26 16:34:13 +00:00
lda SRC.ACC+1
eor #$ff
sta DIR.Word+1
2020-02-26 16:34:13 +00:00
stz DIR.Byte
2020-03-09 16:24:08 +00:00
jsr SRC.GetChar
bcs .1
2020-02-26 16:34:13 +00:00
cmp #C.SPACE
beq .1
2020-02-26 16:34:13 +00:00
cmp #','
bne .98
2020-02-26 16:34:13 +00:00
2020-03-06 16:20:29 +00:00
jsr EXP.ResetAcc
jsr EXP.Eval
bcs .9
2020-03-06 16:20:29 +00:00
lda SRC.ACC+3
ora SRC.ACC+2
ora SRC.ACC+1
bne .99
2020-02-26 16:34:13 +00:00
lda SRC.ACC
sta DIR.Byte
2020-02-26 16:34:13 +00:00
.1 inc DIR.Word
bne .2
inc DIR.Word+1
beq .8
2020-02-26 16:34:13 +00:00
.2 lda DIR.Byte
jsr OUT.EmitByte
bcc .1
rts
2020-02-26 16:34:13 +00:00
.8 clc
.9 rts
2020-02-26 16:34:13 +00:00
2019-03-25 07:04:40 +00:00
.99 lda #E.RANGE
sec
rts
2020-02-26 16:34:13 +00:00
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
2020-03-02 06:53:19 +00:00
2020-03-06 16:20:29 +00:00
.1 jsr EXP.ResetAcc
jsr EXP.Eval
bcs .9
2020-03-02 06:53:19 +00:00
2020-03-03 06:50:47 +00:00
ldy #0
2020-03-06 16:20:29 +00:00
ldx SRC.ACC.SIZE
.2 lda SRC.ACC,y
jsr OUT.EmitByte
bcs .9
2020-03-03 06:50:47 +00:00
iny
dex
bne .2
2020-03-02 06:53:19 +00:00
2020-03-03 06:50:47 +00:00
.3 jsr SRC.GetChar
bcs .8
2020-03-02 06:53:19 +00:00
cmp #C.SPACE
beq .8
2020-03-02 06:53:19 +00:00
cmp #','
bne .98
2020-03-03 06:50:47 +00:00
jsr SRC.GetNextChar
bcc .1
2020-03-03 06:50:47 +00:00
2019-03-25 07:04:40 +00:00
.98 lda #E.SYNTAX.ERROR
2020-03-03 06:50:47 +00:00
sec
.9 rts
2020-03-03 06:50:47 +00:00
.8 clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.DO >LDA.G ASM.DO.StackPtr
2020-08-17 13:03:39 +00:00
tay
inc
cmp #DO.MAXDEPTH
bcs .98
2020-08-17 13:03:39 +00:00
tya
beq .1
* clc
adc #ASM.DO.Stack-1
tay
lda (pData),y Previous DO is false?
bne .1
>INC.G ASM.DO.StackPtr yes,stack FALSE
2020-02-24 13:33:28 +00:00
2020-08-17 13:03:39 +00:00
* clc
adc #ASM.DO.Stack-1
tay
lda #0
bra .8
.1 jsr SRC.GetNextCharNB
bcs .99
2020-02-24 13:33:28 +00:00
2020-03-06 16:20:29 +00:00
jsr EXP.ResetAcc
jsr EXP.Eval
bcs .99
2020-02-24 13:33:28 +00:00
>INC.G ASM.DO.StackPtr
2020-08-17 13:03:39 +00:00
* clc
adc #ASM.DO.Stack-1
tay
lda SRC.ACC
ora SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
2020-08-17 13:03:39 +00:00
beq .8
lda #$ff
2019-10-03 06:25:27 +00:00
2020-08-17 13:03:39 +00:00
.8 sta (pData),y
2020-02-24 13:33:28 +00:00
clc
rts
2020-02-24 13:33:28 +00:00
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.EL >LDA.G ASM.DO.StackPtr
beq .9
2020-08-17 13:03:39 +00:00
tax
dec
beq .1 no previous DO context
clc
adc #ASM.DO.Stack-1
tay
lda (pData),y
beq .8 previous is FALSE
2020-02-24 13:33:28 +00:00
2020-08-17 13:03:39 +00:00
.1 txa
clc
adc #ASM.DO.Stack-1
tay
lda (pData),y
eor #$ff
sta (pData),y
2020-02-24 13:33:28 +00:00
2020-08-17 13:03:39 +00:00
.8 clc
rts
2020-02-24 13:33:28 +00:00
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
*---------------------------------------
2020-03-09 06:58:48 +00:00
DIR.DU >LDA.G ASM.DU.ON
bmi DIR.EP.ILLEGAL
lda #$80
sta (pData),y
ldy #ASM.PC.DU
jmp DIR.SavePC
*---------------------------------------
DIR.PH >LDA.G ASM.PH.ON
bmi DIR.EP.ILLEGAL
lda #$80
sta (pData),y
ldy #ASM.PC.PH
jsr DIR.SavePC
jmp DIR.OR
*---------------------------------------
DIR.ED >LDA.G ASM.DU.ON
bpl DIR.EP.ILLEGAL
lda #0
sta (pData),y
ldy #ASM.PC.DU
jmp DIR.RestorePC
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.EP >LDA.G ASM.PH.ON
bpl .9
2020-03-09 06:58:48 +00:00
lda #0
sta (pData),y
ldy #ASM.PC.PH
2020-03-09 06:58:48 +00:00
jmp DIR.RestorePC
.9
DIR.EP.ILLEGAL lda #E.ILLEGAL.DIR
sec
2020-08-17 13:03:39 +00:00
DIR.EP.RTS 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
2020-08-17 13:03:39 +00:00
lda #$ff
>STA.G OUT.bEquate
2020-03-02 16:49:47 +00:00
>LDA.G SYM.BufPtr
2020-08-17 13:03:39 +00:00
beq DIR.EP.ILLEGAL not in global symbol context
2020-02-26 16:34:13 +00:00
2020-03-02 16:49:47 +00:00
eor #SYMG
beq .1
2020-08-17 13:03:39 +00:00
bcs DIR.EP.ILLEGAL .SE not allowed in local/private
bcc .10 .EQ in local, skip F update
2020-03-02 16:49:47 +00:00
2020-08-17 13:03:39 +00:00
.1 ror A = 0 : CS = SYMG.F.RW
2020-03-06 06:56:36 +00:00
ora #SYMG.F.EQU
2020-03-06 16:20:29 +00:00
sta SRC.ACC.F
2020-03-02 16:49:47 +00:00
.10 jsr SRC.GetNextCharNB
2020-03-06 16:20:29 +00:00
bcs .9
2018-01-12 16:05:04 +00:00
2020-08-17 13:03:39 +00:00
jsr EXP.ResetAccV keep F
2020-03-06 16:20:29 +00:00
2020-02-26 16:34:13 +00:00
jsr EXP.Eval
2020-08-17 13:03:39 +00:00
bcs DIR.EP.RTS
2020-02-26 16:34:13 +00:00
2020-03-06 16:20:29 +00:00
>LDA.G SYM.BufPtr
2020-02-23 20:01:48 +00:00
2020-02-26 16:34:13 +00:00
cmp #SYMG
beq .12
2020-02-28 16:30:16 +00:00
2020-02-26 16:34:13 +00:00
tay
ldx #3 we are in local/private
.11 lda SRC.ACC,x update value
dey
sta (ZPSymbolBuf),y
dex
bpl .11
2020-03-02 16:49:47 +00:00
2020-02-26 16:34:13 +00:00
clc
rts
2020-08-17 13:03:39 +00:00
.12 ldy #SYMG-1
.13 lda SRC.ACC.F,y
sta (ZPSymbolBuf),y
dey
bpl .13
2020-03-06 16:20:29 +00:00
>LDA.G ASM.PASS
bne .2
2019-03-22 16:47:33 +00:00
2020-03-06 16:20:29 +00:00
jmp SYM.StoreGlobal
2020-02-26 16:34:13 +00:00
2020-03-06 16:20:29 +00:00
.2 jmp SYM.UpdateGlobal
2018-01-12 16:05:04 +00:00
2020-08-17 13:03:39 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2020-02-25 07:28:30 +00:00
DIR.FI >LDA.G ASM.DO.StackPtr
2020-08-17 13:03:39 +00:00
beq DIR.EP.ILLEGAL
2020-02-24 13:33:28 +00:00
dec
sta (pData),y
2020-02-24 13:33:28 +00:00
2020-02-25 07:28:30 +00:00
clc
rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
DIR.HS jsr SRC.GetNextCharNB
bcs .99
2020-03-03 06:50:47 +00:00
jsr SRC.IsDigit16
bcs .99
2020-03-03 06:50:47 +00:00
2020-02-28 07:21:46 +00:00
.1 sta DIR.Byte
jsr SRC.GetNextChar
bcc .2
2019-10-03 06:25:27 +00:00
jmp OUT.EmitByte
2020-03-03 06:50:47 +00:00
.2 jsr SRC.IsDigit16
bcc .3
2020-03-03 06:50:47 +00:00
cmp #','
beq .22
cmp #'.'
bne .99
2020-03-03 16:44:52 +00:00
.22 lda DIR.Byte
jsr OUT.EmitByte
bcc .5
rts
2020-03-03 06:50:47 +00:00
.3 pha
2020-03-03 16:44:52 +00:00
lda DIR.Byte
asl
asl
asl
asl
2020-02-28 07:21:46 +00:00
sta DIR.Byte
pla
2020-02-28 07:21:46 +00:00
ora DIR.Byte
2020-03-03 06:50:47 +00:00
.4 jsr OUT.EmitByte
bcs .9
2020-03-03 06:50:47 +00:00
jsr SRC.GetNextChar
bcs .8
2020-03-03 06:50:47 +00:00
2020-03-02 06:53:19 +00:00
cmp #C.SPACE
beq .8
2020-03-03 06:50:47 +00:00
jsr SRC.IsDigit16
bcc .1
2020-03-03 06:50:47 +00:00
cmp #','
beq .5
cmp #'.'
bne .99
2020-03-03 06:50:47 +00:00
.5 jsr SRC.GetNextChar
bcs .99
2020-03-03 06:50:47 +00:00
jsr SRC.IsDigit16
bcc .1
2020-03-03 06:50:47 +00:00
2019-03-25 07:04:40 +00:00
.99 lda #E.SYNTAX.ERROR
sec
2019-10-03 06:25:27 +00:00
.9 rts
2020-03-03 06:50:47 +00:00
.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
2020-02-23 20:01:48 +00:00
>LDYA ZPLinePtr
2019-04-01 06:07:56 +00:00
jmp FIO.OpenFile
2020-02-23 20:01:48 +00:00
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
2020-03-02 06:53:19 +00:00
cmp #C.SPACE
beq .8
2020-03-02 06:53:19 +00:00
2019-03-25 07:04:40 +00:00
.9 lda #E.SYNTAX.ERROR
sec
rts
2020-03-02 06:53:19 +00:00
.7 jmp (J.LI,x)
.8 clc
rts
2020-02-26 16:34:13 +00:00
DIR.LI.ON ldy #ASM.LI.ON
sec
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
DIR.LI.OFF ldy #ASM.LI.ON
clc
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
DIR.LI.CON ldy #ASM.LI.CON
sec
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
DIR.LI.COFF ldy #ASM.LI.CON
clc
bra DIR.LI.APPLY
DIR.LI.MON ldy #ASM.LI.MON
sec
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
DIR.LI.MOFF ldy #ASM.LI.MON
clc
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
DIR.LI.XON ldy #ASM.LI.XON
sec
bra DIR.LI.APPLY
2020-02-26 16:34:13 +00:00
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
2020-02-23 20:01:48 +00:00
>PUSHB.G MAC.hList
2019-03-18 16:48:16 +00:00
>PUSHW ZPLinePtr
>SYSCALL SListNewKey
bcs .99
2020-02-23 20:01:48 +00:00
2019-03-29 16:21:30 +00:00
>STYA.G MAC.ID
2020-02-23 20:01:48 +00:00
.8 lda #$ff
>STA.G ASM.MA.ON
clc
rts
2020-02-23 20:01:48 +00:00
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
2020-02-23 20:01:48 +00:00
jmp FIO.LOAD.CPU
2020-02-25 16:42:22 +00:00
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
*---------------------------------------
2020-02-28 16:30:16 +00:00
DIR.OR jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR
2020-02-27 16:46:40 +00:00
2020-03-06 16:20:29 +00:00
jsr EXP.ResetAcc
jsr EXP.Eval
bcs .9
2020-02-26 16:34:13 +00:00
ldx #0
2020-02-27 16:46:40 +00:00
ldy #ASM.PC
.1 lda SRC.ACC,x
sta (pData),y
iny
2020-02-27 16:46:40 +00:00
inx
cpx #4
bne .1
2020-02-27 16:46:40 +00:00
>LDA.G ASM.DU.ON
bmi .8
>LDA.G ASM.PH.ON
bmi .8
lda SRC.ACC
>STA.G DST.AUXTYPE
lda SRC.ACC+1
iny
sta (pData),y
.8 clc
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2020-03-09 06:58:48 +00:00
DIR.EN
2015-10-04 20:55:51 +00:00
*---------------------------------------
2020-03-09 06:58:48 +00:00
DIR.PG
*---------------------------------------
DIR.TI
*---------------------------------------
DIR.US
2015-10-04 20:55:51 +00:00
*---------------------------------------
2020-02-27 16:46:40 +00:00
DIR.TA
DIR.TA.8 clc
DIR.TA.RTS rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2020-02-26 16:34:13 +00:00
DIR.TF >LDA.G ASM.PASS If Pass#1, ignore
2020-02-27 16:46:40 +00:00
beq DIR.TA.8
2020-02-26 16:34:13 +00:00
>LDA.G ArgDstFile
beq .1
>SYSCALL ArgV
bra .2
.1 jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR
>LDYA ZPLinePtr
2020-02-28 16:30:16 +00:00
.2 >SYSCALL StrDup
2020-02-27 16:46:40 +00:00
bcs DIR.TA.RTS
>STYA ZPPtr1
stx ZPPtr2
lda #S.FI.T.BIN
sta ZPPtr2+1
ldy #$ff
.3 iny
lda (ZPPtr1),y
beq .7
cmp #','
bne .3
lda #0
sta (ZPPtr1),y
iny
lda (ZPPtr1),y
cmp #'T'
beq .4
.30 lda #E.SYNTAX.ERROR
bra .9
.4 ldx #0
.5 iny
lda (ZPPtr1),y
cmp DIR.SYS,x including \0
bne .30
inx
cpx #4
bne .5
lda #S.FI.T.SYS
sta ZPPtr2+1
.7 >PUSHW ZPPtr1
2020-02-26 16:34:13 +00:00
>PUSHWI 0 Allocate
>SYSCALL RealPath
bcs .9
2020-02-27 16:46:40 +00:00
2020-02-26 16:34:13 +00:00
txa
>STA.G DST.hFILENAME
2020-02-28 16:30:16 +00:00
>SYSCALL GetMemPtr
2020-02-26 16:34:13 +00:00
>PUSHYA
>PUSHBI O.WRONLY+O.CREATE
2020-02-27 16:46:40 +00:00
>PUSHB ZPPtr2+1 Type
>PUSHW.G DST.AUXTYPE
2020-02-26 16:34:13 +00:00
>SYSCALL FOpen
bcs .9
>STA.G DST.hREFNUM
2020-02-27 16:46:40 +00:00
clc
.9 php
pha
lda ZPPtr2
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2020-02-27 16:46:40 +00:00
pla
plp
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
2020-02-27 16:46:40 +00:00
.1 lda (pData),y
pha
dey
2019-03-21 16:37:02 +00:00
cpy #ASM.PC-1
bne .1
2020-02-27 16:46:40 +00:00
2019-03-21 16:37:02 +00:00
phx
ply
ldx #3
2020-02-27 16:46:40 +00:00
.2 pla
sta (pData),y
iny
dex
bpl .2
2020-03-09 06:58:48 +00:00
clc
rts
*---------------------------------------
DIR.RestorePC ldx #3
2020-02-27 16:46:40 +00:00
.1 lda (pData),y
pha
iny
dex
bpl .1
2020-02-27 16:46:40 +00:00
ldy #ASM.PC+3
ldx #3
2020-02-27 16:46:40 +00:00
.2 pla
sta (pData),y
dey
dex
bpl .2
2020-02-27 16:46:40 +00:00
2020-03-09 06:58:48 +00:00
clc because of JMP to it
rts
*---------------------------------------
2015-10-04 20:55:51 +00:00
MAN
2020-08-17 13:03:39 +00:00
SAVE usr/src/bin/asm.s.dir
LOAD usr/src/bin/asm.s
2015-10-04 20:55:51 +00:00
ASM