Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-02-20 16:07:43 +00:00
parent 1dfc2bf03e
commit 4efc6c0860
17 changed files with 248 additions and 200 deletions

View File

@ -303,7 +303,7 @@ REG File created on ProDOS : T=TXT,X=$0000
`lda fd` `lda fd`
`>SYSCALL close` `>SYSCALL close`
# read # read (BLOCKING)
## C ## C
`int read(hFD fd, void *buf, int count);` `int read(hFD fd, void *buf, int count);`
@ -319,7 +319,7 @@ REG File created on ProDOS : T=TXT,X=$0000
CC: Y,A = bytes read CC: Y,A = bytes read
CS: A = EC CS: A = EC
# write # write (BLOCKING)
## C ## C
`int write(hFD fd, const void *buf, int count);` `int write(hFD fd, const void *buf, int count);`
@ -665,12 +665,10 @@ A = hFILE
return a hFILE to a new FIFO return a hFILE to a new FIFO
## C ## C
`hFILE mkfifo(const char *pathname, int mode);` `hFILE mkfifo();`
## ASM ## ASM
**In:** **In:**
`>PUSHW mode`
`>LDYA pathname`
`>SYSCALL mkfifo` `>SYSCALL mkfifo`
## RETURN VALUE ## RETURN VALUE
@ -689,7 +687,7 @@ A = hFILE
CC = OK, CS = ERROR CC = OK, CS = ERROR
A = hFD A = hFD
# PutChar # putchar (BLOCKING)
Print A (char) to StdOut Print A (char) to StdOut
## C ## C
@ -703,7 +701,7 @@ Print A (char) to StdOut
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# FPutC # fputc (BLOCKING)
Print A (char) to hFILE Print A (char) to hFILE
## C ## C
@ -718,7 +716,7 @@ Print A (char) to hFILE
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# PutS # puts (BLOCKING)
Write Str to StdOut, appends '\r\n' Write Str to StdOut, appends '\r\n'
## C ## C
@ -732,7 +730,7 @@ Write Str to StdOut, appends '\r\n'
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# FPutS # fputs (BLOCKING)
Write Str to FILE Write Str to FILE
## C ## C
@ -747,7 +745,11 @@ Write Str to FILE
## RETURN VALUE ## RETURN VALUE
CC = success CC = success
# PrintF/SPrintF/FPrintF # PrintF (BLOCKING)
# FPrintF (BLOCKING)
# SPrintF
Prints C-Style String Prints C-Style String
## C ## C
@ -818,7 +820,7 @@ Modifiers for len and padding :
+ %2f : '3.14' + %2f : '3.14'
# FGetS # fgets (BLOCKING)
read bytes from stream into the array read bytes from stream into the array
pointed to by s, until n-1 bytes are read, or a <newline> is read and pointed to by s, until n-1 bytes are read, or a <newline> is read and
transferred to s, or an end-of-file condition is encountered. The transferred to s, or an end-of-file condition is encountered. The
@ -838,7 +840,7 @@ string is then terminated with a null byte.
Y,A: s Y,A: s
CC = success CC = success
# GetChar # getchar (BLOCKING)
Get char from StdIn Get char from StdIn
## C ## C
@ -852,7 +854,7 @@ Get char from StdIn
CC = success CC = success
A = char A = char
# GetC # getc (BLOCKING)
Get char from Node Get char from Node
## C ## C
@ -941,7 +943,7 @@ int fclose ( hFILE stream );
## RETURN VALUE ## RETURN VALUE
# FRead # FRead (BLOCKING)
Read bytes from file Read bytes from file
## C ## C
@ -957,7 +959,7 @@ int fread (hFILE stream, void * ptr, int count );
## RETURN VALUE ## RETURN VALUE
Y,A = Bytes Read Y,A = Bytes Read
# FWrite # FWrite (BLOCKING)
Write bytes to file Write bytes to file
## C ## C

View File

@ -97,7 +97,9 @@ CS.INIT
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN >SYSCALL GetChar CS.RUN bra .11
>SYSCALL GetChar
bcs .10 no char bcs .10 no char
cmp #$03 Ctrl-C cmp #$03 Ctrl-C
@ -114,7 +116,7 @@ CS.RUN >SYSCALL GetChar
.10 >LDA.G bPause .10 >LDA.G bPause
bne .8 Pause... bne .8 Pause...
>LDA.G hFILE .11 >LDA.G hFILE
bne .2 bne .2
.1 >INC.G ArgIndex .1 >INC.G ArgIndex

View File

@ -108,9 +108,8 @@ CS.RUN >PUSHBI 0
>SYSCALL printf Send Query for term W & H >SYSCALL printf Send Query for term W & H
bcs CS.RUN.RTS bcs CS.RUN.RTS
.1 >SLEEP .1 >SYSCALL GetChar
>SYSCALL GetChar bcs CS.RUN.RTS
bcs .1
jsr CharIn jsr CharIn
@ -139,15 +138,10 @@ CS.RUN >PUSHBI 0
>STA.G bSaved >STA.G bSaved
jsr SCRN.Init jsr SCRN.Init
bcs CS.RUN.RTS .9 bcs CS.RUN.RTS
CS.RUN.LOOP >SLEEP CS.RUN.LOOP >SYSCALL GetChar
>SYSCALL GetChar bcs CS.RUN.RTS I/O eror
bcc .1
tay
beq CS.RUN.LOOP no char
bra .9 I/O eror
.1 jsr CharIn .1 jsr CharIn
@ -159,7 +153,7 @@ CS.RUN.LOOP >SLEEP
>SYSCALL printf >SYSCALL printf
lda #0 lda #0
.9 sec sec
CS.RUN.RTS rts CS.RUN.RTS rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT sec CS.DOEVENT sec

View File

@ -102,7 +102,7 @@ CS.RUN
jsr InitSrcDirYA jsr InitSrcDirYA
bcs .9 bcs .9
*-------------------------------------- *--------------------------------------
CS.RUN.LOOP >SLEEP CS.RUN.LOOP bra .2
>SYSCALL GetChar >SYSCALL GetChar
bcs .2 no char bcs .2 no char

View File

@ -63,33 +63,18 @@ CS.RUN >LEA.G MemStat
>LDYAI Mem.Table+S.MEM >LDYAI Mem.Table+S.MEM
>STYA ZPPTR1 >STYA ZPPTR1
CS.RUN.LOOP >SLEEP
>SYSCALL GetChar
bcs .13
cmp #3 Ctrl-C ?
beq .9
cmp #19 Ctrl-S ?
bne .12
>LDA.G bSTOP
eor #$ff
sta (pData),y
bra .13
.12 >STZ.G bSTOP
.13 >LDA.G bSTOP
bne CS.RUN.LOOP
>LDA.G LINE.COUNT
bne .1
>LDYA L.MSG0 >LDYA L.MSG0
>SYSCALL puts >SYSCALL puts
CS.RUN.LOOP >LDA.G bSTOP
beq .1
>SYSCALL GetChar
cmp #3 Ctrl-C ?
beq CS.RUN.LOOP.RTS
>STZ.G bSTOP
.1 lda (ZPPTR1) .1 lda (ZPPTR1)
bpl .2 bpl .2
@ -111,11 +96,11 @@ CS.RUN.LOOP >SLEEP
bra CS.RUN.LOOP bra CS.RUN.LOOP
.9 sec sec
rts CS.RUN.LOOP.RTS rts
CS.RUN.FOOTER >SYSCALL GetChar CS.RUN.FOOTER >SYSCALL GetChar
bcs CS.RUN.FOOTER bcs CS.RUN.LOOP.RTS
>PUSHB.G MEM.COUNT >PUSHB.G MEM.COUNT
>PUSHB.G USED.COUNT >PUSHB.G USED.COUNT

View File

@ -229,7 +229,7 @@ CS.RUN.GETC >LDA.G hFILE
rts rts
.1 >SYSCALL GetChar .1 >SYSCALL GetChar
.2 rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.GETLINE >PUSHWI 256 CS.RUN.GETLINE >PUSHWI 256
>PUSHW ZPBufPtr >PUSHW ZPBufPtr
@ -269,10 +269,7 @@ CS.RUN.GETLINE >PUSHWI 256
.8 sta (ZPBufPtr),y .8 sta (ZPBufPtr),y
clc clc
rts .9 rts
.9 >DEBUG
rts
*-------------------------------------- *--------------------------------------
CS.RUN.PRINT >LDA.G bLineNum CS.RUN.PRINT >LDA.G bLineNum
bpl .1 bpl .1

View File

@ -389,6 +389,14 @@ CMD.ECHO stz ZPPtr1 echo -N
CMD.GETKEY lda (ZPArgVBufPtr) CMD.GETKEY lda (ZPArgVBufPtr)
beq .99 beq .99
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
bcs .9
tay
beq .1
>SYSCALL getchar >SYSCALL getchar
bcs .9 bcs .9

View File

@ -223,21 +223,22 @@ CS.RUN jsr CL.Init
*-------------------------------------- *--------------------------------------
CS.RUN.LOOP CS.RUN.LOOP
.1 jsr CheckSleep .1
beq .3 * jsr CheckSleep
* beq .3
>SYSCALL GetChar * >SYSCALL GetChar
bcs .9 I/O err * bcs .9 I/O err
cmp #3 Ctrl-C * cmp #3 Ctrl-C
bne .1 * bne .1
>LDA.G bBatchMode batch mode ? * >LDA.G bBatchMode batch mode ?
beq .1 * beq .1
>LDA.G bSET.C * >LDA.G bSET.C
beq .8 * beq .8
bra .1 * bra .1
.3 >LDA.G bPause .3 >LDA.G bPause
bpl .6 bpl .6
@ -359,22 +360,23 @@ CS.RUN.READ jsr CL.RESET
.8 jmp CS.RUN.LOOP.END .8 jmp CS.RUN.LOOP.END
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.BATCH >SYSCALL GetChar CS.RUN.BATCH
bcs .2 * >SYSCALL GetChar
* bcs .2
cmp #3 test Ctrl-c * cmp #3 test Ctrl-c
bne .1 * bne .1
* sec * sec
.9 rts *.9 rts
.1 cmp #19 test Ctrl-s *.1 cmp #19 test Ctrl-s
bne .2 * bne .2
lda #$80 * lda #$80
>STA.G bPause * >STA.G bPause
clc * clc
jmp CS.RUN.LOOP.END * jmp CS.RUN.LOOP.END
.2 >LDA.G bSET.X .2 >LDA.G bSET.X
beq .5 beq .5
@ -393,7 +395,7 @@ CS.RUN.BATCH >SYSCALL GetChar
>PUSHBI 2 >PUSHBI 2
>LDYA L.MSG.TRACE >LDYA L.MSG.TRACE
>SYSCALL printf >SYSCALL printf
bcs .9 bcs CS.RUN.LOOP.RTS
.5 jsr CORE.Run .5 jsr CORE.Run
bcc CS.RUN.LOOP.END bcc CS.RUN.LOOP.END

View File

@ -354,6 +354,8 @@ S.IOCTL.STATCODE.STATUS .EQ 0
S.IOCTL.STATCODE.GETDCB .EQ 1 S.IOCTL.STATCODE.GETDCB .EQ 1
S.IOCTL.STATCODE.GETNL .EQ 2 S.IOCTL.STATCODE.GETNL .EQ 2
S.IOCTL.STATCODE.GETDIB .EQ 3 S.IOCTL.STATCODE.GETDIB .EQ 3
S.IOCTL.STATCODE.GETRC .EQ 4
S.IOCTL.STATCODE.GETWC .EQ 5
S.IOCTL.CTRLCODE .EQ 4 1 BYTE S.IOCTL.CTRLCODE .EQ 4 1 BYTE
S.IOCTL.CTRLCODE.RESET .EQ 0 S.IOCTL.CTRLCODE.RESET .EQ 0
S.IOCTL.CTRLCODE.SETDCB .EQ 1 S.IOCTL.CTRLCODE.SETDCB .EQ 1

View File

@ -117,14 +117,7 @@ CS.RUN.LOOP0 >LDYA L.ENV.TERM
ldy #S.PS.hStdOut ldy #S.PS.hStdOut
lda (pPs),y lda (pPs),y
>SYSCALL fwrite >SYSCALL fwrite
bcc .2 sent! bcs .9 I/O error
tay
bne CS.RUN.9 error ?
>SLEEP
bra .1 no data sent, loop
.2 >LDA.G ArgDev .2 >LDA.G ArgDev
>SYSCALL ArgV >SYSCALL ArgV
@ -134,14 +127,21 @@ CS.RUN.LOOP0 >LDYA L.ENV.TERM
>LDYA L.MSG.GREETINGS >LDYA L.MSG.GREETINGS
>SYSCALL printf >SYSCALL printf
bcs CS.RUN.9 unable to send greetings...reset.. .9 bcs CS.RUN.9 unable to send greetings...reset..
jsr Init.Timeout jsr Init.Timeout
CS.RUN.LOOP1 >SLEEP CS.RUN.LOOP1 ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
bcs CS.RUN.9
tay
beq .1
>SYSCALL GetChar >SYSCALL GetChar
bcs .1 bcs CS.RUN.9
cmp #IAC cmp #IAC
beq CS.RUN.IACMODE beq CS.RUN.IACMODE
@ -171,16 +171,14 @@ CS.RUN.LOOP1 >SLEEP
sec sec
CS.RUN.9 rts CS.RUN.9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.IACMODE >SLEEP Wait for IAC CMD (or SB) CS.RUN.IACMODE >SYSCALL GetChar Wait for IAC CMD (or SB)
>SYSCALL GetChar bcs CS.RUN.9
bcs CS.RUN.IACMODE
>STA.G IAC.CMD >STA.G IAC.CMD
.1 >SLEEP Wait for IAC SUBCMD >SYSCALL GetChar Wait for IAC SUBCMD
>SYSCALL GetChar bcs CS.RUN.9
bcs .1
>STA.G IAC.SUBCMD >STA.G IAC.SUBCMD
tax tax
@ -210,18 +208,15 @@ CS.RUN.IAC.CMD cmp #WILL
.8 jmp CS.RUN.LOOP1 .8 jmp CS.RUN.LOOP1
*-------------------------------------- *--------------------------------------
CS.RUN.IAC.SB CS.RUN.IAC.SB >SYSCALL GetChar Wait for IAC SB.IS or SEND
.1 >SLEEP Wait for IAC SB.IS or SEND bcs .9
>SYSCALL GetChar
bcs .1
>STA.G IAC.SB.CMD >STA.G IAC.SB.CMD
>STZ.G IAC.SB.LEN >STZ.G IAC.SB.LEN
.2 >SLEEP .2 >SYSCALL GetChar
>SYSCALL GetChar bcs .9
bcs .2
cmp #IAC cmp #IAC
beq .4 end of DATA, go wait SE beq .4 end of DATA, go wait SE
@ -242,9 +237,8 @@ CS.RUN.IAC.SB
>INC.G IAC.SB.LEN >INC.G IAC.SB.LEN
bra .2 bra .2
.4 >SLEEP .4 >SYSCALL GetChar
>SYSCALL GetChar bcs .9
bcs .4
cmp #SE cmp #SE
bne .8 bne .8
@ -262,6 +256,7 @@ CS.RUN.IAC.SB
>SYSCALL SetEnv >SYSCALL SetEnv
.8 jmp CS.RUN.LOOP1 .8 jmp CS.RUN.LOOP1
.9 rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT lda (pEvent) CS.DOEVENT lda (pEvent)
bpl .9 is it a TIMER event? bpl .9 is it a TIMER event?

View File

@ -97,9 +97,8 @@ CS.RUN.REPaint >PUSHBI 0
>LDYA ZPCfgPtr >LDYA ZPCfgPtr
jsr CS.RUN.DumpConfYA jsr CS.RUN.DumpConfYA
CS.RUN.Loop >SLEEP CS.RUN.Loop >SYSCALL GetChar
>SYSCALL GetChar bcs .99
bcs CS.RUN.Loop
cmp #17 Ctrl-Q cmp #17 Ctrl-Q
beq .8 beq .8
@ -114,6 +113,7 @@ CS.RUN.Loop >SLEEP
>LDYA L.MSG.QUIT.ERR >LDYA L.MSG.QUIT.ERR
bra .9 bra .9
.99 rts
.1 cmp #20 Ctrl-T .1 cmp #20 Ctrl-T
bne .2 bne .2

View File

@ -16,7 +16,7 @@ ZPPTR1 .BS 2
ZS.END ZS.END
.ED .ED
*-------------------------------------- *--------------------------------------
INPUT.BufPtr.SIZE .EQ 16 INPUT.BUF.SIZE .EQ 16
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -64,14 +64,10 @@ CS.RUN >STZ.G hUSERNAME
lda #0 Echo all caracters lda #0 Echo all caracters
jsr INPUT.RESET jsr INPUT.RESET
.1 >SLEEP .1 >SYSCALL GetChar
>SYSCALL GetChar bcs .9
bcc .11
tax
beq .1 no char
bra .9
.11 jsr INPUT.CHARIN jsr INPUT.CHARIN
jsr INPUT.LINEIN jsr INPUT.LINEIN
bcc .1 bcc .1
@ -83,14 +79,10 @@ CS.RUN >STZ.G hUSERNAME
lda #'*' lda #'*'
jsr INPUT.RESET jsr INPUT.RESET
.2 >SLEEP .2 >SYSCALL GetChar
>SYSCALL GetChar bcs .9
bcc .22
tax
beq .2 no char
.9 rts
.22 jsr INPUT.CHARIN jsr INPUT.CHARIN
jsr INPUT.LINEIN jsr INPUT.LINEIN
bcc .2 bcc .2
@ -105,7 +97,7 @@ CS.RUN >STZ.G hUSERNAME
>PUSHBI S.PS.F.HOLD+S.PS.F.DUPENV >PUSHBI S.PS.F.HOLD+S.PS.F.DUPENV
>LDYA L.SHELL >LDYA L.SHELL
>SYSCALL ExecL >SYSCALL ExecL
rts .9 rts
*-------------------------------------- *--------------------------------------
CS.RUN.SETENV >PUSHW L.HOME CS.RUN.SETENV >PUSHW L.HOME
>LDYA L.ENV.HOME >LDYA L.ENV.HOME
@ -157,7 +149,7 @@ INPUT.CHARIN tax save char...
lda (ZPPTR1) lda (ZPPTR1)
cmp #INPUT.BufPtr.SIZE Buffer full? cmp #INPUT.BUF.SIZE Buffer full?
beq .9 beq .9
inc inc
@ -231,7 +223,7 @@ HOME .AZ "${ROOT}ROOT/"
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START
INPUT.BufPtr .BS INPUT.BufPtr.SIZE+1 INPUT.BUF .BS INPUT.BUF.SIZE+1
INPUT.Status .BS 1 INPUT.Status .BS 1
INPUT.PassChar .BS 1 INPUT.PassChar .BS 1
INPUT.PrevCR .BS 1 INPUT.PrevCR .BS 1

View File

@ -89,14 +89,14 @@ IO.Open.I ldx #5 $/DEV/
.DA IO.OPEN.DSOCK .DA IO.OPEN.DSOCK
.DA IO.OPEN.SSOCK .DA IO.OPEN.SSOCK
.DA IO.OPEN.PIPE .DA IO.OPEN.PIPE
IO.OPEN.9 sec
IO.OPEN.RTS rts IO.OPEN.RTS rts
*-------------------------------------- *--------------------------------------
IO.OPEN.REG >MLICALL MLIGETFILEINFO IO.OPEN.REG >MLICALL MLIGETFILEINFO
bcc IO.OPEN.REG.E Already Exists bcc IO.OPEN.REG.E Already Exists
bit K.Open.FLAGS Create if not exists ? bit K.Open.FLAGS Create if not exists ?
bpl IO.OPEN.9 No, return MLI error bpl IO.OPEN.RTS No, return MLI error
ldx #2 Yes, Create... ldx #2 Yes, Create...
@ -275,7 +275,7 @@ IO.CLOSE.NOD ldx #0
bne .1 bne .1
rts rts
*/-------------------------------------- */--------------------------------------
* # read * # read (BLOCKING)
* ## C * ## C
* `int read(hFD fd, void *buf, int count);` * `int read(hFD fd, void *buf, int count);`
* ## ASM * ## ASM
@ -305,7 +305,7 @@ IO.Read.I lda (pFD) #S.FD.T
.DA IO.READ.SSOCK .DA IO.READ.SSOCK
.DA IO.READ.PIPE .DA IO.READ.PIPE
*/-------------------------------------- */--------------------------------------
* # write * # write (BLOCKING)
* ## C * ## C
* `int write(hFD fd, const void *buf, int count);` * `int write(hFD fd, const void *buf, int count);`
* ## ASM * ## ASM
@ -560,6 +560,40 @@ IO.MLIOPEN >LDYAI 1024 get a ProDOS IOBUF
* clc * clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
IO.EOF tax
jmp (.1,x)
.1 .DA STDIO.IOERR REG
.DA STDIO.IOERR DIR
.DA IO.EOF.CDEV
.DA STDIO.IOERR BDEV
.DA STDIO.IOERR LNK
.DA STDIO.IOERR DSOCK
.DA IO.EOF.SSOCK
.DA IO.EOF.PIPE
*--------------------------------------
IO.EOF.CDEV >LDYAI K.IOBuf
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
jsr K.IOCTL.GetPDrv
lda #S.IOCTL.STATCODE.GETRC
jsr K.GetDevStatus.I
bcs .9
lda K.IOBuf
ora K.IOBuf+1
.9 rts
*--------------------------------------
IO.EOF.SSOCK
*--------------------------------------
IO.EOF.PIPE
lda #MLI.E.IO
sec
rts
*--------------------------------------
IO.DEVDIR >PSTR "/DEV/" IO.DEVDIR >PSTR "/DEV/"
*-------------------------------------- *--------------------------------------
MAN MAN

View File

@ -13,7 +13,7 @@ K.PrintF.PadC .EQ FAC+5
BCDBUF .EQ ARG BCDBUF .EQ ARG
HEXBUF.Signed .EQ ARG.SIGN HEXBUF.Signed .EQ ARG.SIGN
*/-------------------------------------- */--------------------------------------
* # PutChar * # putchar (BLOCKING)
* Print A (char) to StdOut * Print A (char) to StdOut
* ## C * ## C
* `int putchar ( int character );` * `int putchar ( int character );`
@ -29,7 +29,7 @@ K.PutChar >PUSHA
ldy #S.PS.hStdOut ldy #S.PS.hStdOut
lda (pPs),y lda (pPs),y
*/-------------------------------------- */--------------------------------------
* # FPutC * # fputc (BLOCKING)
* Print A (char) to hFILE * Print A (char) to hFILE
* ## C * ## C
* `int fputc ( hFILE stream , int character );` * `int fputc ( hFILE stream , int character );`
@ -55,7 +55,7 @@ K.FPutC.Y lda #0
jmp IO.Write.I jmp IO.Write.I
K.FPutC.9 >RET 1 K.FPutC.9 >RET 1
*/-------------------------------------- */--------------------------------------
* # PutS * # puts (BLOCKING)
* Write Str to StdOut, appends '\r\n' * Write Str to StdOut, appends '\r\n'
* ## C * ## C
* `int puts ( const char * str );` * `int puts ( const char * str );`
@ -84,7 +84,7 @@ K.PutS >PUSHYA
K.PutS.RTS rts K.PutS.RTS rts
*/-------------------------------------- */--------------------------------------
* # FPutS * # fputs (BLOCKING)
* Write Str to FILE * Write Str to FILE
* ## C * ## C
* `int fputs (hFILE stream, const char * str );` * `int fputs (hFILE stream, const char * str );`
@ -107,7 +107,9 @@ K.FPutS jsr PFT.CheckNodeA set IO.hFD
jmp IO.Write.I jmp IO.Write.I
.9 >RET 2 .9 >RET 2
*/-------------------------------------- */--------------------------------------
* # PrintF/SPrintF/FPrintF * # PrintF (BLOCKING)
* # FPrintF (BLOCKING)
* # SPrintF
* Prints C-Style String * Prints C-Style String
* ## C * ## C
* `int printf ( const char * format, ... );` * `int printf ( const char * format, ... );`
@ -709,7 +711,7 @@ PrintF.Flush.hFILE
lda #$ff SELF MODIFIED lda #$ff SELF MODIFIED
jmp K.FWrite jmp K.FWrite
*/-------------------------------------- */--------------------------------------
* # FGetS * # fgets (BLOCKING)
* read bytes from stream into the array * read bytes from stream into the array
* pointed to by s, until n-1 bytes are read, or a <newline> is read and * pointed to by s, until n-1 bytes are read, or a <newline> is read and
* transferred to s, or an end-of-file condition is encountered. The * transferred to s, or an end-of-file condition is encountered. The
@ -765,7 +767,7 @@ K.FGetS jsr PFT.CheckNodeA
.99 rts .99 rts
K.FGetS.RET4 >RET 4 K.FGetS.RET4 >RET 4
*/-------------------------------------- */--------------------------------------
* # GetChar * # getchar (BLOCKING)
* Get char from StdIn * Get char from StdIn
* ## C * ## C
* `int getchar ();` * `int getchar ();`
@ -779,7 +781,7 @@ K.FGetS.RET4 >RET 4
K.GetChar ldy #S.PS.hStdIn K.GetChar ldy #S.PS.hStdIn
lda (pPs),y lda (pPs),y
*/-------------------------------------- */--------------------------------------
* # GetC * # getc (BLOCKING)
* Get char from Node * Get char from Node
* ## C * ## C
* `int getc ( hFILE stream );` * `int getc ( hFILE stream );`
@ -1048,7 +1050,7 @@ K.FClose jsr PFT.CheckNodeA
.9 rts .9 rts
*/-------------------------------------- */--------------------------------------
* # FRead * # FRead (BLOCKING)
* Read bytes from file * Read bytes from file
* ## C * ## C
* int fread (hFILE stream, void * ptr, int count ); * int fread (hFILE stream, void * ptr, int count );
@ -1066,7 +1068,7 @@ K.FRead jsr PFT.CheckNodeA
jmp IO.Read.I jmp IO.Read.I
*/-------------------------------------- */--------------------------------------
* # FWrite * # FWrite (BLOCKING)
* Write bytes to file * Write bytes to file
* ## C * ## C
* `int fwrite (hFILE stream, const void * ptr, int count );` * `int fwrite (hFILE stream, const void * ptr, int count );`
@ -1192,7 +1194,12 @@ K.FEOF.MARK .BS 3
K.FEOF jsr PFT.CheckNodeA K.FEOF jsr PFT.CheckNodeA
bcs .9 bcs .9
>MLICALL MLIGETMARK lda (pFD)
beq .10
jmp IO.EOF
.10 >MLICALL MLIGETMARK
bcs .9 bcs .9
ldy #2 ldy #2

View File

@ -43,7 +43,7 @@ DRV.TERM.STATUS jsr DRV.TERM.GetIOCTLBufCntDCB
beq .1 beq .1
cmp #S.IOCTL.STATCODE.GETDIB cmp #S.IOCTL.STATCODE.GETDIB
bne .9 bne .3
ldy #S.DIB-1 ldy #S.DIB-1
.HS 2C bit abs .HS 2C bit abs
@ -60,7 +60,34 @@ DRV.TERM.STATUS jsr DRV.TERM.GetIOCTLBufCntDCB
clc clc
rts rts
.3 cmp #S.IOCTL.STATCODE.GETRC
bne .9
ldy #S.DCB.TTY.OUTTAIL
lda (ZPDCBPtr),y
iny
sbc (ZPDCBPtr),y OUTHEAD
and #$F
bit bActive
bpl .8
bit OPENAPPLE
bmi .8
bit KBD
bpl .8
inc
.8 sta (ZPBufPtr)
ldy #1
lda #0
sta (ZPBufPtr),y
clc
rts
.9 lda #MLI.E.BADCTL .9 lda #MLI.E.BADCTL
sec sec
rts rts
@ -1219,55 +1246,6 @@ RESET.VALUES .DA #0 S.DCB.TTY.MODE
SCR.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0 SCR.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
SCR.BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07 SCR.BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
*-------------------------------------- *--------------------------------------
BUF.BASEL .DA #0
.DA #80
.DA #160
.DA #240
.DA #320
.DA #400
.DA #480
.DA #560
.DA #640
.DA #720
.DA #800
.DA #880
.DA #960
.DA #1040
.DA #1120
.DA #1200
.DA #1280
.DA #1360
.DA #1440
.DA #1520
.DA #1600
.DA #1680
.DA #1760
.DA #1840
BUF.BASEH .DA /0
.DA /80
.DA /160
.DA /240
.DA /320
.DA /400
.DA /480
.DA /560
.DA /640
.DA /720
.DA /800
.DA /880
.DA /960
.DA /1040
.DA /1120
.DA /1200
.DA /1280
.DA /1360
.DA /1440
.DA /1520
.DA /1600
.DA /1680
.DA /1760
.DA /1840
*--------------------------------------
CtrlChars .HS 05080A0C0D151B CtrlChars .HS 05080A0C0D151B
CtrlChars.Cnt .EQ *-CtrlChars CtrlChars.Cnt .EQ *-CtrlChars
*-------------------------------------- *--------------------------------------

View File

@ -226,6 +226,55 @@ GetCharAtCurPos ldy #S.DCB.TTY.CV
rts rts
*-------------------------------------- *--------------------------------------
BUF.BASEL .DA #0
.DA #80
.DA #160
.DA #240
.DA #320
.DA #400
.DA #480
.DA #560
.DA #640
.DA #720
.DA #800
.DA #880
.DA #960
.DA #1040
.DA #1120
.DA #1200
.DA #1280
.DA #1360
.DA #1440
.DA #1520
.DA #1600
.DA #1680
.DA #1760
.DA #1840
BUF.BASEH .DA /0
.DA /80
.DA /160
.DA /240
.DA /320
.DA /400
.DA /480
.DA /560
.DA /640
.DA /720
.DA /800
.DA /880
.DA /960
.DA /1040
.DA /1120
.DA /1200
.DA /1280
.DA /1360
.DA /1440
.DA /1520
.DA /1600
.DA /1680
.DA /1760
.DA /1840
*--------------------------------------
MAN MAN
SAVE USR/SRC/SYS/KERNEL.S.TERMLC SAVE USR/SRC/SYS/KERNEL.S.TERMLC
LOAD USR/SRC/SYS/KERNEL.S LOAD USR/SRC/SYS/KERNEL.S

View File

@ -453,6 +453,7 @@ K.StrFTime jsr MEM.SPtr1PPtr2
.8 lda #0 Terminate C string .8 lda #0 Terminate C string
sta (ZPPtr1) sta (ZPPtr1)
clc
rts rts
*-------------------------------------- *--------------------------------------
K.StrFTime.TBL .AS "aAbBdHImMpSwyY" K.StrFTime.TBL .AS "aAbBdHImMpSwyY"