Kernel 0.93++

This commit is contained in:
Rémy GIBERT 2020-01-23 15:48:22 +01:00
parent 251cdd0f39
commit 149a3bd080
9 changed files with 127 additions and 103 deletions

Binary file not shown.

View File

@ -21,7 +21,7 @@ J.CSH.BOPS .DA CSH.BOPS.ADD
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
J.CSH.BOPS.ADDt .DA CSH.TMISSMATCH
J.CSH.BOPS.ADDt .DA CSH.TMISMATCH
.DA CSH.BOPS.ADDi8
.DA CSH.BOPS.ADDi16
.DA CSH.BOPS.ADDi32
@ -29,7 +29,7 @@ J.CSH.BOPS.ADDt .DA CSH.TMISSMATCH
.DA CSH.BOPS.ADDu16
.DA CSH.BOPS.ADDu32
.DA CSH.BOPS.ADDf
J.CSH.BOPS.SUBt .DA CSH.TMISSMATCH
J.CSH.BOPS.SUBt .DA CSH.TMISMATCH
.DA CSH.BOPS.SUBi8
.DA CSH.BOPS.SUBi16
.DA CSH.BOPS.SUBi32

View File

@ -4,10 +4,13 @@ NEW
*--------------------------------------
CSH.Init >SYSCALL SListNew
bcs .9
>STA.G CSH.hSymbols
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPCSHConst
txa
>STA.G CSH.hConst
@ -15,9 +18,11 @@ CSH.Init >SYSCALL SListNew
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPCSHStack
txa
>STA.G CSH.hStack
lda #$0
>STA.G CSH.ConstPtr
>STA.G CSH.StackPtr
@ -27,15 +32,18 @@ CSH.Init >SYSCALL SListNew
.9 rts
*--------------------------------------
CSH.Quit >LDA.G CSH.hSymbols
beq .1
>SYSCALL SListFree
>LDA.G hFileBuf
.1 >LDA.G hFileBuf
jsr .7
>LDA.G CSH.hStack
jsr .7
>LDA.G CSH.hConst
jsr .7
.7 beq CSH.Quit.RTS
>SYSCALL FreeMem
CSH.Quit.RTS rts
@ -99,10 +107,16 @@ CSH.Run.1 cmp #'#'
cmp #';'
bne .99
bra .8
.7 lda #0 no return value type check required
jsr CSH.fCall
bcs .9
jsr CSH.SIZEOF X = returned value type
clc A = Sizeof
adc pStack
sta pStack Discard value on stack
.8 jsr CSH.GetNextCharNB Skip ;
bcs .9
cmp #C.CR
@ -283,10 +297,14 @@ CSH.TYPE stx ZPVarType
bne .2
ldx ZPVarType
jsr CSH.SIZEOF
.1 dec pStack
dec
bne .1
ldx ZPVarType
bra .7
.2 cmp #'='
@ -347,11 +365,14 @@ CSH.fCall ldx ZPPtr1
lda ZPPtr2
bne .11
lda (ZPPtr1)
sta ZPPtr2
bra .1 expected type is 0, no check
.11 cmp (ZPPtr1) Get Return value Type
bne .91
.1 inc ZPPtr1 advance to arg list type
bne .2
inc ZPPtr1+1
@ -452,7 +473,7 @@ CSH.ExpEval ldx ZPPtr1
ldx ZPPtr2+1 local : BOP1
phx
sta ZPPtr2
sta ZPPtr2 local : expected type
.10 lda #$ff
sta ZPPtr2+1 Reset BOP1
@ -464,7 +485,7 @@ CSH.ExpEval ldx ZPPtr1
jsr CSH.GetVar
bcs .1
ldx ZPPtr2 var type (could be 0=any)
ldx ZPPtr2 expected var type (could be 0=any)
jsr CSH.GetVarValueOnStack Y,A = VarID, Get value on stack
bcs .29
@ -694,6 +715,7 @@ CSH.GetNumOnStack
sta (pStack),y
clc
rts
.4 >PULLA
inc pStack
inc pStack
@ -799,24 +821,34 @@ CSH.GetVarValueOnStack
bcs .9
ldx ZPVarType
beq .1
beq .1 any type
cpx ZPVarData
bne .99
beq .2
txa
and #CSH.Q.PPPOINTER
beq .99 not pointer....mismatch
eor ZPVarData
and #CSH.Q.PPPOINTER
bne .99 compare only pointer depth
.1 ldx ZPVarData
beq *
jsr CSH.SIZEOF
.2 jsr CSH.SIZEOF
tay
.2 lda ZPVarData,y
.3 lda ZPVarData,y
>PUSHA
dey
bne .2
bne .3
clc X = Var Type
.9 rts
.99
*--------------------------------------
CSH.TMISSMATCH lda #CSH.E.TMISMATCH
CSH.TMISMATCH lda #CSH.E.TMISMATCH
sec
rts
*--------------------------------------
@ -961,23 +993,24 @@ CSH.BOPS.LOR
CSH.CheckStack tax
>LDA.G CSH.StackPtr
beq .9
dec
tay
txa
cmp (ZPCSHStack),y
bne .9
clc
rts
.9 lda #CSH.E.SYNTAX
sec
rts
*--------------------------------------
CSH.Push pha
>LDA.G CSH.StackPtr
inc
dec
beq .9
sta (pData),y
dec
tay
pla
sta (ZPCSHStack),y
@ -991,14 +1024,15 @@ CSH.Push pha
*--------------------------------------
CSH.Pop >LDA.G CSH.StackPtr
beq .9
dec
pha
inc
sta (pData),y
tay
ply
lda (ZPCSHStack),y
clc
rts
.9 lda #CSH.E.SYNTAX
.9 lda #CSH.E.STACKERR
sec
rts
*--------------------------------------
@ -1138,6 +1172,7 @@ CSH.IsDigit10 cmp #'0'
CSH.SIZEOF txa
and #CSH.Q.PPPOINTER
bne .2
txa
and #$f
phx
@ -1145,6 +1180,7 @@ CSH.SIZEOF txa
lda CSH.TYPESIZE,x
plx
rts
.2 lda #2
rts
*--------------------------------------
@ -1184,16 +1220,18 @@ EXEC.getchar >SYSCALL getchar
*--------------------------------------
EXEC.puts >PULLYA
>SYSCALL puts
rts
*--------------------------------------
EXEC.printf >SYSCALL printf2
rts
*--------------------------------------
EXEC.putenv >SYSCALL getenv
>PUSHYA
rts
*--------------------------------------
EXEC.setenv >SYSCALL getenv
EXEC.printf >SYSCALL printf2
>PUSHYA
rts
*--------------------------------------
EXEC.putenv >SYSCALL putenv
>PUSHYA
rts
*--------------------------------------
EXEC.setenv >SYSCALL setenv
>PUSHYA
rts
*--------------------------------------
@ -1201,7 +1239,7 @@ EXEC.getenv >SYSCALL getenv
>PUSHYA
rts
*--------------------------------------
EXEC.unsetenv >SYSCALL getenv
EXEC.unsetenv >SYSCALL unsetenv
>PUSHYA
rts
*--------------------------------------

View File

@ -270,7 +270,7 @@ MSG.USAGE .AS "Usage : CSH <option> file\r\n"
.AS " -D : Debug Mode\r\n"
.AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n"
MSG.DEBUG .AZ "DEBUG:pStack=%H\r\n"
MSG.DEBUG .AZ "pStack=%H"
MSG.ERR .AZ "^\r\nLine #%D:"
*--------------------------------------
OptionList .AS "DdTt"

View File

@ -4,18 +4,18 @@ NEW
*--------------------------------------
BUF.InsertA sta TmpByte
jsr BUF.ComputeCOffset
cpy #255
beq .8
>LDYAI 1
jsr BUF.BufPtrSetup
bcs .9
inx
bne .1
inc
.1 stx BufPtrDst
lda BufPtr
clc
adc #1
sta BufPtrDst
lda BufPtr+1
adc #0
sta BufPtrDst+1
jsr BUF.MoveForwardTail
@ -46,17 +46,14 @@ BUF.InsertTAB >LDA.G FileX
adc TmpByte
bcs .8
ldy TmpByte
lda #0
jsr BUF.BufPtrSetup
bcs .9
pha
txa
lda BufPtr
clc
adc TmpByte
sta BufPtrDst
pla
lda BufPtr+1
adc #0
sta BufPtrDst+1
@ -141,16 +138,13 @@ BUF.InsertClipboard
sbc BufLen+1
bcs .8
>LDYA.G ClipboardLen
jsr BUF.BufPtrSetup
bcs .9
pha
txa
lda BufPtr
clc
>ADC.G ClipboardLen
sta BufPtrDst
pla
lda BufPtr+1
>ADC.G ClipboardLen+1
sta BufPtrDst+1
@ -202,7 +196,7 @@ BUF.InsertClipboard
.9 rts
*--------------------------------------
BUF.DelSel jsr BUF.GetSelLen
bcs .8
bcs .9 nothing to delete
>LDA.G SelStart
clc
@ -233,13 +227,6 @@ BUF.DelSel jsr BUF.GetSelLen
sbc SelLen+1
sta FileLen+1
jsr SCRN.UpdateStatusBar
jsr SCRN.Unsaved
jsr BUF.ResetSel
jmp SCRN.CursorAdjust
.8 clc
.9 rts
*--------------------------------------
@ -261,19 +248,13 @@ BUF.SelToClipboard
txa
>STA.G hClipBoard
>LDA.G hBuffer
>SYSCALL GetMemPtr
pha
tya
>LDA.G BufBase
clc
>ADC.G SelStart
sta BufPtr
pla
iny SelStart+1
adc (pData),y
>LDA.G BufBase+1
>ADC.G SelStart+1
sta BufPtr+1
lda SelLen
@ -580,16 +561,17 @@ BUF.GetSelLen ldy #SelEnd
.9 sec
rts
*--------------------------------------
* in : Y,A = cnt to insert at COffset
*--------------------------------------
BUF.BufPtrSetup lda BUF.COffset
clc
>ADC.G BufBase
sta BufPtr
tax
lda BUF.COffset+1
>ADC.G BufBase+1
sta BufPtr+1
clc
rts
*--------------------------------------
MAN

View File

@ -244,9 +244,7 @@ Ctrl.L jsr BUF.GetLine
jmp SCRN.UpdateViewPort
*--------------------------------------
Ctrl.CR jsr BUF.ComputeCOffset
lda #C.CR
Ctrl.CR lda #C.CR
jsr BUF.InsertA
bcs .9
@ -494,9 +492,11 @@ Ctrl.S >LDYA L.DLG.SAVE
.2 jsr SCRN.LineBufSprintf
jmp SCRN.LineBufOut
jsr SCRN.LineBufOut
bcs .9
.8 jmp SCRN.GotoCurXCurY
.8 clc
.9 rts
*--------------------------------------
Ctrl.FS jsr BUF.GetLine
@ -526,7 +526,7 @@ Ctrl.FS jsr BUF.GetLine
Ctrl.V jsr BUF.InsertClipboard
bcs .9
jsr SCRN.Unsaved
jmp SCRN.UpdateStatusBar
jmp SCRN.UpdateMainAndStatus
.9 rts
*--------------------------------------
@ -562,10 +562,14 @@ Ctrl.X jsr BUF.SelToClipboard
bcs Ctrl.W.RTS
Ctrl.D jsr BUF.DelSel
bcs Ctrl.W.RTS
jsr SCRN.Unsaved
bcs .8
jsr BUF.ResetSel
jsr SCRN.CursorAdjust
jsr SCRN.Unsaved will update TopBar
jmp SCRN.UpdateMainAndStatus
.8 clc
rts
*--------------------------------------
Ctrl.Z jsr BUF.ComputeCOffset

View File

@ -22,7 +22,7 @@ FILE.New.1 >SYSCALL RealPath
>STYA.G BufBase
txa
>STA.G hBuffer FileLen already set to 0
>STA.G hBuf FileLen already set to 0
lda #0
sta (BufPtr)
@ -270,7 +270,7 @@ FILE.GetBuffer >LDA.G STATBUF+S.STAT.SIZE+3
>STYA BufPtr
>STYA.G BufBase
txa
>STA.G hBuffer
>STA.G hBuf
lda #0
sta (BufPtr)

View File

@ -82,11 +82,18 @@ SCRN.UpdateTopBarAsync
lda #C.CR
jsr SCRN.ToLineBuf
>LDA.G FileType
>LDA.G bUnSaved
beq .2
lda #'!'
jsr SCRN.ToLineBuf
.2 >LDA.G FileType
tax
>PUSHW L.MSG.FILETYPES,x
>LDA.G hFileName
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI 4
@ -94,13 +101,7 @@ SCRN.UpdateTopBarAsync
jsr SCRN.LineBufSprintf
bcs .9
>LDA.G bUnSaved
beq .2
lda #'*'
jsr SCRN.ToLineBuf
.2 ldx #SEQ.CURRESTORE-SEQS
ldx #SEQ.CURRESTORE-SEQS
jsr SCRN.SEQS.ToLineBuf
jmp SCRN.LineBufOut
@ -532,10 +533,10 @@ SCRN.scrollDn >PUSHBI 0
jsr BUF.GetLineAX
bcs .9
* >DEBUG
lda #0
jsr SCRN.UpdateLineAtALenY
* >DEBUG
.9 rts
*--------------------------------------
SCRN.LineBufInitBar
@ -571,7 +572,7 @@ SCRN.LineBufInitInv
ldx #SEQ.INV-SEQS
SCRN.LineBufInit
>LDYA.G LineBufBase
>LDYA.G LineBuf
>STYA LineBufPtr
jsr SCRN.SEQS.ToLineBuf
@ -620,7 +621,7 @@ SCRN.LineBufOut lda #0
sta (LineBufPtr)
>PUSHBI 0
>LDYA.G LineBufBase
>LDYA.G LineBuf
>SYSCALL printf
rts
*--------------------------------------

View File

@ -63,7 +63,6 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.SEQ.DETECT .DA SEQ.DETECT
L.SEQ.INIT .DA SEQ.INIT
L.SEQ.SCROLLRGN .DA SEQ.SCROLLRGN
L.SEQ.RESET .DA SEQ.RESET
@ -72,6 +71,7 @@ L.SEQ.SCROLLDN .DA SEQ.SCROLLDN
L.SEQ.SCROLLCURUP .DA SEQ.SCROLLCURUP
L.SEQ.SCROLLCURDN .DA SEQ.SCROLLCURDN
L.SEQ.CEOL .DA SEQ.CEOL
L.MSG.DETECT .DA MSG.DETECT
L.MSG.TOPBAR .DA MSG.TOPBAR
L.MSG.FILETYPES .DA MSG.TXTCR
.DA MSG.TXTCRLF
@ -147,7 +147,7 @@ CS.INIT clc
CS.INIT.RTS rts
*--------------------------------------
CS.RUN >PUSHBI 0
>LDYA L.SEQ.DETECT
>LDYA L.MSG.DETECT
>SYSCALL printf Send Query for term W & H
bcs CS.INIT.RTS
@ -161,9 +161,9 @@ CS.RUN >PUSHBI 0
>LDYAI 510+5+5+4+1 potentially 255*\\ NORM,INV,CEOL & \0
>SYSCALL Getmem
bcs CS.INIT.RTS
>STYA.G LineBufBase
>STYA.G LineBuf
txa
>STA.G hLineBuffer
>STA.G hLineBuf
lda #1
>SYSCALL ArgV
@ -228,13 +228,13 @@ CS.DOEVENT lda (pEvent)
.9 sec
rts
*--------------------------------------
CS.QUIT ldy #hLineBuffer
CS.QUIT ldy #hLineBuf
jsr .8
ldy #hBuffer
ldy #hBuf
jsr .8
ldy #hBufferBackup
ldy #hBufBackup
jsr .8
ldy #hClipBoard
@ -307,9 +307,6 @@ CharIn tax
.22 cmp #C.SPACE
bcc .3
pha
jsr BUF.ComputeCOffset
pla
jsr BUF.InsertA
bcs .9
@ -438,7 +435,6 @@ SEQ.INV .AZ "\e[7m"
SEQ.CURSAVE .AZ "\e7"
SEQ.CURRESTORE .AZ "\e8"
*--------------------------------------
SEQ.DETECT .AZ "Querying term caps...\e[999;999H\e[6n"
SEQ.RESET .AZ "\ec"
SEQ.INIT .AS "\ec\e(B\e)0"
SEQ.SCROLLRGN .AZ "\e[?7l\e[2;%dr"
@ -447,7 +443,8 @@ SEQ.SCROLLUP .AZ "\eD"
SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
SEQ.SCROLLDN .AZ "\eM"
*--------------------------------------
MSG.TOPBAR .AZ "A2osX Edit:%s %s"
MSG.DETECT .AZ "Querying term caps...\e[999;999H\e[6n"
MSG.TOPBAR .AZ "A2osX Edit:%s (%s)"
MSG.TXTCR .AZ "TXT/CR"
MSG.TXTCRLF .AZ "TXT/CRLF"
MSG.TXTASM .AZ "S-C/ASM"
@ -616,11 +613,13 @@ FileType .BS 1
hFind .BS 1
hReplace .BS 1
hLineBuffer .BS 1
LineBufBase .BS 2
hBuffer .BS 1
hLineBuf .BS 1
LineBuf .BS 2
hBuf .BS 1
BufBase .BS 2
hBufferBackup .BS 1
hBufBackup .BS 1
hClipBoard .BS 1
ClipBoardLen .BS 2