Kernel 0.9.1 : KERNEL, room in MEM API to add missing GetStkObjProperty function

This commit is contained in:
Rémy GIBERT 2018-05-07 16:59:51 +02:00
parent 5bdf3479dd
commit c8e77c9006
13 changed files with 190 additions and 140 deletions

View File

@ -212,14 +212,6 @@ Return Float rounded into a long
+ PUSHW = X (*Float) + PUSHW = X (*Float)
+ Y,A = Dest (*long) + Y,A = Dest (*long)
# GetMemStat.YA
## In:
+ Y,A = Ptr to 24 bytes buffer
## Out:
+ Buffer filled with memory stats
# GetMem0.YA # GetMem0.YA
## In: ## In:
@ -342,18 +334,14 @@ Create a new copy of this C-String
## Out: ## Out:
# LoadStkObj # GetStkObjProperty.AY
Load a file in AUX memory (Stock Objects)
## In: ## In:
+ PUSHW = AUXTYPE (Handled by.... + A = hObject (AUX Memory)
+ PUSHB = TYPE ... + Y = Property Index
+ PUSHB = MODE ...
+ PUSHW = PATH ...FOpen)
## Out: ## Out:
+ Y,A = File Length + Y,A = Property Value
+ X = hMem of Loaded Object in AUX mem
# NewStkObj.YA # NewStkObj.YA
@ -376,6 +364,19 @@ Load a file in AUX memory (Stock Objects)
+ none. + none.
+ (X,Y unmodified) + (X,Y unmodified)
# LoadStkObj
Load a file in AUX memory (Stock Objects)
## In:
+ PUSHW = AUXTYPE (Handled by....
+ PUSHB = TYPE ...
+ PUSHB = MODE ...
+ PUSHW = PATH ...FOpen)
## Out:
+ Y,A = File Length
+ X = hMem of Loaded Object in AUX mem
# ExecPSNewEnv.YA # ExecPSNewEnv.YA
# ExecPS.YA (Blocking Parent PID) # ExecPS.YA (Blocking Parent PID)
@ -390,6 +391,30 @@ Load a file in AUX memory (Stock Objects)
## Out: ## Out:
+ A = Child PSID + A = Child PSID
# GetMemStat.YA
## In:
+ Y,A = Ptr to 24 bytes buffer
## Out:
+ Buffer filled with memory stats
# GetPSStatus.A
## In:
+ A = PID
## Out:
+ A = Status Byte
# GetPSStat.YA
## In:
+ Y,A = Ptr to 24 bytes buffer
## Out:
+ Buffer filled with PS stats
# Stat # Stat
Return information about a file Return information about a file

Binary file not shown.

Binary file not shown.

View File

@ -40,7 +40,7 @@ CS.INIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN >LDYA pData CS.RUN >LDYA pData
>SYSCALL GetPSList.YA >SYSCALL GetPSStat.YA
>LDYA L.MSG0 >LDYA L.MSG0
>SYSCALL PrintF.YA >SYSCALL PrintF.YA

View File

@ -171,9 +171,9 @@ SYS.ExecPS.YA .EQ $A2
SYS.CreatePSNewEnv.YA .EQ $A4 SYS.CreatePSNewEnv.YA .EQ $A4
SYS.CreatePS.YA .EQ $A6 SYS.CreatePS.YA .EQ $A6
* .EQ $A8 * .EQ $A8
* .EQ $AA SYS.GetMemStat.YA .EQ $AA
SYS.GetPSStatus.A .EQ $AC SYS.GetPSStatus.A .EQ $AC
SYS.GetPSList.YA .EQ $AE SYS.GetPSStat.YA .EQ $AE
* .EQ $B0 * .EQ $B0
SYS.GetArg.A .EQ $B2 SYS.GetArg.A .EQ $B2
@ -205,7 +205,7 @@ SYS.Tan .EQ $DA
SYS.ATan .EQ $DC SYS.ATan .EQ $DC
* .EQ $DF * .EQ $DF
*-------------------------------------- *--------------------------------------
SYS.GetMemStat.YA .EQ $E0 SYS.GetStkObjProperty.AY .EQ $E0
SYS.FreeMem.A .EQ $E2 SYS.FreeMem.A .EQ $E2
SYS.GetMemPtr.A .EQ $E4 SYS.GetMemPtr.A .EQ $E4
SYS.GetMemByID.A .EQ $E6 SYS.GetMemByID.A .EQ $E6

View File

@ -104,11 +104,6 @@ S.RECT.Y2 .EQ 6
* *
S.RECT .EQ 8 S.RECT .EQ 8
*-------------------------------------- *--------------------------------------
T.WND .EQ 0
T.MENU .EQ 2
T.BUTTON .EQ 4
T.TEXT .EQ 6
*--------------------------------------
S.WND.T .EQ 0 S.WND.T .EQ 0
S.WND.F .EQ 1 S.WND.F .EQ 1
S.WND.F.RESIZE .EQ %00000001 S.WND.F.RESIZE .EQ %00000001
@ -163,6 +158,21 @@ S.MITEM.TEXTLEN .EQ 5
S.MITEM.TEXT .EQ 6 CSTR S.MITEM.TEXT .EQ 6 CSTR
* ... * ...
*-------------------------------------- *--------------------------------------
S.CTRL.T .EQ 0
S.CTRL.T.WND .EQ 0
S.CTRL.T.MENU .EQ 2
S.CTRL.T.BUT .EQ 4
S.CTRL.T.TEXT .EQ 6
S.CTRL.F .EQ 1
S.CTRL.ID .EQ 3
S.CTRL.hOWNER .EQ 4
S.CTRL.hPARENT .EQ 5
S.CTRL.X .EQ 6
S.CTRL.Y .EQ 8
S.CTRL.W .EQ 10
S.CTRL.H .EQ 12
*--------------------------------------
S.BUT.T .EQ 0 S.BUT.T .EQ 0
S.BUT.F .EQ 1 S.BUT.F .EQ 1
S.BUT.F.DISABLED .EQ %10000000 S.BUT.F.DISABLED .EQ %10000000

View File

@ -4,16 +4,27 @@ AUTO 4,1
*-------------------------------------- *--------------------------------------
BUT.New >STYA ZPPtr1 BUT.New >STYA ZPPtr1
ldy #S.CTRL.W
lda (ZPPtr1),y
iny
ora (ZPPtr1),y
bne . W in !NULL, static size
ldy #S.BUT.hBM ldy #S.BUT.hBM
lda (ZPPtr1),y lda (ZPPtr1),y
beq . beq .1
>SYSCALL
lda #0
ldy #
sta
ldy #S.BM.W
>SYSCALL GetStkObjProperty.AY
phy
ldy #S.CTRL.W+1
sta (ZPPtr1),y
dey
pla
sta (ZPPtr1),y
.1 ldy
*-------------------------------------- *--------------------------------------
BUT.Draw BUT.Draw

View File

@ -271,6 +271,8 @@ DEVNAME.GFX .AZ "GFX"
DEVNAME.MOUSE .AZ "MOU1" DEVNAME.MOUSE .AZ "MOU1"
*-------------------------------------- *--------------------------------------
hDevMouse .BS 1 hDevMouse .BS 1
hSYSFON .BS 1
hSYSFONB .BS 1
*-------------------------------------- *--------------------------------------
DX .BS 2 DX .BS 2
DY .BS 2 DY .BS 2

View File

@ -9,18 +9,19 @@ AUTO 4,1
* X = hMem to Expanded String (C-String) * X = hMem to Expanded String (C-String)
* Y,A = PTR to Expanded String * Y,A = PTR to Expanded String
*\-------------------------------------- *\--------------------------------------
K.ExpandStr.YA stz ENV.hStr Reset Intermediate string... K.ExpandStr.YA stz .88+1 Reset Intermediate string...
.1 >STYA ZPPtr2 .1 >STYA ZPPtr2
stz ENV.BufLen init Expanded String len=0 stz ENV.BufLen init Expanded String len=0
stz ENV.bFound No var found yet
stz .82+1 No var found yet
stz ENV.bNoExp Reset no expand flag stz ENV.bNoExp Reset no expand flag
ldy #0 ldy #0
.10 stz ENV.VarLen .10 stz ENV.VarLen
stz ENV.bInVar stz .23+1 reset In var flag
.11 lda (ZPPtr2),y End of CSTR? .11 lda (ZPPtr2),y End of CSTR?
beq .8 beq .8
@ -33,7 +34,7 @@ K.ExpandStr.YA stz ENV.hStr Reset Intermediate string...
lda ENV.bNoExp lda ENV.bNoExp
eor #$ff eor #$ff
sta ENV.bNoExp toggle flag sta ENV.bNoExp toggle flag
bra .11 bra .11
.21 bit ENV.bNoExp .21 bit ENV.bNoExp
bpl .23 bpl .23
@ -41,14 +42,15 @@ K.ExpandStr.YA stz ENV.hStr Reset Intermediate string...
.22 jsr ENV.AddAToBuf .22 jsr ENV.AddAToBuf
bra .11 bra .11
.23 ldx ENV.bInVar already in a var? .23 ldx #$ff SELF MODIFIED already in a var?
bne .3 yes... bne .3 yes...
cmp #'$' no, found one ? cmp #'$' no, found one ?
bne .22 no, store... bne .22 no, store...
sta ENV.bFound Toggle flag sta .82+1 Toggle Expanded flag
sta ENV.bInVar
sta .23+1 Set In Var flag
bra .11 skip this char bra .11 skip this char
@ -98,7 +100,7 @@ K.ExpandStr.YA stz ENV.hStr Reset Intermediate string...
stz ENV.VarName,x stz ENV.VarName,x
jsr ENV.GetValue yes, expand and add to STR jsr ENV.GetValue yes, expand and add to STR
.80 lda ENV.hStr working from our temp string ? .80 lda .88+1 working from our temp string ?
beq .81 no... beq .81 no...
jsr K.FreeMem.A yes, discard.... jsr K.FreeMem.A yes, discard....
@ -109,28 +111,16 @@ K.ExpandStr.YA stz ENV.hStr Reset Intermediate string...
>LDYAI K.Buf256 >LDYAI K.Buf256
jsr K.NewStr.YA jsr K.NewStr.YA
bcs .9 bcs .9
stx ENV.hStr save this as temp string, in case of recurse
ldx ENV.bFound Did we expand something ? stx .88+1 save this as temp string, in case of recurse
beq .82 .82 ldx #$ff SELF MODIFIED Did we expand something ?
beq .88
jmp .1 Yes, start over with hPStr jmp .1 Yes, start over with hPStr
.82 ldx ENV.hStr .88 ldx #$ff SELF MODIFIED
* or exit with Y,A from K.NewStrYA * or exit with Y,A from K.NewStrYA
.9 rts .9 rts
*--------------------------------------
ENV.GetValue jsr ENV.ExpandSysVar
bcc .9
>LDYAI ENV.VarName
jsr K.GetEnv.YA
bcs .9
>STYA ZPPtr3
jsr ENV.AddP3ToBuf
.9 rts
*/-------------------------------------- */--------------------------------------
* # PutEnv.YA * # PutEnv.YA
* ## In: * ## In:
@ -143,8 +133,10 @@ K.PutEnv.YA >STYA ZPPtr1 NAME=VALUE
.1 lda (ZPPtr1),y copy STR to K.Buf256 .1 lda (ZPPtr1),y copy STR to K.Buf256
beq .9 beq .9
cmp #'=' cmp #'='
beq .2 beq .2
sta K.Buf256,y sta K.Buf256,y
iny iny
bne .1 bne .1
@ -300,10 +292,32 @@ K.UnsetEnv.I jsr ENV.FindVarP1
jsr ENV.DelVarP3 Ptr3 -> ENVNAME jsr ENV.DelVarP3 Ptr3 -> ENVNAME
K.UnsetEnv.I.8 clc K.UnsetEnv.I.8 clc
rts K.UnsetEnv.I.9 rts
*-------------------------------------- *--------------------------------------
* PRIVATE * PRIVATE
*-------------------------------------- *--------------------------------------
ENV.GetValue jsr ENV.ExpandSysVar
bcc K.UnsetEnv.I.9
>LDYAI ENV.VarName
jsr K.GetEnv.YA
bcs K.UnsetEnv.I.9
*--------------------------------------
ENV.AddYAToBuf >STYA ZPPtr3
*--------------------------------------
ENV.AddP3ToBuf ldx ENV.BufLen
ldy #$ff
dex
.1 iny
inx
lda (ZPPtr3),y
sta K.Buf256,x
bne .1
stx ENV.BufLen
rts
*--------------------------------------
* ENV.ExpandSysVar * ENV.ExpandSysVar
* In: * In:
* ENV.VarLen,ENV.VarName * ENV.VarLen,ENV.VarName
@ -326,8 +340,7 @@ ENV.ExpandSysVar
jsr K.GetArg.A jsr K.GetArg.A
bcs K.UnsetEnv.I.8 Arg# is undefined, do not append anything bcs K.UnsetEnv.I.8 Arg# is undefined, do not append anything
>STYA ZPPtr3 jmp ENV.AddYAToBuf
jmp ENV.AddP3ToBuf
.1 ldx #ENV.SysVarsJmp-ENV.SysVars-1 .1 ldx #ENV.SysVarsJmp-ENV.SysVars-1
@ -361,19 +374,16 @@ ENV.SysVarsArgs lda #1
.1 lda (ZPPtr3) .1 lda (ZPPtr3)
beq .8 beq .8
jsr ENV.AddP3ToBuf
.2 jsr ENV.AddP3ToBuf
.2 jsr ENV.NextEnvP3 jsr ENV.NextEnvP3
lda (ZPPtr3) lda (ZPPtr3)
beq .8 beq .8
inx
beq .8 make sure not overlapping buf 256
lda #' ' lda #' '
sta K.Buf256,x jsr ENV.AddAToBuf
stx ENV.BufLen
jsr ENV.AddP3ToBuf
bra .2 bra .2
.8 clc .8 clc
@ -412,13 +422,10 @@ ENV.SysVarsCPID ldy #S.PS.CPID
cld cld
ldx ENV.BufLen
lda .3+1 lda .3+1
beq .4 beq .4
ora #$30 jsr ENV.AddAToBuf30
sta K.Buf256,x
inx
.4 lda .2+1 .4 lda .2+1
pha pha
@ -428,19 +435,14 @@ ENV.SysVarsCPID ldy #S.PS.CPID
lsr lsr
beq .5 beq .5
ora #$30 jsr ENV.AddAToBuf30
sta K.Buf256,x
inx
.5 pla .5 pla
and #$0f and #$0f
.8 ora #$30 .8 jsr ENV.AddAToBuf30
sta K.Buf256,x
inx
stx ENV.BufLen
clc clc
rts rts
*-------------------------------------- *--------------------------------------
@ -536,31 +538,17 @@ ENV.NextEnvP3 ldy #0
inc ZPPtr3+1 inc ZPPtr3+1
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
ENV.AddP3ToBuf ldx ENV.BufLen ENV.AddAToBuf30 ora #$30
ldy #$ff
dex
.1 iny
inx
lda (ZPPtr3),y
sta K.Buf256,x
bne .1
stx ENV.BufLen
rts
*--------------------------------------
ENV.AddAToBuf ldx ENV.BufLen ENV.AddAToBuf ldx ENV.BufLen
sta K.Buf256,x sta K.Buf256,x
inx inc ENV.BufLen
stx ENV.BufLen
rts rts
*-------------------------------------- *--------------------------------------
ENV.BufLen .BS 1 ENV.BufLen .BS 1
ENV.bNoExp .BS 1 ENV.bNoExp .BS 1
ENV.bInVar .BS 1
ENV.bFound .BS 1
ENV.hStr .BS 1
ENV.VarLen .BS 1 ENV.VarLen .BS 1
ENV.VarNamePtr .BS 2
ENV.VarName .BS 16 ENV.VarName .BS 16
*-------------------------------------- *--------------------------------------
MAN MAN

View File

@ -103,9 +103,9 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.CreatePSNewEnv.YA .DA K.CreatePSNewEnv.YA
.DA K.CreatePS.YA .DA K.CreatePS.YA
.DA 0 .DA 0
.DA 0 .DA K.GetMemStat.YA
.DA K.GetPSStatus.A .DA K.GetPSStatus.A
.DA K.GetPSList.YA .DA K.GetPSStat.YA
.DA 0 $B0 .DA 0 $B0
.DA K.GetArg.A .DA K.GetArg.A
@ -136,7 +136,7 @@ K.SYSCALL.JMP .DA 0 $00
*-------------------------------------- *--------------------------------------
* $E000 * $E000
*-------------------------------------- *--------------------------------------
.DA K.GetMemStat.YA $E0 .DA K.GetStkObjProperty.AY $E0
.DA K.FreeMem.A .DA K.FreeMem.A
.DA K.GetMemPtr.A .DA K.GetMemPtr.A
.DA K.GetMemByID.A .DA K.GetMemByID.A

View File

@ -18,41 +18,6 @@ ZPSListDataPtr .EQ ZPMEMMGR+14
* - mem.ID=0 always used! useful to test if hMem=0 * - mem.ID=0 always used! useful to test if hMem=0
*-------------------------------------- *--------------------------------------
*/-------------------------------------- */--------------------------------------
* # GetMemStat.YA
* ## In:
* Y,A = Ptr to 24 bytes buffer
* ## Out:
* Buffer filled with memory stats
*\--------------------------------------
K.GetMemStat.YA >STYA ZPMemMgrTmp1
ldy #22
ldx #6
.1 lda DevMgr.Stat,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .1
sta SETREADAUX
ldy #14
jsr .2
sta CLRREADAUX
ldy #6
.2 ldx #6
.3 lda Mem.Table,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .3
rts
*/--------------------------------------
* # GetMem0.YA * # GetMem0.YA
* ## In: * ## In:
* Y,A = Size Requested * Y,A = Size Requested
@ -557,13 +522,14 @@ K.SListFree.A
sta CLRWRITEAUX sta CLRWRITEAUX
rts rts
*/-------------------------------------- */--------------------------------------
* # GetStkObjProperty.A * # GetStkObjProperty.AY
* ## In: * ## In:
* A = hMem To Free (AUX Memory) * A = hObject (AUX Memory)
* Y = Property Index * Y = Property Index
* ## Out: * ## Out:
* Y,A = Property Value * Y,A = Property Value
*\-------------------------------------- *\--------------------------------------
K.GetStkObjProperty.AY
phy phy
sta SETREADAUX sta SETREADAUX
jsr K.GetMemPtr.A jsr K.GetMemPtr.A

View File

@ -384,14 +384,61 @@ PS.SetMemOwner lda CORE.LastPSID
ldy #S.MEM.OWNERPID ldy #S.MEM.OWNERPID
sta (ZPMEMMGR),y sta (ZPMEMMGR),y
rts rts
*-------------------------------------- */--------------------------------------
* # GetMemStat.YA
* ## In:
* Y,A = Ptr to 24 bytes buffer
* ## Out:
* Buffer filled with memory stats
*\--------------------------------------
K.GetMemStat.YA >STYA ZPMemMgrTmp1
ldy #22
ldx #6
.1 lda DevMgr.Stat,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .1
sta SETREADAUX
ldy #14
jsr .2
sta CLRREADAUX
ldy #6
.2 ldx #6
.3 lda Mem.Table,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .3
rts
*/--------------------------------------
* # GetPSStatus.A
* ## In:
* A = PID
* ## Out:
* A = Status Byte
*\--------------------------------------
K.GetPSStatus.A jsr CORE.GetPSByID.A K.GetPSStatus.A jsr CORE.GetPSByID.A
bcs .9 bcs .9
>STYA ZPPtr1 >STYA ZPPtr1
lda (ZPPtr1) lda (ZPPtr1)
.9 rts .9 rts
*-------------------------------------- */--------------------------------------
K.GetPSList.YA >STYA ZPPtr1 * # GetPSStat.YA
* ## In:
* Y,A = Ptr to 24 bytes buffer
* ## Out:
* Buffer filled with PS stats
*\--------------------------------------
K.GetPSStat.YA >STYA ZPPtr1
ldx #0 ldx #0

View File

@ -1155,9 +1155,10 @@ HEX2DEC ror .31+1
lsr lsr
.6 and #$0F .6 and #$0F
ora #$30
cmp #$30
beq .7 a zero? beq .7 a zero?
ora #$30
inc PADLEN found a non zero, Print all digits, even if 0, next time inc PADLEN found a non zero, Print all digits, even if 0, next time
ldy #'0' ldy #'0'