ACOS: new string functions, KERNEL & SBIN: some memleak fixed, CIFS : fixed some malformed FRAMES

This commit is contained in:
burniouf 2021-07-13 18:52:04 +02:00
parent cb628265b7
commit 3c55ead88e
20 changed files with 399 additions and 196 deletions

View File

@ -841,7 +841,7 @@ Print A (char) to hFILE
`>PUSHB character`
`>SYSCALL fputc`
## RETURN VALUE
## RETURN VALUE
CC = success
# putchar (BLOCKING)
@ -855,7 +855,7 @@ Print A (char) to StdOut
`lda character`
`>SYSCALL putchar`
## RETURN VALUE
## RETURN VALUE
CC = success
# puts (BLOCKING)
@ -869,7 +869,7 @@ Write Str to StdOut, appends '\r\n'
`>LDYAI str`
`>SYSCALL PutS`
## RETURN VALUE
## RETURN VALUE
CC = success
# fputs (BLOCKING)
@ -884,7 +884,7 @@ Write Str to hFILE
`>PUSHW str`
`>SYSCALL fputs`
## RETURN VALUE
## RETURN VALUE
CC = success
# fgets (BLOCKING)
@ -903,8 +903,8 @@ string is then terminated with a null byte.
`>PUSHW n`
`>SYSCALL fgets`
## RETURN VALUE
Y,A: s
## RETURN VALUE
Y,A: s
CC = success
# getchar (BLOCKING)
@ -917,7 +917,7 @@ Get char from StdIn
**In:**
`>SYSCALL getchar`
## RETURN VALUE
## RETURN VALUE
CC = success
A = char
@ -932,7 +932,7 @@ Get char from Node
`lda stream`
`>SYSCALL getc`
## RETURN VALUE
## RETURN VALUE
CC = success
A = char
@ -947,7 +947,7 @@ push byte back into input stream
`>PUSHB stream`
`>SYSCALL ungetc`
## RETURN VALUE
## RETURN VALUE
CC = success
A = char
@ -979,7 +979,7 @@ TODO: replace flags/ftype/auxtype with mode="w+,t=TYP,x=AUXTYPE"
+ ,t=123 or t=$ff or t=TXT
+ ,x=12345 or x=$ffff
## RETURN VALUE
## RETURN VALUE
CC : A = hFILE
CS : A = EC
@ -1063,7 +1063,7 @@ Test the end-of-file indicator for hFILE
`>SYSCALL feof`
## RETURN VALUE
CC :
CC :
A = $ff EOF
A = 0 NOT EOF
CS :
@ -1123,20 +1123,20 @@ Prints C-Style String
## ASM
**In:**
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
`>PUSHW format`
`>PUSHW i`
`...`
`>PUSHBI 2` #bytecount
`>SYSCALL PrintF`
FPrintF :
FPrintF :
`>PUSHB hFILE`
`>PUSHW format`
`>PUSHW i`
`...`
`>PUSHBI 2` #bytecount
`>SYSCALL fprintf`
SPrintF :
SPrintF :
`>PUSHW str`
`>PUSHW format`
`>PUSHW i`
@ -1148,7 +1148,7 @@ SPrintF :
CC : success, Y,A = bytes sent
CS : error, A = code from Output
Specifiers :
+ %b : pull 1 byte to Print BIN
+ %b : pull 1 byte to Print BIN
+ %d : pull 1 byte unsigned DEC 0..255
+ %D : pull 2 bytes unsigned DEC 0..65535
+ %u : pull 4 bytes long unsigned DEC 0..4294967295
@ -1172,11 +1172,11 @@ Specifiers :
+ \\\\ : Print \
+ \\% : Print %
Modifiers for len and padding :
Modifiers for len and padding :
+ %d : '9' '12'
+ %2d : ' 9' '12'
+ %02d : '09' '12'
+ %11s : 'ABCDEFGH '
+ %11s : 'ABCDEFGH '
+ %011s : 'ABCDEFGH000'
+ %2f : '3.14'

Binary file not shown.

Binary file not shown.

View File

@ -41,18 +41,18 @@ CODE.LDYXI lda #$A0 LDY #imm
jsr CODE.EmitByte
tya
jsr CODE.EmitByte
lda #$A2 LDX #imm
*--------------------------------------
CODE.LDXI lda #$A2 LDX #imm
jsr CODE.EmitByte
txa
jmp CODE.EmitByte
bra CODE.EmitByte
*--------------------------------------
CODE.JSRRT lda #$20 JSR
jsr CODE.EmitByte
lda J.RT,x
jsr CODE.EmitByte
lda J.RT+1,x
jmp CODE.EmitByte
bra CODE.EmitByte
*--------------------------------------
CODE.FPUCALL lda #$A2 LDX #imm
jsr CODE.EmitByte
@ -65,10 +65,6 @@ CODE.FPUCALL lda #$A2 LDX #imm
lda /A2osX.FPUCALL
bra CODE.EmitByte
*--------------------------------------
CODE.FPRINTCRLF ldx #C.CR
jsr CODE.PutChar
ldx #C.LF
*--------------------------------------
CODE.PutChar lda #$A9 LDA #imm
jsr CODE.EmitByte
txa

View File

@ -715,6 +715,9 @@ CORE.IsEndExp cmp #')' CS = true
cmp #';'
beq CORE.ToUpperCase.RTS
cmp #'\'
beq CORE.ToUpperCase.RTS
CORE.IsEndInst cmp #':' CS = true
beq .8

View File

@ -34,7 +34,14 @@ FN.KEY
sec
rts
*--------------------------------------
FN.LEFTd jsr CORE.CheckOP
FN.LEFTd ldx #RT.LEFTd.ID
bra FN.RIGHTd.1
FN.RIGHTd ldx #RT.RIGHTd.ID
FN.RIGHTd.1 phx
jsr CORE.CheckOP
bcs .99
jsr EXP.Eval
@ -55,7 +62,7 @@ FN.LEFTd jsr CORE.CheckOP
jsr CORE.CheckCP
bcs .99
ldx #RT.LEFTd.ID
plx
jsr CODE.JSRRT
lda #'$'
@ -66,7 +73,9 @@ FN.LEFTd jsr CORE.CheckOP
.90 lda #E.TMISMATCH
sec
.99 rts
.99 plx
rts
*--------------------------------------
FN.LEN jsr CORE.CheckOP
bcs .99
@ -90,11 +99,58 @@ FN.LEN jsr CORE.CheckOP
sec
.99 rts
*--------------------------------------
FN.MIDd
FN.MIDd jsr CORE.CheckOP
bcs .99
jsr EXP.Eval str
bcs .99
lda EXP.TYPE
beq .90
jsr CORE.CheckComma
bcs .99
jsr EXP.Eval start
bcs .99
lda EXP.TYPE
bne .90
jsr CORE.CheckComma
bcc .1
ldy #255
ldx #255
jsr CODE.PUSHYXI
bra .2
.1 jsr EXP.Eval len
bcs .99
lda EXP.TYPE
bne .90
.2 jsr CORE.CheckCP
bcs .99
ldx #RT.MIDd.ID
jsr CODE.JSRRT
lda #'$'
sta EXP.TYPE
clc
rts
.90 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
FN.PDL
FN.PEEK
FN.RANDOM
FN.RIGHTd
FN.RNDd
lda #E.CSYN
sec

View File

@ -72,10 +72,12 @@ KW.GOTO1 jsr CODE.EmitByte
.99 rts
*--------------------------------------
KW.HOME
lda #E.CSYN
sec
rts
KW.HOME ldx #8 CLRSCR
jsr CODE.LDXI
ldx #RT.OUTX.ID
clc
jmp CODE.JSRRT
*--------------------------------------
* IP exp THEN st1 ELSE st2
*--------------------------------------
@ -203,10 +205,21 @@ KW.INFO
sec
rts
*--------------------------------------
KW.INPUT jsr CORE.GetNextCharNB
bcs .9
KW.INPUT stz hIn Defaut to Keyboard
jsr CORE.CreateOrGetVar
jsr CORE.GetNextCharNB
bcs .9
cmp #'"'
bne .5
jsr EXP.CreateStrConst
bcs .99
ldx #RT.StrOut.ID
jsr CODE.JSRRT
.5 jsr CORE.CreateOrGetVar
bcs .99
ldx #RT.INPUT.ID
@ -253,18 +266,20 @@ KW.POSITION
sec
rts
*--------------------------------------
KW.PRINT stz hOut reset to hStdOut
stz ZPPtr2 put ending CR
ldy #S.PS.hStdOut
lda (pPS),y
sta hOut Default to screen
KW.PRINT stz ZPPtr2 put ending CR
stz hOut Default to screen
.10 jsr CORE.GetNextCharNB
bcs .8
.11 jsr CORE.IsEndInst
.11 cmp #'\'
bne .13
.12 ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
bra .10
.13 jsr CORE.IsEndInst
bcs .8
jsr CORE.IsKW
@ -287,7 +302,10 @@ KW.PRINT stz hOut reset to hStdOut
jsr CORE.GetCharNB
bcs .8
.70 jsr CORE.IsEndInst
.70 cmp #'\'
beq .12
jsr CORE.IsEndInst
bcs .8
jsr CORE.IsKW
@ -313,7 +331,8 @@ KW.PRINT stz hOut reset to hStdOut
.8 bit ZPPtr2
bmi .80
jsr CODE.FPRINTCRLF
ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
.80 clc
rts

View File

@ -51,7 +51,8 @@ RT.StrOut ldy #S.PS.hStdOut
>PUSHA
lda (pStack),y
>PUSHA
>SYSCALL fputs
>PUSHBI 0
>SYSCALL fprintf
inc pStack
inc pStack
rts
@ -115,6 +116,9 @@ RT.INPUT lda #0
stz ZPPtr1
ldx #0 OUT.ELW
jsr RT.OUTX
.1 >SYSCALL GetChar
bcs RT.INPUT.9
@ -124,44 +128,80 @@ RT.INPUT lda #0
bcs .7
cmp #C.CR
beq RT.INPUT.8
bne .2
cmp #C.BS
lda #0
sta (ZPStrBuf),y
ldx #4 OUT.CRLF
jsr RT.OUTX
bra RT.INPUT.8
.2 cmp #C.BS
bne .1
cpy #0
beq .1
>SYSCALL PutChar
lda #C.SPACE
>SYSCALL PutChar
lda #C.BS
>SYSCALL PutChar
ldx 6 OUT.BSSPBS
jsr RT.OUTX
dec ZPPtr1
bra .1
.7 sta (ZPStrBuf),y
.7 cpy #255
bcs .1
sta (ZPStrBuf),y
>SYSCALL PutChar
inc ZPPtr1
bne .1
bra .1
RT.INPUT.8 lda #0
sta (ZPStrBuf),y
RT.INPUT.8 ldx #2 OUT.DLW
jsr RT.OUTX
>PUSHW ZPStrBuf
clc
RT.INPUT.9 rts
*--------------------------------------
RT.LEFTd >PULLW ZPPtr2 cnt
lda (pStack)
sta ZPPtr1
ldy #1
lda (pStack),y
sta ZPPtr1+1
RT.LEFTd >PULLB ZPPtr2 cnt
inc pStack
>PULLW ZPPtr1 src str
ldy #0
.1 lda (ZPPtr1),y
sta (ZPStrBuf),y
beq .8
iny
cpy ZPPtr2
bne .1
lda #0
sta (ZPStrBuf),y
.8 >PUSHW ZPStrBuf
clc
rts
*--------------------------------------
RT.LEN >PULLYA str
>SYSCALL strlen
>PUSHYA
rts
*--------------------------------------
RT.MIDd >PULLA len
tax
inc pStack
>PULLB ZPPtr2 start
inc pStack
>PULLW ZPPtr1 src str
ldy #0
.1 lda (ZPPtr1),y
beq .8
@ -169,16 +209,69 @@ RT.LEFTd >PULLW ZPPtr2 cnt
cpy ZPPtr2
bne .1
lda #0
sta (ZPPtr1),y
tya
clc
adc ZPPtr1
sta ZPPtr1
bcc .2
.8 rts
*--------------------------------------
RT.LEN >PULLYA str
>SYSCALL strlen
>PUSHYA
inc ZPPtr1+1
.2 ldy #0
.3 txa
beq .8
lda (ZPPtr1),y
sta (ZPStrBuf),y
beq .80
iny
dex
bne .3
txa
.8 sta (ZPStrBuf),y
.80 >PUSHW ZPStrBuf
clc
rts
*--------------------------------------
RT.RIGHTd >PULLB ZPPtr2 cnt
inc pStack
>PULLW ZPPtr1 src str
ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
tya
sec
sbc ZPPtr2
bcc .8
beq .8
clc
adc ZPPtr1
sta ZPPtr1
bcc .2
inc ZPPtr1+1
.2 ldy #$ff
.3 iny
lda (ZPPtr1),y
sta (ZPStrBuf),y
bne .3
.8 >PUSHW ZPStrBuf
clc
rts
*--------------------------------------
RT.STRd >PULLYA int
pha
>PUSHW ZPStrBuf
@ -195,6 +288,14 @@ RT.VAL >PULLYA str
>PUSHYA
rts
*--------------------------------------
RT.OUTCRLF ldx #4 CRLF
RT.OUTX ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW L.OUT,x
>SYSCALL FPutS
rts
*--------------------------------------
MAN
SAVE usr/src/bin/acos.s.rt
LOAD usr/src/bin/acos.s

View File

@ -76,7 +76,6 @@ CS.START cld
*--------------------------------------
L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.USAGE .DA MSG.USAGE
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.COMPILING .DA MSG.COMPILING
L.MSG.DEBUG .DA MSG.DEBUG
L.MSG.TRACE .DA MSG.TRACE
@ -86,6 +85,11 @@ L.MSG.FWREFERR .DA MSG.FWREFERR
L.MSG.RUN .DA MSG.RUN
L.MSG.STR .DA MSG.STR
L.MSG.INT16 .DA MSG.INT16
L.OUT .DA OUT.ELW
.DA OUT.DLW
.DA OUT.CRLF
.DA OUT.BSSPBS
.DA OUT.CLRSCR
L.FMT.DATE .DA FMT.DATE
L.FMT.TIME .DA FMT.TIME
*--------------------------------------
@ -186,6 +190,10 @@ RT.LEFTd.ID .EQ *-J.RT
.DA RT.LEFTd
RT.LEN.ID .EQ *-J.RT
.DA RT.LEN
RT.MIDd.ID .EQ *-J.RT
.DA RT.MIDd
RT.RIGHTd.ID .EQ *-J.RT
.DA RT.RIGHTd
RT.STRd.ID .EQ *-J.RT
.DA RT.STRd
RT.TIMEd.ID .EQ *-J.RT
@ -207,6 +215,10 @@ RT.IntGet.ID .EQ *-J.RT
.DA RT.IntGet
RT.IntOut.ID .EQ *-J.RT
.DA RT.IntOut
RT.OUTCRLF.ID .EQ *-J.RT
.DA RT.OUTCRLF
RT.OUTX.ID .EQ *-J.RT
.DA RT.OUTX
.DA 0
*--------------------------------------
* Called once at process creation
@ -482,7 +494,8 @@ MSG.GREETINGS .AZ "\r\nACOS-Shell %d.%d\r\n\r\n"
MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
.AS " -D : Debug Mode\r\n"
.AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n"
.AZ "\r\n"
*--------------------------------------
MSG.COMPILING .AZ "***Compiling : %s...\r\n"
MSG.DEBUG .AZ "***CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
MSG.TRACE .AZ "%05D>%s\r\n"
@ -493,6 +506,19 @@ MSG.RUN .AZ "***Code size: %D, Data Size: %D, Running...\r\n"
MSG.STR .AZ "%s"
MSG.INT16 .AZ "%I"
*--------------------------------------
OUT.ELW .DA #C.ESC
.AZ "[?7h" Enable Line Wrap
OUT.DLW .DA #C.ESC
.AZ "[?7l" Disable Line Wrap
OUT.CRLF .DA #C.CR,#C.LF,#0
OUT.BSSPBS .DA #C.BS,#C.SPACE,#C.BS,#0
OUT.CLRSCR .DA #C.ESC
.AS "c"
.DA #C.ESC
.AS "(B"
.DA #C.ESC
.AZ ")0"
*--------------------------------------
FMT.DATE .AZ "%d/%m/%Y"
FMT.TIME .AZ "%H:%M:%S"
*--------------------------------------

View File

@ -129,6 +129,7 @@ CIFS.OpenDir >STYA pPath resolved path
bcs .9
>STYA ZPPtr2
stx hFD
lda #S.FD.T.DIR
sta (ZPPtr2)
@ -147,9 +148,12 @@ CIFS.OpenDir >STYA pPath resolved path
>PUSHW pPath
>PUSHWI 0
txa
>PUSHA
>PUSHB hFD
>SYSCALL2 mknod
bcc .9
jsr CIFS.FreeFD
sec
.9 rts
*--------------------------------------
@ -292,7 +296,8 @@ CIFS2.ReadDir jsr GetPFD
.9 jmp Exit.NODATA
.99 jmp Exit.KO
.99 stz CIFS.Status
jmp FreeRespData
*--------------------------------------
CIFS2.ReadDir.GetBuf
ldy #S.NETBIOS+S.SMB.H+S.TRANS2.H Search Count
@ -472,6 +477,7 @@ CIFS2.ReadDir.FillBuf
rts
*--------------------------------------
CIFS.CloseReg
CIFS.CloseDir tax
lda Nod.Table.hName-2,x
@ -531,7 +537,9 @@ CIFS.FOpen >STYA pPath resolved path
jsr AppendTypePtr2
.2 tya
.2 jsr AddYReqLen
tya
ldy #S.NETBIOS+S.SMB.H+6 NameLength
sta (ZPReqPtr),y
@ -539,10 +547,6 @@ CIFS.FOpen >STYA pPath resolved path
inc +1 for \0
jsr Add2ByteCount
jsr AddYReqLenPtr2
jsr SetReqLen
ldx #1 FILE_OPEN
ldy #3 fopen flags
@ -565,6 +569,8 @@ CIFS.FOpen >STYA pPath resolved path
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 CreateDisposition
sta (ZPReqPtr),y
jsr SetReqLen
jsr WriteSocket
bcs .9
@ -632,8 +638,13 @@ CIFS2.FOpen jsr ReadSocket
>PUSHWZ mod
>PUSHB hFD
>SYSCALL2 mknod
bcc .91
jsr CIFS.FreeFD
sec
.91 jsr Exit.KO
.91 stz CIFS.Status
jmp FreeRespData
bra .90
.9 jsr Exit.NODATA
@ -694,7 +705,7 @@ CIFS2.FClose sta hFILE
bcs .99
lda hFILE
jsr CIFS.CloseDir
jsr CIFS.CloseReg
jmp Exit.OK
@ -990,13 +1001,33 @@ CIFS2.FWrite jsr ReadSocket
.90 >POP 5
.99 rts
*--------------------------------------
CIFS.FFlush
CIFS.FFlush clc Nothing to do
rts
*--------------------------------------
CIFS2.FFlush
CIFS.FSeek
*--------------------------------------
CIFS.FSeek ldy #5 hNod
lda (pStack),y
jsr GetPFD
>PULLA
tax whence
>PULLL DWORD
inc pStack
clc
rts
*--------------------------------------
CIFS2.FSeek
*--------------------------------------
CIFS.FTell
*--------------------------------------
CIFS2.FTell
*--------------------------------------
CIFS.FEOF
*--------------------------------------
CIFS2.FEOF lda #MLI.E.BADCALL
sec
rts
@ -1152,6 +1183,12 @@ CIFS.NewFD >LDYAI S.FD.REG
.9 rts
*--------------------------------------
CIFS.FreeFD pha
lda hFD
>SYSCALL2 FreeMem
pla
rts
*--------------------------------------
CIFS.RWGetFidOfs
ldx #6
ldy #S.FD.REG.REF

View File

@ -31,11 +31,11 @@ pPath .BS 2
flags .BS 1
ftype .BS 1
auxtype .BS 2
ZPRespPtr .BS 2
bFlag .BS 1
ByteCountOfs .BS 1
DWORD .BS 4
ZS.END .ED
*--------------------------------------
@ -245,18 +245,14 @@ CIFS.Negotiate lda (pStack)
ldy #S.NETBIOS+S.SMB.H.FLAGS
sta (ZPCtxPtr),y
phx
txa hSMBContext
lda hResp
>SYSCALL2 FreeMem
pla
jsr FreeRespData
clc
>RET 2
bra .99
.97 lda hResp
>SYSCALL2 FreeMem
.97 jsr FreeRespData
.98 lda #MLI.E.IO
@ -353,14 +349,12 @@ CIFS.SessionSetup
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
.8 lda hResp
>SYSCALL2 FreeMem
.8 jsr FreeRespData
clc
>RET 7
bra .99
.97 lda hResp
>SYSCALL2 FreeMem
.97 jsr FreeRespData
.98 lda #MLI.E.IO
sec
@ -459,14 +453,12 @@ CIFS.TreeConnect
lda (ZPRespPtr),y
sta (ZPCtxPtr),y
.8 lda hResp
>SYSCALL2 FreeMem
.8 jsr FreeRespData
clc
>RET 5
bra .99
.97 lda hResp
>SYSCALL2 FreeMem
.97 jsr FreeRespData
.98 lda #MLI.E.IO
sec
@ -701,27 +693,6 @@ AppendTypePtr2 ldx #0
.8 rts
*--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .1
inc ZPReqLen+1
.1 tya
sec +1 for \0
adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
Add2ByteCount ldy ByteCountOfs
clc
adc (ZPReqPtr),y
@ -734,6 +705,28 @@ Add2ByteCount ldy ByteCountOfs
sta (ZPReqPtr),y
rts
*--------------------------------------
AddYReqLenPtr2 tya
sec +1 for \0
adc ZPPtr2
sta ZPPtr2
bcc AddYReqLen
inc ZPPtr2+1
*--------------------------------------
AddYReqLen tya
sec +1 for \0
adc ZPReqLen
sta ZPReqLen
bcc .8
inc ZPReqLen+1
.8 rts
*--------------------------------------
AppendPath ldx #0
.1 lda (pPath)
@ -807,14 +800,7 @@ Sleep2 stz CIFS.Retries
sec
rts
*--------------------------------------
Exit.KO pha
jsr Exit.OK
pla
clc
rts
*--------------------------------------
Exit.OK lda hResp
>SYSCALL2 FreeMem
Exit.OK jsr FreeRespData
stz CIFS.Status
* clc

View File

@ -5,11 +5,7 @@ NEW
* address $FFCB (ROM rts opcode) for rom switching to function.
* $FF9B
*--------------------------------------
IRQ pha
phx
phy
ldx #$FA save 6 bytes of page 0
IRQ ldx #$FA save 6 bytes of page 0
.2 lda $00,x
sta IRQ.ZPSave-$FA,x
@ -67,9 +63,6 @@ IRQ.Done ldx #$FA
* lda IRQ.DoneCn+2
* sta mslot
ply
plx
pla
rti
*--------------------------------------
IRQ.GoX jmp (inttbl,x) interrupt routine x

View File

@ -17,7 +17,6 @@ IAC.BUF.MAX .EQ 32
ZS.START
ZPPtr1 .BS 2
TimeOut .BS 1
hErr .BS 1
ArgIndex .BS 1
ArgDev .BS 1
ArgProg .BS 1
@ -39,7 +38,7 @@ CS.START cld
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #32 Stack Size
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
@ -78,18 +77,17 @@ CS.RUN ldy #S.PS.ARGC
beq .1 valid option, check next arg
ldx ArgIndex
lda ArgDev
bne .2
lda ArgIndex
sta ArgDev
stx ArgDev
bra .1
.2 lda ArgProg
bne .9
lda ArgIndex
sta ArgProg
stx ArgProg
bra .1
.9 >PUSHW L.MSG.USAGE
@ -99,17 +97,12 @@ CS.RUN ldy #S.PS.ARGC
sec
.99 rts
.8 lda ArgDev
.8 lda ArgProg
beq .9
lda ArgProg
beq .9
ldy #S.PS.hStdErr
lda (pPS),y
sta hErr
lda ArgDev
beq .9
>SYSCALL ArgV
>PUSHYA
>PUSHBI O.RDWR
@ -119,13 +112,14 @@ CS.RUN ldy #S.PS.ARGC
>SYSCALL FOpen
bcs .99
sta hFILE
ldy #S.PS.hStdIn
sta (pPS),y
iny #S.PS.hStdOut
sta (pPS),y
iny #S.PS.hStdErr
sta (pPS),y
sta hFILE
CS.RUN.LOOP0 >SLEEP

View File

@ -5,7 +5,7 @@ NEW
.OR $2000
.TF sbin/initd
*--------------------------------------
INITDDBG .EQ 0
INITDDBG .EQ 1
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
@ -64,8 +64,6 @@ CS.RUN ldy #S.PS.PID
cmp #1
bne .9
* bra .55
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
@ -80,7 +78,6 @@ CS.RUN ldy #S.PS.PID
cmp #18 CTRL-R for Root mode
bne .1
*.55
>LDYA L.MSG.CTRLR
>SYSCALL PutS
@ -144,6 +141,7 @@ CS.RUN.ETCINIT >LDYAI 256
jsr CS.RUN.ERRMSG
.FIN
jsr .81
pla
sec
rts

View File

@ -46,7 +46,7 @@ CS.START cld
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #32 Stack Size
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
@ -87,7 +87,6 @@ CS.RUN >LDYA L.ETCISSUE
*--------------------------------------
CS.RUN.EXECPS >LDYA L.ETCMOTD
jsr CS.RUN.DumpFile
jsr CS.CLEANUP
>PUSHW L.SHELL
>PUSHBI S.PS.F.HOLD
@ -317,13 +316,10 @@ CS.RUN.DumpFile >PUSHYA
>SYSCALL FClose
rts
*--------------------------------------
CS.DOEVENT
sec
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT
CS.CLEANUP
.8 clc
CS.QUIT clc
rts
*--------------------------------------
CS.END

View File

@ -347,24 +347,6 @@ DEV.MkFD stx .8+1
DEV.MkFD.Y .DA #S.FD.REG,#S.FD.DIR,#S.FD.PIPE
DEV.MkFD.T .DA #S.FD.T.REG,#S.FD.T.DIR,#S.FD.T.PIPE
*--------------------------------------
DEV.Destroy ldx IO.hDevNod
lda Nod.Table.hName-2,x
beq .1
stz Nod.Table.hName-2,x
jsr K.FreeMem
ldx IO.hDevNod
.1 lda Nod.Table.hFD-2,x
beq .8
stz Nod.Table.hFD-2,x
jmp K.FreeMem
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.dev
LOAD usr/src/sys/kernel.s

View File

@ -71,8 +71,7 @@ FS.OPEN.REG >MLICALL MLIGETFILEINFO
bcc .8
.99 pha Save Error Code
lda IO.hFD
jsr K.Close
jsr FS.CLOSE.REG
pla
sec
@ -103,8 +102,7 @@ FS.OPEN.DIR ldx #1
bcc .9
.98 pha Save Error Code
lda IO.hFD
jsr K.Close
jsr FS.CLOSE.DIR
pla
sec
rts

View File

@ -131,6 +131,7 @@ Kernel.Init3 sta SETALTZP
sta SETIOUDIS
sta SETDHIRES
bmi .10
sta CLRIOUDIS
.10 jsr MemMgrInit

View File

@ -338,10 +338,9 @@ PS.Load ldy #$ff
.6 lda K.S.STAT+S.STAT.P.TYPE
cmp #S.FI.T.BIN
bne .7
jmp PS.LoadBIN
beq .8
.7 cmp #S.FI.T.TXT
cmp #S.FI.T.TXT
beq PS.Load.SCRIPT
cmp #S.FI.T.SYS
@ -359,9 +358,9 @@ PS.Load ldy #$ff
>LDYAI PS.SHUTDOWN
jsr PS.Find.PATH
bcs PS.RTS
bcs .99
jmp PS.LoadBIN
.8 jmp PS.LoadBIN
*--------------------------------------
PS.Load.IPATH lda #E.BADPATH
.HS 2C

View File

@ -387,6 +387,24 @@ K.FClose jsr PFT.CheckNodeA
bcs K.FRead.RTS
jmp UNISTD.Close
*--------------------------------------
DEV.Destroy ldx IO.hDevNod
lda Nod.Table.hName-2,x
beq .1
stz Nod.Table.hName-2,x
jsr K.FreeMem
ldx IO.hDevNod
.1 lda Nod.Table.hFD-2,x
beq .8
stz Nod.Table.hFD-2,x
jmp K.FreeMem
.8 clc
rts
*/--------------------------------------
* # FRead (BLOCKING)
* Read bytes from file