A2osX/SBIN/LOGIN.S.txt

246 lines
4.5 KiB
Plaintext
Raw Normal View History

2015-06-03 18:30:57 +00:00
NEW
2018-11-17 17:17:13 +00:00
PREFIX
AUTO 4,1
2015-06-03 18:30:57 +00:00
.LIST OFF
.OP 65C02
.OR $2000
2018-07-20 05:43:11 +00:00
.TF SBIN/LOGIN
2015-06-03 18:30:57 +00:00
*--------------------------------------
2018-07-20 05:43:11 +00:00
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
2018-12-18 14:37:07 +00:00
.DUMMY
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZS.END
.ED
2015-06-03 18:30:57 +00:00
*--------------------------------------
INPUT.BufPtr.SIZE .EQ 16
2015-06-03 18:30:57 +00:00
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
2018-09-19 15:25:42 +00:00
.DA #S.PS.F.EVENT S.PS.F
.DA #0
2018-12-18 14:37:07 +00:00
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
2015-06-03 18:30:57 +00:00
.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
2018-12-04 13:20:35 +00:00
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.ECHODEL .DA MSG.ECHODEL
2018-11-23 16:20:19 +00:00
L.ENV.SHELL .DA ENV.SHELL
2015-06-03 18:30:57 +00:00
L.SHELL .DA SHELL
2018-11-23 16:20:19 +00:00
L.ENV.HOME .DA ENV.HOME
L.HOME .DA HOME
2015-06-03 18:30:57 +00:00
.DA 0
*--------------------------------------
2018-09-19 15:25:42 +00:00
CS.INIT clc
rts
2015-06-03 18:30:57 +00:00
*--------------------------------------
2018-12-04 13:20:35 +00:00
CS.RUN >STZ.G hUSERNAME
>STA.G hPASSWORD
>STA.G INPUT.PrevCR
2018-08-22 15:23:27 +00:00
>PUSHBI 0
2015-06-03 18:30:57 +00:00
>LDYA L.MSG.LOGIN
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2015-06-03 18:30:57 +00:00
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
2015-06-03 18:30:57 +00:00
jsr INPUT.LINEIN
bcc .1
2018-08-22 15:23:27 +00:00
>PUSHBI 0
2015-06-03 18:30:57 +00:00
>LDYA L.MSG.PASSWORD
2018-06-21 15:12:10 +00:00
>SYSCALL printf
bcs .9
2015-06-03 18:30:57 +00:00
lda #'*'
jsr INPUT.RESET
.2 >SLEEP
>SYSCALL GetChar
bcc .22
tax
beq .2 no char
2018-10-15 06:25:40 +00:00
.9 rts
.22 jsr INPUT.CHARIN
2015-06-03 18:30:57 +00:00
jsr INPUT.LINEIN
bcc .2
2018-12-04 13:20:35 +00:00
>PUSHBI 0
>LDYA L.MSG.ECHOCRLF
>SYSCALL printf
bcs .9
2018-12-04 13:20:35 +00:00
2018-11-23 16:20:19 +00:00
jsr CS.RUN.SETENV
bcs .9
2018-12-04 13:20:35 +00:00
2018-10-15 06:25:40 +00:00
>PUSHBI S.PS.F.HOLD
2016-08-17 06:25:58 +00:00
>LDYA L.SHELL
2018-10-25 15:31:41 +00:00
>SYSCALL ExecL
2018-10-15 06:25:40 +00:00
rts
2015-06-03 18:30:57 +00:00
*--------------------------------------
2018-11-23 21:36:31 +00:00
CS.RUN.SETENV >PUSHW L.HOME
>LDYA L.ENV.HOME
2018-11-23 16:20:19 +00:00
>SYSCALL setenv
bcs .9
2018-11-23 21:36:31 +00:00
>PUSHW L.SHELL
>LDYA L.ENV.SHELL
2018-11-23 16:20:19 +00:00
>SYSCALL setenv
bcs .9
.9 rts
*--------------------------------------
2017-01-12 17:43:45 +00:00
CS.DOEVENT
sec
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
2016-08-17 06:25:58 +00:00
CS.QUIT clc
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
2018-12-04 13:20:35 +00:00
INPUT.RESET >STA.G INPUT.PassChar
>STZ.G INPUT.BufPtr
>STA.G INPUT.Status
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
2017-01-12 17:43:45 +00:00
INPUT.CHARIN tax save char...
2018-12-04 13:20:35 +00:00
>LDA.G INPUT.Status
2015-06-03 18:30:57 +00:00
bmi .9
lda #INPUT.BufPtr
2015-06-03 18:30:57 +00:00
clc
adc pData
sta ZPPTR1
2015-06-03 18:30:57 +00:00
lda pData+1
adc /INPUT.BufPtr
sta ZPPTR1+1
2015-06-03 18:30:57 +00:00
cpx #$20 Control Char?
bcc .2
2018-12-04 13:20:35 +00:00
cpx #C.DEL
beq INPUT.CHARIN.DEL
lda (ZPPTR1)
2015-06-03 18:30:57 +00:00
cmp #INPUT.BufPtr.SIZE Buffer full?
2015-06-03 18:30:57 +00:00
beq .9
inc
sta (ZPPTR1)
2015-06-03 18:30:57 +00:00
tay
txa
sta (ZPPTR1),y
2015-06-03 18:30:57 +00:00
2018-12-04 13:20:35 +00:00
>LDA.G INPUT.PassChar
2015-06-03 18:30:57 +00:00
bne .1
2018-12-04 13:20:35 +00:00
2015-06-03 18:30:57 +00:00
txa
2018-12-04 13:20:35 +00:00
2018-07-18 15:30:42 +00:00
.1 >SYSCALL PutChar
2018-12-04 13:20:35 +00:00
bcs .9
>STZ.G INPUT.PrevCR
rts
2015-06-03 18:30:57 +00:00
2018-12-04 13:20:35 +00:00
.2 cpx #C.CR
bne .3
2018-12-04 13:20:35 +00:00
txa
>STA.G INPUT.PrevCR
2018-12-04 13:20:35 +00:00
lda #$80
>STA.G INPUT.Status
rts
2018-12-04 13:20:35 +00:00
.3 cpx #C.LF
bne .4
2018-12-04 13:20:35 +00:00
>LDA.G INPUT.PrevCR
beq .1
.4 >STZ.G INPUT.PrevCR
2015-06-03 18:30:57 +00:00
.9 rts
*--------------------------------------
2018-12-04 13:20:35 +00:00
INPUT.CHARIN.DEL
lda (ZPPTR1)
beq .8
dec
sta (ZPPTR1)
>PUSHBI 0
>LDYA L.MSG.ECHODEL
>SYSCALL printf
.8 clc
rts
*--------------------------------------
INPUT.LINEIN ldy #INPUT.Status
2015-06-03 18:30:57 +00:00
lda (pData),y
asl CS if a line is in the buffer
2015-06-03 18:30:57 +00:00
rts
*--------------------------------------
CS.END
MSG.LOGIN .AZ "\r\nlogin:"
MSG.PASSWORD .AZ "\r\npassword:"
2018-12-04 13:20:35 +00:00
MSG.ECHOCRLF .AZ "\r\n"
MSG.ECHODEL .DA #C.BS,#C.SPACE,#C.BS,#0
2018-11-23 16:20:19 +00:00
ENV.SHELL .AZ "SHELL"
ENV.HOME .AZ "HOME"
2018-11-23 21:36:31 +00:00
SHELL .AZ "${ROOT}BIN/SHELL"
2018-11-23 16:20:19 +00:00
HOME .AZ "${ROOT}ROOT"
2018-10-18 15:32:57 +00:00
.HS 00
*--------------------------------------
2015-06-03 18:30:57 +00:00
.DUMMY
.OR 0
DS.START
INPUT.BufPtr .BS INPUT.BufPtr.SIZE+1
INPUT.Status .BS 1
INPUT.PassChar .BS 1
2018-12-04 13:20:35 +00:00
INPUT.PrevCR .BS 1
2015-06-03 18:30:57 +00:00
hUSERNAME .BS 1
hPASSWORD .BS 1
DS.END
.ED
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SBIN/LOGIN.S
2015-06-03 18:30:57 +00:00
ASM