A2osX/SYS/KERNEL.S.PS.txt

1052 lines
18 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-05-25 19:24:07 +00:00
AUTO 3,1
*/--------------------------------------
2018-10-25 15:31:41 +00:00
* # ExecL
2020-02-14 07:21:56 +00:00
* ## C / CSH
* `int execl(const char *cmdline, short int flags);`
2018-10-25 15:31:41 +00:00
* ## ASM
2020-01-24 14:21:08 +00:00
* `>PUSHW cmdline`
2018-10-25 15:31:41 +00:00
* `>PUSHB flags`
* `>SYSCALL execl`
* ## RETURN VALUE
* A = Child PSID
*\--------------------------------------
2020-01-24 14:21:08 +00:00
K.ExecL >PULLB PS.Flags
2020-12-15 13:23:22 +00:00
2018-10-26 14:46:11 +00:00
>LDYAI 256
jsr K.GetMem
bcs .99
2020-02-14 07:21:56 +00:00
2018-10-26 14:46:11 +00:00
stx .90+1
>STYA PS.ArgV
>PUSHYA
2020-02-14 07:21:56 +00:00
jsr K.Arg2ArgV cmdline on stack, push buffer
2018-10-26 14:46:11 +00:00
bcs .9
2020-02-14 07:21:56 +00:00
2018-10-26 14:46:11 +00:00
jsr PS.Exec
2019-10-03 06:25:27 +00:00
.9 php
2018-10-26 06:16:14 +00:00
pha
2018-10-26 14:46:11 +00:00
.90 lda #$ff SELF MODIFIED
jsr K.FreeMem
2018-10-26 06:16:14 +00:00
pla
2018-10-26 14:46:11 +00:00
plp
2019-10-03 06:25:27 +00:00
.99 rts
2018-10-25 15:31:41 +00:00
*/--------------------------------------
* # ExecV
2020-02-14 07:21:56 +00:00
* ## C / CSH
2019-01-18 16:06:44 +00:00
* `int execv(const char* argv[], short int flags);`
2018-10-15 06:25:40 +00:00
* ## ASM
2020-02-14 07:21:56 +00:00
* `>PUSHW argv`
2018-10-15 06:25:40 +00:00
* `>PUSHB flags`
2018-10-15 15:39:21 +00:00
* `>SYSCALL execv`
2018-10-11 15:23:06 +00:00
* ## RETURN VALUE
2018-10-15 06:25:40 +00:00
* A = Child PSID
*\--------------------------------------
2020-02-14 07:21:56 +00:00
K.ExecV >PULLB PS.Flags
>PULLW PS.ArgV
2020-12-15 13:23:22 +00:00
2019-01-21 06:52:04 +00:00
PS.Exec jsr PS.CreateChild A=PID,Child S.PS at PS.NewPSPtr,PS.Load.hMem
bcs .9
2018-11-27 14:03:26 +00:00
sta .8+1
2018-12-03 12:32:46 +00:00
2019-01-21 06:52:04 +00:00
stz K.IOBuf If !=0 after PS.Load, it's a script
2020-12-15 13:23:22 +00:00
2018-07-05 05:42:16 +00:00
jsr PS.Load
2018-11-23 07:02:00 +00:00
bcs .90
2018-12-03 12:32:46 +00:00
2019-01-21 06:52:04 +00:00
jsr PS.AddArgV K.IOBuf= /.../SHELL, K.Buf256=/.../SCRIPT
bcc .8 or K.IOBuf= 0, K.Buf256=/.../BINFILE
2020-06-07 08:06:51 +00:00
2018-11-23 07:02:00 +00:00
.90 pha save error code
2021-04-10 17:17:40 +00:00
>PUSHB .8+1 PID
>PUSHBI 2 SIG
2019-07-29 15:38:55 +00:00
jsr K.Kill
pla get back error code
sec
rts
2018-11-27 14:03:26 +00:00
.8 lda #$ff SELF MODIFIED
2019-07-29 15:38:55 +00:00
* clc
2020-12-15 13:23:22 +00:00
.9
2021-05-04 17:31:21 +00:00
rts
2020-02-07 12:53:46 +00:00
*/--------------------------------------
* # Fork
* ## C
2020-02-14 07:21:56 +00:00
* `short int fork();`
2020-02-07 12:53:46 +00:00
* ## ASM
* `>SYSCALL fork`
* ## RETURN VALUE
* A = Child PSID
*\--------------------------------------
2020-06-09 13:40:21 +00:00
K.Fork jsr PS.CreateChild A=PID,Child S.PS at PS.NewPSPtr,PS.Load.hMem
2021-05-04 17:31:21 +00:00
bcs .99
2020-06-09 13:40:21 +00:00
sta .8+1
2020-12-15 13:23:22 +00:00
2020-06-09 13:40:21 +00:00
ldy #S.PS.S
lda #S.PS.S.RUN
sta (PS.NewPSPtr),y
2020-12-15 13:23:22 +00:00
2020-08-07 19:49:24 +00:00
ldy #S.PS.hCS
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
sta (PS.NewPSPtr),y
jsr MEM.GetMemByID
jsr Mem.IncRefCnt
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.MEM.PTR+1
lda (ZPMemMgrSPtr),y
pha
dey
lda (ZPMemMgrSPtr),y
ldy #S.PS.ZP.CODE+1
sta (PS.NewPSPtr),y
dey
pla
sta (PS.NewPSPtr),y
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.hDS
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
jsr MEM.Dup
2021-05-04 17:31:21 +00:00
.99 bcs .9
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.hDS
sta (PS.NewPSPtr),y
jsr K.GetMemPtr
phy
ldy #S.PS.ZP.DATA+1
sta (PS.NewPSPtr),y
dey
pla
sta (PS.NewPSPtr),y
ldy #S.PS.hSS
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
jsr MEM.Dup
bcs .9
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.hSS
sta (PS.NewPSPtr),y
jsr K.GetMemPtr
phy
ldy #S.PS.ZP.STACK+1
sta (PS.NewPSPtr),y
dey
pla
sta (PS.NewPSPtr),y
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.hARGV
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
jsr MEM.Dup
bcs .9
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.hARGV
sta (PS.NewPSPtr),y
dey
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y S.PS.ARGC
2020-08-09 19:47:42 +00:00
sta (PS.NewPSPtr),y
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.ARGC
sta (PS.NewPSPtr),y
iny S.PS.hARGV
txa
sta (PS.NewPSPtr),y
ldy #S.PS.A
lda #0
sta (PS.NewPSPtr),y Forked PS will get A=PSID=0
iny
2020-12-15 13:23:22 +00:00
.1 lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
sta (PS.NewPSPtr),y
iny
cpy #S.PS.hSession
bne .1
2020-12-15 13:23:22 +00:00
2020-08-09 19:47:42 +00:00
ldy #S.PS.ZP.LOCAL
2020-12-15 13:23:22 +00:00
.2 lda (ZPPtr1),y
2020-08-09 19:47:42 +00:00
sta (PS.NewPSPtr),y
iny
cpy #S.PS
bne .2
2020-12-15 13:23:22 +00:00
2020-06-09 13:40:21 +00:00
.8 lda #$ff SELF MODIFIED
* clc
.9 rts
*--------------------------------------
2016-09-29 15:30:15 +00:00
* PS.CreateChild
2016-08-17 06:25:58 +00:00
* in :
* out :
* A = PSID
*--------------------------------------
2019-01-24 13:53:29 +00:00
PS.CreateChild ldx #0
bra .2 Skip PS0
2020-06-09 13:40:21 +00:00
2018-10-15 15:39:21 +00:00
.1 lda PS.Table.PID,x
2018-10-17 15:31:29 +00:00
beq .4 Found an empty slot
2020-06-09 13:40:21 +00:00
2019-01-24 13:53:29 +00:00
.2 inx
2018-10-23 15:36:57 +00:00
cpx CORE.PSCount
2018-10-15 15:39:21 +00:00
bne .1
2020-06-09 13:40:21 +00:00
2018-10-23 15:36:57 +00:00
cpx #K.PS.MAX
bne .3
2020-06-09 13:40:21 +00:00
2018-10-21 20:54:07 +00:00
lda #E.OOH
2016-08-17 06:25:58 +00:00
sec
rts
2019-10-03 06:25:27 +00:00
.99 plx
rts
2020-06-09 13:40:21 +00:00
2019-10-03 06:25:27 +00:00
.3 inc CORE.PSCount
2020-06-09 13:40:21 +00:00
2018-10-15 15:39:21 +00:00
.4 inc CORE.LastPSID Get a PSID not already running
2016-08-17 06:25:58 +00:00
beq .4 not = 0
2020-06-09 13:40:21 +00:00
lda CORE.LastPSID
2018-10-17 15:31:29 +00:00
jsr CORE.GetPS Y=PS Index, X,A unmodified
bcc .4 running...loop
2016-08-17 06:25:58 +00:00
lda CORE.LastPSID
sta PS.Table.PID,x
2018-10-17 15:31:29 +00:00
phx save PS Index
>LDYAI S.PS
2018-06-21 15:12:10 +00:00
jsr K.GetMem0 Blank Everything in this S.PS
bcs .99
2020-06-09 13:40:21 +00:00
2019-01-21 06:52:04 +00:00
>STYA PS.NewPSPtr
txa
plx
2018-10-17 15:31:29 +00:00
sta PS.Table.hPS,x
2019-07-18 15:55:43 +00:00
jsr Mem.SetOwner Set Ownership
2019-07-25 06:13:56 +00:00
lda PS.Flags
and #S.PS.F.CLOSEONX
sta (PS.NewPSPtr)
lda CORE.LastPSID
2019-05-22 15:46:20 +00:00
ldy #S.PS.PID
sta (PS.NewPSPtr),y
2020-08-09 19:47:42 +00:00
lda #S.PS.F.NOHUP
2020-08-09 20:45:04 +00:00
bit PS.Flags
beq .5
2020-06-09 13:40:21 +00:00
2020-08-09 20:45:04 +00:00
lda PS.Table.hPS Select PS0
jsr K.GetMemPtr
bra .6
2016-08-17 06:25:58 +00:00
2020-08-09 20:45:04 +00:00
.5 >LDYA pPs
2020-08-09 19:47:42 +00:00
2020-08-09 20:45:04 +00:00
.6 >STYA ZPPtr1 = Parent process
ldy #S.PS.PID
lda (ZPPtr1),y
dey #S.PS.PPID
sta (PS.NewPSPtr),y
ldy #S.PS.hCWD copy hPREFIX...
lda (ZPPtr1),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
2019-07-19 06:41:33 +00:00
2019-05-22 15:46:20 +00:00
jsr K.StrDup
bcs .9
2020-06-09 13:40:21 +00:00
2019-07-18 15:55:43 +00:00
jsr Mem.SetOwner Set Ownership
2016-08-17 06:25:58 +00:00
txa
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y
2020-01-20 11:13:58 +00:00
2020-02-03 16:05:54 +00:00
ldy #S.PS.hENV
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2020-12-15 13:23:22 +00:00
2020-02-03 16:05:54 +00:00
jsr MEM.DupX dup hENV from parent PS
bcs .9
2019-01-22 16:35:42 +00:00
2016-08-17 06:25:58 +00:00
ldy #S.PS.hENV
2019-04-15 05:40:13 +00:00
sta (PS.NewPSPtr),y
2020-01-20 11:13:58 +00:00
2020-09-05 13:38:04 +00:00
sta SETWRITEAUX
jsr Mem.SetOwner Set Ownership
sta CLRWRITEAUX
2018-11-28 14:58:42 +00:00
ldy #S.PS.hStdIn
2020-08-09 20:45:04 +00:00
.7 lda (ZPPtr1),y
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y
2016-08-17 06:25:58 +00:00
iny
2017-01-12 17:43:45 +00:00
cpy #S.PS.hStdErr+1
2019-05-22 15:46:20 +00:00
bne .7
2020-12-15 13:23:22 +00:00
2020-03-12 16:44:11 +00:00
ldy #S.PS.hSession
2020-08-09 20:45:04 +00:00
lda (ZPPtr1),y
2019-05-08 19:41:46 +00:00
sta (PS.NewPSPtr),y
2020-02-04 14:35:48 +00:00
2020-03-13 16:10:36 +00:00
* tax
* lda S.Table.hSID-1,x
* jsr MEM.GetMemByID
* jsr MEM.IncRefCnt
2019-07-19 14:05:22 +00:00
2019-05-05 17:15:37 +00:00
lda #S.PS.F.HOLD
2017-10-27 14:56:46 +00:00
bit PS.Flags
2019-05-22 15:46:20 +00:00
beq .8
2020-08-09 20:45:04 +00:00
ora (ZPPtr1)
sta (ZPPtr1) HOLD parent PS
lda CORE.LastPSID
2019-05-22 15:46:20 +00:00
ldy #S.PS.CPID
2020-08-09 20:45:04 +00:00
sta (ZPPtr1),y
2019-10-03 06:25:27 +00:00
.8
* lda #S.PS.S.INIT
2020-12-15 13:23:22 +00:00
* ldy #S.PS.S
2019-07-22 16:28:44 +00:00
* sta (PS.NewPSPtr),y Make this PS Init....
2017-01-12 17:43:45 +00:00
2019-05-22 15:46:20 +00:00
lda CORE.LastPSID Exit with A=PSID
clc
rts
2020-12-15 13:23:22 +00:00
2019-05-22 15:46:20 +00:00
.9 pha
2021-04-10 17:17:40 +00:00
>PUSHB CORE.LastPSID
>PUSHBI 2 SIG
2019-07-29 15:38:55 +00:00
jsr K.Kill
2019-05-22 15:46:20 +00:00
pla
sec
rts
2016-08-17 06:25:58 +00:00
*--------------------------------------
2019-01-18 16:06:44 +00:00
PS.Load ldy #$ff
.1 iny
lda (PS.ArgV),y
beq .2 no / in path...try search in PATH
2019-11-15 14:40:48 +00:00
2019-01-18 16:06:44 +00:00
cmp #'/'
bne .1
2019-11-15 14:40:48 +00:00
2020-08-18 19:56:50 +00:00
>LDYA PS.ArgV found /, some path specified, no search
2020-12-15 13:23:22 +00:00
jsr PS.STAT.YA
2019-01-21 06:52:04 +00:00
bcc .6 REAL path in K.Buf256
2019-11-15 14:40:48 +00:00
2019-01-18 16:06:44 +00:00
.99 rts
2019-11-15 14:40:48 +00:00
2019-01-21 06:52:04 +00:00
.2 >LDYA PS.ArgV
2020-01-20 11:13:58 +00:00
2020-09-25 12:05:23 +00:00
jsr PS.Find.PATH Get fullpath in K.Buf256
2019-01-21 06:52:04 +00:00
bcc .6
2020-01-16 07:33:14 +00:00
2019-01-18 16:06:44 +00:00
>LDYA PS.ArgV
2020-09-25 12:05:23 +00:00
jsr PS.Find.CWD
2019-01-18 16:06:44 +00:00
bcs .99
2019-11-15 14:40:48 +00:00
2019-01-18 16:06:44 +00:00
.6 lda K.S.STAT+S.STAT.P.TYPE
2018-11-22 16:39:41 +00:00
cmp #S.FI.T.BIN
2020-02-06 16:23:59 +00:00
bne .7
jmp PS.LoadBIN
2019-11-15 14:40:48 +00:00
2019-01-18 16:06:44 +00:00
.7 cmp #S.FI.T.TXT
beq PS.Load.SCRIPT
2018-11-23 16:20:19 +00:00
2020-09-25 12:05:23 +00:00
cmp #S.FI.T.SYS
bne PS.Load.IPATH
2018-11-22 16:39:41 +00:00
2020-09-25 12:05:23 +00:00
jsr PS.Buf2IO .SYSTEM -> IOBUF
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
* ldy #$ff
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
*.8 iny
* inx
* lda PS.T,y
* sta K.IOBuf-1,x
* bne .8
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
>LDYAI PS.SHUTDOWN
jsr PS.Find.PATH
2021-05-04 17:31:21 +00:00
bcs PS.RTS
2020-09-25 12:05:23 +00:00
jmp PS.LoadBIN
*--------------------------------------
2019-01-18 16:06:44 +00:00
PS.Load.IPATH lda #E.BADPATH
2020-02-14 07:21:56 +00:00
.HS 2C
PS.Load.IBIN lda #E.IBIN
2019-01-18 16:06:44 +00:00
sec
2021-05-04 17:31:21 +00:00
PS.RTS rts
2020-09-25 12:05:23 +00:00
*--------------------------------------
PS.Load.SCRIPT jsr PS.Buf2IO
2019-01-18 16:06:44 +00:00
2019-01-21 06:52:04 +00:00
jsr PS.LoadGetHeader
2021-05-04 17:31:21 +00:00
bcs PS.RTS
2018-11-22 16:39:41 +00:00
2020-01-15 09:50:04 +00:00
>PUSHWI PS.Load.ROOT
>PUSHWI K.Buf256 K.Buf256 = "$ROOT"
2020-02-06 16:23:59 +00:00
>SYSCALL2 GetEnv
2019-01-18 16:06:44 +00:00
bcs PS.Load.IPATH
2018-11-22 16:39:41 +00:00
ldx #$ff
2018-12-03 12:32:46 +00:00
2019-01-21 06:52:04 +00:00
.1 inx
2020-01-15 09:50:04 +00:00
lda K.Buf256,x
2019-01-21 06:52:04 +00:00
bne .1
2019-12-04 06:56:03 +00:00
2018-11-22 16:39:41 +00:00
ldy #0
2019-12-04 06:56:03 +00:00
2019-01-21 06:52:04 +00:00
.3 lda K.IOBuf+128,y Check HEADER= "#!/"
2018-11-22 16:39:41 +00:00
cmp PS.Load.HEADER,y
2019-01-18 16:06:44 +00:00
bne PS.Load.IBIN
2018-11-22 16:39:41 +00:00
iny
cpy #3
bne .3
2019-12-04 06:56:03 +00:00
2019-10-03 06:25:27 +00:00
.4 iny
2018-11-22 16:39:41 +00:00
inx
lda K.IOBuf+128-1,y
2019-07-24 15:17:08 +00:00
sta K.Buf256-1,x K.Buf256 = "${ROOT}BIN/SHELL"
2018-12-03 12:32:46 +00:00
beq .5
2019-12-04 06:56:03 +00:00
2018-12-03 12:32:46 +00:00
eor #C.CR
2020-12-15 13:23:22 +00:00
bne .4
2019-07-24 15:17:08 +00:00
sta K.Buf256-1,x K.Buf256 = "${ROOT}BIN/SHELL\0"
2019-12-02 16:47:53 +00:00
2020-08-18 19:56:50 +00:00
.5 >LDYAI K.Buf256
2020-12-15 13:23:22 +00:00
jsr PS.STAT.YA
2021-05-04 17:31:21 +00:00
bcs PS.RTS
2019-12-02 16:47:53 +00:00
2019-01-21 06:52:04 +00:00
lda K.S.STAT+S.STAT.P.TYPE
cmp #S.FI.T.BIN
2020-02-14 07:21:56 +00:00
beq PS.LoadBIN
jmp PS.Load.IBIN
2019-01-18 16:06:44 +00:00
*--------------------------------------
2020-02-14 07:21:56 +00:00
PS.LoadBIN jsr BIN.Load K.Buf256= "${ROOT}BIN/SH\0", K.IOBuf=/.../SCRIPT
2016-08-17 06:25:58 +00:00
bcs .9
2019-12-04 06:56:03 +00:00
2017-01-12 17:43:45 +00:00
>STYA ZPPtr4 save PTR to Code Segment
2020-12-15 13:23:22 +00:00
phy
ldy #S.PS.ZP.CODE+1
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y save pCode HI...
dey
pla
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y save pCode LO...
2016-08-17 06:25:58 +00:00
txa
ldy #S.PS.hCS
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y save CS hMem in S.PS
2019-01-30 06:20:13 +00:00
* jsr MEM.GetMemByID
2019-07-18 15:55:43 +00:00
* jsr Mem.SetOwner Set Ownership
2018-09-19 15:25:42 +00:00
ldy #H.BIN.F Get Bin S.PS.F
lda (ZPPtr4),y
beq .1
ldy #S.PS.F update PS S.PS.F
2019-01-21 06:52:04 +00:00
ora (PS.NewPSPtr),y
sta (PS.NewPSPtr),y
2018-09-19 15:25:42 +00:00
.1 ldy #H.BIN.DS.SIZE+1
2017-01-12 17:43:45 +00:00
lda (ZPPtr4),y Load DS.SIZE HI
2016-08-17 06:25:58 +00:00
tax
2020-12-15 13:23:22 +00:00
dey
2017-01-12 17:43:45 +00:00
ora (ZPPtr4),y
2016-08-17 06:25:58 +00:00
beq .2 DS.SIZE=0...
lda (ZPPtr4),y
tay
txa Y,A = DS.SIZE
2018-08-11 10:57:57 +00:00
ldx #S.MEM.F.INIT0+S.MEM.F.DATA
jsr MEM.GetMem.YAX
2016-08-17 06:25:58 +00:00
bcs .9
phy
ldy #S.PS.ZP.DATA+1
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save pData HI...
dey
pla
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save pData LO...
2016-08-17 06:25:58 +00:00
txa
ldy #S.PS.hDS
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save DS hMem in S.PS
2019-07-18 15:55:43 +00:00
jsr Mem.SetOwner Set Ownership
2018-07-05 05:42:16 +00:00
.2 ldy #H.BIN.SS.SIZE
lda (ZPPtr4),y Load SS.SIZE
2019-10-03 06:25:27 +00:00
tay
2019-07-19 15:35:19 +00:00
beq .3 SS.SIZE.LO=0, set as default $100
2019-07-31 15:10:59 +00:00
lda #$ff SS.SIZE.HI
2019-07-19 15:35:19 +00:00
2019-07-31 15:10:59 +00:00
.3 inc
2019-11-15 14:40:48 +00:00
ldx #S.MEM.F.NOCROSS+S.MEM.F.STACK
jsr MEM.GetMem.YAX
bcs .9
2019-11-15 14:40:48 +00:00
phy save pStack base LO
ldy #S.PS.ZP.STACK+1
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save pStack HI...
2019-02-24 22:11:52 +00:00
ldy #S.PS.ZP.LOCAL+1
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save pLocal HI...
pla make pStack = Base...
ldy #H.BIN.SS.SIZE ...plus Stack size
* clc
adc (ZPPtr4),y
2020-12-15 13:23:22 +00:00
2019-11-15 14:40:48 +00:00
ldy #S.PS.ZP.STACK
2019-02-24 22:11:52 +00:00
sta (PS.NewPSPtr),y
2019-11-15 14:40:48 +00:00
txa
ldy #S.PS.hSS
2019-11-15 14:40:48 +00:00
sta (PS.NewPSPtr),y save SS hMem in S.PS
clc Potentially CS from ADC (ZPPtr4),y
2020-03-04 16:38:32 +00:00
jmp Mem.SetOwner Set Ownership
.9 rts
2016-08-17 06:25:58 +00:00
*--------------------------------------
2018-11-22 16:39:41 +00:00
PS.LoadGetHeader
2020-02-14 07:21:56 +00:00
>PUSHWI K.IOBuf
2018-11-22 16:39:41 +00:00
>PUSHBI O.RDONLY
2020-02-14 07:21:56 +00:00
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
2019-12-04 06:56:03 +00:00
>SYSCALL2 fopen
2019-01-21 06:52:04 +00:00
bcs .9
2019-12-04 06:56:03 +00:00
2018-11-22 16:39:41 +00:00
sta .1+1
2018-12-03 12:32:46 +00:00
2021-05-14 20:58:20 +00:00
>PUSHA
2018-11-22 16:39:41 +00:00
>PUSHWI K.IOBuf+128
2021-05-14 20:58:20 +00:00
>PUSHWI 128
2019-12-04 06:56:03 +00:00
>SYSCALL2 fread
2021-05-14 20:58:20 +00:00
2018-11-22 16:39:41 +00:00
php
pha
2021-05-14 20:58:20 +00:00
.1 lda #$FF SELF MODIFIED
2019-12-04 06:56:03 +00:00
>SYSCALL2 fclose
2018-11-22 16:39:41 +00:00
pla
plp
2021-05-14 20:58:20 +00:00
2019-01-21 06:52:04 +00:00
.9 rts
2018-11-22 16:39:41 +00:00
*--------------------------------------
PS.Load.ROOT .AZ "ROOT"
PS.Load.HEADER .AZ "#!/"
*--------------------------------------
2019-01-21 06:52:04 +00:00
* K.Buf256= /.../SHELL, K.IOBuf=/.../SCRIPT
2020-12-15 13:23:22 +00:00
* - or -
* K.Buf256=/.../BINFILE,K.IOBuf=0
2019-01-21 06:52:04 +00:00
* Buf256+IOBUF(?)+PS.ArgV[1,...] -> #S.PS.hARGV
2018-11-23 07:02:00 +00:00
*--------------------------------------
2019-01-21 06:52:04 +00:00
PS.AddArgV ldy #$ff In both cases, remove ARGV[0]
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
.60 iny
lda (PS.ArgV),y
bne .60
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
tya
sec
adc PS.ArgV
sta PS.ArgV
bcc .70
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
inc PS.ArgV+1 Skip old ARGV[0] = scriptename
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
.70 >LDYAI K.Buf256
jsr K.strlen
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
>STYA PS.ArgSize
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
lda K.IOBuf is there a /BIN/SHELL ?
2018-11-23 07:02:00 +00:00
beq .10
2019-10-12 14:20:09 +00:00
2018-11-28 14:58:42 +00:00
>LDYAI K.IOBuf
2018-11-23 16:20:19 +00:00
jsr K.strlen
2019-01-21 06:52:04 +00:00
jsr PS.AddYAp12ArgSize
2018-11-23 07:02:00 +00:00
2019-01-21 06:52:04 +00:00
.10 ldx #0 For now, 0 args...
lda K.IOBuf
beq .11 +1 for scriptpath
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
inx
2019-10-12 14:20:09 +00:00
2019-01-21 06:52:04 +00:00
.11 >LDYA PS.ArgV
2018-11-23 07:02:00 +00:00
>STYA ZPPtr1
2018-11-23 16:20:19 +00:00
.1 lda (ZPPtr1)
2018-11-23 07:02:00 +00:00
beq .4
2019-10-12 14:20:09 +00:00
2018-11-23 16:20:19 +00:00
inx
2019-10-12 14:20:09 +00:00
2018-11-23 07:02:00 +00:00
ldy #0
2019-10-12 14:20:09 +00:00
2018-11-23 07:02:00 +00:00
.2 iny
2018-11-23 16:20:19 +00:00
lda (ZPPtr1),y
2018-11-23 07:02:00 +00:00
bne .2
2019-10-12 14:20:09 +00:00
2019-10-03 06:25:27 +00:00
* lda #0
2019-01-21 06:52:04 +00:00
jsr PS.AddYAp12ArgSize
2021-05-04 17:31:21 +00:00
jsr SHARED.AddYp12P1
2018-11-23 07:02:00 +00:00
bra .1
2018-11-23 16:20:19 +00:00
.4 txa
ldy #S.PS.ARGC
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y
2019-10-12 14:20:09 +00:00
2019-01-04 13:17:31 +00:00
>LDYA PS.ArgSize Add 1 for ending 0
2018-11-23 07:02:00 +00:00
iny
bne .5
inc
2019-10-12 14:20:09 +00:00
.5 iny Add ONE MORE ?????!!!!
bne .51
inc
.51 jsr K.GetMem
bcs .9
2018-11-23 16:20:19 +00:00
>STYA ZPPtr2 Target Buffer
2018-11-22 16:39:41 +00:00
txa
2018-11-23 16:20:19 +00:00
ldy #S.PS.hARGV
2019-01-21 06:52:04 +00:00
sta (PS.NewPSPtr),y
2018-10-15 15:39:21 +00:00
2019-01-21 06:52:04 +00:00
>LDYAI K.Buf256
jsr PS.AddYAToStrV
2018-11-28 14:58:42 +00:00
lda K.IOBuf
2018-11-23 16:20:19 +00:00
beq .6
2019-10-12 14:20:09 +00:00
2018-11-28 14:58:42 +00:00
>LDYAI K.IOBuf
2019-01-21 06:52:04 +00:00
jsr PS.AddYAToStrV
2019-10-12 14:20:09 +00:00
2018-11-23 16:20:19 +00:00
.6 >LDYA PS.ArgV
>STYA ZPPtr1
2019-10-12 14:20:09 +00:00
.7 lda (ZPPtr1)
2018-10-15 06:25:40 +00:00
sta (ZPPtr2)
2019-07-08 15:39:14 +00:00
beq .8 Ending \0
2019-10-12 14:20:09 +00:00
2018-11-23 16:20:19 +00:00
jsr PS.AddPtr1ToStrV
2019-10-12 14:20:09 +00:00
bra .7
2019-07-08 15:39:14 +00:00
.8 clc
2019-10-12 14:20:09 +00:00
.9 rts
2018-11-23 16:20:19 +00:00
*--------------------------------------
2019-01-21 06:52:04 +00:00
PS.AddYAToStrV >STYA ZPPtr1
2018-11-23 16:20:19 +00:00
PS.AddPtr1ToStrV
2018-12-03 12:32:46 +00:00
ldy #$ff
2019-10-12 14:20:09 +00:00
2018-10-15 06:25:40 +00:00
.2 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .2
2019-10-12 14:20:09 +00:00
2021-05-04 17:31:21 +00:00
jsr SHARED.AddYp12P1
jmp SHARED.AddYp12P2
*--------------------------------------
2019-01-21 06:52:04 +00:00
PS.AddYAp12ArgSize
pha
tya
sec +1 for \0
adc PS.ArgSize
sta PS.ArgSize
pla
adc PS.ArgSize+1
sta PS.ArgSize+1
rts
*/--------------------------------------
2019-07-19 15:35:19 +00:00
* # Kill
2018-12-04 13:20:35 +00:00
* ## C
* `int kill(short int pid, short int sig);`
* ## ASM
2021-04-10 17:17:40 +00:00
* `>PUSHB pid`
2018-12-04 13:20:35 +00:00
* `>PUSHB sig`
* `>SYSCALL kill`
* ## RETURN VALUE
2019-07-29 20:59:00 +00:00
*\--------------------------------------
K.Kill.PID .BS 1
*--------------------------------------
2021-04-10 17:17:40 +00:00
K.Kill >PULLB .10+1 SIG
>PULLA PID
cmp #0
beq .9 CS
2020-01-22 21:52:00 +00:00
2019-07-29 20:59:00 +00:00
sta K.Kill.PID
2018-12-04 13:20:35 +00:00
jsr CORE.GetPSByID
bcs .99
2020-01-22 21:52:00 +00:00
2018-12-04 13:20:35 +00:00
>STYA ZPPtr1
2021-04-10 17:17:40 +00:00
.10 lda #$ff SELF MODIFIED
2019-07-24 05:53:09 +00:00
cmp #2+1
2018-12-04 13:20:35 +00:00
bcs .9
2020-01-22 21:52:00 +00:00
2018-12-04 13:20:35 +00:00
asl
tax
jmp (.1,x)
2020-09-24 06:24:47 +00:00
2018-12-04 13:20:35 +00:00
.1 .DA K.Kill.0
.DA K.Kill.1
2019-07-24 05:53:09 +00:00
.DA K.Kill.2
2020-01-22 21:52:00 +00:00
2018-12-04 13:20:35 +00:00
.9 lda #E.SYN
* sec
2021-04-10 17:17:40 +00:00
.99 rts
2018-12-04 13:20:35 +00:00
*--------------------------------------
2020-09-24 06:24:47 +00:00
K.Kill.1 lda (ZPPtr1)
and #S.PS.F.SLEEP^$FF
sta (ZPPtr1)
ldy #S.PS.S
2019-10-03 06:25:27 +00:00
lda #S.PS.S.QUIT
2019-07-22 16:28:44 +00:00
sta (ZPPtr1),y
2020-01-22 21:52:00 +00:00
2019-07-24 05:53:09 +00:00
K.Kill.0 clc
2018-12-04 13:20:35 +00:00
rts
2020-01-22 21:52:00 +00:00
2020-03-12 16:44:11 +00:00
K.Kill.2 ldy #S.PS.hSession
2019-07-19 15:35:19 +00:00
lda (ZPPtr1),y
tax
2020-03-13 07:15:58 +00:00
* lda S.Table.hSID-1,x
* jsr K.FreeMem
2020-01-18 19:37:32 +00:00
ldy #S.PS.hENV
lda (ZPPtr1),y
2020-02-14 07:21:56 +00:00
>SYSCALL2 FreeStkObj
2020-12-15 13:23:22 +00:00
2020-01-18 19:37:32 +00:00
ldx #4
2019-07-19 15:35:19 +00:00
2020-01-22 21:52:00 +00:00
.11 ldy .10,x
2019-07-29 15:38:55 +00:00
lda (ZPPtr1),y
2019-07-29 20:59:00 +00:00
beq .12
2019-07-29 15:38:55 +00:00
jsr K.FreeMem
.12 dex
bpl .11
2019-07-19 15:35:19 +00:00
2019-07-24 05:53:09 +00:00
lda (ZPPtr1)
bit #S.PS.F.CLOSEONX
beq .1
2019-07-25 06:13:56 +00:00
2019-07-19 15:35:19 +00:00
ldy #S.PS.hStdOut
lda (ZPPtr1),y
2020-02-14 07:21:56 +00:00
>SYSCALL2 fclose
2019-07-19 15:35:19 +00:00
2019-07-29 20:59:00 +00:00
.1 lda K.Kill.PID
2019-07-19 15:35:19 +00:00
ldx #0
.2 cmp PS.Table.PID,x
beq .3
inx
cpx CORE.PSCount
bne .2
2019-07-29 15:38:55 +00:00
bra *
2019-07-19 15:35:19 +00:00
.3 stz PS.Table.PID,x
lda PS.TABLE.hPS,x
stz PS.TABLE.hPS,x
2019-07-29 15:38:55 +00:00
jmp K.FreeMem
2019-07-19 15:35:19 +00:00
2019-07-29 15:38:55 +00:00
.10 .DA #S.PS.hSS,#S.PS.hDS,#S.PS.hCS
2020-01-18 19:37:32 +00:00
.DA #S.PS.hARGV,#S.PS.hCWD
2019-07-29 15:38:55 +00:00
*/--------------------------------------
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
* ## C
2020-12-15 13:23:22 +00:00
* `int loadtxtfile ( const char * filename );`
2019-07-29 15:38:55 +00:00
* ## ASM
* **In:**
2020-12-15 13:23:22 +00:00
* `>LDYA filename`
2019-07-29 15:38:55 +00:00
* `>SYSCALL loadtxtfile`
* ## RETURN VALUE
* Y,A = File Length (without ending 0)
* X = hMem of Loaded File
*\--------------------------------------
2020-12-15 13:23:22 +00:00
K.LoadTxtFile >PUSHYA
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
sec
2019-07-29 15:38:55 +00:00
.HS 90 BCC
*/--------------------------------------
* # LoadFile
* Load a file in memory
* ## C
* `int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
* ## ASM
* **In:**
2020-02-18 06:55:54 +00:00
* `>PUSHW filename`
2019-07-29 15:38:55 +00:00
* `>PUSHB flags`
2020-02-18 06:55:54 +00:00
* `>PUSHB ftype`
* `>PUSHW auxtype`
2019-07-29 15:38:55 +00:00
* `>SYSCALL loadfile`
* ## RETURN VALUE
* Y,A = File Length
* X = hMem of Loaded File
*\--------------------------------------
K.LoadFile clc
2020-12-15 13:23:22 +00:00
2020-11-19 15:34:02 +00:00
ror PS.bTXT
2020-08-19 19:39:43 +00:00
2020-02-14 07:21:56 +00:00
>SYSCALL2 FOpen
2020-08-19 19:39:43 +00:00
bcs .99
2019-07-29 15:38:55 +00:00
2020-11-19 15:34:02 +00:00
sta PS.hFILE
2020-12-15 13:23:22 +00:00
>PUSHA
>PUSHWI K.S.Stat
>SYSCALL2 FStat
2020-08-19 19:39:43 +00:00
bcs .98
2019-07-29 15:38:55 +00:00
lda K.S.Stat+S.STAT.SIZE+3
ora K.S.Stat+S.STAT.SIZE+2
2020-08-19 19:39:43 +00:00
bne .97
2019-07-29 15:38:55 +00:00
>LDYA K.S.Stat+S.STAT.SIZE
2020-11-19 15:34:02 +00:00
bit PS.bTXT Add 1 to buffer size for ending 0
2019-07-29 15:38:55 +00:00
bpl .1
2020-12-15 13:23:22 +00:00
2019-07-29 15:38:55 +00:00
iny
bne .1
2020-12-15 13:23:22 +00:00
2019-07-29 15:38:55 +00:00
inc
bne .1
2020-02-14 07:21:56 +00:00
2020-08-19 19:39:43 +00:00
.97 lda #E.FTB
.98 pha
2020-11-19 15:34:02 +00:00
lda PS.hFILE
2020-08-19 19:39:43 +00:00
>SYSCALL2 FClose
pla
sec
.99 rts
*--------------------------------------
2019-07-29 15:38:55 +00:00
.1 jsr K.GetMem
2020-08-19 19:39:43 +00:00
bcs .96
2020-11-19 15:34:02 +00:00
>STYA PS.MemPtr
stx PS.hMem
2020-08-19 19:39:43 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB PS.hFILE
2020-11-19 15:34:02 +00:00
>PUSHW PS.MemPtr
2021-05-14 20:58:20 +00:00
>PUSHWI $ffff
>SYSCALL2 fread
2020-08-19 19:39:43 +00:00
bcs .96
2020-02-14 07:21:56 +00:00
2020-08-19 19:39:43 +00:00
sty .7+1
2019-07-29 15:38:55 +00:00
sta .8+1
2020-11-19 15:34:02 +00:00
bit PS.bTXT
2019-07-29 15:38:55 +00:00
bpl .5
pha set ending 0
tya
* clc
2020-11-19 15:34:02 +00:00
adc PS.MemPtr
2019-07-29 15:38:55 +00:00
sta .4+1
pla
2020-11-19 15:34:02 +00:00
adc PS.MemPtr+1
2019-07-29 15:38:55 +00:00
sta .4+2
.4 stz $ffff Self Modified
2020-08-19 19:39:43 +00:00
.5 jsr .98 FClose
2019-10-03 06:25:27 +00:00
2019-07-29 15:38:55 +00:00
.7 ldy #$ff SELFMODIFIED
.8 lda #$ff SELFMODIFIED
2020-11-19 15:34:02 +00:00
ldx PS.hMem
2019-07-29 15:38:55 +00:00
clc
rts
2020-08-19 19:39:43 +00:00
.96 pha
jsr .98 FClose
2020-11-19 15:34:02 +00:00
lda PS.hMem
2020-08-19 19:39:43 +00:00
jsr K.FreeMem
pla
sec
.9 rts
2019-07-29 15:38:55 +00:00
*/--------------------------------------
2020-01-17 11:23:11 +00:00
* # FileSearch
* Search a file in the provided PATH list
* And return, if found, the full path to it.
* ## C
2020-02-18 06:55:54 +00:00
* `int filesearch( char *filename, char *searchpath, char *fullpath, stat *filestat);`
2020-01-17 11:23:11 +00:00
* ## ASM
* **In:**
2020-02-18 06:55:54 +00:00
* `>PUSHW filename`
* `>PUSHW fullpath`
* `>PUSHW searchpath`
* `>PUSHW filestat`
* `>SYSCALL filesearch`
2020-01-17 11:23:11 +00:00
* ## RETURN VALUE
* CC : success
* DstBuf = FilePath
* DstStat = S.STAT
* CS : not found
*\--------------------------------------
K.FileSearch >PULLW .4+1 DstStat
>PULLW .2+1 DstBuf
2020-09-25 12:05:23 +00:00
>PULLW PS.Find.2+1 path to search
>PULLW PS.Find.4+1 filename to find
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
stz PS.Find.98+1
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
jsr PS.Find
2021-04-10 17:17:40 +00:00
bcs .9
2020-01-17 11:23:11 +00:00
ldx #$ff
.1 inx
lda K.Buf256,x
.2 sta $ffff,x Self Modified
bne .1
2021-04-10 17:17:40 +00:00
2020-01-17 11:23:11 +00:00
ldx #S.STAT-1
.3 lda K.S.STAT,x
.4 sta $ffff,x Self Modified
dex
bpl .3
2021-04-10 17:17:40 +00:00
2020-01-17 11:23:11 +00:00
* clc
2021-04-10 17:17:40 +00:00
.9 rts
2020-01-17 11:23:11 +00:00
*--------------------------------------
2020-09-25 12:05:23 +00:00
PS.Find.CWD >STYA PS.Find.4+1 filename to find
2020-01-17 11:23:11 +00:00
ldy #S.PS.hCWD
lda (PS.NewPSPtr),y
jsr K.GetMemPtr
2020-09-25 12:05:23 +00:00
>STYA PS.Find.2+1
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
stz PS.Find.98+1
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
bra PS.Find
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
PS.Find.LIB ldx #0
2020-01-17 11:23:11 +00:00
.HS 2C BIT ABS
2020-09-25 12:05:23 +00:00
PS.Find.DRV ldx #2
2020-01-17 11:23:11 +00:00
.HS 2C BIT ABS
2020-09-25 12:05:23 +00:00
PS.Find.PATH ldx #4
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
>STYA PS.Find.4+1 filename to find
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
>PUSHW PS.VARS,x
2020-01-17 11:23:11 +00:00
>PUSHWI 0 allocate...
2020-02-06 16:23:59 +00:00
>SYSCALL2 GetEnv get value for Search Path
2021-04-10 17:17:40 +00:00
bcs PS.Find.RTS
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
>STYA PS.Find.2+1
stx PS.Find.98+1
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
PS.Find stz PS.Find.1+1
2020-12-15 13:23:22 +00:00
2020-09-25 12:05:23 +00:00
PS.Find.1 ldy #0 Self Modified Index in Search list string
2020-01-17 11:23:11 +00:00
ldx #0
2020-09-25 12:05:23 +00:00
PS.Find.2 lda $ffff,y SELF MODIFIED
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
beq PS.Find.3 end of string, try it....
2020-01-17 11:23:11 +00:00
iny
cmp #':'
2020-09-25 12:05:23 +00:00
beq PS.Find.3
2020-01-17 11:23:11 +00:00
sta K.Buf256,x
inx
2020-09-25 12:05:23 +00:00
bra PS.Find.2
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
PS.Find.3 txa
beq PS.Find.98 String is empty....nothing to try
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
sty PS.Find.1+1 save current index
2020-01-17 11:23:11 +00:00
ldy #0
2020-09-25 12:05:23 +00:00
PS.Find.4 lda $ffff,y Self Modified, Append Filename...
2020-01-17 11:23:11 +00:00
sta K.Buf256,x
2020-09-25 12:05:23 +00:00
beq PS.Find.5
2020-01-17 11:23:11 +00:00
iny
inx
2020-09-25 12:05:23 +00:00
bra PS.Find.4
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
PS.Find.5 >LDYAI K.Buf256
2020-12-15 13:23:22 +00:00
jsr PS.STAT.YA
2021-03-17 19:49:39 +00:00
bcs PS.Find.1 Failed...retry next path...
2020-01-17 11:23:11 +00:00
2021-03-17 19:49:39 +00:00
lda K.S.STAT+S.STAT.MODE+1
cmp /S.STAT.MODE.DIR Dir ?
2020-09-25 12:05:23 +00:00
beq PS.Find.1
2021-03-17 19:49:39 +00:00
2020-09-25 12:05:23 +00:00
jsr PS.Find.98 Discard Expanded hSrch list
2020-01-17 11:23:11 +00:00
clc
2021-04-10 17:17:40 +00:00
PS.Find.RTS rts
2020-01-17 11:23:11 +00:00
2020-09-25 12:05:23 +00:00
PS.Find.98 lda #$ff SELF MODIFIED : Discard Search list
2020-01-17 11:23:11 +00:00
beq .1
2020-12-15 13:23:22 +00:00
2020-01-17 11:23:11 +00:00
jsr K.FreeMem
.1 lda #MLI.E.FNOTFND
sec
rts
*--------------------------------------
2020-09-25 12:05:23 +00:00
PS.Buf2IO ldx #$ff
.1 inx Save Script name in IOBuf
lda K.Buf256,x
sta K.IOBuf,x
bne .1
rts
*--------------------------------------
2020-12-15 13:23:22 +00:00
PS.STAT.YA >PUSHYA
>PUSHWI K.S.STAT
>SYSCALL2 Stat
rts
*--------------------------------------
2020-09-25 12:05:23 +00:00
PS.SHUTDOWN .AZ "shutdown"
*PS.T .AZ " -T 3"
PS.VARS .DA .1
2020-01-17 11:23:11 +00:00
.DA .2
.DA .3
.1 .AZ "LIB"
.2 .AZ "DRV"
.3 .AZ "PATH"
*/--------------------------------------
2019-07-29 15:38:55 +00:00
* # GetMemStat
* **In:**
* Y,A = Ptr to 24 bytes buffer
* ## RETURN VALUE
* Buffer filled with memory stats
*\--------------------------------------
K.GetMemStat >STYA ZPPtr1
ldy #23
ldx #7
2020-09-25 12:05:23 +00:00
2019-07-29 15:38:55 +00:00
.1 lda DevMgr.Stat,x
sta (ZPPtr1),y
dey
dex
bpl .1
sta SETREADAUX
jsr .2
sta CLRREADAUX
2020-09-25 12:05:23 +00:00
2019-07-29 15:38:55 +00:00
.2 ldx #7
2020-09-25 12:05:23 +00:00
2019-07-29 15:38:55 +00:00
.3 lda Mem.Table,x
sta (ZPPtr1),y
dey
dex
bpl .3
2020-09-25 12:05:23 +00:00
2019-07-30 08:57:25 +00:00
clc
2019-07-29 15:38:55 +00:00
rts
2019-07-19 15:35:19 +00:00
*--------------------------------------
2016-08-17 06:25:58 +00:00
MAN
2020-12-15 13:23:22 +00:00
SAVE usr/src/sys/kernel.s.ps
LOAD usr/src/sys/kernel.s
2016-08-17 06:25:58 +00:00
ASM