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
|
2018-12-04 16:45:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2020-02-27 07:27:42 +00:00
|
|
|
|
.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
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2020-02-27 07:27:42 +00:00
|
|
|
|
L.MSG.CTRLR .DA MSG.CTRLR
|
|
|
|
|
L.BINSH .DA BINSH
|
|
|
|
|
L.ETCINIT .DA ETCINIT
|
|
|
|
|
L.BINMEM .DA BINMEM
|
|
|
|
|
L.BINPS .DA BINPS
|
|
|
|
|
L.BINSHUTDOWN .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
|
|
|
|
|
>SYSCALL feof
|
|
|
|
|
bcs .99
|
|
|
|
|
tay
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>SYSCALL getchar
|
|
|
|
|
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-02-27 07:27:42 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.BINSH
|
|
|
|
|
jsr CS.RUN.EXEC.YA
|
2020-03-13 16:10:36 +00:00
|
|
|
|
|
|
|
|
|
>SLEEP
|
|
|
|
|
|
2020-02-27 07:27:42 +00:00
|
|
|
|
.1 jsr CS.RUN.ETCINIT
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
.2 >SYSCALL getchar
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #C.CR Ctrl.M
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
>LDYA L.BINMEM
|
|
|
|
|
jsr CS.RUN.EXEC.YA
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.3 cmp #16 Ctrl.P
|
|
|
|
|
bne .4
|
|
|
|
|
>LDYA L.BINPS
|
|
|
|
|
jsr CS.RUN.EXEC.YA
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.4 cmp #4 Ctrl.D
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
>LDYA L.BINSHUTDOWN
|
|
|
|
|
jsr CS.RUN.EXEC.YA
|
|
|
|
|
bcs .2
|
|
|
|
|
|
2018-12-04 16:45:58 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-02-27 07:27:42 +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
|
|
|
|
|
|
|
|
|
|
>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-02-27 07:27:42 +00:00
|
|
|
|
bcs .90
|
|
|
|
|
|
|
|
|
|
sta hFile
|
|
|
|
|
|
|
|
|
|
.1 >PUSHWI 256
|
|
|
|
|
>PUSHW BufPtr
|
|
|
|
|
lda hFile
|
|
|
|
|
>SYSCALL fgets
|
|
|
|
|
bcs .80
|
|
|
|
|
|
|
|
|
|
lda (BufPtr)
|
|
|
|
|
cmp #'#'
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
>LDYA BufPtr
|
|
|
|
|
jsr CS.RUN.EXEC.YA
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.90 pha
|
|
|
|
|
jsr .81
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.80 lda hFile
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2020-02-27 07:27:42 +00:00
|
|
|
|
|
|
|
|
|
.81 lda hBuf
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-02-27 07:27:42 +00:00
|
|
|
|
|
2018-12-04 16:45:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-27 07:27:42 +00:00
|
|
|
|
CS.RUN.EXEC.YA >PUSHYA
|
2020-03-13 16:10:36 +00:00
|
|
|
|
>PUSHBI S.PS.F.HOLD
|
2020-02-27 07:27:42 +00:00
|
|
|
|
>SYSCALL ExecL
|
|
|
|
|
rts
|
2018-12-04 16:45:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2020-03-13 16:10:36 +00:00
|
|
|
|
MSG.CTRLR .AZ "INITD:Entering ROOT mode..."
|
2020-02-27 07:27:42 +00:00
|
|
|
|
BINSH .AZ "${ROOT}bin/sh"
|
2020-02-26 07:28:45 +00:00
|
|
|
|
ETCINIT .AZ "${ROOT}etc/init"
|
2020-02-27 07:27:42 +00:00
|
|
|
|
BINMEM .AZ "${ROOT}bin/mem"
|
|
|
|
|
BINPS .AZ "${ROOT}bin/ps"
|
|
|
|
|
BINSHUTDOWN .AZ "${ROOT}bin/shutdown"
|
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
|
|
|
|
|
SAVE USR/SRC/SBIN/INITD
|
|
|
|
|
ASM
|