Kernel 0.9.1 : Code reorganization & move to CSTR : External commands (PS)

This commit is contained in:
Rémy GIBERT 2017-09-21 08:35:44 +02:00
parent 832cb80c06
commit 38c8649e23
8 changed files with 50 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View File

@ -12,8 +12,6 @@ AUTO 6
.INB /A2OSX.BUILD/INC/A2OSX.I .INB /A2OSX.BUILD/INC/A2OSX.I
*-------------------------------------- *--------------------------------------
ZPPTR1 .EQ ZPBIN ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
ZPPTR3 .EQ ZPBIN+4
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -40,15 +38,23 @@ L.MSG1 .DA MSG1
CS.INIT clc CS.INIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN >LDYAI TSKMGR.TABLE+S.PS CS.RUN >LDYA pData
>STYA ZPPTR1 >SYSCALL GetPSList.YA
stz PS.COUNT
>LDYA L.MSG0 >LDYA L.MSG0
>SYSCALL PrintF.YA >SYSCALL PrintF.YA
.1 lda (ZPPTR1) lda (pData) PS.COUNT
bpl .4 beq .8
.1 dec
asl
tay
lda (pData),y PID
ldy #S.PS.hARGS ldy #S.PS.hARGS
lda (ZPPTR1),y lda (ZPPTR1),y
@ -75,12 +81,12 @@ CS.RUN >LDYAI TSKMGR.TABLE+S.PS
bcc .5 bcc .5
inc ZPPTR1+1 inc ZPPTR1+1
.5 inc PS.COUNT .7 lda (pData) PS.COUNT
lda PS.COUNT dec
cmp #K.PS.MAX sta (pData)
bne .1 bne .1
lda #0 tell TSKMGR that all done ok, but .8 lda #0 tell Kernel that all done ok, but
sec we do not want to stay in memory sec we do not want to stay in memory
rts rts
*-------------------------------------- *--------------------------------------
@ -91,9 +97,17 @@ CS.QUIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.END CS.END
PS.COUNT .BS 1
MSG0 >CSTR "ID Flags PID Command Line\r\n" MSG0 >CSTR "ID Flags PID Command Line\r\n"
MSG1 >CSTR "%03d %b %03d %S\r\n" MSG1 >CSTR "%03d %b %03d %S\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
PS.COUNT .BS 1
PS.DATA .BS K.PS.MAX+K.PS.MAX
DS.END
.ED
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/BIN/PS.S SAVE /A2OSX.SRC/BIN/PS.S
ASM ASM

View File

@ -263,7 +263,7 @@ SYS.CreateProcessYA .EQ $A6
* .EQ $A8 * .EQ $A8
* .EQ $AA * .EQ $AA
* .EQ $AC * .EQ $AC
* .EQ $AE SYS.GetPSList.YA .EQ $AE
SYS.GetArgC .EQ $B0 SYS.GetArgC .EQ $B0
SYS.GetArg.A .EQ $B2 SYS.GetArg.A .EQ $B2

View File

@ -8,6 +8,7 @@ AUTO 6
CMD.Init >LDYAI CmdLine.MAX+1 CMD.Init >LDYAI CmdLine.MAX+1
>SYSCALL GetMem.YA >SYSCALL GetMem.YA
bcs .9 bcs .9
>STYA ZPCMDBuf
txa txa
>STA.G hCmdBuf >STA.G hCmdBuf
.9 rts .9 rts

View File

@ -139,11 +139,7 @@ CS.RUN >LDA.G bReadMode READ Command ?
jmp CS.RUN.BATCH jmp CS.RUN.BATCH
*-------------------------------------- *--------------------------------------
.10 >LDA.G hCmdBuf Get the buffer .10 jsr CmdLine.RESET reset CmdBuf
>SYSCALL GetMemPtr.A
>STYA ZPCMDBuf
jsr CmdLine.RESET reset it
.12 jsr PrintPrompt .12 jsr PrintPrompt
bcs CS.RUN.EXIT.RTS bcs CS.RUN.EXIT.RTS
@ -160,7 +156,7 @@ CS.RUN >LDA.G bReadMode READ Command ?
jsr CMD.Parse jsr CMD.Parse
>LDA.G CmdBuflen >LDA.G CmdBuflen
beq .12 Empty line beq .8 Empty line
jsr HIS.Add jsr HIS.Add
@ -507,7 +503,6 @@ CmdLine.RESET lda #0
sta (ZPCMDBuf) sta (ZPCMDBuf)
>STA.G bCmdBufexec >STA.G bCmdBufexec
>STA.G CmdBuflen >STA.G CmdBuflen
>STA.G bCmdBufExec
>STA.G bSecureRead Clear password mode >STA.G bSecureRead Clear password mode
rts rts
*-------------------------------------- *--------------------------------------

View File

@ -107,7 +107,7 @@ K.SYSCALL.JMP .DA 0 $00
.DA 0 .DA 0
.DA 0 .DA 0
.DA 0 .DA 0
.DA 0 .DA K.GetPSList.YA
.DA K.GetArgC $B0 .DA K.GetArgC $B0
.DA K.GetArg.A .DA K.GetArg.A

View File

@ -356,6 +356,25 @@ PS.DupEnv.A jsr K.GetMemPtr.A
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
K.GetPSList.YA >STYA ZPPtr1
lda CORE.PSCount
sta (ZPPtr1)
ldx #0
ldy #1
.1 lda PS.Table.PID,x
sta (ZPPtr1),y
iny
lda PS.Table.hMem,x
sta (ZPPtr1),y
iny
inx
cpx CORE.PSCount
bne .1
rts
*--------------------------------------
MAN MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.PS SAVE /A2OSX.SRC/SYS/KERNEL.S.PS
LOAD /A2OSX.SRC/SYS/KERNEL.S LOAD /A2OSX.SRC/SYS/KERNEL.S