Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-02-14 14:51:24 +00:00
parent 324423e027
commit b889c4778e
8 changed files with 154 additions and 65 deletions

View File

@ -61,7 +61,7 @@ X = DevID
# GetDevStatus
## C
`int getdevstatus(short int hDEV, S.DIB* dstat);`
`int getdevstatus(short int DevID, S.DIB* dstat);`
## ASM
`>PUSHWI S.DIB`
@ -803,6 +803,9 @@ Specifiers :
+ \f : Print 'FF' ($0C,12)
+ \n : Print 'LF' ($0A,10)
+ \r : Print 'CR' ($0D,13)
+ \t : Print 'TAB' ($09,09)
+ \v : Print 'VT' ($0B,11)
+ \xHH : Print byte with hexadecimal value HH (1 to 2 digits)
+ \\\\ : Print \
+ \\% : Print %

Binary file not shown.

View File

@ -17,6 +17,8 @@ CORE.Quit >LDA.G CORE.hArgVBuf
.9 rts
*--------------------------------------
* http://heirloom.sourceforge.net/sh/sh.1.html
*--------------------------------------
* Input : ZPArgVBuf (String)
* Tokenize ZPArgVBuf
* :LOOP
@ -61,16 +63,21 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
jsr CORE.GetCharNB
bcs .9 Ending 0, CS,A=0
cmp #'#' commented line?
cmp #C.CR
beq .80 empty line ?
.10 cmp #'#' commented line?
bne .2
.1 jsr CORE.GetNextCharNB
bcs .8 A=0
eor #C.CR
bne .1
jsr CORE.GetNextChar
bcs .8 EOF
cmp #C.CR
bne .1 EOL
.80 jsr CORE.GetNextChar skip CR...
.8 clc
.8 lda #0
clc
.9 rts EOL, CS,A=0
.2 cmp #'|'
@ -141,10 +148,24 @@ CORE.ExecCmd jsr CORE.GetNextCharNB Skip EoL char
CORE.ExecCmd.1 lda #0
sta (ZPArgVBufPtr)
jsr CORE.StkGet IF,WHILE,FOR ?
bcs .3 no particular context, exec...
tax
>LDA.G CORE.IntCmd
bmi .2 external ...
and #$3F
cmp #C.FOR
bcs .3 FOR...FI : always execute
.2 txa
bpl .8 context is FALSE, skip line
asl
bpl .8 parent context is FALSE, skip line
>LDYA ZPArgVBuf
.3 >LDYA ZPArgVBuf
>STYA ZPArgVBufPtr
>LDA.G CORE.IntCmd
@ -153,6 +174,9 @@ CORE.ExecCmd.1 lda #0
jmp (J.CMD,x)
.8 clc
rts
CORE.ExecExtCmd >PUSHB.G CORE.PSFlags
>LDYA ZPArgVBuf
>SYSCALL execv
@ -314,6 +338,9 @@ CORE.ArgV.NextChar
CORE.ArgV.Next lda (ZPArgVBufPtr)
beq .8
>LDYA ZPArgVBufPtr
>STYA ZPArgVBufPrev
.1 jsr CORE.ArgV.NextChar
lda (ZPArgVBufPtr)
bne .1

View File

@ -80,7 +80,7 @@ EXP.TEST lda (ZPArgVBufPtr)
jsr CORE.ArgV.Next
beq .9
>LDYA L.EXP.OP.UNARY -d -e -f ?
>LDYA L.EXP.OP.UNARY -d -e -f -n -z ?
jsr CORE.LookupArgVBuf
bcs .1
@ -93,8 +93,8 @@ EXP.TEST lda (ZPArgVBufPtr)
>EOR.G CORE.Test
sta (pData),y
bra .8 go check ]
lda (ZPArgVBufPtr)
bra .80 go check ]
.9 lda #E.ESYN
sec
@ -118,7 +118,7 @@ EXP.TEST lda (ZPArgVBufPtr)
.8 jsr CORE.ArgV.Next
beq .9
cmp #']'
.80 cmp #']'
bne .9
ldy #1
@ -128,13 +128,14 @@ EXP.TEST lda (ZPArgVBufPtr)
rts
*--------------------------------------
EXP.TEST.UNARY jsr CORE.ArgV.Next
beq .9 we need one arg
beq EXP.OP.UNARY.ESYN we need one arg or ]
>LDA.G CORE.Operator
tax
jmp (J.EXP.OP.UNARY,x)
.9 lda #E.ESYN
EXP.OP.UNARY.ESYN
lda #E.ESYN
sec
rts
@ -161,6 +162,10 @@ EXP.OP.UNARY.DEF.7
>PUSHEA.G StatBuf
>LDYA ZPArgVBufPtr
>SYSCALL STAT
php
jsr CORE.ArgV.Next
plp
rts
EXP.OP.UNARY.DEF.8
@ -173,6 +178,22 @@ EXP.OP.UNARY.DEF.9
clc
rts
*--------------------------------------
EXP.OP.UNARY.N lda (ZPArgVBufPtr) [ -N ] ?
cmp #']'
beq EXP.OP.UNARY.DEF.9 FALSE
jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN
bra EXP.OP.UNARY.DEF.8 arg is not empty TRUE
EXP.OP.UNARY.Z lda (ZPArgVBufPtr) [ -Z ] ?
cmp #']'
beq EXP.OP.UNARY.DEF.8 TRUE
jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN
bra EXP.OP.UNARY.DEF.9 FALSE
*--------------------------------------
EXP.TEST.BINARY >LDA.G CORE.Operator
beq .1 =
@ -184,7 +205,7 @@ EXP.TEST.BINARY >LDA.G CORE.Operator
.1 jsr CORE.ArgV.Next
beq .9
>PUSHW ZPPtr1
>PUSHW ZPArgVBufPrev
>LDYA ZPArgVBufPtr
>SYSCALL strcmp
ror CS if !=
@ -199,15 +220,15 @@ EXP.TEST.BINARY >LDA.G CORE.Operator
rts
*--------------------------------------
EXP.TEST.BINARY.NUM
jsr CORE.ArgV.Next
beq .9
>LDYA ZPPtr1
>LDYA ZPArgVBufPrev
>SYSCALL AToL
bcs .9
>PULLL.G M32.ACC
jsr CORE.ArgV.Next
beq .9
>LDYA ZPArgVBufPtr
>SYSCALL AToL
bcs .9

View File

@ -97,42 +97,54 @@ IO.Reset.Err >LDA.G IO.hErr
.8 rts
*--------------------------------------
IO.PrintBatchErrMsg
>LDA.G hInputBuf
>SYSCALL GetMemPtr
>LDYA ZPInputBuf
>STYA ZPPtr1
stz ZPPtr3
stz ZPPtr3+1
stz ZPPtr2 Line Count
stz ZPPtr2+1
.1 >LDYA ZPPtr1
>STYA ZPPtr2 Save actual line start
inc ZPPtr3
.1 inc ZPPtr2
bne .2
inc ZPPtr3+1
inc ZPPtr2+1
.2 lda (ZPPtr1)
beq .6 EoF
inc ZPPtr1
bne .3
inc ZPPtr1+1
.2 ldy #$ff
.3 iny
lda (ZPPtr1),y
beq .4 EoF
cmp #C.CR
bne .3 Scan until EoL
.3 cmp #$0D
bne .2 Scan until EoL
ldx ZPPtr1
cpx ZPInputBufPtr
.4 tya
clc
adc ZPPtr1
tax
lda ZPPtr1+1
adc #0
pha
cpx ZPInputBufPtr
sbc ZPInputBufPtr+1
bcc .1 not this line....
pla
bcs .41
inx
bne .40
inc
.40 stx ZPPtr1
sta ZPPtr1+1
bra .1
.4 ldy #0
.41 ldy #$ff
.5 lda (ZPPtr2),y
.5 iny
lda (ZPPtr1),y
beq .6
iny
cmp #$0D
cmp #C.CR
beq .6
phy
>PUSHA
ldy #S.PS.hStdErr
@ -147,22 +159,24 @@ IO.PrintBatchErrMsg
lda (pPS),y
>SYSCALL fprintf
lda ZPInputBufPtr
sec
sbc ZPPtr2
beq .8
tay
ldy #$ff
.7 phy
.7 iny
lda (ZPPtr1),y
beq .8
cmp #C.CR
beq .8
phy
>PUSHBI '-'
ldy #S.PS.hStdErr
lda (pPS),y
>SYSCALL fputc
ply
dey
bne .7
bra .7
.8 >PUSHW ZPPtr3
.8 >PUSHW ZPPtr2
>PUSHBI 2
>PUSHW L.MSG.BATCHERR

View File

@ -153,6 +153,8 @@ L.EXP.OP.UNARY .DA EXP.OP.UNARY
J.EXP.OP.UNARY .DA EXP.OP.UNARY.D
.DA EXP.OP.UNARY.E
.DA EXP.OP.UNARY.F
.DA EXP.OP.UNARY.N
.DA EXP.OP.UNARY.Z
L.EXP.OP.BINARY .DA EXP.OP.BINARY
L.EXP.OP.MATH .DA EXP.OP.MATH
J.EXP.OP.MATH .DA M32.Add
@ -583,6 +585,8 @@ EXP.BEGIN .AZ "!["
EXP.OP.UNARY .AZ "-D"
.AZ "-E"
.AZ "-F"
.AZ "-N"
.AZ "-Z"
.HS 00
EXP.OP.BINARY .AZ "="
.AZ "!="

View File

@ -160,6 +160,9 @@ K.FPutS jsr PFT.CheckNodeA set IO.hFD
* + \f : Print 'FF' ($0C,12)
* + \n : Print 'LF' ($0A,10)
* + \r : Print 'CR' ($0D,13)
* + \t : Print 'TAB' ($09,09)
* + \v : Print 'VT' ($0B,11)
* + \xHH : Print byte with hexadecimal value HH (1 to 2 digits)
* + \\\\ : Print \
* + \\% : Print %
* Modifiers for len and padding :
@ -202,14 +205,14 @@ K.PrintF.1 stz PrintF.Cnt
.1 jsr MEM.GetCharPtr1
beq .8 end of format..
cmp #'%'
.22 cmp #'%'
bne .10
stz K.PrintF.PadL
lda #' '
sta K.PrintF.PadC
.2 ldx #PrintFTBL2-PrintFTBL1-1
.2 ldx #PrintFTBL1.Cnt-1
jsr MEM.GetCharPtr1
beq .99
@ -268,20 +271,35 @@ K.PrintF.1 stz PrintF.Cnt
.10 cmp #'\'
bne .20
ldx #PrintFTBL2.OUT-PrintFTBL2-1
jsr MEM.GetCharPtr1
beq .99
ldx #PrintFTBL2.Cnt-1
.12 cmp PrintFTBL2,x
beq .13
beq .19
dex
bpl .12
bra .1
cmp #'x'
bne .1
.13 lda PrintFTBL2.OUT,x
>LDYA ZPPtr1
>STYA ZPPtr2
jsr STDLIB.GetHex
bcs .99
jsr MEM.AddYToPtr1
.14 lda HEXBUF
bra .20
.19 lda PrintFTBL2.OUT,x
.20 jsr PrintF.COut
bcc .1
bcs .99
jmp .1
.99 php
pha
@ -307,8 +325,10 @@ PrintF.ESC jmp (.1,x)
.DA PrintF.S,PrintF.SS
*--------------------------------------
PrintFTBL1 .AS "bBdDuefhHiILnNsS"
PrintFTBL2 .AS "befnr\%"
PrintFTBL2.OUT .HS 08.1B.0C.0A.0D \b\e\f\n\r
PrintFTBL1.Cnt .EQ *-PrintFTBL1
PrintFTBL2 .AS "befnrtv\%"
PrintFTBL2.Cnt .EQ *-PrintFTBL2
PrintFTBL2.OUT .HS 08.1B.0C.0A.0D.09.0B \b\e\f\n\r\t\v
.DA #'\' \\
.DA #'%' \%
*--------------------------------------

View File

@ -145,7 +145,7 @@ STDLIB.GetHex lda (ZPPtr2)
sta STDLIB.32
ldy #$ff
ldy #0
.1 iny
lda (ZPPtr2),y
@ -177,7 +177,7 @@ STDLIB.GetHex lda (ZPPtr2)
* Convert Decimal int at ZPPtr2 to STDLIB.32
*--------------------------------------
STDLIB.GetDec jsr STDLIB.32.Clear
ldy #$ff
.1 iny