2020-07-27 15:19:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF bin/shutdown
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/kernel.i
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
2020-07-30 11:14:37 +00:00
|
|
|
|
ZPPtr1 .BS 2
|
2020-07-27 15:19:35 +00:00
|
|
|
|
Count .BS 1
|
|
|
|
|
Index .BS 1
|
2020-08-25 14:54:30 +00:00
|
|
|
|
ZS.END .ED
|
2020-07-27 15:19:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA #0 S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
|
|
|
|
.DA #32 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2020-07-30 11:14:37 +00:00
|
|
|
|
L.MSGPS .DA MSGPS
|
|
|
|
|
L.MSGDEV .DA MSGDEV
|
2020-07-27 15:19:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-07-30 11:14:37 +00:00
|
|
|
|
CS.RUN jsr CS.RUN.PS
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
2020-07-30 11:14:37 +00:00
|
|
|
|
jsr CS.RUN.DEV
|
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
|
|
|
|
|
>PUSHBI 1 INITD
|
2020-08-25 14:54:30 +00:00
|
|
|
|
>SYSCALL Kill
|
2020-07-30 11:14:37 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PS
|
2020-07-27 15:19:35 +00:00
|
|
|
|
.10 stz Count
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
stx Index
|
|
|
|
|
|
|
|
|
|
.1 lda PS.Table.hPS,x
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetMemPtr
|
2020-07-30 11:14:37 +00:00
|
|
|
|
>STYA ZPPtr1
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
2020-07-30 11:14:37 +00:00
|
|
|
|
lda (ZPPtr1)
|
2020-07-27 15:19:35 +00:00
|
|
|
|
bmi .6 HOLD
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.S
|
|
|
|
|
cmp #S.PS.S.QUIT
|
|
|
|
|
beq .6
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID
|
2020-07-30 11:14:37 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2020-07-30 15:45:10 +00:00
|
|
|
|
beq .7 don't kill PS0
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
|
|
|
|
cmp #1
|
|
|
|
|
beq .7 don't kill INITD
|
|
|
|
|
|
|
|
|
|
cmp (pPS),y don't kill myself
|
|
|
|
|
beq .7
|
|
|
|
|
|
2020-07-30 11:14:37 +00:00
|
|
|
|
>PUSHW L.MSGPS
|
2020-07-27 15:19:35 +00:00
|
|
|
|
ldy #S.PS.PID
|
2020-07-30 11:14:37 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2020-07-27 15:19:35 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hARGV
|
2020-07-30 11:14:37 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2020-07-27 15:19:35 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>PUSHBI 3
|
2020-08-25 14:54:30 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID
|
2020-07-30 11:14:37 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2020-08-25 14:54:30 +00:00
|
|
|
|
>SYSCALL Kill
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
|
|
|
|
.6 inc Count
|
|
|
|
|
|
|
|
|
|
.7 >SLEEP
|
|
|
|
|
|
|
|
|
|
inc Index
|
|
|
|
|
ldx Index
|
|
|
|
|
cpx #K.PS.MAX
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda Count
|
|
|
|
|
bne .10
|
2020-07-30 11:14:37 +00:00
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DEV ldx #1
|
|
|
|
|
stx Index
|
|
|
|
|
|
|
|
|
|
.1 lda Dev.Table-1,x
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
lda Dev.Table,x
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
beq .7
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
2020-07-30 11:14:37 +00:00
|
|
|
|
>PUSHW L.MSGDEV
|
|
|
|
|
>PUSHB Index
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
clc
|
|
|
|
|
adc #S.FD.DEV
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc /S.FD.DEV
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>PUSHBI 3
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.7 inc Index
|
2020-08-25 14:54:30 +00:00
|
|
|
|
inc Index
|
2020-07-27 15:19:35 +00:00
|
|
|
|
|
2020-07-30 11:14:37 +00:00
|
|
|
|
ldx Index
|
|
|
|
|
cpx #K.DEV.MAX*2+1
|
|
|
|
|
bne .1
|
|
|
|
|
|
2020-07-27 15:19:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2020-07-30 11:14:37 +00:00
|
|
|
|
MSGPS .AZ "SHUTDOWN:Killing process %3d, %s\r\n"
|
|
|
|
|
MSGDEV .AZ "SHUTDOWN:Closing device %3d, %s\r\n"
|
2020-07-27 15:19:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2020-08-25 14:54:30 +00:00
|
|
|
|
DS.END .ED
|
2020-07-27 15:19:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/shutdown.s
|
|
|
|
|
ASM
|