A2osX/BIN/ASM.S.MAC.txt

232 lines
3.7 KiB
Plaintext
Raw Normal View History

2018-01-29 07:41:05 +00:00
NEW
2019-09-02 06:09:28 +00:00
AUTO 3,1
2018-01-29 07:41:05 +00:00
*---------------------------------------
MAC.Init >SYSCALL SListNew
bcs .9
2018-01-29 07:41:05 +00:00
2019-03-29 16:21:30 +00:00
>STA.G MAC.hList
>LDYAI 256
2018-07-20 11:51:08 +00:00
>SYSCALL getmem
bcs .9
>STYA ZPMacroBuf
txa
2019-03-29 16:21:30 +00:00
>STA.G MAC.hBuf
>LDYAI 256
2018-07-20 11:51:08 +00:00
>SYSCALL getmem
bcs .9
2019-03-29 16:21:30 +00:00
>STYA ZPMacroStk
txa
2019-03-29 16:21:30 +00:00
>STA.G MAC.hStk
.9 rts
2018-01-29 07:41:05 +00:00
*---------------------------------------
2019-03-29 16:21:30 +00:00
MAC.Reset >STZ.G MAC.StkPtr
2019-04-01 06:07:56 +00:00
>STA.G MAC.CtxID
rts
*---------------------------------------
2019-03-29 16:21:30 +00:00
MAC.Quit >LDA.G MAC.hStk
beq .1
2018-01-29 16:48:07 +00:00
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2019-03-29 16:21:30 +00:00
.1 >LDA.G MAC.hBuf
beq .3
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2019-03-29 16:21:30 +00:00
.3 >LDA.G MAC.hList
beq .8
2018-07-24 16:00:24 +00:00
>SYSCALL SListFree
2018-01-29 07:41:05 +00:00
.8 clc
rts
2018-01-29 07:41:05 +00:00
*---------------------------------------
2019-03-18 16:48:16 +00:00
MAC.AddChar tax
2019-03-22 16:47:33 +00:00
>LDA.G ASM.PASS If Pass#2, ignore
bne .8
2019-03-18 16:48:16 +00:00
>LDA.G MAC.BufPtr
tay
2019-03-18 16:48:16 +00:00
txa
sta (ZPMacroBuf),y
2019-03-18 16:48:16 +00:00
>INC.G MAC.BufPtr
2019-03-18 16:48:16 +00:00
txa
2019-04-01 06:07:56 +00:00
beq .1
cmp #C.CR
bne .8
2019-04-01 06:07:56 +00:00
.1 >LDA.G MAC.BufPtr
2019-03-18 16:48:16 +00:00
tay
lda #0
>PUSHYA
>PUSHW ZPMacroBuf
2019-03-29 16:21:30 +00:00
>PUSHW.G MAC.ID
>LDA.G MAC.hList
2019-03-18 16:48:16 +00:00
>SYSCALL SListAddData
rts
.8 clc
2019-04-01 06:07:56 +00:00
MAC.AddChar.RTS rts
*---------------------------------------
2019-03-29 16:21:30 +00:00
MAC.ReadLine >LDA.G MAC.StkPtr
tay
dey
2019-04-01 06:07:56 +00:00
lda (ZPMacroStk),y
sta ZPPtr1
2019-03-29 16:21:30 +00:00
dey
2019-04-01 06:07:56 +00:00
lda (ZPMacroStk),y
sta ZPPtr1+1 pop mac ID
2019-03-29 16:21:30 +00:00
2019-04-01 06:07:56 +00:00
dey
2019-03-29 16:21:30 +00:00
lda (ZPMacroStk),y
2019-04-01 06:07:56 +00:00
sta ZPPtr2
2019-03-29 16:21:30 +00:00
dey
lda (ZPMacroStk),y
2019-04-01 06:07:56 +00:00
sta ZPPtr2+1 pop offset
2019-03-29 16:21:30 +00:00
dey
lda (ZPMacroStk),y
2019-04-01 06:07:56 +00:00
sta ZPMacroBuf
2019-03-29 16:21:30 +00:00
dey
lda (ZPMacroStk),y
2019-04-01 06:07:56 +00:00
sta ZPMacroBuf+1 pop args
tya
>STA.G MAC.StkPtr
2019-03-29 16:21:30 +00:00
2019-04-01 06:07:56 +00:00
>PUSHW ZPPtr2 offset
2019-06-07 15:02:51 +00:00
>PUSHWZ len = 0 (string mode)
2019-04-01 06:07:56 +00:00
>PUSHW ZPLineBuf
>PUSHW ZPPtr1 Mac ID
2019-03-29 16:21:30 +00:00
>LDA.G MAC.hList
>SYSCALL SListGetData
2019-04-01 06:07:56 +00:00
bcs MAC.AddChar.RTS
pha
tya
* clc
adc ZPPtr2
sta ZPPtr2
pla
adc ZPPtr2+1
sta ZPPtr2+1
>LDYA ZPMacroBuf
>SYSCALL puts
>LDA.G MAC.StkPtr
tay
lda ZPLinePtr+1 push args
sta (ZPMacroStk),y
iny
lda ZPLinePtr
sta (ZPMacroStk),y
iny
*---------------------------------------
MAC.Push lda ZPPtr2+1 push offset
sta (ZPMacroStk),y
iny
lda ZPPtr2
sta (ZPMacroStk),y
iny
lda ZPPtr1+1 push MAC.ID
sta (ZPMacroStk),y
iny
lda ZPPtr1
sta (ZPMacroStk),y
iny
tya
>STA.G MAC.StkPtr
clc
rts
*---------------------------------------
MAC.Exec jsr SRC.GetNextChar skip '>'
bcs .90
>PUSHW ZPLinePtr
>LDA.G MAC.hList
>SYSCALL SListLookup
bcs .90
>STYA ZPPtr1 MAC.ID
txa
* clc
adc ZPLinePtr
sta ZPLinePtr
bcc .1
inc ZPLinePtr+1
.1 jsr SRC.GetChar
bcs .8
cmp #' '
bne .92
jsr SRC.GetNextChar
beq .8 eol..
cmp #' ' some arg...
bne .8
.2 jsr SRC.GetNextChar comment....skip
bcc .2
.8 >LDA.G MAC.StkPtr
cmp #MA.MAXDEPTH*8
beq .91
stz ZPPtr2
stz ZPPtr2+1 offset = 0
>INC.G MAC.CtxID
>INC.G MAC.Depth
>LDA.G MAC.StkPtr
tay
lda ZPLinePtr+1 push args
sta (ZPMacroStk),y
iny
lda ZPLinePtr
sta (ZPMacroStk),y
iny
jmp MAC.Push
.90 lda #E.MACRO.INV
sec
rts
.91 lda #E.MACRO.TOO.MANY
sec
2019-03-18 16:48:16 +00:00
rts
2019-04-01 06:07:56 +00:00
.92 lda #E.SYNTAX.ERROR
sec
rts
*---------------------------------------
2018-01-29 07:41:05 +00:00
MAN
2019-01-28 07:44:37 +00:00
SAVE USR/SRC/BIN/ASM.S.MAC
LOAD USR/SRC/BIN/ASM.S
2018-01-29 07:41:05 +00:00
ASM