mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-22 22:30:25 +00:00
Kernel 0.9.2
This commit is contained in:
parent
c982c8fb9c
commit
6286ac371c
@ -325,32 +325,32 @@ Return float rounded into a long
|
||||
A = hMem To Free
|
||||
**Out:**
|
||||
none.
|
||||
(X,Y unmodified)
|
||||
(X unmodified)
|
||||
|
||||
# GetMemPtr
|
||||
**In:**
|
||||
A = hMem
|
||||
A = hMem
|
||||
**Out:**
|
||||
Y,A = PTR to MemBlock
|
||||
(X unmodified)
|
||||
Y,A = PTR to MemBlock
|
||||
(X unmodified)
|
||||
|
||||
# GetMemByID
|
||||
**In:**
|
||||
A = hMem
|
||||
A = hMem
|
||||
**Out:**
|
||||
Y,A = ZPMemMgrSPtr = PTR to S.MEM
|
||||
X unmodified
|
||||
Y,A = ZPMemMgrSPtr = PTR to S.MEM
|
||||
(X unmodified)
|
||||
|
||||
# NewStr
|
||||
Create a new copy of this C-String
|
||||
**In:**
|
||||
Y,A = Ptr to source C-String
|
||||
Y,A = Ptr to source C-String
|
||||
**Out:**
|
||||
CC : success
|
||||
Y,A = PTR to String
|
||||
X = hMem (PSTR)
|
||||
CS : error
|
||||
A = SYS error code
|
||||
CC : success
|
||||
Y,A = PTR to String
|
||||
X = hMem (PSTR)
|
||||
CS : error
|
||||
A = SYS error code
|
||||
|
||||
# SListGetByID
|
||||
**In:**
|
||||
@ -883,7 +883,7 @@ Convert String to 16 bits int
|
||||
**Out:**
|
||||
Y,A = int
|
||||
|
||||
# realpath
|
||||
# RealPath
|
||||
Return the canonicalized absolute pathname
|
||||
|
||||
## C
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -52,6 +52,8 @@ CS.INIT lda #0
|
||||
>LEA.G MemStat
|
||||
>SYSCALL GetMemStat
|
||||
|
||||
* >LDA.G MemStat+S.MSTAT.MLast
|
||||
* >DEBUG
|
||||
* lda (pPs)
|
||||
* ora #S.PS.F.EVENT Now accept events
|
||||
* sta (pPs)
|
||||
@ -76,6 +78,7 @@ CS.RUN >SYSCALL GetChar
|
||||
|
||||
.13 >LDA.G bSTOP
|
||||
bne .8
|
||||
|
||||
>INC.G MEM.COUNT
|
||||
>SYSCALL GetMemByID
|
||||
>STYA ZPPTR1
|
||||
@ -193,9 +196,10 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
||||
.12 >LDYA L.MSG1
|
||||
>SYSCALL printf
|
||||
|
||||
ldy #S.MEM.BIN
|
||||
lda (ZPPTR1),y
|
||||
lda (ZPPTR1)
|
||||
and #S.MEM.F.CODE
|
||||
bne .7
|
||||
|
||||
****** DATA
|
||||
ldy #S.MEM.PTR
|
||||
lda (ZPPTR1),y
|
||||
@ -232,7 +236,9 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN+1
|
||||
>LDYA L.MSG1.HEX
|
||||
bra .8
|
||||
****** BIN
|
||||
.7 >SYSCALL GetMemPtr
|
||||
.7 ldy #S.MEM.BIN
|
||||
lda (ZPPTR1),y
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>LDYA L.MSG1.BIN
|
||||
|
||||
|
@ -100,6 +100,9 @@ MEM.GetMem.YAX stx Mem.ReqFlags
|
||||
jsr Mem.AddSlot X = new slot
|
||||
bcs .9
|
||||
|
||||
lda #S.MEM.F.ALIGN Make sure marked FREE
|
||||
sta (ZPMemMgrSPtr)
|
||||
|
||||
.6 >LDYA ZPMemMgrSize
|
||||
jsr Mem.AddSlot X = new slot
|
||||
bcs .9
|
||||
@ -234,10 +237,9 @@ Mem.NextSlot lda ZPMemMgrSPtr
|
||||
* A = hMem To Free
|
||||
* **Out:**
|
||||
* none.
|
||||
* (X,Y unmodified)
|
||||
* (X unmodified)
|
||||
*\--------------------------------------
|
||||
K.FreeMem phy
|
||||
tay
|
||||
K.FreeMem tay
|
||||
|
||||
beq * Slot=0, reserved by Kernel
|
||||
|
||||
@ -255,13 +257,14 @@ K.FreeMem phy
|
||||
sta (ZPMemMgrSPtr),y
|
||||
bne .8 no, must be a code segment loaded several times
|
||||
|
||||
* lda #0
|
||||
sta (ZPMemMgrSPtr) mark this slot as free
|
||||
|
||||
ldy #S.MEM.BIN
|
||||
lda (ZPMemMgrSPtr),y Any BINPATH to discard ?
|
||||
lda (ZPMemMgrSPtr)
|
||||
and #S.MEM.F.CODE CS: Any BINPATH to discard ?
|
||||
sta (ZPMemMgrSPtr) Mark as FREE
|
||||
beq .1
|
||||
|
||||
ldy #S.MEM.BIN
|
||||
lda (ZPMemMgrSPtr),y
|
||||
|
||||
jsr K.GetMemByID X unmodified
|
||||
lda (ZPMemMgrSPtr)
|
||||
bpl * ***MUST BE ALLOCATED***
|
||||
@ -277,7 +280,7 @@ K.FreeMem phy
|
||||
bmi .8 used, exit
|
||||
|
||||
.2 dec Mem.LastSlot free! get previous....
|
||||
beq .3 empty list: go set Mem.Free=Mem.HiMem
|
||||
beq .80 empty list: go set Mem.Free=Mem.HiMem
|
||||
|
||||
lda Mem.LastSlot
|
||||
jsr K.GetMemByID X unmodified
|
||||
@ -291,17 +294,15 @@ K.FreeMem phy
|
||||
lda (ZPMemMgrSPtr),y
|
||||
sta Mem.Free+1
|
||||
|
||||
.8 ply
|
||||
clc
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.3 >LDYA Mem.HiMem
|
||||
.80 >LDYA Mem.HiMem
|
||||
>STYA Mem.Free
|
||||
bra .8
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
.9 ply discard saved Y
|
||||
|
||||
lda $D000
|
||||
.9 lda $D000
|
||||
sta .91+1
|
||||
bit RRAMWRAMBNK2
|
||||
bit RRAMWRAMBNK2
|
||||
@ -331,26 +332,10 @@ K.FreeMem.ERR .AZ "FreeMem:%H:hMem already freed."
|
||||
*/--------------------------------------
|
||||
* # GetMemPtr
|
||||
* **In:**
|
||||
* A = hMem
|
||||
* A = hMem
|
||||
* **Out:**
|
||||
* Y,A = PTR to MemBlock
|
||||
* (X unmodified)
|
||||
*\--------------------------------------
|
||||
K.GetMemPtr jsr K.GetMemByID
|
||||
ldy #S.MEM.PTR
|
||||
lda (ZPMemMgrSPtr),y
|
||||
pha
|
||||
iny
|
||||
lda (ZPMemMgrSPtr),y
|
||||
ply
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # GetMemByID
|
||||
* **In:**
|
||||
* A = hMem
|
||||
* **Out:**
|
||||
* Y,A = ZPMemMgrSPtr = PTR to S.MEM
|
||||
* X unmodified
|
||||
* Y,A = PTR to MemBlock
|
||||
* (X unmodified)
|
||||
*\--------------------------------------
|
||||
* Optimized for :
|
||||
* Mem.Table is page aligned at $1800
|
||||
@ -365,6 +350,31 @@ K.GetMemPtr jsr K.GetMemByID
|
||||
!!!!!WARNING!!!!!
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
K.GetMemPtr sta ZPMemMgrSPtr
|
||||
lda /Mem.Table/8
|
||||
asl ZPMemMgrSPtr
|
||||
rol
|
||||
asl ZPMemMgrSPtr
|
||||
rol
|
||||
asl ZPMemMgrSPtr
|
||||
rol
|
||||
sta ZPMemMgrSPtr+1
|
||||
|
||||
ldy #S.MEM.PTR
|
||||
lda (ZPMemMgrSPtr),y
|
||||
pha
|
||||
iny
|
||||
lda (ZPMemMgrSPtr),y
|
||||
ply
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # GetMemByID
|
||||
* **In:**
|
||||
* A = hMem
|
||||
* **Out:**
|
||||
* Y,A = ZPMemMgrSPtr = PTR to S.MEM
|
||||
* (X unmodified)
|
||||
*\--------------------------------------
|
||||
K.GetMemByID sta ZPMemMgrSPtr
|
||||
lda /Mem.Table/8
|
||||
asl ZPMemMgrSPtr
|
||||
@ -376,35 +386,17 @@ K.GetMemByID sta ZPMemMgrSPtr
|
||||
sta ZPMemMgrSPtr+1
|
||||
ldy ZPMemMgrSPtr
|
||||
rts
|
||||
*--------------------------------------
|
||||
* OLD CODE
|
||||
*--------------------------------------
|
||||
* stz ZPMemMgrSPtr+1
|
||||
* asl
|
||||
* rol ZPMemMgrSPtr+1
|
||||
* asl
|
||||
* rol ZPMemMgrSPtr+1
|
||||
* asl
|
||||
* rol ZPMemMgrSPtr+1
|
||||
** clc IMPLICIT
|
||||
* adc #Mem.Table
|
||||
* tay
|
||||
* lda ZPMemMgrSPtr+1
|
||||
* adc /Mem.Table
|
||||
* sty ZPMemMgrSPtr
|
||||
* sta ZPMemMgrSPtr+1
|
||||
* rts
|
||||
*/--------------------------------------
|
||||
* # NewStr
|
||||
* Create a new copy of this C-String
|
||||
* **In:**
|
||||
* Y,A = Ptr to source C-String
|
||||
* Y,A = Ptr to source C-String
|
||||
* **Out:**
|
||||
* CC : success
|
||||
* Y,A = PTR to String
|
||||
* X = hMem (PSTR)
|
||||
* CS : error
|
||||
* A = SYS error code
|
||||
* CC : success
|
||||
* Y,A = PTR to String
|
||||
* X = hMem (PSTR)
|
||||
* CS : error
|
||||
* A = SYS error code
|
||||
*\--------------------------------------
|
||||
K.NewStr >STYA .1+1
|
||||
>STYA .4+1
|
||||
|
Loading…
x
Reference in New Issue
Block a user