A2osX/SBIN/LOGIN.S.txt

237 lines
4.4 KiB
Plaintext
Raw Normal View History

2015-06-03 18:30:57 +00:00
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
.INB INC/A2OSX.API.I
*--------------------------------------
INPUT.BUFFER.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
jsr CROUT
jsr CROUT
>LDYA L.MSG.LOGIN
jsr PRINT.MSG
lda #0 Echo all caracters
jsr INPUT.RESET
.1 jsr A2osX.Sleep
jsr INPUT.LINEIN
bcc .1
jsr CROUT
>LDYA L.MSG.PASSWORD
jsr PRINT.MSG
lda #'*'
jsr INPUT.RESET
.2 jsr A2osX.Sleep
jsr INPUT.LINEIN
bcc .2
jsr CROUT
ldy #hSHELL
lda (pData),y
>SYSCALL SYS.ExecProcessA
bcc .8
jsr PRBYTE
.8 clc
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.STATUS
sta (pData),y
lda #0
ldy #INPUT.BUFFER
sta (pData),y
rts
*--------------------------------------
INPUT.CHARIN tax saver char...
ldy #INPUT.STATUS
lda (pData),y
bmi .9
lda #INPUT.BUFFER
clc
adc pData
sta ZPQuickPtr1
lda pData+1
adc /INPUT.BUFFER
sta ZPQuickPtr1+1
cpx #$20 Control Char?
bcc .2
lda (ZPQuickPtr1)
cmp #INPUT.BUFFER.SIZE Buffer full?
beq .9
inc
sta (ZPQuickPtr1)
tay
txa
sta (ZPQuickPtr1),y
ldy #INPUT.STATUS
lda (pData),y
bne .1
txa
.1 jmp COUT
.2 cpx #$0D
bne .9
ldy #INPUT.STATUS
lda #$80
sta (pData),y
.9 rts
*--------------------------------------
INPUT.LINEIN ldy #INPUT.STATUS
lda (pData),y
asl CS is a line is in the buffer
rts
ldy #INPUT.BUFFER
lda (pData),y get Line Length
bne .9 if 0, empty line
clc
.9 rts
*--------------------------------------
PRINT.MSG >STYA ZPQuickPtr1
ldy #0
.1 lda (ZPQuickPtr1),y
beq .2
jsr COUT
iny
bne .1
.2 rts
*--------------------------------------
PRBYTE pha
lsr
lsr
lsr
lsr
ora #$30
cmp #$3A
bcc .1
adc #6
.1 jsr COUT
pla
and #$0F
ora #$30
cmp #$3A
bcc COUT
adc #6
bra COUT
*--------------------------------------
CROUT lda #13
*--------------------------------------
COUT phx
phy
ldx #DEVMGR.COUT
jsr pDevJmp
ply
plx
rts
pDevJmp jmp (pDev)
CS.END
*--------------------------------------
MSG.LOGIN >CSTRING "login:"
MSG.PASSWORD >CSTRING "password:"
SHELL >PSTRING "SHELL"
*--------------------------------------
.DUMMY
.OR 0
DS.START
INPUT.BUFFER .BS INPUT.BUFFER.SIZE+1
INPUT.STATUS .BS 1
hUSERNAME .BS 1
hPASSWORD .BS 1
hSHELL .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE SBIN/LOGIN.S
ASM