mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-15 04:29:35 +00:00
409 lines
6.8 KiB
Plaintext
409 lines
6.8 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*---------------------------------------
|
||
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 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
|
||
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.INVALID.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.INVALID.DIRECTIVE
|
||
sec
|
||
rts
|
||
*---------------------------------------
|
||
DIR.EQ jsr EXP.Eval
|
||
bcs .9
|
||
|
||
ldx #3
|
||
.1 lda SRC.ACC,x
|
||
sta SRC.GLabel.Value,x
|
||
dex
|
||
bpl .1
|
||
|
||
clc
|
||
.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.INVALID.DIRECTIVE
|
||
sec
|
||
rts
|
||
*---------------------------------------
|
||
DIR.HS clc
|
||
rts
|
||
*---------------------------------------
|
||
DIR.IN jsr SRC.GetArg
|
||
bcs .9
|
||
|
||
>LDYA L.SRC.BUFFER
|
||
>SYSCALL NewPStrYA
|
||
|
||
phx
|
||
|
||
jsr FIO.OpenFileA
|
||
plx
|
||
php
|
||
pha
|
||
|
||
txa
|
||
>SYSCALL FreeMemA
|
||
|
||
pla
|
||
plp
|
||
rts
|
||
|
||
|
||
.9 lda #ERR.SYNTAX.ERROR
|
||
sec
|
||
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
|
||
|
||
sta (pData),y
|
||
rts
|
||
*---------------------------------------
|
||
DIR.MA jsr SRC.GetArg
|
||
bcs .9
|
||
|
||
.1 jsr FIO.ReadLine
|
||
bcs .99
|
||
|
||
lda UsrBuf256
|
||
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
|
||
lda (pData),y
|
||
bne .1
|
||
|
||
|
||
|
||
bra .1
|
||
clc
|
||
rts
|
||
|
||
.9 lda #ERR.INVALID.MACRO.DEF
|
||
sec
|
||
.99 rts
|
||
*---------------------------------------
|
||
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
|
||
|
||
jmp FIO.LOAD.ASM.T
|
||
|
||
.9 lda #ERR.SYNTAX.ERROR
|
||
sec
|
||
rts
|
||
*---------------------------------------
|
||
DIR.OR 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.INVALID.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.SRC/BIN/ASM.S.DIR
|
||
LOAD /A2OSX.SRC/BIN/ASM.S
|
||
ASM
|