A2osX/SBIN/INITD.S.txt

124 lines
3.1 KiB
Plaintext
Raw Normal View History

2018-12-04 16:45:58 +00:00
NEW
PREFIX
AUTO 4,1 Enable MASM3 auto line num
.LIST OFF
.OP 65C02 Target CPU, must match CPU level in header
.OR $2000 usualy $2000, but any value > $100 allowed
.TF SBIN/INITD
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
* MyPtr .BS 2
ZS.END
.ED
*--------------------------------------
* 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
L.MSG.CTRLR .DA MSG.CTRLR
2019-10-03 06:25:27 +00:00
L.MSG.ETCINIT .DA MSG.ETCINIT
2018-12-04 16:45:58 +00:00
L.BINSHELL .DA BINSHELL
2018-12-05 15:12:10 +00:00
L.ETCINIT .DA ETCINIT
L.MSG.RUNNING .DA MSG.RUNNING
2018-12-04 16:45:58 +00:00
.DA 0
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
CS.RUN ldy #S.PS.PID
lda (pPS),y
cmp #1
bne .9
>SYSCALL getchar
bcs .1
cmp #$12 CTRL-R for Root mode
bne .1
>LDYA L.MSG.CTRLR
>SYSCALL puts
>PUSHBI S.PS.F.HOLD
>LDYA L.BINSHELL
>SYSCALL ExecL
>SLEEP
.1 >LDYA L.MSG.ETCINIT
>SYSCALL puts
>PUSHBI S.PS.F.HOLD
>LDYA L.ETCINIT
>SYSCALL ExecL
>SLEEP
2018-12-05 15:12:10 +00:00
>LDYA L.MSG.RUNNING
>SYSCALL puts
ldy #S.PS.F.HOLD
ora (pPS),y
sta (pPS),y
>SLEEP
2018-12-04 16:45:58 +00:00
lda #0
sec
rts
.9 lda #E.SYN
sec
rts
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
* Called once, when RUN exited with CS
* Put code for unloading LIB here
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
2018-12-05 15:12:10 +00:00
MSG.CTRLR .AZ "INITD:Ctrl-R Pressed, entering ROOT mode..."
MSG.ETCINIT .AS "INITD:Executing ETC/INIT Script:"
2018-12-04 16:45:58 +00:00
ETCINIT .AZ "${ROOT}ETC/INIT"
BINSHELL .AZ "${ROOT}BIN/SHELL"
2018-12-05 15:12:10 +00:00
MSG.RUNNING .AZ "INITD:Running..."
MSH.SHUTDOWN .AZ "INITD:Shutting down..."
2018-12-04 16:45:58 +00:00
*--------------------------------------
* Per Process DATA segement (0 filled before INIT)
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/SBIN/INITD
ASM