A2osX/SBIN/LOGIN.S.txt
2015-12-12 11:13:14 +01:00

229 lines
4.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/SBIN/LOGIN
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
*--------------------------------------
INPUT.BufPtr.SIZE .EQ 16
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length To Relocate
.DA DS.END-DS.START Data Segment to Allocate
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.LOGIN .DA MSG.LOGIN
L.MSG.PASSWORD .DA MSG.PASSWORD
L.SHELL .DA SHELL
.DA 0
*--------------------------------------
CS.INIT >LDYA L.SHELL
>SYSCALL SYS.NewPStrYA
bcs .9
ldy #hSHELL
sta (pData),y
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc Tell TskMgr To stay in memory
.9 rts
*--------------------------------------
CS.RUN lda #0
ldy #hUSERNAME
sta (pData),y
ldy #hPASSWORD
sta (pData),y
lda #13
>SYSCALL SYS.COutA
bcs .9
>LDYA L.MSG.LOGIN
>SYSCALL SYS.PSTROutYA
bcs .9
lda #0 Echo all caracters
jsr INPUT.RESET
.1 >SYSCALL SYS.Sleep
jsr INPUT.LINEIN
bcc .1
lda #13
>SYSCALL SYS.COutA
bcs .9
>LDYA L.MSG.PASSWORD
>SYSCALL SYS.PSTROutYA
lda #'*'
jsr INPUT.RESET
.2 >SYSCALL SYS.Sleep
jsr INPUT.LINEIN
bcc .2
lda #13
>SYSCALL SYS.COutA
bcs .9
ldy #hSHELL
lda (pData),y
ldy #0
>SYSCALL SYS.ExecProcessNewEnvYA
bcs .9
.8 clc
rts
.9 sec
rts
*--------------------------------------
CS.DOEVENT ldy #S.EVT.hDEV
lda (pEvent),y
ldy #S.PS.hINDEV
cmp (pPs),y
bne .99
lda (pEvent)
and #S.EVT.F.KEY
beq .99
ldy #S.EVT.DATAHI
lda (pEvent),y
bne .99
ldy #S.EVT.DATALO
lda (pEvent),y
jsr INPUT.CHARIN
clc
rts
.99 sec
rts
*--------------------------------------
CS.QUIT ldy #hSHELL
lda (pData),y
>SYSCALL SYS.FreeMemA
clc
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
INPUT.RESET ldy #INPUT.PassChar
sta (pData),y
lda #0
ldy #INPUT.BufPtr
sta (pData),y
ldy #INPUT.Status
sta (pData),y
rts
*--------------------------------------
INPUT.CHARIN tax saver char...
ldy #INPUT.Status
lda (pData),y
bmi .9
lda #INPUT.BufPtr
clc
adc pData
sta ZPPTR1
lda pData+1
adc /INPUT.BufPtr
sta ZPPTR1+1
cpx #$20 Control Char?
bcc .2
lda (ZPPTR1)
cmp #INPUT.BufPtr.SIZE Buffer full?
beq .9
inc
sta (ZPPTR1)
tay
txa
sta (ZPPTR1),y
ldy #INPUT.PassChar
lda (pData),y
bne .1
txa
.1 >SYSCALL SYS.COutA
rts
.2 cpx #13 CR
bne .3
ldy #INPUT.Status
lda (pData),y
bne .9
inc
sta (pData),y
rts
.3 cpx #10 LF
bne .4
ldy #INPUT.Status
lda (pData),y
beq .31
lda #$80
sta (pData),y
rts
.31
.4
.9 rts
*--------------------------------------
INPUT.LINEIN ldy #INPUT.Status
lda (pData),y
asl CS if a line is in the buffer
rts
*--------------------------------------
CS.END
MSG.LOGIN >PSTRING "login:"
MSG.PASSWORD >PSTRING "password:"
SHELL >PSTRING "SBIN/SHELL"
.DUMMY
.OR 0
DS.START
INPUT.BufPtr .BS INPUT.BufPtr.SIZE+1
INPUT.Status .BS 1
INPUT.PassChar .BS 1
hUSERNAME .BS 1
hPASSWORD .BS 1
hSHELL .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE SBIN/LOGIN.S
ASM