Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-04-29 07:59:01 +02:00
parent 7e9bc637b1
commit 30e70ae0b5
3 changed files with 207 additions and 3 deletions

Binary file not shown.

View File

@ -0,0 +1,197 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/USERDEL
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPhPW .BS 1
ZPPWPtr .BS 2
ZPhStr .BS 1
ZPStrPtr .BS 2
ArgIndex .BS 1
ArgUsername .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 Segment Size
.DA #64 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.INV .DA MSG.INV
.DA 0
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
CS.RUN >LDYAI S.PW
>SYSCALL getmem
bcs .99
>STYA ZPPWPtr
stx ZPhPW
>LDYAI 256
>SYSCALL getmem
bcs .99
>STYA ZPStrPtr
stx ZPhStr
jsr CS.RUN.CheckArg
bcs .99
>PUSHW ZPPWPtr
lda ArgUsername
>SYSCALL ArgV
>SYSCALL GetPWName
bcs .90
ldy #S.PW.PASSWD
lda #0
sta (ZPPWPtr),y
>LDYA ZPPWPtr
>SYSCALL putpw
bcs .99
jsr CS.RUN.RmDir
bcs .99
lda #0
sec
rts
.9 >PUSHBI 0
>LDYA L.MSG.INV
>SYSCALL printf
lda #E.IUSR
sec
rts
.90 lda #E.IPWDDB
sec
.99 rts
*--------------------------------------
CS.RUN.CheckArg inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .8
>STYA ZPStrPtr
lda (ZPStrPtr)
cmp #'-'
bne .4
ldy #1
lda (ZPStrPtr),y
ldx OptionList
.2 cmp OptionList,x
beq .3
dex
bne .2
.9 >PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
lda #E.SYN
sec
rts
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra CS.RUN.CheckArg
.4 ldx ArgUsername
bne .9
sta ArgUsername
bra CS.RUN.CheckArg
.8 lda ArgUsername
beq .9
clc
rts
*--------------------------------------
CS.RUN.RmDir clc
rts
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
* Called once, when RUN exited with CS
* Put code for unloading LIB here
*--------------------------------------
CS.QUIT lda ZPhStr
beq .8
>SYSCALL freemem
.1 lda ZPhPW
beq .8
>SYSCALL freemem
.8 clc
rts
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "Rr"
OptionVars .DA #bDelete,#bDelete
*--------------------------------------
* Initialized DATA
*--------------------------------------
MSG.USAGE .AS "Usage : USERDEL username\r\n"
.AZ " -r : Force remove files in home directory\r\n"
MSG.INV .AZ "Invalid username.\r\n"
*--------------------------------------
* Per Process DATA segment
*--------------------------------------
.DUMMY
.OR 0
DS.START
bDelete .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/USERDEL.S
ASM

View File

@ -63,7 +63,7 @@ PWD.GetPWName lda PWD.hDB
ldy #0
jsr MEM.TXTPTR.GetY
beq .99
* >DEBUG
.1 lda (ZPPtr3)
beq .99
@ -123,7 +123,13 @@ PWD.PutPW >LDYA ZPPtr2
.1 jsr K.GetmemPtr
>STYA PWD.DBPtr
jsr PWD.DeleteRecord
ldy #S.PW.PASSWD
jsr MEM.TXTPTR.GetY
bne .12
jmp PWD.DeleteRecord
.12 jsr PWD.DeleteRecord
bcc .11 user exits..
jsr PWD.GetUID new user, get UID
@ -290,7 +296,8 @@ PWD.FindRecord >LDYA PWD.DBPtr
.8 clc
rts
.9 sec
.9 lda #E.IUSR
sec
rts
*--------------------------------------
PWD.NextLine iny