mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-15 04:29:35 +00:00
205 lines
3.8 KiB
Plaintext
205 lines
3.8 KiB
Plaintext
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
|
||
>SYSCALL GetC
|
||
bcs .1 no char
|
||
jsr INPUT.CHARIN
|
||
jsr INPUT.LINEIN
|
||
bcc .1
|
||
|
||
>LDYA L.MSG.PASSWORD
|
||
>SYSCALL CPrintFYA
|
||
bcs .9
|
||
|
||
lda #'*'
|
||
jsr INPUT.RESET
|
||
|
||
.2 >SYSCALL Sleep
|
||
>SYSCALL GetC
|
||
bcs .2 no char
|
||
jsr INPUT.CHARIN
|
||
jsr INPUT.LINEIN
|
||
bcc .2
|
||
|
||
lda #13
|
||
>SYSCALL PutCA
|
||
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
|
||
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 save 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 PutCA
|
||
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
|