NEW AUTO 3,1 *-------------------------------------- X.PWD jmp (.1-SYS.GetPWUID,x) .1 .DA PWD.GetPWUID .DA PWD.GetPWName .DA PWD.PutPW *-------------------------------------- * ZPPtr1 : UID / pName * ZPPtr2 : pPW * ZPPtr3 : pDB * USERNAME:PASSWORD:UID:GID:GECOS:HOME:SHELL\CR * ....\CR * \0 *-------------------------------------- PWD.GetPWUID lda PWD.hDB beq .9 jsr K.GetmemPtr >STYA ZPPtr3 .1 lda (ZPPtr3) beq .99 ldy #0 .2 lda (ZPPtr3),y iny cmp #':' bne .2 .3 lda (ZPPtr3),y iny cmp #':' bne .3 jsr PWD.GetByte cmp ZPPtr1+1 beq .8 .4 iny lda (ZPPtr3),y cmp #C.CR bne .4 tya sec adc ZPPtr3 sta ZPPtr3 bcc .1 inc ZPPtr3+1 bra .1 .8 jmp PWD.Record2PM .9 lda #E.IPWDDB sec rts .99 lda #E.IUSR sec rts *-------------------------------------- PWD.GetPWName lda PWD.hDB beq .9 jsr K.GetmemPtr >STYA ZPPtr3 .1 lda (ZPPtr3) beq .99 ldy #$ff .2 iny lda (ZPPtr1),y beq .4 cmp (ZPPtr3),y beq .2 .3 iny lda (ZPPtr3),y cmp #C.CR bne .3 tya sec adc ZPPtr3 sta ZPPtr3 bcc .1 inc ZPPtr3+1 bra .1 .4 lda (ZPPtr3),y cmp #':' bne .3 jmp PWD.Record2PM .9 lda #E.IPWDDB sec rts .99 lda #E.IUSR sec rts *-------------------------------------- PWD.PutPW >LDYA ZPPtr2 >STYA TXTPTR lda PWD.hDB bne .1 ldy #S.PW.UID jsr MEM.TXTPTR.GetY bne .9 Must be ROOT user jmp PWD.InitDB .1 .9 lda #E.IPWDDB sec rts *-------------------------------------- PWD.InitDB jsr PWD.GetRecordLen >STYA PWD.DBSize jsr K.getmem bcs .9 >STYA ZPPtr3 >STYA PWD.DBPtr stx PWD.hDB jsr PWD.StoreRecord inc PWD.bDirty clc .9 rts *-------------------------------------- PWD.Record2PM ldy #0 ldx #0 NAME .1 lda (ZPPtr3),y iny cmp #':' beq .2 jsr MEM.PutCharPtr2 inx bra .1 .2 lda #0 jsr MEM.PutCharPtr2 inx cpx #S.PW.PASSWD bne .2 .3 lda (ZPPtr3),y iny cmp #':' beq .4 jsr MEM.PutCharPtr2 inx bra .3 .4 lda #0 jsr MEM.PutCharPtr2 inx cpx #S.PW.UID bne .4 jsr PWD.GetByte UID jsr MEM.PutCharPtr2 jsr PWD.GetByte GID jsr MEM.PutCharPtr2 ldx #S.PW.GECOS .5 lda (ZPPtr3),y iny cmp #':' beq .6 jsr MEM.PutCharPtr2 inx bra .5 .6 lda #0 jsr MEM.PutCharPtr2 inx cpx #S.PW.DIR bne .6 .7 lda (ZPPtr3),y iny cmp #':' beq .8 jsr MEM.PutCharPtr2 inx bra .7 .8 lda #0 jsr MEM.PutCharPtr2 inx cpx #S.PW.SHELL bne .8 .9 lda (ZPPtr3),y iny cmp #C.CR beq .10 jsr MEM.PutCharPtr2 inx bra .9 .10 lda #0 jsr MEM.PutCharPtr2 clc rts *-------------------------------------- PWD.GetByte stz .8+1 .1 lda (ZPPtr3),y iny cmp #':' beq .8 and #$f pha lda .8+1 asl asl clc adc .8+1 asl sta .8+1 pla clc adc .8+1 sta .8+1 bra .1 .8 lda #$ff rts *-------------------------------------- PWD.StoreRecord sec .HS 90 BCC *-------------------------------------- PWD.GetRecordLen clc ldx #0 ldy #S.PW.NAME-1 jsr PWD.StoreString lda #':' jsr PWD.StoreChar ldy #S.PW.PASSWD-1 jsr PWD.StoreString lda #':' jsr PWD.StoreChar ldy #S.PW.UID jsr MEM.TXTPTR.GetY jsr PWD.StoreByte lda #':' jsr PWD.StoreChar iny S.PW.UID jsr MEM.TXTPTR.GetY jsr PWD.StoreByte lda #':' jsr PWD.StoreChar * iny S.PW.GECOS jsr PWD.StoreString lda #':' jsr PWD.StoreChar ldy #S.PW.DIR-1 jsr PWD.StoreString lda #':' jsr PWD.StoreChar ldy #S.PW.SHELL-1 jsr PWD.StoreString lda #C.CR jsr PWD.StoreChar txa tay lda #0 rts *-------------------------------------- PWD.StoreString iny jsr MEM.TXTPTR.GetY beq .8 jsr PWD.StoreChar bra PWD.StoreString .8 rts *-------------------------------------- PWD.StoreByte php phx stz .2+1 stz .3+1 ldx #8 sed .1 asl pha .2 lda #$ff Self Modified adc .2+1 sta .2+1 .3 lda #$ff Self Modified adc .3+1 sta .3+1 pla dex bne .1 cld plx plp lda .3+1 beq .4 jsr PWD.StoreChar30 .4 lda .2+1 beq PWD.StoreChar30 php lsr lsr lsr lsr plp and #$0f plp corrupt Z beq .5 jsr PWD.StoreChar30 .5 lda .2+1 and #$0f *-------------------------------------- PWD.StoreChar30 ora #$30 PWD.StoreChar inx bcc .9 Dry run, no store sta (ZPPtr3) inc ZPPtr3 bne .9 inc ZPPtr3+1 .9 rts *-------------------------------------- MAN SAVE USR/SRC/SYS/KERNEL.S.PWDX LOAD USR/SRC/SYS/KERNEL.S ASM