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

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

@ -104,11 +104,6 @@ S.RECT.Y2 .EQ 6
*
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.F .EQ 1
S.WND.F.RESIZE .EQ %00000001
@ -163,6 +158,21 @@ S.MITEM.TEXTLEN .EQ 5
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.F .EQ 1
S.BUT.F.DISABLED .EQ %10000000

View File

@ -4,16 +4,27 @@ AUTO 4,1
*--------------------------------------
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
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

View File

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

View File

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

View File

@ -103,9 +103,9 @@ K.SYSCALL.JMP .DA 0 $00
.DA K.CreatePSNewEnv.YA
.DA K.CreatePS.YA
.DA 0
.DA 0
.DA K.GetMemStat.YA
.DA K.GetPSStatus.A
.DA K.GetPSList.YA
.DA K.GetPSStat.YA
.DA 0 $B0
.DA K.GetArg.A
@ -136,7 +136,7 @@ K.SYSCALL.JMP .DA 0 $00
*--------------------------------------
* $E000
*--------------------------------------
.DA K.GetMemStat.YA $E0
.DA K.GetStkObjProperty.AY $E0
.DA K.FreeMem.A
.DA K.GetMemPtr.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
*--------------------------------------
*/--------------------------------------
* # 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
* ## In:
* Y,A = Size Requested
@ -557,13 +522,14 @@ K.SListFree.A
sta CLRWRITEAUX
rts
*/--------------------------------------
* # GetStkObjProperty.A
* # GetStkObjProperty.AY
* ## In:
* A = hMem To Free (AUX Memory)
* A = hObject (AUX Memory)
* Y = Property Index
* ## Out:
* Y,A = Property Value
*\--------------------------------------
K.GetStkObjProperty.AY
phy
sta SETREADAUX
jsr K.GetMemPtr.A

View File

@ -384,14 +384,61 @@ PS.SetMemOwner lda CORE.LastPSID
ldy #S.MEM.OWNERPID
sta (ZPMEMMGR),y
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
bcs .9
>STYA ZPPtr1
lda (ZPPtr1)
.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

View File

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