Kernel 0.94+

This commit is contained in:
Rémy GIBERT 2021-04-15 22:52:08 +02:00
parent f02d240ad3
commit 4c922fed4d
8 changed files with 368 additions and 88 deletions

Binary file not shown.

Binary file not shown.

View File

@ -48,7 +48,19 @@ KW.GOTO1 jsr CODE.EmitByte
.99 rts
*--------------------------------------
KW.HOME
lda #E.CSYN
sec
rts
*--------------------------------------
* IP exp THEN st1 ELSE st2
*--------------------------------------
KW.IF
lda #E.CSYN
sec
rts
*--------------------------------------
KW.INFO
KW.INPUT
KW.KILL

View File

@ -25,6 +25,7 @@ LineNum .BS 2
char .BS 1
bIgnoreCase .BS 1
bLineNum .BS 1
bInvertMatch .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -55,19 +56,54 @@ L.MSG.NUMLINE .DA MSG.NUMLINE
CS.INIT clc
rts
*--------------------------------------
CS.RUN
.10 jsr CS.RUN.NextArg
bcs .8
CS.RUN jsr CS.RUN.CheckArgs
bcs CS.RUN.LOOP.RTS
stz LineNum
stz LineNum+1
CS.RUN.LOOP >SLEEP
>PUSHB hFile
>PUSHW ZPBufPtr
>PUSHWI 256
>SYSCALL FGetS
bcs .9
inc LineNum
bne .2
inc LineNum+1
.2 jsr CS.RUN.PRINT
bcc CS.RUN.LOOP
rts
.9 cmp #MLI.E.EOF
bne .99
lda #0 Exit with no Error
.99 sec
CS.RUN.LOOP.RTS rts
*--------------------------------------
CS.RUN.CheckArgs
jsr CS.RUN.NextArg
bcs .4
lda (ZPPtr1)
cmp #'-'
beq .1
lda ArgPattern
bne .11
lda ArgIndex
sta ArgPattern
>LDYA ZPPtr1
>STYA ZPPatternPtr
bra .10
bra CS.RUN.CheckArgs
.11 lda hFile
bne .97
@ -75,8 +111,9 @@ CS.RUN
>LDYA ZPPtr1
jsr CS.RUN.OPEN
bcs .9
sta hFile
bra .10
bra CS.RUN.CheckArgs
.1 ldy #1
lda (ZPPtr1),y
@ -84,26 +121,22 @@ CS.RUN
ldx #OptionList.Cnt-1
.2 cmp OptionList,x
beq .3
dex
bpl .2
bra .97
.3 txa
beq .98
lsr
tax
lda #$80
sta bIgnoreCase-1,x
bra .10 scan for any other args
.97 lda #E.SYN
.98 pha
>PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
pla
sec
.9 rts
.8 lda hFile
bra CS.RUN.CheckArgs
.4 lda hFile
bne .80
ldy #S.PS.hStdIn
@ -130,80 +163,19 @@ CS.RUN
>STYA ZPBufPtr
stx hBuf
stz LineNum
stz LineNum+1
CS.RUN.LOOP >SLEEP
>PUSHB hFile
>PUSHW ZPBufPtr
>PUSHWI 256
>SYSCALL FGetS
bcs .9
inc LineNum
bne .2
inc LineNum+1
.2 jsr CS.RUN.PRINT
bcc CS.RUN.LOOP
rts
.9 cmp #MLI.E.EOF
bne .99
lda #0 Exit with no Error
.99 sec
rts
*--------------------------------------
CS.RUN.OPEN >PUSHYA
>PUSHBI O.RDONLY+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
sta hFile
* clc
.9 rts
*--------------------------------------
CS.RUN.PRINT >LDYA ZPBufPtr
>STYA ZPPtr1
.1 lda (ZPPtr1)
beq .8
ldy #$ff
.2 iny
lda (ZPPtr1),y
bne .3
lda (ZPPatternPtr),y
bne .8
.3 lda (ZPPatternPtr),y
beq .6
jsr CS.RUN.toUpper
sta char
lda (ZPPtr1),y
jsr CS.RUN.toUpper
cmp char
beq .2
inc ZPPtr1
bne .1
inc ZPPtr1+1
bra .1
.6 lda bLineNum
bpl .7
>PUSHW L.MSG.NUMLINE
>PUSHW LineNum
>PUSHBI 2
.97 lda #E.SYN
.98 pha
>PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
bcs .9
.7 >LDYA ZPBufPtr
>SYSCALL PutS
pla
sec
rts
.8 clc
.9 rts
*--------------------------------------
CS.RUN.NextArg inc ArgIndex
lda ArgIndex
@ -211,6 +183,74 @@ CS.RUN.NextArg inc ArgIndex
bcs .9
>STYA ZPPtr1
.9 rts
*--------------------------------------
CS.RUN.OPEN >PUSHYA
>PUSHBI O.RDONLY+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
sta hFile
.9 rts
*--------------------------------------
CS.RUN.PRINT >LDYA ZPBufPtr
>STYA ZPPtr1
.1 lda (ZPPtr1)
beq .8
ldy #$ff
.2 iny
lda (ZPPtr1),y
bne .3
lda (ZPPatternPtr),y
bne .4
.3 lda (ZPPatternPtr),y
beq .6
jsr CS.RUN.toUpper
sta char
lda (ZPPtr1),y
jsr CS.RUN.toUpper
cmp char
beq .2
inc ZPPtr1
bne .1
inc ZPPtr1+1
bra .1
.4 clc not matching
.HS B0 BCS
.6 sec matching
ror
eor bInvertMatch
bpl .8
lda bLineNum
bpl .7
>PUSHW L.MSG.NUMLINE
>PUSHW LineNum
>PUSHBI 2
>SYSCALL PrintF
bcs .9
.7 >LDYA ZPBufPtr
>SYSCALL PutS
rts
.8 clc
.9 rts
*--------------------------------------
CS.RUN.toUpper bit bIgnoreCase
@ -241,13 +281,14 @@ CS.DOEVENT sec
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AZ "HhIiNn"
OptionList .AZ "HhIiNnVv"
OptionList.Cnt .EQ *-OptionList
*--------------------------------------
MSG.USAGE .AS "Usage : GREP <pattern> <File> or CMD|GREP <pattern>\r\n"
.AS " -H : This help screen\r\n"
.AS " -I : Ignore Case\r\n"
.AS " -N : Print line Number"
.AS " -N : Print line Number\r\n"
.AS " -V : Invert Match"
MSG.CRLF .AZ "\r\n"
MSG.NUMLINE .AZ "%5D:"
*--------------------------------------

82
BIN/TUITEST.S.txt Normal file
View File

@ -0,0 +1,82 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF root/tuitest
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/libtui.i
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #32 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.LIBTUI .DA LIBTUI
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTUI
>SYSCALL LoadLib
bcs .9
sta hLIBTUI
.9 clc
rts
*--------------------------------------
CS.RUN
lda #E.SYN
sec
rts
*--------------------------------------
CS.DOEVENT sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT lda hLIBTUI
beq .8
>SYSCALL UnloadLib
.8 clc
rts
*--------------------------------------
CS.END
*--------------------------------------
LIBTUI .AZ "libtui"
hLIBTUI .BS 1
*--------------------------------------
LBOX1 .DA #10 X1
.DA #4 Y1
.DA #20 W
.DA #10 H
LBOX1.Title .AZ "Title"
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END .ED
*--------------------------------------
MAN
SAVE root/tuitest.s
ASM

35
INC/LIBTUI.I.txt Normal file
View File

@ -0,0 +1,35 @@
NEW
AUTO 3,1
*--------------------------------------
LIBTUI.Init .EQ 4
LIBTUI.Close .EQ 6
*--------------------------------------
S.OBJ.T .EQ 0
S.OBJ.T.LBOX .EQ 0
S.OBJ.F .EQ 1
S.OBJ.F.bTITLE .EQ %10000000
S.OBJ.F.bMENU .EQ %01000000
S.OBJ.F.bSTATUS .EQ %00100000
S.OBJ.S .EQ 2
S.OBJ.S.bVISIBLE .EQ %10000000
* .EQ 3
S.OBJ.X1 .EQ 4
S.OBJ.Y1 .EQ 5
S.OBJ.W .EQ 6
S.OBJ.H .EQ 7
S.OBJ.X2 .EQ 8
S.OBJ.Y2 .EQ 9
S.OBJ.pTITLE .EQ 10
S.OBJ.pMENU .EQ 12
S.OBJ.pSTATUS .EQ 14
*
S.OBJ .EQ 16
*--------------------------------------
S.LBOX.pL .EQ S.OBJ+0
S.LBOX.Idx .EQ S.OBJ+2
S.LBOX.Cnt .EQ S.OBJ+4
*
S.LBOX .EQ S.OBJ+16
*--------------------------------------
MAN
SAVE inc/libtui.i

110
LIB/LIBTUI.S.txt Normal file
View File

@ -0,0 +1,110 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF lib/libtui
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/libtui.i
*--------------------------------------
.DUMMY
.OR ZPLIB
ZPObjPtr .BS 2
ZPPtr1 .BS 2
.ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
.DA LIBTUI.Init
.DA LIBTUI.Close
.DA 0
*--------------------------------------
LIB.LOAD clc
rts
*--------------------------------------
LIB.UNLOAD clc
rts
*--------------------------------------
LIBTUI.Init clc
rts
*--------------------------------------
LIBTUI.Close clc
rts
*--------------------------------------
LIBTUI.LBOXNew >STYA ZPPtr1
>LDYAI S.LBOX
>SYSCALL GetMem
bcs .9
>STYA ZPObjPtr
lda #S.OBJ.T.LBOX
sta (ZPObjPtr)
ldy #S.OBJ.F
.1 lda (ZPPtr1),y
sta (ZPObjPtr),y
cpy #S.OBJ.H+1
bne .1
.8 txa
clc
.9 rts
*--------------------------------------
LIBTUI.LBOXLoad
*--------------------------------------
LIBTUI.LBOXFocus
*--------------------------------------
LIBTUI.LBOXRun
*--------------------------------------
LIBTUI.LBOXClose
clc
rts
*--------------------------------------
LIBGUI.SetupX2Y2
ldy #S.OBJ.X1
jsr .1
ldy #S.OBJ.Y1
.1 clc
lda (ZPObjPtr),y
iny
iny S.OBJ.W/H
adc (ZPObjPtr),y
iny
iny S.OBJ.X2/Y2
sta (ZPObjPtr),y
rts
*--------------------------------------
LIBTUI.DrawFrame
*--------------------------------------
CS.END
*--------------------------------------
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s
ASM

View File

@ -850,8 +850,8 @@ XRW.SeekYA sta XRW.D2Trk-1,x will be current track at the end
jsr XRW.Wait25600usec
XRW.SeekPhOff lda IO.D2.Ph0Off,x
nop
nop
ldx A2L
lda IO.D2.RData,x
lda IO.D2.Ph0Off,y
clc Exit wit CC (recalibrate)