A2osX/BIN/ASM.S.DIR.txt
2018-01-15 06:50:44 +00:00

415 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
DIR.Init lda #$00
ldy #ASM.LI.CON
sta (pData),y
ldy #ASM.LI.XON
sta (pData),y
lda #$80
ldy #ASM.LI.ON
sta (pData),y
rts
*---------------------------------------
DIR.AC clc
rts
*---------------------------------------
DIR.AS clc
rts
*---------------------------------------
DIR.AT clc
rts
*---------------------------------------
DIR.AZ clc
rts
*---------------------------------------
DIR.BS jsr SRC.GetNextCharNB
beq .98
jsr EXP.Eval
bcs .9
lda SRC.ACC+3
ora SRC.ACC+2
bne .99
lda SRC.ACC
sta DIR.Counter
lda SRC.ACC+1
bmi .99
sta DIR.Counter+1
stz DIR.Byte
jsr SRC.GetNextChar
beq .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 ldy #ASM.PC
lda (pData),y
clc
adc DIR.Counter
sta (pData),y
iny
lda (pData),y
adc DIR.Counter+1
sta (pData),y
.2 lda DIR.Counter
bne .3
lda DIR.Counter+1
beq .8
dec DIR.Counter+1
.3 dec DIR.Counter
lda DIR.Byte
jsr FIO.EmitByte
bcc .2
rts
.8 clc
.9 rts
.99 lda #ERR.RANGE
sec
rts
.98 lda #ERR.SYNTAX.ERROR
sec
rts
*---------------------------------------
DIR.DA clc
rts
*---------------------------------------
DIR.DO ldy #ASM.DO.Count
lda (pData),y
inc
cmp #SRC.DO.MAXDEPTH
bcs .98
jsr EXP.Eval
bcs .99
ldy #ASM.DO.Count
lda (pData),y
inc
sta (pData),y
* clc ok from bcs .99
adc #ASM.DOELSE.Flag-1
tay
lda SRC.ACC
ora SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3 if
sta (pData),y
lda #$FF
ldy #ASM.DO.ON
sta (pData),y
clc
rts
.98 lda #ERR.TOO.MANY.DO
sec
.99 rts
*---------------------------------------
DIR.DU clc
rts
*---------------------------------------
DIR.ED clc
rts
*---------------------------------------
DIR.EL clc
rts
*---------------------------------------
DIR.EM lda #ERR.INV.MACRO.DEF
sec
rts
*---------------------------------------
DIR.EN clc
rts
*---------------------------------------
DIR.EP ldy #ASM.PH.ON
lda (pData),y
bpl .9
lda #0
sta (pData),y
ldy #ASM.PC.PH+3
ldx #3
.1 lda (pData),y
pha
dey
dex
bpl .1
ldy #ASM.PC
ldx #3
.2 pla
sta (pData),y
iny
dex
bpl .2
clc
rts
.9 lda #ERR.INV.DIRECTIVE
sec
rts
*---------------------------------------
DIR.EQ jsr SRC.GetNextCharNB
beq .99
jsr EXP.Eval
bcs .9
ldx #3
.1 lda SRC.ACC,x
sta SRC.GLabel.Value,x
dex
bpl .1
clc
rts
.99 lda #ERR.SYNTAX.ERROR
sec
.9 rts
*---------------------------------------
DIR.FI ldy #ASM.DO.Count
lda (pData),y
beq .99
dec
sta (pData),y
bne .1
lda #$0
ldy #ASM.DO.ON
sta (pData),y
.1 clc
rts
.99 lda #ERR.INV.DIRECTIVE
sec
rts
*---------------------------------------
DIR.HS clc
rts
*---------------------------------------
DIR.IN jsr SRC.GetNextCharNB
beq .9
>LDYA ZPLinePtr
>SYSCALL RealPath.YA
phx
jsr FIO.OpenFile
plx
php
pha
txa
>SYSCALL FreeMem.A
pla
plp
rts
.9 lda #ERR.SYNTAX.ERROR
sec
rts
*---------------------------------------
DIR.LI jsr SRC.GetNextCharNB
beq DIR.LI.9
>LDYA L.T.LI
jsr SRC.GetKeyword
bcs DIR.LI.9
jmp (J.LI,x)
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.XON ldy #ASM.LI.XON
sec
bra DIR.LI.APPLY
DIR.LI.XOFF ldy #ASM.LI.XON
clc
bra DIR.LI.APPLY
DIR.LI.ON ldy #ASM.LI.ON
sec
bra DIR.LI.APPLY
DIR.LI.OFF ldy #ASM.LI.ON
clc
DIR.LI.APPLY lsr
sta (pData),y
rts
DIR.LI.9 lda #ERR.SYNTAX.ERROR
sec
rts
*---------------------------------------
DIR.MA jsr SRC.GetNextCharNB
beq .9
.1 jsr FIO.ReadLine
bcs .99
jsr SRC.PrintLine
lda (ZPLineBuf)
beq .1
cmp #'*' Comment?
beq .8
cmp #';' Comment?
beq .8
cmp #' ' no label...go scan dir/opcode
beq .3
.2 jsr SRC.GetNextChar skip label
beq .8
cmp #' '
bne .2
.3 jsr SRC.GetNextCharNB Scan for an Opcode...
beq .8
cmp #'.'
bne .8
jsr SRC.GetNextChar
beq .8
cmp #'E'
bne .8
jsr SRC.GetNextChar
beq .8
cmp #'M'
bne .8
clc
rts
.8 ldy #ASM.PASS If Pass#2, ignore
lda (pData),y
bne .1
bra .1
clc
rts
.9 lda #ERR.INV.MACRO.DEF
sec
.99 rts
*---------------------------------------
DIR.OP jsr SRC.GetNextCharNB
beq DIR.OP.SYNERR
>LDYA ZPLinePtr
jmp FIO.LOAD.ASM.T
DIR.OP.SYNERR lda #ERR.SYNTAX.ERROR
sec
rts
*---------------------------------------
DIR.OR jsr SRC.GetNextCharNB
beq 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
*---------------------------------------
DIR.PG clc
rts
*---------------------------------------
DIR.PH ldy #ASM.PH.ON
lda (pData),y
bmi .9
lda #$80
sta (pData),y
ldy #ASM.PC+3
ldx #3
.1 lda (pData),y
pha
dey
dex
bpl .1
ldy #ASM.PC.PH
ldx #3
.2 pla
sta (pData),y
iny
dex
bpl .2
jmp DIR.OR
.9 lda #ERR.INV.DIRECTIVE
sec
rts
*---------------------------------------
DIR.SE clc
rts
*---------------------------------------
DIR.TA clc
rts
*---------------------------------------
DIR.TF clc
rts
*---------------------------------------
DIR.TI clc
rts
*---------------------------------------
DIR.US clc
rts
*---------------------------------------
MAN
SAVE /A2OSX.BUILD/BIN/DEV/ASM.S.DIR
LOAD /A2OSX.BUILD/BIN/DEV/ASM.S
ASM