Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-03-26 12:17:47 +00:00
parent 3e69efa6a5
commit 3fe962ee0a
6 changed files with 120 additions and 106 deletions

Binary file not shown.

View File

@ -74,7 +74,13 @@ OUT.PrintLine jsr OUT.PrintLineOn
OUT.PrintLine.1 jsr OUT.PrintLineOutBuf
bcs OUT.PrintLine.9
>PUSHW ZPLineBuf
>LDA.G SRC.LINENUM
cmp #76
bne .23
>DEBUG
.23 >PUSHW ZPLineBuf
>PUSHW.G SRC.LINENUM
>PUSHBI 4
>LDYA L.MSG.SRCLINE

View File

@ -340,13 +340,7 @@ CS.RUN ldy #S.PS.hStdIn
.2 jsr SRC.ParseLine
bcs .9
>LDA.G SRC.LINENUM
cmp #76
bne .23
>DEBUG
.23 jsr OUT.PrintLine
jsr OUT.PrintLine
.8 clc
rts

View File

@ -17,6 +17,17 @@ ZS.START
ZPPTR1 .BS 2
ZPBufPtr .BS 2
ByteIndex .BS 1
ArgCount .BS 1
FileCount .BS 1
bPause .BS 1
bPrintAll .BS 1
bLineNum .BS 1
bSuppressBlankLine .BS 1
ArgIndex .BS 1
hBuf .BS 1
hFile .BS 1
LineNum .BS 2
bPrintedBlankLine .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -49,13 +60,13 @@ L.ASCII .DA ASCII
CS.INIT clc
rts
*--------------------------------------
CS.RUN
.1 >INC.G ArgCount
CS.RUN
.1 inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .7
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
@ -80,13 +91,13 @@ CS.RUN
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
sta 0,y
bra .1
.4 >INC.G FileCount
.4 inc FileCount
bra .1 scan for any other args
.7 >LDA.G FileCount
.7 lda FileCount
beq .99
>LDYAI 256
@ -94,8 +105,7 @@ CS.RUN
bcs .9
>STYA ZPBufPtr
txa
>STA.G hBuf
stx hBuf
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
@ -113,18 +123,19 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
cmp #$13 Ctrl-S
bne .10
>LDA.G bPause
lda bPause
eor #$ff
sta (pData),y
sta bPause
bne CS.RUN.LOOP
.10 >LDA.G bPause
.10 lda bPause
bne CS.RUN.LOOP Pause...
.11 >LDA.G hFILE
.11 lda hFILE
bne .2
.1 >INC.G ArgIndex
.1 inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .99 No more arg...the end!
@ -139,11 +150,11 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
jsr CS.RUN.OPEN
.90 bcs .9
>STA.G hFILE
sta hFILE
.2 >PUSHWI 256
>PUSHW ZPBufPtr
>LDA.G hFILE
lda hFILE
>SYSCALL fgets
bcs .7
@ -163,42 +174,41 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
.9 sec
rts
*--------------------------------------
CS.RUN.OPEN phy
pha
CS.RUN.OPEN pha
lda #0
>STA.G bPrintedBlankLine Reset this flag for the new file
stz bPrintedBlankLine Reset this flag for the new file
>PUSHWI 0 Aux type
>PUSHBI S.FI.T.TXT
>PUSHBI O.RDONLY+O.TEXT
pla
ply
>SYSCALL FOpen
rts
*--------------------------------------
CS.RUN.PRINT >INCW.G LineNum
>LDA.G bSuppressBlankLine
CS.RUN.PRINT inc LineNum
bne .10
inc LineNum+1
.10 lda bSuppressBlankLine
bpl .2
lda (ZPBufPtr)
bne .1 Empty line ?
>LDA.G bPrintedBlankLine
lda bPrintedBlankLine
bmi .8
lda #$ff
sta (pData),y
sta bPrintedBlankLine
bra .2
.1 >STZ.G bPrintedBlankLine
.1 stz bPrintedBlankLine
.2 jsr CS.RUN.PRINTNUM
bcs .99
>LDA.G bPrintAll
lda bPrintAll
bmi .3
>LDYA ZPBufPtr
@ -254,27 +264,24 @@ CS.RUN.PRINT >INCW.G LineNum
.9 rts
*--------------------------------------
CS.RUN.PRINTNUM clc
>LDA.G bLineNum
lda bLineNum
bpl .8
>PUSHW.G LineNum
>PUSHW LineNum
>PUSHBI 2
>LDYA L.MSG.LINENUM
>SYSCALL printf
.8 rts
*--------------------------------------
CS.QUIT >LDA.G hBuf
CS.QUIT lda hBuf
beq CS.RUN.CLOSE
>SYSCALL FreeMem
CS.RUN.CLOSE >LDA.G hFILE
CS.RUN.CLOSE lda hFILE
beq .8
pha
lda #0
sta (pData),y
pla
stz hFILE
>SYSCALL FClose
.8 clc
@ -332,17 +339,6 @@ ASCII >PSTR "NUL"
.DUMMY
.OR 0
DS.START
ArgCount .BS 1
FileCount .BS 1
bPause .BS 1
bPrintAll .BS 1
bLineNum .BS 1
bSuppressBlankLine .BS 1
ArgIndex .BS 1
hBuf .BS 1
hFile .BS 1
LineNum .BS 2
bPrintedBlankLine .BS 1
DS.END
.ED
*--------------------------------------

View File

@ -10,11 +10,27 @@ AUTO 4,1
.INB INC/A2OSX.I
.INB INC/MLI.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
BufPtr .EQ ZPBIN+4
BufPtrBackup .EQ ZPBIN+6
ClipboardPtr .EQ ZPBIN+8
.DUMMY
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZPPTR2 .BS 2
BufPtr .BS 2
BufPtrBackup .BS 2
ClipboardPtr .BS 2
hMem .BS 1
TmpByte .BS 1
TmpLen .BS 2
TmpCount .BS 2
TmpIndex .BS 2
SelLen .BS 2
BUF.LOffset .BS 2
BUF.COffset .BS 2
BUF.TmpLine1 .BS 2
BUF.TmpLine2 .BS 2
bNotRepaint .BS 1
bSelected .BS 1
ZS.END .ED
*--------------------------------------
PromptBufMax .EQ 64
PromptModeHelp .EQ 2
@ -33,7 +49,7 @@ CS.START cld
.DA CS.END-CS.START CS
.DA DS.END-DS.START DS
.DA #16 SS
.DA #10 ZP
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
@ -325,16 +341,15 @@ LoadFile >PUSHWI 0 Aux type
>SYSCALL GetMemPtr
>SYSCALL LoadFile
>SYSCALL LoadTXTFile
bcs .9
stx hMem
>STYA TmpLen
iny
bne .2
inc +1 for ending zero
bne .1
inc Add 1 for \0
.2 >SYSCALL GetMem0
.1 >SYSCALL GetMem
bcs .98
>STYA ZPPTR2
@ -346,36 +361,34 @@ LoadFile >PUSHWI 0 Aux type
>SYSCALL GetMemPtr
>STYA ZPPTR1
lda TmpLen
eor #$ff
tax
lda TmpLen+1
eor #$ff
pha
stz TmpLen
stz TmpLen+1
ldy #0
ldx #0
.5 inx
bne .6
pla
inc
beq .7
pha
.2 lda (ZPPTR1),y
beq .8
cpx #C.CR
bne .3
cmp #C.LF
beq .4
.6 lda (ZPPTR1),y
sta (ZPPTR2),y
.3 jsr PutBytePtr2
.4 tax set previous char
iny
bne .5
bne .2
inc ZPPTR1+1
inc ZPPTR2+1
bra .5
bra .2
.7 ldy #FileLen
lda TmpLen
sta (pData),y
iny
lda TmpLen+1
sta (pData),y
.8 >LDYA TmpLen
>STYA.G FileLen
lda #0
jsr PutBytePtr2 set ending \0
jsr .98
clc
rts
@ -387,6 +400,17 @@ LoadFile >PUSHWI 0 Aux type
sec
.9 rts
*--------------------------------------
PutBytePtr2 sta (ZPPTR2)
inc ZPPTR2
bne .1
inc ZPPTR2+1
.1 inc TmpLen
bne .8
inc TmpLen+1
.8 rts
*--------------------------------------
SaveFile >PUSHWI 0 Aux type
>PUSHBI S.FI.T.TXT
>PUSHBI O.CREATE+O.WRONLY
@ -481,18 +505,6 @@ MSG.HELP >PSTR "All commands: (* = Not yet implemented)"
MSG.NEWFILE .AZ "(new file)"
EscChars >PSTR "DBAC"
EscAscii .HS 04080A0B15
hMem .BS 1
TmpByte .BS 1
TmpLen .BS 2
TmpCount .BS 2
TmpIndex .BS 2
SelLen .BS 2
BUF.LOffset .BS 2
BUF.COffset .BS 2
BUF.TmpLine1 .BS 2
BUF.TmpLine2 .BS 2
bNotRepaint .BS 1
bSelected .BS 1
*--------------------------------------
.DUMMY
.OR 0

View File

@ -444,16 +444,22 @@ CORE.PSExec lda (pPS)
bne CORE.PSResume
bit #S.PS.F.RUN
bne .3
bit #S.PS.F.QUIT
bne .2
bit #S.PS.F.INIT
bne .1
ldx #PS.QUIT
ldx #31
.1 stz ZPBIN,x
dex
bpl .1
ldx #PS.INIT
.HS 2C BIT ABS
.1 ldx #PS.INIT
.2 ldx #PS.QUIT
.HS 2C BIT ABS
.2 ldx #PS.RUN
.3 ldx #PS.RUN
.HS 2C BIT ABS
CORE.PSDoEvent ldx #PS.DOEVENT