mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-03 12:06:05 +00:00
216 lines
3.8 KiB
Plaintext
216 lines
3.8 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF 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 #S.PS.F.EVENT S.PS.F
|
||
.DA #0
|
||
.DA CS.END-CS.START CS
|
||
.DA DS.END-DS.START DS
|
||
.DA #64 SS
|
||
.DA #2 ZP SS
|
||
.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 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN lda #0
|
||
ldy #hUSERNAME
|
||
sta (pData),y
|
||
ldy #hPASSWORD
|
||
sta (pData),y
|
||
|
||
>PUSHBI 0
|
||
>LDYA L.MSG.LOGIN
|
||
>SYSCALL printf
|
||
bcs .9
|
||
|
||
lda #0 Echo all caracters
|
||
jsr INPUT.RESET
|
||
|
||
.1 >SLEEP
|
||
>SYSCALL GetChar
|
||
bcc .11
|
||
tax
|
||
beq .1 no char
|
||
bra .9
|
||
|
||
.11 jsr INPUT.CHARIN
|
||
jsr INPUT.LINEIN
|
||
bcc .1
|
||
|
||
>PUSHBI 0
|
||
>LDYA L.MSG.PASSWORD
|
||
>SYSCALL printf
|
||
bcs .9
|
||
|
||
lda #'*'
|
||
jsr INPUT.RESET
|
||
|
||
.2 >SLEEP
|
||
>SYSCALL GetChar
|
||
bcc .22
|
||
tax
|
||
beq .2 no char
|
||
bra .9
|
||
|
||
.22 jsr INPUT.CHARIN
|
||
jsr INPUT.LINEIN
|
||
bcc .2
|
||
|
||
lda #13
|
||
>SYSCALL PutChar
|
||
bcs .9
|
||
lda #10
|
||
>SYSCALL PutChar
|
||
bcs .9
|
||
|
||
>LDYA L.SHELL
|
||
>SYSCALL ExpandStr
|
||
bcs .9
|
||
|
||
phx
|
||
>SYSCALL ExecPS
|
||
|
||
plx
|
||
|
||
php
|
||
pha
|
||
txa
|
||
>SYSCALL FreeMem
|
||
pla
|
||
plp
|
||
|
||
.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 PutChar
|
||
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 .AZ "\r\nlogin:"
|
||
MSG.PASSWORD .AZ "\r\npassword:"
|
||
SHELL .AZ "${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 /A2OSX.SRC/SBIN/LOGIN.S
|
||
ASM
|