A2osX/BIN/WHO.S.txt

146 lines
2.9 KiB
Plaintext
Raw Normal View History

2019-04-15 05:40:13 +00:00
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2020-01-09 16:24:46 +00:00
.TF bin/who
2019-04-15 05:40:13 +00:00
*--------------------------------------
2020-07-08 15:26:23 +00:00
.INB inc/macros.i
.INB inc/io.i
.INB inc/mli.i
.INB inc/a2osx.i
.INB inc/kernel.i
2019-04-15 05:40:13 +00:00
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
2020-01-09 16:44:20 +00:00
SessionID .BS 1
2020-07-30 13:59:04 +00:00
hSession .BS 1
2019-04-26 15:07:22 +00:00
ZPSessionPtr .BS 2
2020-03-23 07:08:27 +00:00
ZS.END .ED
2019-04-15 05:40:13 +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
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
2019-04-15 05:40:13 +00:00
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
2020-07-30 13:59:04 +00:00
CS.RUN >LDYA L.MSG0
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2019-04-15 05:40:13 +00:00
ldx #1
2020-01-09 16:44:20 +00:00
stx SessionID
2020-01-09 16:24:46 +00:00
2020-07-08 15:26:23 +00:00
.1 lda S.Table.hSID-1,x
2019-04-15 05:40:13 +00:00
beq .7
2020-01-09 16:24:46 +00:00
2020-07-30 13:59:04 +00:00
>SYSCALL GetStkObj
>STYA ZPSessionPtr
stx hSession
2020-01-09 16:24:46 +00:00
2020-01-09 16:44:20 +00:00
>PUSHW L.MSG1 format
>PUSHB SessionID 1 byte SID
2020-02-04 16:27:37 +00:00
ldx SessionID
2020-07-08 15:26:23 +00:00
lda S.Table.hSID-1,x
2020-02-04 16:27:37 +00:00
>PUSHA 1 byte hSession
2020-07-30 13:59:04 +00:00
>PUSHB (ZPSessionPtr) 1 byte PRIVILEGE
2020-02-04 14:35:48 +00:00
2020-01-09 16:44:20 +00:00
ldy #S.SESSION.UID
2020-07-30 13:59:04 +00:00
>PUSHB (ZPSessionPtr),y 1 byte UID
2020-01-09 16:44:20 +00:00
2020-02-04 14:35:48 +00:00
iny #S.SESSION.UID
2020-07-30 13:59:04 +00:00
>PUSHB (ZPSessionPtr),y 1 byte GID
2020-01-09 16:44:20 +00:00
2020-07-30 13:59:04 +00:00
lda ZPSessionPtr
2019-04-15 05:40:13 +00:00
clc
2019-04-16 15:54:56 +00:00
adc #S.SESSION.NAME
2019-04-15 05:40:13 +00:00
tay
2020-07-30 13:59:04 +00:00
lda ZPSessionPtr+1
2019-04-16 15:54:56 +00:00
adc /S.SESSION.NAME
2020-01-09 16:44:20 +00:00
>PUSHYA 2 bytes NAME
2020-01-09 16:24:46 +00:00
2020-01-09 16:44:20 +00:00
ldx SessionID
lda S.Table.hFile-1,x
2020-07-08 15:26:23 +00:00
jsr CS.RUN.GetDevName
2020-01-09 16:44:20 +00:00
>PUSHYA 2 bytes DEV
2020-01-09 16:24:46 +00:00
2020-02-04 16:27:37 +00:00
>PUSHBI 9 total = 9 ... bytes
2020-01-09 16:24:46 +00:00
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2020-07-30 13:59:04 +00:00
lda hSession
2020-08-19 19:39:43 +00:00
>SYSCALL FreeMem
2020-01-09 16:24:46 +00:00
2020-01-09 16:44:20 +00:00
.7 inc SessionID
ldx SessionID
2019-04-15 05:40:13 +00:00
cpx #K.USR.MAX+1
2020-07-30 13:59:04 +00:00
beq .8
jmp .1
2020-01-09 16:24:46 +00:00
2019-04-15 05:40:13 +00:00
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
.9 rts
*--------------------------------------
2020-07-08 15:26:23 +00:00
CS.RUN.GetDevName
2019-04-15 15:29:07 +00:00
tax
2020-12-15 13:23:22 +00:00
lsr
bcc .1
2019-04-15 15:29:07 +00:00
lda Dev.Table-1,x
clc
adc #S.FD.DEV
tay
lda Dev.Table,x
adc /S.FD.DEV
2020-01-09 16:24:46 +00:00
* clc
2019-04-15 15:29:07 +00:00
rts
2020-01-09 16:24:46 +00:00
2020-12-15 13:23:22 +00:00
.1 lda Nod.Table.hFD-2,x
>SYSCALL GetMemPtr
2019-04-15 15:29:07 +00:00
rts
*--------------------------------------
2019-04-15 05:40:13 +00:00
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
CS.END
2020-02-04 16:27:37 +00:00
MSG0 .AZ "SID hSD Privilege UID GID Name Dev"
MSG1 .AZ "%3d $%0h %b %3d %3d %16s %s\r\n"
2019-04-15 05:40:13 +00:00
*--------------------------------------
.DUMMY
.OR 0
DS.START
2020-08-19 19:39:43 +00:00
DS.END .ED
2019-04-15 05:40:13 +00:00
*--------------------------------------
MAN
2020-07-08 15:26:23 +00:00
SAVE usr/src/bin/who.s
2019-04-15 05:40:13 +00:00
ASM