mirror of
https://github.com/A2osX/A2osX.git
synced 2025-02-16 03:32:13 +00:00
Work In Progress
This commit is contained in:
parent
066614dab8
commit
3fdea2c2c6
432
BIN/ASM.S.txt
432
BIN/ASM.S.txt
@ -16,11 +16,14 @@ AUTO 6
|
|||||||
SYM.BLOCK.SIZE .EQ 4096
|
SYM.BLOCK.SIZE .EQ 4096
|
||||||
SYM.BLOCK.MAX .EQ 8
|
SYM.BLOCK.MAX .EQ 8
|
||||||
SRC.IN.DEPTH.MAX .EQ 7
|
SRC.IN.DEPTH.MAX .EQ 7
|
||||||
|
SRC.LABEL.MAXLEN .EQ 16
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
ERR.INV.ARGS .EQ 1
|
ERR.INV.ARGS .EQ 1
|
||||||
ERR.SRC.INV.TYPE .EQ 2
|
ERR.SRC.INV.TYPE .EQ 2
|
||||||
ERR.SRC.TOO.MANY.IN .EQ 3
|
ERR.SRC.TOO.MANY.IN .EQ 3
|
||||||
ERR.SYM.TOO.LARGE .EQ 10
|
ERR.SYNTAX.ERROR .EQ 99
|
||||||
|
ERR.SYM.TOO.LONG .EQ 10
|
||||||
|
ERR.VAL.TOO.BIG .EQ 11
|
||||||
ERR.LINE.TOO.LONG .EQ 20
|
ERR.LINE.TOO.LONG .EQ 20
|
||||||
ERR.INVALID.LABEL .EQ 21
|
ERR.INVALID.LABEL .EQ 21
|
||||||
|
|
||||||
@ -47,7 +50,9 @@ L.LIBSTR .DA LIBSTR
|
|||||||
L.MSG.HELP1 .DA MSG.HELP1
|
L.MSG.HELP1 .DA MSG.HELP1
|
||||||
L.MSG.HELP2 .DA MSG.HELP2
|
L.MSG.HELP2 .DA MSG.HELP2
|
||||||
L.MSG.SRCLINE .DA MSG.SRCLINE
|
L.MSG.SRCLINE .DA MSG.SRCLINE
|
||||||
|
L.MSG.ERROR .DA MSG.ERROR
|
||||||
L.READ.BUFFER .DA READ.BUFFER
|
L.READ.BUFFER .DA READ.BUFFER
|
||||||
|
T.DIRECTIVES.JMP .DA DIR.LI
|
||||||
.DA 0
|
.DA 0
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
CS.INIT >LDYA L.LIBSTR
|
CS.INIT >LDYA L.LIBSTR
|
||||||
@ -88,10 +93,10 @@ CS.INIT.ARGS >SYSCALL SYS.GetMemPtrA
|
|||||||
>PUSHA
|
>PUSHA
|
||||||
>SYSCALL SYS.PStrCat
|
>SYSCALL SYS.PStrCat
|
||||||
|
|
||||||
.3 jsr SRC.OPEN
|
ldy #SRC.hFILENAME
|
||||||
bcs .99
|
sta (pData),y Store filename
|
||||||
|
|
||||||
lda (pPs)
|
.3 lda (pPs)
|
||||||
ora #S.PS.F.EVENT Now accept events
|
ora #S.PS.F.EVENT Now accept events
|
||||||
sta (pPs)
|
sta (pPs)
|
||||||
|
|
||||||
@ -105,28 +110,63 @@ CS.INIT.ARGS >SYSCALL SYS.GetMemPtrA
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN ldy #bCANCEL
|
CS.RUN ldy #bCANCEL
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
beq .1
|
bne .99
|
||||||
sec
|
|
||||||
rts
|
|
||||||
|
|
||||||
.1 ldy #bSTOP
|
ldy #bSTOP
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
beq .2
|
bne .8
|
||||||
|
|
||||||
|
ldy #SRC.COUNT root file is already opened?
|
||||||
|
lda (pData),y
|
||||||
|
bne .10
|
||||||
|
|
||||||
|
ldy #SRC.hFILENAME
|
||||||
|
lda (pData),y
|
||||||
|
|
||||||
|
jsr SRC.OpenFileA
|
||||||
|
bcs *
|
||||||
|
|
||||||
|
.10 jsr SRC.ReadLine
|
||||||
|
bcc .2
|
||||||
|
cmp #$4C End Of File?
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
jsr SRC.FileClose
|
||||||
|
|
||||||
|
ldy #SRC.COUNT end of root file ?
|
||||||
|
lda (pData),y
|
||||||
|
bne .8 no continue back to previous file
|
||||||
|
|
||||||
|
ldy #ASM.PASS
|
||||||
|
lda (pData),y End of pass #2 ??
|
||||||
|
bne .1
|
||||||
|
inc
|
||||||
|
sta (pData),y
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.2 jsr SRC.ReadLine
|
.1 lda #0 End of assembly, exit with no error
|
||||||
bcs .9
|
.99 sec
|
||||||
|
rts
|
||||||
jsr SRC.ParseLine
|
|
||||||
|
.2 jsr SRC.ParseLine
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
>PUSHWI TmpBuffer256
|
>PUSHWI TmpBuffer256
|
||||||
>PUSHW SRC.LINENUM
|
>PUSHW SRC.LINENUM
|
||||||
>PUSHW L.MSG.SRCLINE
|
>PUSHW L.MSG.SRCLINE
|
||||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||||
clc
|
|
||||||
.9 rts
|
.8 clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.9 >PUSHA
|
||||||
|
>PUSHW SRC.LINENUM
|
||||||
|
>PUSHW L.MSG.ERROR
|
||||||
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||||
|
|
||||||
|
sec
|
||||||
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
||||||
lda (pEvent),y
|
lda (pEvent),y
|
||||||
@ -163,30 +203,15 @@ CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
|||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.QUIT ldy #SRC.COUNT
|
CS.QUIT jsr SRC.FileClose
|
||||||
|
bne CS.QUIT
|
||||||
|
|
||||||
|
ldy #SRC.hFILENAME
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
.1 clc
|
|
||||||
adc #SRC.hREFNUMS-1
|
|
||||||
tay
|
|
||||||
lda (pData),y
|
|
||||||
>SYSCALL SYS.MLICloseA
|
|
||||||
|
|
||||||
ldy SRC.COUNT
|
|
||||||
lda (pData),y
|
|
||||||
clc
|
|
||||||
adc #SRC.hBUFFERS-1
|
|
||||||
tay
|
|
||||||
lda (pData),y
|
|
||||||
>SYSCALL SYS.FreeMemA
|
>SYSCALL SYS.FreeMemA
|
||||||
|
|
||||||
ldy #SRC.COUNT
|
|
||||||
lda (pData),y
|
|
||||||
dec
|
|
||||||
sta (pData),y
|
|
||||||
bne .1
|
|
||||||
|
|
||||||
.8 lda hLIBSTR
|
.8 lda hLIBSTR
|
||||||
>SYSCALL SYS.UnloadLibA
|
>SYSCALL SYS.UnloadLibA
|
||||||
clc
|
clc
|
||||||
@ -196,7 +221,7 @@ LOAD.ASM.T
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.OPEN sta hFileName
|
SRC.OpenFileA sta hFileName
|
||||||
|
|
||||||
ldy #SRC.COUNT
|
ldy #SRC.COUNT
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
@ -246,19 +271,26 @@ SRC.OPEN sta hFileName
|
|||||||
txa
|
txa
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
|
|
||||||
cmp #$04 TXT?
|
cmp #$FA S-C/BAS?
|
||||||
bne .1
|
beq .8
|
||||||
|
|
||||||
>PUSHBI $0D
|
cmp #$04 TXT ?
|
||||||
>PUSHBI $FF
|
|
||||||
>PUSHB hFileName
|
|
||||||
>SYSCALL SYS.MLINewLine
|
|
||||||
bcs .99
|
|
||||||
bra .8
|
|
||||||
|
|
||||||
.1 cmp #$FA S-C/BAS?
|
|
||||||
bne .98
|
bne .98
|
||||||
|
|
||||||
|
>PUSHBI $0D Line separator for TXT file
|
||||||
|
>PUSHBI $FF
|
||||||
|
|
||||||
|
ldy #SRC.COUNT
|
||||||
|
lda (pData),y
|
||||||
|
clc
|
||||||
|
adc #SRC.hREFNUMS
|
||||||
|
tay
|
||||||
|
lda (pData),y
|
||||||
|
>PUSHA
|
||||||
|
>SYSCALL SYS.MLINewLine
|
||||||
|
bcs .99
|
||||||
|
|
||||||
.8 ldy #SRC.COUNT
|
.8 ldy #SRC.COUNT
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
inc
|
inc
|
||||||
@ -277,13 +309,22 @@ SRC.ReadLine ldy #SRC.COUNT
|
|||||||
adc #SRC.hFILETYPES-1
|
adc #SRC.hFILETYPES-1
|
||||||
tay
|
tay
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
bmi SRC.ReadLine.TFA
|
bmi .10
|
||||||
jmp SRC.ReadLine.T04
|
|
||||||
*---------------------------------------
|
|
||||||
SRC.ReadLine.TFA >LDYAI 3 LEN + LINENUM
|
|
||||||
jsr SRC.ReadLine.YA
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
|
>PUSHWI 256
|
||||||
|
>PUSHWI TmpBuffer256
|
||||||
|
jsr SRC.ReadFromFile
|
||||||
|
bcs .19
|
||||||
|
|
||||||
|
lda #0 replace ending $0D with $00
|
||||||
|
sta TmpBuffer256,y
|
||||||
|
.19 rts
|
||||||
|
|
||||||
|
.10 >PUSHWI 3
|
||||||
|
>PUSHW L.READ.BUFFER
|
||||||
|
jsr SRC.ReadFromFile
|
||||||
|
bcs .9
|
||||||
|
|
||||||
lda READ.BUFFER+1
|
lda READ.BUFFER+1
|
||||||
sta SRC.LINENUM
|
sta SRC.LINENUM
|
||||||
lda READ.BUFFER+2
|
lda READ.BUFFER+2
|
||||||
@ -291,20 +332,21 @@ SRC.ReadLine.TFA >LDYAI 3 LEN + LINENUM
|
|||||||
|
|
||||||
lda READ.BUFFER LEN
|
lda READ.BUFFER LEN
|
||||||
sec
|
sec
|
||||||
sbc #3 remove LEN + LINENUM from LEN
|
sbc #3
|
||||||
bcc .9 LEN should be at least 3
|
bcc .9 LEN should be at least 3
|
||||||
beq .8
|
|
||||||
|
tay
|
||||||
tay Read remaining chars
|
|
||||||
lda #0
|
lda #0
|
||||||
jsr SRC.ReadLine.YA
|
>PUSHYA
|
||||||
bcs .9
|
>PUSHW L.READ.BUFFER
|
||||||
|
jsr SRC.ReadFromFile
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
.1 lda READ.BUFFER,y
|
.1 lda READ.BUFFER,y
|
||||||
bmi .2
|
bmi .2
|
||||||
|
|
||||||
sta TmpBuffer256,x
|
sta TmpBuffer256,x
|
||||||
beq .8 Ending 00
|
beq .8 Ending 00
|
||||||
inx
|
inx
|
||||||
@ -352,13 +394,7 @@ SRC.ReadLine.TFA >LDYAI 3 LEN + LINENUM
|
|||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
SRC.ReadLine.T04
|
SRC.ReadFromFile ldy #SRC.COUNT
|
||||||
clc
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
SRC.ReadLine.YA >PUSHYA
|
|
||||||
>PUSHW L.READ.BUFFER
|
|
||||||
ldy #SRC.COUNT
|
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
clc
|
clc
|
||||||
adc #SRC.hREFNUMS-1
|
adc #SRC.hREFNUMS-1
|
||||||
@ -366,54 +402,218 @@ SRC.ReadLine.YA >PUSHYA
|
|||||||
lda (pData),y
|
lda (pData),y
|
||||||
>PUSHA
|
>PUSHA
|
||||||
>SYSCALL SYS.MLIRead
|
>SYSCALL SYS.MLIRead
|
||||||
|
bcs .9
|
||||||
|
tax $100 byte transfered ?
|
||||||
|
beq .9
|
||||||
|
lda #ERR.LINE.TOO.LONG
|
||||||
|
sec
|
||||||
|
.9 rts
|
||||||
|
*---------------------------------------
|
||||||
|
SRC.FileClose ldy #SRC.COUNT
|
||||||
|
lda (pData),y
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
clc
|
||||||
|
adc #SRC.hREFNUMS-1
|
||||||
|
tay
|
||||||
|
lda (pData),y
|
||||||
|
>SYSCALL SYS.MLICloseA
|
||||||
|
|
||||||
|
ldy #SRC.COUNT
|
||||||
|
lda (pData),y
|
||||||
|
clc
|
||||||
|
adc #SRC.hBUFFERS-1
|
||||||
|
tay
|
||||||
|
lda (pData),y
|
||||||
|
>SYSCALL SYS.FreeMemA
|
||||||
|
|
||||||
|
ldy #SRC.COUNT
|
||||||
|
lda (pData),y
|
||||||
|
dec
|
||||||
|
sta (pData),y
|
||||||
|
|
||||||
|
.8 clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.ParseLine stz SRC.BufPtr
|
SRC.ParseLine stz SRC.Label.Flags
|
||||||
jsr SRC.GetNextChar
|
stz SRC.BufPtr
|
||||||
beq .8
|
lda TmpBuffer256
|
||||||
|
beq SRC.ParseLine.Ok
|
||||||
cmp #'*' Comment?
|
cmp #'*' Comment?
|
||||||
beq .8
|
beq SRC.ParseLine.Ok
|
||||||
cmp #' '
|
cmp #' '
|
||||||
beq SRC.ParseLine.OpCode
|
beq SRC.ParseLine.OpCde
|
||||||
|
|
||||||
SRC.ParseLine.Sym cmp #'.' Local Label?
|
SRC.ParseLine.Sym cmp #'.' Local Label?
|
||||||
bne SRC.ParseLine.SymG
|
bne SRC.ParseLine.SymG
|
||||||
|
|
||||||
jsr SRC.GetNextToken
|
jsr SRC.GetChar
|
||||||
bcs
|
beq SRC.ParseLine.Err1
|
||||||
jsr SRC.IsNumber
|
jsr SRC.GetDecimal
|
||||||
bcs SRC.ParseLine.Err1
|
bcs SRC.ParseLine.Err1
|
||||||
|
jsr SYM.AddLocal
|
||||||
|
bcc SRC.ParseLine.OpCde
|
||||||
|
rts
|
||||||
|
|
||||||
SRC.ParseLine.SymG
|
SRC.ParseLine.SymG jsr SYM.ClearLocal
|
||||||
jsr SRC.GetToken
|
jsr SRC.GetLabel
|
||||||
jsr SYM.ClearLocal
|
bcs SRC.ParseLine.Err1
|
||||||
|
|
||||||
|
inc SRC.Label.Flags Remember to Add Label
|
||||||
|
|
||||||
SRC.ParseLine.OpCode
|
ldx #3 Makes Current Label = PC for now
|
||||||
jsr SRC.GetNextCharNB
|
ldy #ASM.PC
|
||||||
|
lda (pdata),y
|
||||||
|
.1 sta SRC.LabelValue,x
|
||||||
|
dey
|
||||||
|
dex
|
||||||
|
bpl .1
|
||||||
|
|
||||||
|
SRC.ParseLine.OpCde jsr SRC.GetCharNB
|
||||||
|
beq SRC.ParseLine.Ok
|
||||||
|
|
||||||
|
SRC.ParseLine.Ok lda SRC.Label.Flags
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
|
jsr SYM.AddLocal
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
SRC.ParseLine.Err1 lda #ERR.INVALID.LABEL
|
SRC.ParseLine.Err1 lda #ERR.INVALID.LABEL
|
||||||
|
SRC.ParseLine.Err sec
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
|
SRC.GetDecimal stz SRC.ACC+1
|
||||||
|
stz SRC.ACC+2
|
||||||
|
stz SRC.ACC+3
|
||||||
|
|
||||||
|
jsr SRC.GetChar
|
||||||
|
beq .99
|
||||||
|
jsr SRC.IsDigit10
|
||||||
|
bcs .99
|
||||||
|
and #$0F
|
||||||
|
sta SRC.ACC
|
||||||
|
|
||||||
|
.1 jsr SRC.GetChar
|
||||||
|
beq .8
|
||||||
|
cmp #' '
|
||||||
|
beq .8
|
||||||
|
jsr SRC.IsDigit10
|
||||||
|
bcs .99
|
||||||
|
and #$0F
|
||||||
|
|
||||||
|
pha
|
||||||
|
jsr SRC.ACC10
|
||||||
|
pla
|
||||||
|
bcs .9
|
||||||
|
clc
|
||||||
|
adc SRC.ACC
|
||||||
|
sta SRC.ACC
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
inc SRC.ACC+1
|
||||||
|
bne .1
|
||||||
|
inc SRC.ACC+2
|
||||||
|
bne .1
|
||||||
|
inc SRC.ACC+3
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
.9 lda #ERR.VAL.TOO.BIG
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
.8 clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.99 lda #ERR.SYNTAX.ERROR
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.GetToken
|
SRC.GetLabel jsr SRC.GetChar
|
||||||
|
|
||||||
|
beq .9
|
||||||
|
jsr SRC.IsLetter
|
||||||
|
bcs .9
|
||||||
|
sta SRC.Label
|
||||||
|
|
||||||
|
ldy #1
|
||||||
|
|
||||||
|
.1 jsr SRC.GetChar
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
cmp #' '
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
cmp #'.'
|
||||||
|
beq .2
|
||||||
|
|
||||||
|
jsr SRC.IsLetterOrDigit
|
||||||
|
bcs .9
|
||||||
|
.2 sta SRC.Label,y
|
||||||
|
iny
|
||||||
|
cpy #SRC.LABEL.MAXLEN
|
||||||
|
bne .1 if equ Carry is set
|
||||||
|
|
||||||
|
.9 sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
.8 lda #0
|
||||||
|
sta SRC.Label,y
|
||||||
|
clc
|
||||||
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.GetNextCharNB jsr SRC.GetNextChar
|
SRC.IsLetterOrDigit jsr SRC.IsDigit10
|
||||||
|
bcc SRC.IsLetterRTS
|
||||||
|
*---------------------------------------
|
||||||
|
SRC.IsLetter cmp #'A'
|
||||||
|
bcc .9
|
||||||
|
cmp #'['
|
||||||
|
bcc SRC.IsLetterRTS
|
||||||
|
|
||||||
|
cmp #'a'
|
||||||
|
bcc .9
|
||||||
|
cmp #'{'
|
||||||
|
bcs SRC.IsLetterRTS
|
||||||
|
|
||||||
|
adc #$20 to Uppercase
|
||||||
|
rts
|
||||||
|
|
||||||
|
.9 sec
|
||||||
|
SRC.IsLetterRTS rts
|
||||||
|
*---------------------------------------
|
||||||
|
SRC.IsDigit10 cmp #'0'
|
||||||
|
bcc .9
|
||||||
|
cmp #':'
|
||||||
|
rts cc if ok, cs if not
|
||||||
|
|
||||||
|
.9 sec
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
|
SRC.GetCharNB jsr SRC.GetChar
|
||||||
beq .9
|
beq .9
|
||||||
cmp #' '
|
cmp #' '
|
||||||
beq SRC.GetNextCharNB
|
beq SRC.GetCharNB
|
||||||
.9 rts
|
.9 rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.GetNextChar ldx SRC.BufPtr
|
SRC.GetChar ldx SRC.BufPtr
|
||||||
lda TmpBuffer256,x
|
lda TmpBuffer256,x
|
||||||
inc SRC.BufPtr
|
inc SRC.BufPtr
|
||||||
and #$7f
|
and #$7f
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
|
SYM.ClearPrivate
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
|
SYM.AddPrivate
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
|
SYM.LookupPrivate
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
SYM.ClearLocal
|
SYM.ClearLocal
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
@ -422,12 +622,15 @@ SYM.AddLocal
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
*---------------------------------------
|
SYM.LookupLocal
|
||||||
SYM.AddGlobal
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SYM.Lookup
|
SYM.AddGlobal
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
|
SYM.LookupGlobal
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
@ -437,7 +640,7 @@ SYM.BLOCK.ALLOC ldx #0
|
|||||||
inx
|
inx
|
||||||
cpx #SYM.BLOCK.MAX
|
cpx #SYM.BLOCK.MAX
|
||||||
bne .1
|
bne .1
|
||||||
lda #ERR.SYM.TOO.LARGE
|
lda #ERR.SYM.TOO.LONG
|
||||||
sec Out of block error
|
sec Out of block error
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -451,6 +654,51 @@ SYM.BLOCK.ALLOC ldx #0
|
|||||||
clc
|
clc
|
||||||
.9 rts
|
.9 rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
|
SRC.ACC10 lda SRC.ACC ACC*2-> ACC & ACCTMP
|
||||||
|
asl
|
||||||
|
sta SRC.ACC
|
||||||
|
sta SRC.ACCTMP
|
||||||
|
lda SRC.ACC+1
|
||||||
|
rol
|
||||||
|
sta SRC.ACC+1
|
||||||
|
sta SRC.ACCTMP+1
|
||||||
|
lda SRC.ACC+2
|
||||||
|
rol
|
||||||
|
sta SRC.ACC+2
|
||||||
|
sta SRC.ACCTMP+2
|
||||||
|
lda SRC.ACC+3
|
||||||
|
rol
|
||||||
|
sta SRC.ACC+3
|
||||||
|
sta SRC.ACCTMP+3
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
ldx #1
|
||||||
|
.1 asl SRC.ACC ACC=ACC*8
|
||||||
|
rol SRC.ACC+1
|
||||||
|
rol SRC.ACC+2
|
||||||
|
rol SRC.ACC+3
|
||||||
|
bcs .9
|
||||||
|
dex
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
lda SRC.ACC CC from ROL SRC.ACC+3
|
||||||
|
adc SRC.ACCTMP
|
||||||
|
sta SRC.ACC
|
||||||
|
lda SRC.ACC+1
|
||||||
|
adc SRC.ACCTMP+1
|
||||||
|
sta SRC.ACC+1
|
||||||
|
lda SRC.ACC+2
|
||||||
|
adc SRC.ACCTMP+2
|
||||||
|
sta SRC.ACC+2
|
||||||
|
lda SRC.ACC+3
|
||||||
|
adc SRC.ACCTMP+3
|
||||||
|
sta SRC.ACC+3 CS if overflow
|
||||||
|
|
||||||
|
.9 rts
|
||||||
|
*---------------------------------------
|
||||||
|
DIR.LI clc
|
||||||
|
rts
|
||||||
|
*---------------------------------------
|
||||||
CS.END
|
CS.END
|
||||||
T.DIRECTIVES .AS "AS"
|
T.DIRECTIVES .AS "AS"
|
||||||
.AS "AT"
|
.AS "AT"
|
||||||
@ -483,11 +731,16 @@ LIBSTR >PSTRING "libstr.o"
|
|||||||
MSG.HELP1 >CSTRING "A2osX-Macro Assembler (S-C MASM 2.0 Based)\n"
|
MSG.HELP1 >CSTRING "A2osX-Macro Assembler (S-C MASM 2.0 Based)\n"
|
||||||
MSG.HELP2 >CSTRING "Usage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\n"
|
MSG.HELP2 >CSTRING "Usage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\n"
|
||||||
MSG.SRCLINE >CSTRING "%05D-%s\n"
|
MSG.SRCLINE >CSTRING "%05D-%s\n"
|
||||||
|
MSG.ERROR >CSTRING "%05D-Error:$%h\n"
|
||||||
hLIBSTR .BS 1
|
hLIBSTR .BS 1
|
||||||
hFileName .BS 1
|
hFileName .BS 1
|
||||||
SRC.LINENUM .BS 2
|
SRC.LINENUM .BS 2
|
||||||
SRC.BufPtr .BS 1
|
SRC.BufPtr .BS 1
|
||||||
SRC.Token .BS 256
|
SRC.Label.Flags .BS 1
|
||||||
|
SRC.Label .BS SRC.LABEL.MAXLEN
|
||||||
|
SRC.LabelValue .BS 4
|
||||||
|
SRC.ACC .BS 4
|
||||||
|
SRC.ACCTMP .BS 4
|
||||||
READ.BUFFER .BS 256
|
READ.BUFFER .BS 256
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DUMMY
|
.DUMMY
|
||||||
@ -496,20 +749,25 @@ DS.START
|
|||||||
bSTOP .BS 1
|
bSTOP .BS 1
|
||||||
bCANCEL .BS 1
|
bCANCEL .BS 1
|
||||||
|
|
||||||
|
SRC.hFILENAME .BS 1
|
||||||
|
|
||||||
SRC.COUNT .BS 1
|
SRC.COUNT .BS 1
|
||||||
SRC.hREFNUMS .BS SRC.IN.DEPTH.MAX Store ref_num of opened files (Main, .INs & .INBs)
|
SRC.hREFNUMS .BS SRC.IN.DEPTH.MAX Store ref_num of opened files (Main, .INs & .INBs)
|
||||||
SRC.hBUFFERS .BS SRC.IN.DEPTH.MAX Store hMem to allocated buffers
|
SRC.hBUFFERS .BS SRC.IN.DEPTH.MAX Store hMem to allocated buffers
|
||||||
SRC.hFILETYPES .BS SRC.IN.DEPTH.MAX Store file type of opened SRC files
|
SRC.hFILETYPES .BS SRC.IN.DEPTH.MAX Store file type of opened SRC files
|
||||||
|
|
||||||
DST.hFILENAME .BS 1
|
DST.hFILENAME .BS 1
|
||||||
DST.hFILETYPE .BS 1
|
|
||||||
DST.hREFNUM .BS 1
|
DST.hREFNUM .BS 1
|
||||||
DST.hBUFFER .BS 1
|
DST.hBUFFER .BS 1
|
||||||
|
DST.hFILETYPE .BS 1
|
||||||
|
|
||||||
ASM.T.hFILENAME .BS 1
|
ASM.T.hFILENAME .BS 1
|
||||||
ASM.T.hFILE .BS 1 handle to loaded ASM.T.xxxxx
|
ASM.T.hFILE .BS 1 handle to loaded ASM.T.xxxxx
|
||||||
ASM.PASS .BS 1
|
ASM.PASS .BS 1
|
||||||
ASM.ORG .BS 4 32Bits Origin
|
ASM.PH.ON .BS 1
|
||||||
|
ASM.LI.OFF .BS 1
|
||||||
|
ASM.PC .BS 4 32Bits PC
|
||||||
|
ASM.PC.PH .BS 4 32Bits PC saved for PH directive
|
||||||
|
|
||||||
SYM.BLOCKS .BS SYM.BLOCK.MAX
|
SYM.BLOCKS .BS SYM.BLOCK.MAX
|
||||||
DS.END .ED
|
DS.END .ED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user