A2osX/SBIN/LOGIN.S.txt

218 lines
4.0 KiB
Plaintext
Raw Permalink 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 /A2OSX.DEV/INC/MACROS.I
.INB /A2OSX.DEV/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 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
>LDYA L.MSG.LOGIN
>SYSCALL CPrintFYA
bcs .9
lda #0 Echo all caracters
jsr INPUT.RESET
.1 >SYSCALL Sleep
jsr INPUT.LINEIN
bcc .1
>LDYA L.MSG.PASSWORD
>SYSCALL CPrintFYA
bcs .9
lda #'*'
jsr INPUT.RESET
.2 >SYSCALL Sleep
jsr INPUT.LINEIN
bcc .2
lda #13
>SYSCALL COutA
bcs .9
>LDYA L.SHELL
>SYSCALL ExpandPStrYA
bcs .9
stx .3+1
>SYSCALL ExecProcessNewEnvYA
php
pha
.3 lda #$ff Self Modified
>SYSCALL FreeMemA
pla
plp
rts
.8 clc
.9 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 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 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 >CSTR "\nlogin:"
MSG.PASSWORD >CSTR "\npassword:"
SHELL >PSTR "${A2OSX}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
DS.END
.ED
*--------------------------------------
MAN
SAVE SBIN/LOGIN.S
ASM