Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-02-28 17:30:16 +01:00
parent cd258586b4
commit e356259cb5
9 changed files with 147 additions and 80 deletions

Binary file not shown.

View File

@ -275,7 +275,7 @@ DIR.EQ clc
>LDA.G ASM.PASS >LDA.G ASM.PASS
bne .2 bne .2
*---------------------------------------
>LDA.G SYM.GlobalPtr PASS#1 >LDA.G SYM.GlobalPtr PASS#1
cmp #SYMG cmp #SYMG
@ -489,9 +489,7 @@ DIR.OP.SYNERR lda #E.SYNTAX.ERROR
sec sec
rts rts
*--------------------------------------- *---------------------------------------
DIR.OR DIR.OR jsr SRC.GetNextCharNB
* >DEBUG
jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR bcs DIR.OP.SYNERR
jsr EXP.Eval jsr EXP.Eval
@ -558,7 +556,7 @@ DIR.TF >LDA.G ASM.PASS If Pass#1, ignore
>LDYA ZPLinePtr >LDYA ZPLinePtr
.2 >SYSCALL strdup .2 >SYSCALL StrDup
bcs DIR.TA.RTS bcs DIR.TA.RTS
>STYA ZPPtr1 >STYA ZPPtr1
stx ZPPtr2 stx ZPPtr2
@ -605,7 +603,7 @@ DIR.TF >LDA.G ASM.PASS If Pass#1, ignore
txa txa
>STA.G DST.hFILENAME >STA.G DST.hFILENAME
>SYSCALL GetMemptr >SYSCALL GetMemPtr
>PUSHYA >PUSHYA
>PUSHBI O.WRONLY+O.CREATE >PUSHBI O.WRONLY+O.CREATE
>PUSHB ZPPtr2+1 Type >PUSHB ZPPtr2+1 Type

View File

@ -67,7 +67,10 @@ EXP.Eval.Next stz SRC.ACC.F
.14 cmp #'*' .14 cmp #'*'
bne .10 bne .10
jsr SYM.PC2Acc * >LDA.G ASM.PASS
* beq .55
* >DEBUG
*.55 jsr SYM.PC2Acc
jsr SRC.GetNextChar jsr SRC.GetNextChar
jmp EXP.EvalOperator jmp EXP.EvalOperator
@ -173,7 +176,7 @@ EXP.EvalOperator
.7 jsr SRC.GetChar .7 jsr SRC.GetChar
bcs EXP.EvalExitOK bcs EXP.EvalExitOK
cmp #' ' cmp #C.SPACE
beq EXP.EvalExitOK beq EXP.EvalExitOK
jsr SRC.IsAMReserved jsr SRC.IsAMReserved
@ -193,25 +196,22 @@ EXP.EvalOperator
EXP.GetLocal jsr SRC.GetNextChar EXP.GetLocal jsr SRC.GetNextChar
bcs .9 bcs .9
jsr SRC.GetDecimal jsr SRC.GetDecimal8
bcs EXP.EvalExitSYN bcs EXP.EvalExitSYN
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne EXP.EvalExitSYN Max .255
ldx SRC.ACC
beq EXP.EvalExitSYN .0 is not allowed
jsr SYM.GetLocalX tax
jsr SYM.LookupLocalX
bcc .8 bcc .8
>LDA.G ASM.PASS pass#2? >LDA.G ASM.PASS pass#2?
bne EXP.EvalExitUND bne EXP.EvalExitUND
lda #SYMG.F.FWREF Mark ACC as pending lda #SYMG.F.FWREF Mark ACC as pending
sta SRC.ACC.F sta SRC.ACC.F
stz SRC.ACC.SIZE stz SRC.ACC.SIZE
clc clc
rts rts
.9 lda #E.SYNTAX.ERROR .9 lda #E.SYNTAX.ERROR
sec sec
.8 rts .8 rts
@ -343,7 +343,14 @@ EXP.OP.ADD ldx #0 ARG-ACC->ACC
lda #E.VAL.TOO.BIG lda #E.VAL.TOO.BIG
.8 rts .8 rts
*--------------------------------------- *---------------------------------------
EXP.OP.SUB ldx #0 ARG-ACC->ACC EXP.OP.SUB >LDA.G ASM.PASS
beq .55
* jsr SYM.Dump.LP
* >DEBUG
.55 ldx #0 ARG-ACC->ACC
ldy #4 ldy #4
sec sec

View File

@ -61,16 +61,9 @@ SRC.ParseLine.LABEL
jsr SRC.GetNextChar jsr SRC.GetNextChar
bcs SRC.ParseLine.InvLbl bcs SRC.ParseLine.InvLbl
jsr SRC.GetDecimal jsr SRC.GetDecimal8
bcs SRC.ParseLine.InvLbl bcs SRC.ParseLine.InvLbl
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne SRC.ParseLine.InvLbl Max .255
lda SRC.ACC
beq SRC.ParseLine.InvLbl .0 is not allowed
jsr SYM.NewLocalA jsr SYM.NewLocalA
bcs SRC.ParseLine.RTS bcs SRC.ParseLine.RTS
bra SRC.ParseLine.DirOp bra SRC.ParseLine.DirOp
@ -506,25 +499,46 @@ SRC.ComputeRel phy
ply ply
rts rts
*--------------------------------------- *---------------------------------------
SRC.GetDecimal8 jsr SRC.GetDecimal
bcs .9
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne .99 Max .255
lda SRC.ACC
beq .99 .0 is not allowed
* clc
rts
.99 sec
.9 rts
*---------------------------------------
SRC.GetDecimal jsr SRC.GetChar SRC.GetDecimal jsr SRC.GetChar
beq .99 beq .99
stz SRC.ACC+1 stz SRC.ACC+1
stz SRC.ACC+2 stz SRC.ACC+2
stz SRC.ACC+3 stz SRC.ACC+3
jsr SRC.IsDigit10 jsr SRC.IsDigit10
bcs .99 bcs .99
and #$0F and #$0F
sta SRC.ACC sta SRC.ACC
.1 jsr SRC.GetNextChar .1 jsr SRC.GetNextChar
bcs .8 bcs .8
cmp #' '
cmp #C.SPACE
beq .8 beq .8
jsr SRC.IsEXPReserved jsr SRC.IsEXPReserved
bcc .8 bcc .8
jsr SRC.IsAMReserved jsr SRC.IsAMReserved
bcc .8 bcc .8
jsr SRC.IsDigit10 jsr SRC.IsDigit10
bcs .9 bcs .9
and #$0F and #$0F
pha pha
jsr SRC.ACC10 jsr SRC.ACC10
@ -534,18 +548,23 @@ SRC.GetDecimal jsr SRC.GetChar
adc SRC.ACC adc SRC.ACC
sta SRC.ACC sta SRC.ACC
bcc .1 bcc .1
inc SRC.ACC+1 inc SRC.ACC+1
bne .1 bne .1
inc SRC.ACC+2 inc SRC.ACC+2
bne .1 bne .1
inc SRC.ACC+3 inc SRC.ACC+3
bne .1 bne .1
.9 lda #E.VAL.TOO.BIG .9 lda #E.VAL.TOO.BIG
sec sec
rts rts
.8 clc .8 clc
rts rts
.99 lda #E.SYNTAX.ERROR .99 lda #E.SYNTAX.ERROR
sec sec
rts rts
@ -561,73 +580,98 @@ SRC.GetHex jsr SRC.GetNextChar skip '$'
sta SRC.ACC sta SRC.ACC
.1 jsr SRC.GetNextChar .1 jsr SRC.GetNextChar
bcs .8 bcs .8
cmp #' '
cmp #C.SPACE
beq .8 beq .8
jsr SRC.IsEXPReserved jsr SRC.IsEXPReserved
bcc .8 bcc .8
jsr SRC.IsAMReserved jsr SRC.IsAMReserved
bcc .8 bcc .8
jsr SRC.IsDigit16 jsr SRC.IsDigit16
bcs .99 bcs .99
ldx #4 ldx #4
.2 asl SRC.ACC .2 asl SRC.ACC
rol SRC.ACC+1 rol SRC.ACC+1
rol SRC.ACC+2 rol SRC.ACC+2
rol SRC.ACC+3 rol SRC.ACC+3
bcs .9 bcs .9
dex dex
bne .2 bne .2
ora SRC.ACC ora SRC.ACC
sta SRC.ACC sta SRC.ACC
bra .1 bra .1
.8 clc .8 clc
rts rts
.9 lda #E.VAL.TOO.BIG .9 lda #E.VAL.TOO.BIG
sec sec
rts rts
.99 lda #E.SYNTAX.ERROR .99 lda #E.SYNTAX.ERROR
sec sec
rts rts
*--------------------------------------- *---------------------------------------
SRC.GetOctal jsr SRC.GetNextChar skip '&' SRC.GetOctal jsr SRC.GetNextChar skip '&'
bcs .99 bcs .99
stz SRC.ACC+1 stz SRC.ACC+1
stz SRC.ACC+2 stz SRC.ACC+2
stz SRC.ACC+3 stz SRC.ACC+3
jsr SRC.IsDigit8 jsr SRC.IsDigit8
bcs .99 bcs .99
and #$0F and #$0F
sta SRC.ACC sta SRC.ACC
.1 jsr SRC.GetNextChar .1 jsr SRC.GetNextChar
bcs .8 bcs .8
cmp #' '
cmp #C.SPACE
beq .8 beq .8
jsr SRC.IsEXPReserved jsr SRC.IsEXPReserved
bcc .8 bcc .8
jsr SRC.IsAMReserved jsr SRC.IsAMReserved
bcc .8 bcc .8
jsr SRC.IsDigit8 jsr SRC.IsDigit8
bcs .9 bcs .9
asl asl
asl asl
asl asl
asl asl
asl asl
ldx #3 ldx #3
.2 asl .2 asl
rol SRC.ACC rol SRC.ACC
rol SRC.ACC+1 rol SRC.ACC+1
rol SRC.ACC+2 rol SRC.ACC+2
rol SRC.ACC+3 rol SRC.ACC+3
bcs .9 bcs .9
dex dex
bne .2 bne .2
bra .1 bra .1
.8 clc .8 clc
rts rts
.9 lda #E.VAL.TOO.BIG .9 lda #E.VAL.TOO.BIG
sec sec
rts rts
.99 lda #E.SYNTAX.ERROR .99 lda #E.SYNTAX.ERROR
sec sec
rts rts

View File

@ -130,6 +130,7 @@ SYM.LookupGlobal
bne .3 bne .3
ldy #SYMG-1 ldy #SYMG-1
.2 lda (ZPSymbolBuf),y .2 lda (ZPSymbolBuf),y
sta SRC.ACC.F,y sta SRC.ACC.F,y
dey dey
@ -229,10 +230,10 @@ SYM.NewLocalA tax Save Local ID
>LDA.G SYM.bInGlobal not in a global label >LDA.G SYM.bInGlobal not in a global label
bpl .91 bpl .91
>LDA.G ASM.PASS Pass #2: should be already defined... >LDA.G ASM.PASS
bne .8 bne SYM.LookupLocalX Pass #2: check if defined
*---------------------------------------
jsr SYM.GetLocalX Pass #1; try to add jsr SYM.LookupLocalX Pass #1; try to add
bcc .9 Already Defined bcc .9 Already Defined
>LDA.G SYM.GlobalPtr >LDA.G SYM.GlobalPtr
@ -290,22 +291,26 @@ SYM.NewLocalA tax Save Local ID
sec sec
rts rts
*--------------------------------------- *---------------------------------------
SYM.GetLocalX lda (ZPSymbolBuf) SYM.LookupLocalX
lda (ZPSymbolBuf)
and #SYMG.F.LOCALS and #SYMG.F.LOCALS
beq .9 beq .99
ldy #SYMG ldy #SYMG
.1 lda (ZPSymbolBuf),y .1 phy
lda (ZPSymbolBuf),y
beq .9 beq .9
txa txa
cmp (ZPSymbolBuf),y cmp (ZPSymbolBuf),y
bne .4 bne .3
phy
>LDA.G MAC.CtxID >LDA.G MAC.CtxID
ply ply
phy
iny iny
cmp (ZPSymbolBuf),y cmp (ZPSymbolBuf),y
bne .3 bne .3
@ -322,17 +327,19 @@ SYM.GetLocalX lda (ZPSymbolBuf)
lda #2 lda #2
sta SRC.ACC.SIZE sta SRC.ACC.SIZE
ply
clc clc
rts rts
.3 dey .3 pla
.4 tya
clc clc
adc #SYML adc #SYML
tay tay
bra .1 bra .1
.9 lda #E.UNDEF.SYMBOL .9 ply
.99 lda #E.UNDEF.SYMBOL
sec sec
rts rts
*--------------------------------------- *---------------------------------------
@ -422,11 +429,15 @@ SYM.Dump >LDA.G bListAll
*--------------------------------------- *---------------------------------------
SYM.Dump.LP ldy #SYMG SYM.Dump.LP ldy #SYMG
ldx #5
.1 lda (ZPSymbolBuf),y .1 lda (ZPSymbolBuf),y
beq .8 beq .8
phy phy
phx
tax ID tax ID
iny iny
@ -456,7 +467,14 @@ SYM.Dump.LP ldy #SYMG
>SYSCALL PrintF >SYSCALL PrintF
pla plx
dex
bne .6
jsr OUT.PrintCR
ldx #5
.6 pla
clc clc
adc #SYML adc #SYML
tay tay

View File

@ -204,7 +204,7 @@ DLG.CTRL.Draw sta TmpByte A=CtrlID
jmp (J.DLG.CTRL.Draw,x) jmp (J.DLG.CTRL.Draw,x)
*-------------------------------------- *--------------------------------------
DLG.CTRL.Draw.LBL DLG.CTRL.Draw.LBL
jsr SCRN.LineBufInitLbl jsr SCRN.LineBufInitLBL
jsr DLG.CTRL.GotoOrg jsr DLG.CTRL.GotoOrg
bcs .9 bcs .9
@ -250,7 +250,7 @@ DLG.CTRL.Draw.TB
tay tay
lda (pData),y lda (pData),y
>SYSCALL GetMemptr >SYSCALL GetMemPtr
>STYA ZPPTR2 >STYA ZPPTR2
lda #C.SPACE lda #C.SPACE
@ -296,7 +296,7 @@ DLG.CTRL.Draw.TB
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
DLG.CTRL.Draw.OL DLG.CTRL.Draw.OL
jsr SCRN.LineBufInitLbl jsr SCRN.LineBufInitLBL
jsr DLG.CTRL.GotoOrg jsr DLG.CTRL.GotoOrg
bcs .9 bcs .9
@ -461,7 +461,7 @@ DLG.CTRL.Focus.TB
jmp SCRN.GotoXY jmp SCRN.GotoXY
DLG.CTRL.Focus.OL DLG.CTRL.Focus.OL
jsr SCRN.LineBufInitLbl jsr SCRN.LineBufInitLBL
jsr DLG.CTRL.GotoOrg jsr DLG.CTRL.GotoOrg
@ -578,7 +578,7 @@ DLG.CTRL.GotoXY
inc inc
>PUSHA >PUSHA
>PUSHBI 2 >PUSHBI 2
>SYSCALL sprintf >SYSCALL SPrintF
.2 lda (LineBufPtr) .2 lda (LineBufPtr)
beq .8 beq .8
@ -718,7 +718,7 @@ DLG.CTRL.CharIn.TB
lda (ZPPTR1),y hMem lda (ZPPTR1),y hMem
tay tay
lda (pData),y lda (pData),y
>SYSCALL GetMemptr >SYSCALL GetMemPtr
>STYA ZPPTR2 >STYA ZPPTR2
ply ply
@ -732,7 +732,7 @@ DLG.CTRL.CharIn.TB
sta (ZPPTR2),y sta (ZPPTR2),y
pla pla
>SYSCALL putchar >SYSCALL PutChar
clc clc
rts rts
@ -752,7 +752,7 @@ DLG.CTRL.CharIn.TB
lda (ZPPTR1),y hMem lda (ZPPTR1),y hMem
tay tay
lda (pData),y lda (pData),y
>SYSCALL GetMemptr >SYSCALL GetMemPtr
>STYA ZPPTR2 >STYA ZPPTR2
ply ply
@ -760,7 +760,7 @@ DLG.CTRL.CharIn.TB
sta (ZPPTR2),y sta (ZPPTR2),y
lda #C.DEL lda #C.DEL
>SYSCALL putchar >SYSCALL PutChar
clc clc
rts rts

View File

@ -44,7 +44,7 @@ FILE.Load jsr BUF.ResetSel
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
>PUSHYA >PUSHYA
>PUSHEA.G STATBUF >PUSHEA.G STATBUF
>SYSCALL stat >SYSCALL Stat
bcc .1 bcc .1
>LDA.G hFileName >LDA.G hFileName
@ -99,7 +99,7 @@ FILE.Load.TXT stz FileLen
>PUSHA >PUSHA
>PUSHEA.G STATBUF >PUSHEA.G STATBUF
>SYSCALL fstat >SYSCALL FStat
bcs .99 bcs .99
jsr FILE.GetBuffer jsr FILE.GetBuffer
@ -108,7 +108,7 @@ FILE.Load.TXT stz FileLen
.1 >PUSHWI 254 .1 >PUSHWI 254
>PUSHW ZPPTR1 >PUSHW ZPPTR1
lda TmpIndex lda TmpIndex
>SYSCALL fread >SYSCALL FRead
bcs .7 bcs .7
lda #0 lda #0
@ -183,7 +183,7 @@ FILE.Load.ASM stz FileLen
.1 >PUSHWI 3 .1 >PUSHWI 3
>PUSHW ZPPTR1 >PUSHW ZPPTR1
lda TmpIndex lda TmpIndex
>SYSCALL fread >SYSCALL FRead
bcs .7 bcs .7
lda #0 lda #0
@ -195,7 +195,7 @@ FILE.Load.ASM stz FileLen
>PUSHA >PUSHA
>PUSHW ZPPTR1 >PUSHW ZPPTR1
lda TmpIndex lda TmpIndex
>SYSCALL fread >SYSCALL FRead
bcs .7 bcs .7
jsr FILE.Load.ASM.Decode jsr FILE.Load.ASM.Decode
@ -217,7 +217,7 @@ FILE.Load.ASM stz FileLen
FILE.Load.ASM.Decode FILE.Load.ASM.Decode
ldy #0 ldy #0
.1 lda (ZPPtr1),y .1 lda (ZPPTR1),y
beq .8 beq .8
iny iny
@ -232,11 +232,11 @@ FILE.Load.ASM.Decode
.2 cmp #$C0 REPEAT char? .2 cmp #$C0 REPEAT char?
bne .5 bne .5
lda (ZPPtr1),y Get Repeat Count lda (ZPPTR1),y Get Repeat Count
iny iny
tax tax
lda (ZPPtr1),y Get Repeat Char lda (ZPPTR1),y Get Repeat Char
iny iny
.4 jsr FILE.Load.ASM.2Buf .4 jsr FILE.Load.ASM.2Buf
@ -302,7 +302,7 @@ FILE.OpenTypeX tax
txa txa
>PUSHA >PUSHA
>PUSHWZ Aux type >PUSHWZ Aux type
>SYSCALL fopen >SYSCALL FOpen
rts rts
*-------------------------------------- *--------------------------------------
FILE.Save >LDYAI 256 FILE.Save >LDYAI 256

View File

@ -551,7 +551,7 @@ SCRN.LineBufInitBar
phx phx
ldx #SEQ.BAR-SEQS ldx #SEQ.BAR-SEQS
bra SCRN.LineBufInit bra SCRN.LineBufInit
SCRN.LineBufInitDlg SCRN.LineBufInitDLG
phx phx
ldx #SEQ.DLG-SEQS ldx #SEQ.DLG-SEQS
bra SCRN.LineBufInit bra SCRN.LineBufInit
@ -597,7 +597,7 @@ SCRN.LineBufGotoLineY
>PUSHBI 2 >PUSHBI 2
*-------------------------------------- *--------------------------------------
SCRN.LineBufSprintf SCRN.LineBufSprintf
>SYSCALL sprintf >SYSCALL SPrintF
bcs .9 bcs .9
tya tya