A2osX/SBIN/INITD.S.txt

238 lines
4.2 KiB
Plaintext
Raw Normal View History

2018-12-04 16:45:58 +00:00
NEW
2020-02-26 07:28:45 +00:00
AUTO 3,1
2018-12-04 16:45:58 +00:00
.LIST OFF
2020-02-26 07:28:45 +00:00
.OP 65C02
.OR $2000
2020-01-24 14:21:08 +00:00
.TF sbin/initd
2020-08-18 08:00:26 +00:00
*---------------------------------------
2020-08-30 17:50:57 +00:00
INITDDBG .EQ 0
2018-12-04 16:45:58 +00:00
*--------------------------------------
2020-07-27 15:19:35 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
2018-12-04 16:45:58 +00:00
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
2020-02-27 07:27:42 +00:00
BufPtr .BS 2
hBuf .BS 1
hFile .BS 1
2020-03-13 07:15:58 +00:00
ZS.END .ED
2018-12-04 16:45:58 +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-12-05 15:12:10 +00:00
.DA #0 S.PS.F.EVENT
2018-12-04 16:45:58 +00:00
.DA #0
.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
.DA 0
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
2018-12-04 16:45:58 +00:00
.1 .DA CS.INIT
.DA CS.RUN
2020-08-27 06:30:03 +00:00
.DA CS.DOEVENT
2018-12-04 16:45:58 +00:00
.DA CS.QUIT
2020-08-27 06:30:03 +00:00
L.MSG.CTRLR .DA MSG.CTRLR
.DO INITDDBG=1
L.MSG.OK .DA MSG.OK
L.MSG.KO .DA MSG.KO
.FIN
2020-02-27 07:27:42 +00:00
L.ETCINIT .DA ETCINIT
2020-07-30 11:14:37 +00:00
L.CMDS .DA BINSH
.DA BINMEM
.DA BINPS
.DA BINLSOF
.DA BINSHUTDOWN
2018-12-04 16:45:58 +00:00
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN ldy #S.PS.PID
lda (pPS),y
cmp #1
bne .9
2020-02-26 07:28:45 +00:00
2020-03-13 16:10:36 +00:00
ldy #S.PS.hStdIn
lda (pPS),y
2020-08-20 13:20:33 +00:00
>SYSCALL FEOF
2020-03-13 16:10:36 +00:00
bcs .99
tay
bne .1
2020-08-27 06:30:03 +00:00
2020-08-20 13:20:33 +00:00
>SYSCALL GetChar
2020-03-13 16:10:36 +00:00
bcs .99
2020-02-26 07:28:45 +00:00
2020-03-13 16:10:36 +00:00
cmp #18 CTRL-R for Root mode
bne .1
2020-02-26 07:28:45 +00:00
2018-12-04 16:45:58 +00:00
>LDYA L.MSG.CTRLR
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2020-08-27 06:30:03 +00:00
2020-07-30 11:14:37 +00:00
ldx #0
jsr CS.RUN.EXEC.X
2020-08-27 06:30:03 +00:00
2020-03-13 16:10:36 +00:00
>SLEEP
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
.1 jsr CS.RUN.ETCINIT
bcs .99
2020-08-27 06:30:03 +00:00
2020-08-20 13:20:33 +00:00
.2 >SYSCALL GetChar
2020-02-27 07:27:42 +00:00
bcs .99
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
cmp #C.CR Ctrl.M
bne .3
2020-08-27 06:30:03 +00:00
2020-07-30 11:14:37 +00:00
ldx #2
jsr CS.RUN.EXEC.X
2020-02-27 07:27:42 +00:00
bra .2
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
.3 cmp #16 Ctrl.P
bne .4
2020-08-27 06:30:03 +00:00
2020-07-30 11:14:37 +00:00
ldx #4
jsr CS.RUN.EXEC.X
2020-02-27 07:27:42 +00:00
bra .2
2020-08-27 06:30:03 +00:00
2020-07-30 11:14:37 +00:00
.4 cmp #12 Ctrl.L
bne .5
ldx #6
jsr CS.RUN.EXEC.X
2020-08-29 17:25:43 +00:00
bra .2
2020-07-30 11:14:37 +00:00
.5 cmp #4 Ctrl.D
2020-02-27 07:27:42 +00:00
bne .2
2020-08-27 06:30:03 +00:00
2020-07-30 11:14:37 +00:00
ldx #8
jsr CS.RUN.EXEC.X
2020-08-29 17:25:43 +00:00
bra .2
2020-08-27 06:30:03 +00:00
2018-12-04 16:45:58 +00:00
.9 lda #E.SYN
sec
2020-02-27 07:27:42 +00:00
.99 rts
*--------------------------------------
CS.RUN.ETCINIT >LDYAI 256
2020-02-28 07:21:46 +00:00
>SYSCALL GetMem
2020-02-27 07:27:42 +00:00
>STYA BufPtr
stx hBuf
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
>PUSHW L.ETCINIT
>PUSHBI O.RDONLY+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ
2020-03-09 16:24:08 +00:00
>SYSCALL FOpen
2020-08-27 06:30:03 +00:00
bcc .10
pha
2020-08-29 17:25:43 +00:00
.DO INITDDBG=1
jsr CS.RUN.ERRMSG
.FIN
2020-08-27 06:30:03 +00:00
jsr .81
pla
sec
rts
.10 sta hFile
2020-02-27 07:27:42 +00:00
.1 >PUSHWI 256
>PUSHW BufPtr
lda hFile
2020-08-20 13:20:33 +00:00
>SYSCALL FGetS
2020-02-27 07:27:42 +00:00
bcs .80
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
lda (BufPtr)
cmp #'#'
beq .1
2020-08-27 06:30:03 +00:00
2020-08-18 08:00:26 +00:00
.DO INITDDBG=1
2020-08-27 06:30:03 +00:00
>PUSHW BufPtr
>PUSHBI 0
>SYSCALL PrintF
2020-08-18 08:00:26 +00:00
.FIN
2020-08-27 06:30:03 +00:00
2020-07-28 20:37:26 +00:00
>PUSHW BufPtr
2020-08-11 18:55:28 +00:00
>PUSHBI S.PS.F.NOHUP+S.PS.F.HOLD
2020-07-28 20:37:26 +00:00
>SYSCALL ExecL
2020-08-27 06:30:03 +00:00
.DO INITDDBG=1
bcs .2
>LDYA L.MSG.OK
>SYSCALL PutS
.FIN
2020-07-28 20:37:26 +00:00
>SLEEP
2020-02-27 07:27:42 +00:00
bra .1
2020-08-27 06:30:03 +00:00
2020-08-29 17:25:43 +00:00
.DO INITDDBG=1
.2 jsr CS.RUN.ERRMSG
bra .1
2020-08-27 06:30:03 +00:00
.FIN
2020-02-27 07:27:42 +00:00
.80 lda hFile
2020-02-28 07:21:46 +00:00
>SYSCALL FClose
2020-08-27 06:30:03 +00:00
2020-02-27 07:27:42 +00:00
.81 lda hBuf
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2020-08-27 06:30:03 +00:00
2018-12-04 16:45:58 +00:00
rts
*--------------------------------------
2020-07-30 11:14:37 +00:00
CS.RUN.EXEC.X >PUSHW L.CMDS,x
2020-03-13 16:10:36 +00:00
>PUSHBI S.PS.F.HOLD
2020-02-27 07:27:42 +00:00
>SYSCALL ExecL
2020-08-27 06:30:03 +00:00
rts
2020-08-29 17:25:43 +00:00
*--------------------------------------
.DO INITDDBG=1
CS.RUN.ERRMSG tax
>PUSHW L.MSG.KO
txa
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
rts
.FIN
2018-12-04 16:45:58 +00:00
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
2020-09-24 06:24:47 +00:00
CS.QUIT clc
2018-12-04 16:45:58 +00:00
rts
*--------------------------------------
CS.END
*--------------------------------------
2020-03-13 16:10:36 +00:00
MSG.CTRLR .AZ "INITD:Entering ROOT mode..."
2020-08-27 06:30:03 +00:00
.DO INITDDBG=1
MSG.OK .AZ " [OK]"
MSG.KO .AZ " [%h]\r\n"
.FIN
2020-02-26 07:28:45 +00:00
ETCINIT .AZ "${ROOT}etc/init"
2020-07-30 11:14:37 +00:00
BINSH .AZ "${ROOT}bin/sh"
2020-02-27 07:27:42 +00:00
BINMEM .AZ "${ROOT}bin/mem"
BINPS .AZ "${ROOT}bin/ps"
2020-07-30 11:14:37 +00:00
BINLSOF .AZ "${ROOT}bin/lsof"
2020-02-27 07:27:42 +00:00
BINSHUTDOWN .AZ "${ROOT}bin/shutdown"
2020-07-30 11:14:37 +00:00
*--------------------------------------
MLI.PARAMS .DA #4
.DA #0
.DA 0
.DA #0
.DA 0
2018-12-04 16:45:58 +00:00
*--------------------------------------
.DUMMY
.OR 0
DS.START
2020-03-13 07:15:58 +00:00
DS.END .ED
2018-12-04 16:45:58 +00:00
*--------------------------------------
MAN
2020-08-20 13:20:33 +00:00
SAVE usr/src/sbin/initd.s
2018-12-04 16:45:58 +00:00
ASM