mirror of
https://github.com/A2osX/A2osX.git
synced 2025-02-20 15:29:07 +00:00
Kernel 0.94
This commit is contained in:
parent
13ad12582b
commit
d1188bc992
Binary file not shown.
@ -150,10 +150,13 @@ DIR.DO >LDA.G ASM.DO.StackPtr
|
||||
inc
|
||||
cmp #DO.MAXDEPTH
|
||||
bcs .98
|
||||
|
||||
jsr SRC.GetNextCharNB
|
||||
bcs .99
|
||||
|
||||
jsr EXP.Eval
|
||||
bcs .99
|
||||
|
||||
>INC.G ASM.DO.StackPtr
|
||||
* clc ok from bcs .99
|
||||
adc #ASM.DO.Stack-1
|
||||
@ -166,10 +169,12 @@ DIR.DO >LDA.G ASM.DO.StackPtr
|
||||
lda #$ff
|
||||
|
||||
.1 sta (pData),y
|
||||
|
||||
lda #$FF
|
||||
>STA.G ASM.DO.ON
|
||||
clc
|
||||
rts
|
||||
|
||||
.98 lda #E.TOO.MANY.DO
|
||||
sec
|
||||
.99 rts
|
||||
@ -189,8 +194,10 @@ DIR.DU.ERR lda #E.INV.DIR
|
||||
*---------------------------------------
|
||||
DIR.ED >LDA.G ASM.DU.ON
|
||||
bpl DIR.DU.ERR
|
||||
|
||||
lda #0
|
||||
sta (pData),y
|
||||
|
||||
ldy #ASM.PC.DU
|
||||
jsr DIR.RestorePC
|
||||
|
||||
@ -202,14 +209,17 @@ DIR.ED >LDA.G ASM.DU.ON
|
||||
*---------------------------------------
|
||||
DIR.EL >LDA.G ASM.DO.StackPtr
|
||||
beq .9
|
||||
|
||||
clc
|
||||
adc #ASM.DO.Stack-1
|
||||
tay
|
||||
lda (pData),y
|
||||
eor #$ff
|
||||
sta (pData),y
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.ELSE.WITHOUT.DO
|
||||
sec
|
||||
rts
|
||||
@ -278,14 +288,17 @@ DIR.EQ clc
|
||||
DIR.FI ldy #ASM.DO.StackPtr
|
||||
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 #E.INV.DIR
|
||||
sec
|
||||
rts
|
||||
|
@ -93,7 +93,7 @@ FIO.OpenFile >STYA ZPPtr1
|
||||
>PUSHBI 2
|
||||
jsr OUT.Print
|
||||
|
||||
>LDA.G SRC.COUNT
|
||||
>LDA.G SRC.Depth
|
||||
cmp #IN.MAXDEPTH
|
||||
bne .1
|
||||
|
||||
@ -127,13 +127,13 @@ FIO.OpenFile >STYA ZPPtr1
|
||||
bcs .99
|
||||
|
||||
pha
|
||||
>LDA.G SRC.COUNT
|
||||
>LDA.G SRC.Depth
|
||||
clc
|
||||
adc #SRC.hFILES
|
||||
tay
|
||||
pla
|
||||
sta (pData),y
|
||||
>LDA.G SRC.COUNT
|
||||
>LDA.G SRC.Depth
|
||||
clc
|
||||
adc #SRC.hFILETYPES
|
||||
tay
|
||||
@ -141,7 +141,7 @@ FIO.OpenFile >STYA ZPPtr1
|
||||
lda FIO.Stat+S.STAT.P.TYPE
|
||||
sta (pData),y
|
||||
|
||||
>INC.G SRC.COUNT
|
||||
>INC.G SRC.Depth
|
||||
|
||||
lda #0
|
||||
>STA.G SRC.LINENUM
|
||||
@ -155,7 +155,7 @@ FIO.OpenFile >STYA ZPPtr1
|
||||
sec
|
||||
.99 rts
|
||||
*---------------------------------------
|
||||
FIO.ReadLine >LDA.G SRC.COUNT
|
||||
FIO.ReadLine >LDA.G SRC.Depth
|
||||
clc
|
||||
adc #SRC.hFILETYPES-1
|
||||
tay
|
||||
@ -258,7 +258,7 @@ FIO.ReadLine >LDA.G SRC.COUNT
|
||||
rts
|
||||
*--------------------------------------
|
||||
FIO.ReadFromFile
|
||||
>LDA.G SRC.COUNT
|
||||
>LDA.G SRC.Depth
|
||||
clc
|
||||
adc #SRC.hFILES-1
|
||||
tay
|
||||
@ -272,7 +272,7 @@ FIO.ReadFromFile
|
||||
sec
|
||||
.9 rts
|
||||
*---------------------------------------
|
||||
FIO.FileClose >LDA.G SRC.COUNT
|
||||
FIO.FileClose >LDA.G SRC.Depth
|
||||
beq .8
|
||||
|
||||
dec
|
||||
|
@ -265,21 +265,20 @@ MAC.ReadLine >LDA.G MAC.hBuf
|
||||
|
||||
lda (ZPMacroBuf)
|
||||
beq .9
|
||||
|
||||
|
||||
|
||||
inc ZPMacroBuf
|
||||
bne .21
|
||||
inc ZPMacroBuf+1
|
||||
|
||||
.21 cmp #'#'
|
||||
bne .20
|
||||
|
||||
>LDYA ZPMacroBuf
|
||||
>SYSCALL puts
|
||||
>DEBUG
|
||||
|
||||
jsr MAC.GetArgCnt
|
||||
ora #$30
|
||||
bra .7
|
||||
sta (ZPLineBuf),y
|
||||
iny
|
||||
|
||||
bra .1
|
||||
|
||||
.20 cmp #'1'
|
||||
bcc .9
|
||||
@ -430,7 +429,7 @@ MAC.GetArgCnt phy
|
||||
|
||||
.1 iny
|
||||
lda (ZPMacroArgBuf),y
|
||||
beq .8
|
||||
beq .7
|
||||
|
||||
cmp #','
|
||||
bne .1
|
||||
|
@ -61,27 +61,39 @@ OUT.PrintLineErr
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf
|
||||
|
||||
ldx ZPLinePtr
|
||||
cpx ZPLineBuf
|
||||
beq .4
|
||||
lda ZPLinePtr
|
||||
sec
|
||||
sbc ZPLineBuf
|
||||
jsr OUT.PrintLineErrDashA
|
||||
|
||||
.3 phx
|
||||
>LDA.G SRC.Depth
|
||||
jsr OUT.PrintLineErrDashA
|
||||
|
||||
>LDA.G MAC.Depth
|
||||
jsr OUT.PrintLineErrDashA
|
||||
|
||||
lda #'^'
|
||||
>SYSCALL PutChar
|
||||
bcs .9
|
||||
|
||||
jmp OUT.PrintCR
|
||||
|
||||
.9 rts
|
||||
*---------------------------------------
|
||||
OUT.PrintLineErrDashA
|
||||
tax
|
||||
beq .8
|
||||
|
||||
.1 phx
|
||||
lda #'-'
|
||||
>SYSCALL PutChar
|
||||
plx
|
||||
bcs .9
|
||||
|
||||
dex
|
||||
cpx ZPLineBuf
|
||||
bne .3
|
||||
bne .1
|
||||
|
||||
.4 lda #'^'
|
||||
phy
|
||||
>SYSCALL PutChar
|
||||
ply
|
||||
bcs .9
|
||||
|
||||
jmp OUT.PrintCR
|
||||
.8 clc
|
||||
.9 rts
|
||||
*---------------------------------------
|
||||
OUT.PrintLine jsr OUT.PrintLineOn
|
||||
@ -90,7 +102,7 @@ OUT.PrintLine jsr OUT.PrintLineOn
|
||||
OUT.PrintLine.1 jsr OUT.PrintLineOutBuf
|
||||
bcs OUT.Print.RTS
|
||||
|
||||
>LDA.G SRC.COUNT
|
||||
>LDA.G SRC.Depth
|
||||
|
||||
.1 dec
|
||||
beq .2
|
||||
|
@ -4,20 +4,19 @@ NEW
|
||||
SRC.ParseLine jsr OUT.Reset
|
||||
jsr SRC.GetChar
|
||||
bcs .8
|
||||
|
||||
cmp #'*' Comment?
|
||||
beq .8
|
||||
|
||||
cmp #';' Comment?
|
||||
beq .8
|
||||
>LDA.G ASM.DO.StackPtr
|
||||
beq .1
|
||||
|
||||
pha
|
||||
jsr SRC.DoCheck
|
||||
pla
|
||||
bcc SRC.ParseLine.DirOp false....skip label processing
|
||||
|
||||
clc
|
||||
adc #ASM.DO.Stack-1
|
||||
tay
|
||||
lda (pData),y
|
||||
beq .8
|
||||
|
||||
.1 >LDA.G ASM.MA.ON
|
||||
>LDA.G ASM.MA.ON
|
||||
bpl SRC.ParseLine.LABEL
|
||||
|
||||
jmp MAC.Learn
|
||||
@ -78,16 +77,29 @@ SRC.ParseLine.DirOp
|
||||
jsr SRC.GetNextChar
|
||||
bcs SRC.ParseLine.InvDir
|
||||
|
||||
jsr SRC.ParseLine.Dir
|
||||
bcs SRC.ParseLine.Err
|
||||
>LDYA L.T.DIRECTIVES
|
||||
jsr SRC.GetKeyword
|
||||
|
||||
bra SRC.ParseLine.Ok
|
||||
bcs SRC.ParseLine.InvDir
|
||||
|
||||
jsr SRC.DoCheck
|
||||
bcs .1 TRUE, always execute
|
||||
|
||||
.5 cmp #'>'
|
||||
cpx #20 .ELSE?
|
||||
beq .1
|
||||
cpx #20 .FIN?
|
||||
bne SRC.ParseLine.Ok
|
||||
.1 jmp (J.DIRECTIVES,x)
|
||||
|
||||
.5 pha
|
||||
jsr SRC.DoCheck
|
||||
pla
|
||||
bcc SRC.ParseLine.Err FALSE, skip all
|
||||
|
||||
cmp #'>'
|
||||
bne SRC.ParseLine.OpCode
|
||||
jsr MAC.Exec
|
||||
bcs SRC.ParseLine.Err
|
||||
bra SRC.ParseLine.Ok
|
||||
jmp MAC.Exec
|
||||
|
||||
SRC.ParseLine.Ok
|
||||
clc
|
||||
SRC.ParseLine.Err
|
||||
@ -102,11 +114,7 @@ SRC.ParseLine.InvDir
|
||||
sec
|
||||
rts
|
||||
*---------------------------------------
|
||||
SRC.ParseLine.Dir
|
||||
>LDYA L.T.DIRECTIVES
|
||||
jsr SRC.GetKeyword
|
||||
|
||||
bcs SRC.ParseLine.InvDir
|
||||
SRC.ParseLine.DirJmp
|
||||
jmp (J.DIRECTIVES,x)
|
||||
*---------------------------------------
|
||||
SRC.ParseLine.OpCode
|
||||
@ -894,6 +902,18 @@ SRC.ACC10 lda SRC.ACC ACC*2-> ACC & ACCTMP
|
||||
sta SRC.ACC+3 CS if overflow
|
||||
.9 rts
|
||||
*---------------------------------------
|
||||
SRC.DoCheck sec
|
||||
>LDA.G ASM.DO.StackPtr
|
||||
beq .8
|
||||
|
||||
clc
|
||||
adc #ASM.DO.Stack-1
|
||||
tay
|
||||
lda (pData),y
|
||||
asl
|
||||
|
||||
.8 rts CS if TRUE
|
||||
*---------------------------------------
|
||||
DEBUG.PSTR pha
|
||||
>PUSHW L.MSG.PSTR
|
||||
pla
|
||||
|
@ -79,20 +79,24 @@ SYM.Dump >LDA.G ASM.LI.ON
|
||||
|
||||
ldy #SYMG.SIZE Get Symbol Size
|
||||
lda (ZPSymbolBuf),y
|
||||
tax
|
||||
beq .3
|
||||
|
||||
phx
|
||||
|
||||
pha
|
||||
|
||||
asl
|
||||
tax
|
||||
>PUSHB L.MSG.EQU0+1,x
|
||||
>PUSHB L.MSG.EQU0,x
|
||||
|
||||
plx
|
||||
phx
|
||||
pla
|
||||
pha
|
||||
tax byte count
|
||||
|
||||
.2 iny
|
||||
clc
|
||||
adc #SYMG.V
|
||||
|
||||
tay
|
||||
|
||||
.2 dey
|
||||
lda (ZPSymbolBuf),y
|
||||
>PUSHA
|
||||
dex
|
||||
@ -129,34 +133,26 @@ SYM.Dump.LP ldy #SYMG
|
||||
|
||||
iny
|
||||
lda (ZPSymbolBuf),y MacID
|
||||
beq .2
|
||||
bne .3
|
||||
|
||||
>PUSHW L.MSG.LSYMBOL
|
||||
txa
|
||||
>PUSHA
|
||||
|
||||
>PUSHB (ZPSymbolBuf),y
|
||||
bra .3
|
||||
jsr SYM.Dump.PushValueY
|
||||
|
||||
.2 >PUSHW L.MSG.LSYMBOL
|
||||
lda #5
|
||||
bra .5
|
||||
|
||||
.3 >PUSHW L.MSG.PSYMBOL
|
||||
txa
|
||||
>PUSHA
|
||||
|
||||
phx
|
||||
>PUSHB (ZPSymbolBuf),y
|
||||
|
||||
jsr SYM.Dump.PushValueY
|
||||
|
||||
.3 ldx #4
|
||||
|
||||
.4 iny
|
||||
lda (ZPSymbolBuf),y
|
||||
>PUSHA
|
||||
dex
|
||||
bne .4
|
||||
|
||||
lda #5
|
||||
plx
|
||||
beq .5
|
||||
|
||||
inc
|
||||
lda #6
|
||||
|
||||
.5 >PUSHA
|
||||
|
||||
@ -171,6 +167,22 @@ SYM.Dump.LP ldy #SYMG
|
||||
|
||||
.8 rts
|
||||
*---------------------------------------
|
||||
SYM.Dump.PushValueY
|
||||
ldx #4
|
||||
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
|
||||
.1 lda (ZPSymbolBuf),y
|
||||
>PUSHA
|
||||
dey
|
||||
dex
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*---------------------------------------
|
||||
SYM.NewOrGetGlobal
|
||||
>LDA.G ASM.PASS
|
||||
bne SYM.GetGlobal
|
||||
|
@ -287,7 +287,7 @@ CS.RUN ldy #S.PS.hStdIn
|
||||
|
||||
.11 >STZ.G bPause
|
||||
|
||||
.12 >LDA.G SRC.COUNT root file is already opened?
|
||||
.12 >LDA.G SRC.Depth root file is already opened?
|
||||
bne .10
|
||||
|
||||
>PUSHW L.MSG.PASS
|
||||
@ -328,7 +328,7 @@ CS.RUN ldy #S.PS.hStdIn
|
||||
bne .9
|
||||
|
||||
jsr FIO.FileClose
|
||||
>LDA.G SRC.COUNT end of root file ?
|
||||
>LDA.G SRC.Depth end of root file ?
|
||||
bne .8 no continue back to previous file
|
||||
|
||||
jsr SYM.StoreGlobal Make sure last Global flushed
|
||||
@ -352,14 +352,15 @@ CS.RUN ldy #S.PS.hStdIn
|
||||
bcs .9
|
||||
|
||||
jsr OUT.PrintLine
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.9 pha
|
||||
jsr OUT.PrintLineErr
|
||||
|
||||
jsr SYM.StoreGlobal Make sure last Global flushed
|
||||
jsr SYM.Dump
|
||||
* jsr SYM.StoreGlobal Make sure last Global flushed
|
||||
* jsr SYM.Dump
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@ -481,7 +482,7 @@ MSG.SYMBOLS .AZ "Symbol Table:"
|
||||
MSG.LSYMBOL .AZ " .%d=%h%h%h%h"
|
||||
MSG.PSYMBOL .AZ " :%d(%d)=%h%h%h%h"
|
||||
MSG.SUMMARY .AZ "\r\nSymbol Table Size : %5D Bytes.\r\n"
|
||||
MSG.END .AZ "End Of Assembly."
|
||||
MSG.END .AZ "**** End Of Assembly."
|
||||
MSG.PSTR .AS "{%S}"
|
||||
MSG.CRLF .AZ "\r\n"
|
||||
MSG.WORD .AZ ">$%H"
|
||||
@ -510,7 +511,7 @@ SRC.hFILENAME .BS 1
|
||||
SRC.hLineBuf .BS 1
|
||||
SRC.hTmpBuf .BS 1
|
||||
|
||||
SRC.COUNT .BS 1
|
||||
SRC.Depth .BS 1
|
||||
SRC.hFILES .BS IN.MAXDEPTH
|
||||
SRC.hFILETYPES .BS IN.MAXDEPTH
|
||||
|
||||
|
@ -757,7 +757,7 @@ CMD.CASE jsr CORE.StkGetCtx Get context in CORE.TestResult
|
||||
cmp #C.CASE
|
||||
bne .9
|
||||
txa previous case was true ?
|
||||
bpl .10
|
||||
bpl .10
|
||||
jsr EXP.GET skip expression
|
||||
bcs .9
|
||||
rts keep existing context
|
||||
@ -845,7 +845,7 @@ CMD.FOR jsr CORE.StkGetCtx
|
||||
cmp #'('
|
||||
beq CMD.FOR.FILE
|
||||
cmp #'`'
|
||||
beq CMD.FOR.EXEC
|
||||
beq CMD.FOR.EXEC
|
||||
*--------------------------------------
|
||||
CMD.FOR.LIST >LDYA ZPArgVBufPtr
|
||||
>SYSCALL strdup
|
||||
|
@ -3,7 +3,7 @@ NEW
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF BIN/TERM
|
||||
.TF bin/term
|
||||
*--------------------------------------
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
@ -17,7 +17,6 @@ BUFSIZE .EQ 256
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPDevName .BS 2
|
||||
ZPBufPtr .BS 2
|
||||
ZPBufLen .BS 2
|
||||
hBuf .BS 1
|
||||
@ -54,12 +53,11 @@ CS.INIT clc
|
||||
CS.RUN lda #1
|
||||
>SYSCALL ArgV
|
||||
bcs .9
|
||||
>STYA ZPDevName
|
||||
|
||||
>PUSHWZ auxtype
|
||||
>PUSHBI 0 type >PUSHBI O.RDWR
|
||||
>PUSHYA
|
||||
>PUSHBI O.RDWR
|
||||
>LDYA ZPDevName
|
||||
>PUSHBI 0 type
|
||||
>PUSHWZ auxtype
|
||||
>SYSCALL fopen
|
||||
bcs .99
|
||||
|
||||
|
@ -199,6 +199,7 @@ CS.RUN ldy #S.PS.hStdIn
|
||||
|
||||
ldy #hSrcFullPath
|
||||
jsr CS.RUN.GetPathY
|
||||
>PUSHYA
|
||||
>SYSCALL remove
|
||||
bcs .22
|
||||
jsr CS.RUN.CheckErr Success!!!
|
||||
|
@ -41,7 +41,7 @@ K.SListSetData >PULLW ZPSListDataLen
|
||||
* ## ASM
|
||||
* `>PUSHB hSList`
|
||||
* `>PUSHW KeyID`
|
||||
* `>PUSHW DataPtr`
|
||||
* `>PUSHW KeyPtr`
|
||||
* `>SYSCALL SListGetByID`
|
||||
* ## RETURN VALUE
|
||||
* Y,A = Next KeyID
|
||||
|
@ -208,9 +208,7 @@ SLISTX.SListGetByID
|
||||
jsr SLIST.GetNextByte
|
||||
ply
|
||||
|
||||
sta CLRWRITEAUX
|
||||
sta (TXTPTR),y
|
||||
sta SETWRITEAUX
|
||||
jsr SHARED.FORPNT.PutNext
|
||||
|
||||
iny
|
||||
dex
|
||||
@ -218,9 +216,7 @@ SLISTX.SListGetByID
|
||||
|
||||
txa lda #0
|
||||
|
||||
sta CLRWRITEAUX
|
||||
sta (TXTPTR),y
|
||||
sta SETWRITEAUX
|
||||
jsr SHARED.FORPNT.PutNext
|
||||
|
||||
jsr SLIST.SkipData
|
||||
>LDYA SLIST.KeyID
|
||||
|
Loading…
x
Reference in New Issue
Block a user