Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-03-12 14:41:55 +00:00
parent 67c26ef904
commit 54e563f0c7
13 changed files with 436 additions and 39 deletions

Binary file not shown.

View File

@ -56,7 +56,7 @@ Y,A = Ptr to installed driver
## RETURN VALUE
CC = OK, CS = ERROR
Y,A = FD
X = DevID
X = hDev
# GetDevStatus
@ -605,6 +605,41 @@ A = Child PSID
## RETURN VALUE
A = Child PSID
# GetPWUID
## C
`int getpwuid(short int uid, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`lda uid`
`>SYSCALL getpwuid`
## RETURN VALUE
# GetPWName
## C
`int getpwname(const char* name, S.PW* passwd );`
## ASM
`>PUSHW passwd`
`>LDYA name`
`>SYSCALL getpwname`
## RETURN VALUE
# PutPW
## C
`int putpw( S.PW* passwd );`
## ASM
`>LDYA passwd`
`>SYSCALL putpw`
## RETURN VALUE
# GetMemStat
**In:**
Y,A = Ptr to 24 bytes buffer

View File

@ -157,7 +157,7 @@ Close socket
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.read`
`>LIBCALL hLIBTCPIP,LIBTCPIP.read`
## RETURN VALUE
CC: Y,A = bytes read
@ -173,7 +173,7 @@ CS: A = EC
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.write`
`>LIBCALL hLIBTCPIP,LIBTCPIP.write`
## RETURN VALUE
CC: Y,A = bytes written
@ -191,7 +191,7 @@ CS: A = EC
**In:**
`>PUSHW addr` (RecvFrom)
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.Recv`
`>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
## RETURN VALUE
CC: A = hMem
@ -211,7 +211,7 @@ CS: A = EC
`>PUSHWI count`
`>PUSHW buf`
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.skt.send`
`>LIBCALL hLIBTCPIP,LIBTCPIP.send`
## RETURN VALUE
CC: Y,A = bytes written

Binary file not shown.

279
BIN/CUT.S.txt Normal file
View File

@ -0,0 +1,279 @@
NEW
PREFIX
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/CUT
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/MLI.I
.INB INC/MLI.E.I
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZPBufPtr .BS 2
ArgCount .BS 1
ArgIndex .BS 1
OptionIdx .BS 1
hBuf .BS 1
FieldNum .BS 1
StartChar .BS 1
EndChar .BS 1
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 SegmentSize
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.CRLF .DA MSG.CRLF
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN stz ArgCount
.10 inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .8
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
beq .1
lda ArgCount
sta ArgIndex
bra .10
.1 ldy #1
lda (ZPPtr1),y
ldx OptionList
.2 cmp OptionList,x
beq .3
dex
bne .2
bra .97
.3 txa
lsr
beq .98 HELP
sta OptionIdx
inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .97
>SYSCALL atoi
bcs .97
tax
bne .97
tya
ldx OptionIdx
sta FieldNum-1,x
bra .10 scan for any other args
.97 lda #E.SYN
.98 pha
>PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
pla
sec
.9 rts
.8 >LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPBufPtr
stx hBuf
lda ArgIndex
beq .80
>SYSCALL ArgV
>PUSHYA
>LDYA ZPBufPtr
>SYSCALL strcpy
bra CS.RUN.OUT
.80 ldy #S.PS.hStdIn
lda (pPS),y
tax
lda OF.Table.hFD-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
>PUSHWI 256
>PUSHW ZPBufPtr
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL fgets
bcc CS.RUN.OUT
cmp #MLI.E.EOF
bne .9
CS.RUN.OUT lda FieldNum
beq CS.RUN.OUT.MN
ldy #$ff
.1 iny skip spaces
lda (ZPBufPtr),y
beq CS.RUN.PRINTCR
cmp #C.SPACE
beq .1
dec FieldNum
beq .4
.2 iny skip token
lda (ZPBufPtr),y
beq CS.RUN.PRINTCR
eor #C.SPACE
bne .2
bra .1
.4 jsr CS.RUN.AddYToBufPtr
ldy #$ff
.6 iny
lda (ZPBufPtr),y
beq .8
eor #C.SPACE
bne .6
sta (ZPBufPtr),y
.8 >LDYA ZPBufPtr
>SYSCALL puts
lda #0 Exit with no Error
sec
rts
*--------------------------------------
CS.RUN.PRINTCR >PUSHBI 0
>LDYA L.MSG.CRLF
>SYSCALL printf
bcs .9
lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.OUT.MN ldy #$ff
ldx StartChar
beq .2
.1 iny
lda (ZPBufPtr),y
beq CS.RUN.PRINTCR
dex
bne .1
.2 ldx EndChar
beq .8
.3 iny
lda (ZPBufPtr),y
beq .8
cpy EndChar
bne .3
lda #0
sta (ZPBufPtr),y
.8 ldy StartChar
jsr CS.RUN.AddYToBufPtr
>LDYA ZPBufPtr
>SYSCALL puts
lda #0 Exit with no Error
sec
rts
*--------------------------------------
CS.RUN.AddYToBufPtr
tya
clc
adc ZPBufPtr
sta ZPBufPtr
bcc .8
lda ZPBufPtr+1
.8 rts
*--------------------------------------
CS.QUIT lda hBuf
beq .8
>SYSCALL FreeMem
.8 clc
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "HhFfMmNn"
*--------------------------------------
MSG.USAGE .AS "Usage : CUT "line of text"\r\n"
.AS " -H : This help screen\r\n"
.AS "-F nn : Output field nn, sep=SPACE\r\n"
.AS "-M nn : Output starting at nn\r\n"
.AS "-N nn : Output Ending at nn"
MSG.CRLF .AZ "\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/CUT.S
ASM

View File

@ -237,10 +237,10 @@ CS.RUN.PRINT.DIR
bmi .4
>LDA.G bColumn
bpl .22
bmi .23
>LDA.G bFullPath
bpl .23
bpl .22
>PUSHBI 0
ldy #hSrcBasePath
@ -250,14 +250,27 @@ CS.RUN.PRINT.DIR
.23 >LDYA ZPFileName
>SYSCALL puts
rts
bcs .9
>LDA.G bRecurse
bpl .8
lda (ZPFileName)
cmp #'.'
beq .8
>LDYA ZPFileName
jmp EnterSubDirYA
.8 clc
.9 rts
.22 >PUSHW ZPFileName
>PUSHBI 2
>LDYA L.MSG.DIR
>SYSCALL printf
bcs .99
bcs .9
ldy #0
@ -289,26 +302,25 @@ CS.RUN.PRINT.DIR
>LDYA L.MSG.DIREXT
>SYSCALL printf
.99 bcs .9
bcs .90
.5 ldy #bRecurse
lda (pData),y
bpl .8
.5 >LDA.G bRecurse
bpl .80
lda (ZPFileName)
cmp #'.'
beq .8
beq .80
jsr CS.RUN.NewLine
bcs .9
bcs .90
>LDYA ZPFileName
jsr EnterSubDirYA
bcs .9
bcs .90
jmp CS.RUN.ENTER.MSG
.8 clc
.9 rts
.80 clc
.90 rts
*--------------------------------------
CS.RUN.PRINT.FILE
ldy #bLong
@ -316,10 +328,10 @@ CS.RUN.PRINT.FILE
bmi .1
>LDA.G bColumn
bpl .22
bmi .23
>LDA.G bFullPath
bpl .23
bpl .22
>PUSHBI 0
ldy #hSrcBasePath

View File

@ -8,6 +8,7 @@ AUTO 4,1
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/MLI.I
.INB INC/MLI.E.I
*--------------------------------------
@ -96,11 +97,25 @@ CS.RUN
.7 >LDA.G bHelp
beq .8
jsr .99
.71 jsr .99
lda #0
rts
.8 >LDYAI 256
.8 >LDA.G hFile
bne .80
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda OF.Table.hFD-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .71
.80 >LDYAI 256
>SYSCALL GetMem
bcs .9
@ -281,10 +296,10 @@ MSG.USAGE .AS "Usage : MORE <File>\r\n"
.AS " -H : This help screen\r\n"
.AS " -N : Number all output lines\r\n"
.AS " -P : Page mode, no scroll\r\n"
.AZ " -S : Process ESC codes\r\n"
.AS " -S : Process ESC codes"
MSG.CRLF .AZ "\r\n"
MSG.Init .AZ "\e[7l"
MSG.NUMLINE .AZ "%5D:"
MSG.CRLF .AZ "\r\n"
MSG.Pause .AZ "\r\e[7m --- 'SPACE' for more, 'CR' one line, 'Q/q' to quit --- \e[0m"
MSG.PauseErase .AZ "\r\e[2K"
*--------------------------------------

View File

@ -105,6 +105,7 @@ E.IBIN .EQ $F6 Invalid BIN format
E.FTB .EQ $F5 File Too Big Error
E.OOB .EQ $F4 Out Of Bound
E.INUM .EQ $F3 Invalid Numerical
E.IUSR .EQ $F2 Invalid User
*--------------------------------------
* A2osX.SYSCALL Constants
*--------------------------------------
@ -239,9 +240,9 @@ SYS.ExecV .EQ $A2
* .EQ $A4
SYS.Kill .EQ $A6
* .EQ $A8
* .EQ $AA
* .EQ $AC
SYS.GetPWUID .EQ $A8
SYS.GetPWName .EQ $AA
SYS.PutPW .EQ $AC
* .EQ $AE
SYS.Args2ArgV .EQ $B0

View File

@ -38,6 +38,7 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.NOPASSWD .DA MSG.NOPASSWD
L.MSG.LOGIN .DA MSG.LOGIN
L.MSG.PASSWORD .DA MSG.PASSWORD
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
@ -51,10 +52,18 @@ L.HOME .DA HOME
CS.INIT clc
rts
*--------------------------------------
CS.RUN >STZ.G hUSERNAME
>STA.G hPASSWORD
>STA.G INPUT.PrevCR
CS.RUN >PUSHEA.G PW
lda #0
>SYSCALL GetPWUID
bcc .10
>PUSHBI 0
>LDYA L.MSG.NOPASSWD
>SYSCALL printf
bcs .9
bra .8
.10 >STZ.G INPUT.PrevCR
>PUSHBI 0
>LDYA L.MSG.LOGIN
@ -91,7 +100,7 @@ CS.RUN >STZ.G hUSERNAME
>SYSCALL printf
bcs .9
jsr CS.RUN.SETENV
.8 jsr CS.RUN.SETENV
bcs .9
>PUSHBI S.PS.F.HOLD+S.PS.F.DUPENV
@ -210,6 +219,8 @@ INPUT.LINEIN ldy #INPUT.Status
rts
*--------------------------------------
CS.END
MSG.NOPASSWD .AS "\r\nA2osX-LOGIN:No ETC/PASSWD file present, Logged as ROOT.\r\n"
.AZ "Consider adding ROOT password with USERADD command.\r\n\r\n"
MSG.LOGIN .AZ "\r\nlogin:"
MSG.PASSWORD .AZ "\r\npassword:"
MSG.ECHOCRLF .AZ "\r\n"
@ -227,8 +238,7 @@ INPUT.BUF .BS INPUT.BUF.SIZE+1
INPUT.Status .BS 1
INPUT.PassChar .BS 1
INPUT.PrevCR .BS 1
hUSERNAME .BS 1
hPASSWORD .BS 1
PW .BS S.PW
DS.END
.ED
*--------------------------------------

View File

@ -102,9 +102,9 @@ K.SYSCALL.JMP .DA K.GetMemStat $00
.DA K.ExecV
.DA 0
.DA K.Kill
.DA 0
.DA 0
.DA 0
.DA K.GetPWUID
.DA K.GetPWName
.DA K.PutPW
.DA 0
.DA K.Args2ArgV $B0

44
SYS/KERNEL.S.PWD.txt Normal file
View File

@ -0,0 +1,44 @@
NEW
PREFIX
AUTO 4,1
*/--------------------------------------
* # GetPWUID
* ## C
* `int getpwuid(short int uid, S.PW* passwd );`
* ## ASM
* `>PUSHW passwd`
* `lda uid`
* `>SYSCALL getpwuid`
* ## RETURN VALUE
*\--------------------------------------
K.GetPWUID
*/--------------------------------------
* # GetPWName
* ## C
* `int getpwname(const char* name, S.PW* passwd );`
* ## ASM
* `>PUSHW passwd`
* `>LDYA name`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
K.GetPWName jsr MEM.SPtr1PPtr2
sec
rts
*/--------------------------------------
* # PutPW
* ## C
* `int putpw( S.PW* passwd );`
* ## ASM
* `>LDYA passwd`
* `>SYSCALL putpw`
* ## RETURN VALUE
*\--------------------------------------
K.PutPW >PULLW ZPPtr1
sec
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.PWD
LOAD USR/SRC/SYS/KERNEL.S
ASM

View File

@ -54,6 +54,7 @@ A2osX.D2 .PH $D000
.INB USR/SRC/SYS/KERNEL.S.TIME
.INB USR/SRC/SYS/KERNEL.S.BIN
.INB USR/SRC/SYS/KERNEL.S.PS
.INB USR/SRC/SYS/KERNEL.S.PWD
.INB USR/SRC/SYS/KERNEL.S.ARG
.INB USR/SRC/SYS/KERNEL.S.ENV
.INB USR/SRC/SYS/KERNEL.S.MATH

View File

@ -147,7 +147,7 @@ note : '$VAR' does NOT expand Variable
| | | -1 : SIGQUIT | |
| LS | Working | -A : Print . & .. | 0.92 |
| | | -C : Single column listing | |
| | | -F : with -C, includes full path | |
| | | -F : Single column, includes full path | |
| | | -L : long listing with size/date... | |
| | | -R : Recurse subdirectories | |
| LSDEV | Working | Dump device Drivers | 0.92 |