A2osX/BIN/ASM.S.DIR.txt

409 lines
6.8 KiB
Plaintext
Raw Normal View History

2015-10-04 20:55:51 +00:00
PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
2015-10-04 20:55:51 +00:00
INC 1
AUTO 6
2015-10-06 16:14:48 +00:00
.LIST OFF
2015-10-04 20:55:51 +00:00
*---------------------------------------
2015-12-04 16:33:33 +00:00
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
*---------------------------------------
2015-10-04 20:55:51 +00:00
DIR.AC clc
rts
*---------------------------------------
DIR.AS clc
rts
*---------------------------------------
DIR.AT clc
rts
*---------------------------------------
DIR.AZ clc
rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
DIR.BS 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.GetChar
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
2015-10-04 20:55:51 +00:00
rts
*---------------------------------------
DIR.DA clc
rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
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
2015-10-04 20:55:51 +00:00
rts
2015-12-04 16:33:33 +00:00
.98 lda #ERR.TOO.MANY.DO
sec
.99 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
DIR.DU clc
rts
*---------------------------------------
DIR.ED clc
rts
*---------------------------------------
DIR.EL clc
rts
*---------------------------------------
2015-10-28 16:55:12 +00:00
DIR.EM lda #ERR.INVALID.MACRO.DEF
2015-10-06 16:14:48 +00:00
sec
rts
*---------------------------------------
2015-10-04 20:55:51 +00:00
DIR.EN clc
rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
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.INVALID.DIRECTIVE
sec
2015-10-04 20:55:51 +00:00
rts
*---------------------------------------
2015-10-30 16:34:59 +00:00
DIR.EQ jsr EXP.Eval
2015-10-28 16:55:12 +00:00
bcs .9
2015-11-20 16:31:14 +00:00
ldx #3
.1 lda SRC.ACC,x
sta SRC.GLabel.Value,x
dex
bpl .1
2015-10-28 16:55:12 +00:00
clc
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2015-12-04 16:33:33 +00:00
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.INVALID.DIRECTIVE
sec
2015-10-04 20:55:51 +00:00
rts
*---------------------------------------
DIR.HS clc
rts
*---------------------------------------
2015-10-06 16:14:48 +00:00
DIR.IN jsr SRC.GetArg
bcs .9
>LDYA L.SRC.BUFFER
>SYSCALL NewStr.YA
2015-10-06 16:14:48 +00:00
2016-08-17 06:25:58 +00:00
phx
2015-11-20 16:31:14 +00:00
2015-10-28 16:55:12 +00:00
jsr FIO.OpenFileA
2015-11-20 16:31:14 +00:00
plx
php
pha
txa
>SYSCALL FreeMem.A
2015-11-20 16:31:14 +00:00
pla
plp
2015-10-06 16:14:48 +00:00
rts
.9 lda #ERR.SYNTAX.ERROR
2015-11-20 16:31:14 +00:00
sec
2015-10-06 16:14:48 +00:00
rts
*---------------------------------------
DIR.LI >LDYA L.T.LI
jsr SRC.GetKeyword
bcc .1
lda #ERR.SYNTAX.ERROR
sec
rts
.1 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
2015-11-20 16:31:14 +00:00
2015-10-06 16:14:48 +00:00
sta (pData),y
rts
*---------------------------------------
2015-10-28 16:55:12 +00:00
DIR.MA jsr SRC.GetArg
bcs .9
.1 jsr FIO.ReadLine
bcs .99
lda UsrBuf256
2015-10-28 16:55:12 +00:00
beq .1
cmp #'*' Comment?
beq .8
cmp #';' Comment?
beq .8
cmp #' ' no label...go scan dir/opcode
beq .3
.2 jsr SRC.GetChar skip label
beq .8
cmp #' '
bne .2
.3 jsr SRC.GetCharNB Scan for an Opcode...
beq .8
cmp #'.'
bne .8
jsr SRC.GetChar
beq .8
cmp #'E'
bne .8
jsr SRC.GetChar
beq .8
cmp #'M'
bne .8
clc
rts
.8 ldy #ASM.PASS If Pass#2, ignore
2015-10-06 16:14:48 +00:00
lda (pData),y
2015-10-28 16:55:12 +00:00
bne .1
2015-10-06 16:14:48 +00:00
2015-10-28 16:55:12 +00:00
bra .1
2015-10-06 16:14:48 +00:00
clc
rts
.9 lda #ERR.INVALID.MACRO.DEF
sec
2015-10-28 16:55:12 +00:00
.99 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2015-10-21 16:24:11 +00:00
DIR.OP jsr SRC.GetArg
bcs .9
ldx SRC.Buffer
lda ASM.T.FILENAMELEN
adc SRC.Buffer
sta ASM.T.FILENAME
tay
.1 lda SRC.Buffer,x
sta ASM.T.FILENAME,y
dey
dex
bne .1
2015-12-04 16:33:33 +00:00
jmp FIO.LOAD.ASM.T
2015-10-21 16:24:11 +00:00
.9 lda #ERR.SYNTAX.ERROR
sec
2015-10-04 20:55:51 +00:00
rts
*---------------------------------------
2015-10-30 16:34:59 +00:00
DIR.OR jsr EXP.Eval
2015-10-28 16:55:12 +00:00
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-12-04 16:33:33 +00:00
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.INVALID.DIRECTIVE
sec
2015-10-04 20:55:51 +00:00
rts
*---------------------------------------
DIR.SE clc
rts
*---------------------------------------
DIR.TA clc
rts
*---------------------------------------
DIR.TF clc
rts
*---------------------------------------
DIR.TI clc
rts
*---------------------------------------
DIR.US clc
rts
*---------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/ASM.S.DIR
LOAD /A2OSX.SRC/BIN/ASM.S
2015-10-04 20:55:51 +00:00
ASM