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

@ -18,42 +18,42 @@ DIR.AC clc
rts
*---------------------------------------
DIR.AT sec
.HS 90 BCC
.HS 90 BCC
*---------------------------------------
DIR.AS clc
lda #0
ror
sta DIR.Byte Save b7 of last char in string
sta DIR.Byte Save b7 of last char in string
jsr SRC.GetNextChar
bcs .9
cmp #'-'
bne .1
lda #$40 save b7 status of ALL chars
lda #$40 save b7 status of ALL chars
tsb DIR.Byte
jsr SRC.GetNextChar
bcs .9
.1 sta DIR.Word Save delimiter....
sta DIR.Word+1 Save also in prev char..
.1 sta DIR.Word Save delimiter....
sta DIR.Word+1 Save also in prev char..
.2 jsr SRC.GetNextChar
bcs .8
cmp DIR.Word delimiter ?
cmp DIR.Word delimiter ?
beq .8
ldx DIR.Word+1 Get prev char
sta DIR.Word+1 replace it with new
ldx DIR.Word+1 Get prev char
sta DIR.Word+1 replace it with new
txa
cmp DIR.Word is it the starting delimiter
beq .2 yes, skip
cmp DIR.Word is it the starting delimiter
beq .2 yes, skip
bit DIR.Byte
bvc .3
ora #$80
.3 jsr OUT.EmitByte no, emit prev char
.3 jsr OUT.EmitByte no, emit prev char
bcc .2
.9 lda #E.SYNTAX.ERROR
sec
rts
.8 lda DIR.Word+1 Get prev char
cmp DIR.Word someone typed .AS "" ?
.8 lda DIR.Word+1 Get prev char
cmp DIR.Word someone typed .AS "" ?
beq .88
bit DIR.Byte
bpl .81
@ -171,7 +171,7 @@ DIR.DO >LDA.G ASM.DO.StackPtr
bcs .99
>INC.G ASM.DO.StackPtr
* clc ok from bcs .99
* clc ok from bcs .99
adc #ASM.DO.Stack-1
tay
lda SRC.ACC
@ -275,12 +275,12 @@ DIR.EQ clc
>LDA.G ASM.PASS
bne .2
*---------------------------------------
>LDA.G SYM.GlobalPtr PASS#1
cmp #SYMG
beq .12
tay
ldx #3 we are in local/private
@ -489,9 +489,7 @@ DIR.OP.SYNERR lda #E.SYNTAX.ERROR
sec
rts
*---------------------------------------
DIR.OR
* >DEBUG
jsr SRC.GetNextCharNB
DIR.OR jsr SRC.GetNextCharNB
bcs DIR.OP.SYNERR
jsr EXP.Eval
@ -558,7 +556,7 @@ DIR.TF >LDA.G ASM.PASS If Pass#1, ignore
>LDYA ZPLinePtr
.2 >SYSCALL strdup
.2 >SYSCALL StrDup
bcs DIR.TA.RTS
>STYA ZPPtr1
stx ZPPtr2
@ -605,7 +603,7 @@ DIR.TF >LDA.G ASM.PASS If Pass#1, ignore
txa
>STA.G DST.hFILENAME
>SYSCALL GetMemptr
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI O.WRONLY+O.CREATE
>PUSHB ZPPtr2+1 Type

View File

@ -66,8 +66,11 @@ EXP.Eval.Next stz SRC.ACC.F
.14 cmp #'*'
bne .10
jsr SYM.PC2Acc
* >LDA.G ASM.PASS
* beq .55
* >DEBUG
*.55 jsr SYM.PC2Acc
jsr SRC.GetNextChar
jmp EXP.EvalOperator
@ -173,7 +176,7 @@ EXP.EvalOperator
.7 jsr SRC.GetChar
bcs EXP.EvalExitOK
cmp #' '
cmp #C.SPACE
beq EXP.EvalExitOK
jsr SRC.IsAMReserved
@ -193,25 +196,22 @@ EXP.EvalOperator
EXP.GetLocal jsr SRC.GetNextChar
bcs .9
jsr SRC.GetDecimal
jsr SRC.GetDecimal8
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
>LDA.G ASM.PASS pass#2?
bne EXP.EvalExitUND
lda #SYMG.F.FWREF Mark ACC as pending
sta SRC.ACC.F
stz SRC.ACC.SIZE
clc
rts
.9 lda #E.SYNTAX.ERROR
sec
.8 rts
@ -343,11 +343,18 @@ EXP.OP.ADD ldx #0 ARG-ACC->ACC
lda #E.VAL.TOO.BIG
.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
sec
.1 lda SRC.ARG,x
sbc SRC.ACC,x
sta SRC.ACC,x

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ SelLen .BS 2
ZPPTR1 .BS 2
bRepaint .BS 1
bSelected .BS 1
bSelected .BS 1
ZPPTR2 .EQ *
TmpLen .BS 2