2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected
|
|
|
|
|
ZPMemMgrTmp1 .EQ ZPMEMMGR+2
|
2018-05-04 14:55:29 +00:00
|
|
|
|
ZPMemMgrSize .EQ ZPMEMMGR+4
|
2018-03-30 15:21:42 +00:00
|
|
|
|
ZPSListID .EQ ZPMEMMGR+6
|
|
|
|
|
ZPSListIBlkPtr .EQ ZPMEMMGR+8
|
|
|
|
|
ZPSListDBlkPtr .EQ ZPMEMMGR+10
|
|
|
|
|
ZPSListKeyPtr .EQ ZPMEMMGR+12
|
|
|
|
|
ZPSListDataPtr .EQ ZPMEMMGR+14
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # GetMem0
|
2017-06-28 14:34:11 +00:00
|
|
|
|
* Y,A = Size Requested
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-06-28 14:34:11 +00:00
|
|
|
|
* CC : success
|
2017-07-06 15:30:40 +00:00
|
|
|
|
* YA = PTR to Mem (ZERO Initialised)
|
2017-06-28 14:34:11 +00:00
|
|
|
|
* X = hMem
|
|
|
|
|
* CS :
|
|
|
|
|
* A = EC
|
2018-01-17 16:31:32 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.GetMem0 ldx #S.MEM.F.INIT0
|
2017-12-07 16:33:39 +00:00
|
|
|
|
.HS 2C bit abs
|
2017-07-06 15:30:40 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # GetMem
|
2017-07-06 15:30:40 +00:00
|
|
|
|
* Y,A = Size Requested
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-07-06 15:30:40 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* YA = PTR to Mem (Uninitialised)
|
|
|
|
|
* X = hMem
|
|
|
|
|
* CS :
|
|
|
|
|
* A = EC
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.GetMem ldx #0
|
2017-10-09 05:51:32 +00:00
|
|
|
|
|
2018-01-17 16:31:32 +00:00
|
|
|
|
MEM.GetMem.YAX stx Mem.ReqFlags
|
2018-05-04 14:55:29 +00:00
|
|
|
|
sta ZPMemMgrSize+1
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2017-06-28 14:34:11 +00:00
|
|
|
|
bit #$0F 16 bytes aligned ?
|
2017-10-09 05:51:32 +00:00
|
|
|
|
beq .10 yes, request it
|
2017-06-28 14:34:11 +00:00
|
|
|
|
|
|
|
|
|
and #$F0 align on 16 bytes
|
|
|
|
|
clc
|
|
|
|
|
adc #$10
|
2017-10-09 05:51:32 +00:00
|
|
|
|
bcc .10
|
2018-05-04 14:55:29 +00:00
|
|
|
|
inc ZPMemMgrSize+1
|
2017-06-28 14:34:11 +00:00
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
.10 sta ZPMemMgrSize
|
2017-06-28 14:34:11 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
>LDYAI Mem.Table
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>STYA ZPMemMgrSPtr
|
|
|
|
|
|
|
|
|
|
ldx #0 Current slot=0
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2016-10-07 15:28:17 +00:00
|
|
|
|
bra .4 skip slot 0, Check if some free slot to reuse first
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
.1 inx move to next slot
|
2017-10-27 06:36:46 +00:00
|
|
|
|
jsr Mem.NextSlot
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPMemMgrSPtr) Get Flags
|
|
|
|
|
bmi .4 in use ?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.2 lda Mem.ReqFlags Found an empty slot
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #S.MEM.F.ALIGN is request needs a page align ?
|
|
|
|
|
beq .3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
|
|
|
|
lda (ZPMemMgrSPtr),y get LO of PTR
|
|
|
|
|
bne .4 not page-aligned
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.3 ldy #S.MEM.LEN
|
|
|
|
|
lda (ZPMemMgrSPtr),y get LEN of this block
|
2018-05-04 14:55:29 +00:00
|
|
|
|
cmp ZPMemMgrSize compare with requested size
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
2018-05-04 14:55:29 +00:00
|
|
|
|
cmp ZPMemMgrSize+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .7 requested size matches slot size !!!
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.4 cpx Mem.LastSlot any other slot to check?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bne .1 last one, create a new slot
|
2016-10-07 15:28:17 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*-------------- Create a New SLOT
|
2018-08-20 15:15:37 +00:00
|
|
|
|
|
|
|
|
|
.5 lda Mem.ReqFlags
|
2015-06-03 18:30:57 +00:00
|
|
|
|
and #S.MEM.F.ALIGN is request needs a page align ?
|
|
|
|
|
beq .6
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
lda Mem.Free target PTR will be page aligned ?
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
2018-05-04 14:55:29 +00:00
|
|
|
|
sbc ZPMemMgrSize
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .6 yes, allocate
|
|
|
|
|
|
|
|
|
|
tay no, reserve a free slot to fill gap
|
|
|
|
|
lda #0
|
2017-11-22 16:27:50 +00:00
|
|
|
|
jsr Mem.AddSlot X = new slot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
lda #S.MEM.F.ALIGN Make sure marked FREE
|
|
|
|
|
sta (ZPMemMgrSPtr)
|
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
.6 >LDYA ZPMemMgrSize
|
2017-11-22 16:27:50 +00:00
|
|
|
|
jsr Mem.AddSlot X = new slot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .9
|
2016-10-07 15:28:17 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*-------------- Reuse this SLOT
|
2017-11-22 16:27:50 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.7 lda Mem.ReqFlags get requested flags
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ora #S.MEM.F.INUSE mark as in use
|
|
|
|
|
sta (ZPMemMgrSPtr)
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
and #S.MEM.F.INIT0
|
|
|
|
|
beq .8
|
2016-11-01 21:34:29 +00:00
|
|
|
|
|
2017-11-22 16:27:50 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
|
|
|
|
lda (ZPMemMgrSPtr),y ZPMemMgrSPtr already set
|
|
|
|
|
sta .12+1
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
|
|
|
|
sta .12+2
|
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
lda ZPMemMgrSize
|
2017-11-22 16:27:50 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
tay y=not lo count
|
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
lda ZPMemMgrSize+1
|
2017-11-22 16:27:50 +00:00
|
|
|
|
eor #$ff a=not hi count
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.11 iny
|
|
|
|
|
bne .12
|
|
|
|
|
inc
|
|
|
|
|
beq .13
|
|
|
|
|
|
|
|
|
|
.12 stz $ffff,x
|
|
|
|
|
inx
|
|
|
|
|
bne .11
|
|
|
|
|
|
|
|
|
|
inc .12+2
|
|
|
|
|
bra .11
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-11-22 16:27:50 +00:00
|
|
|
|
.13 plx
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.8 lda #0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.BIN
|
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
inc Mark this slot used by one process
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.REFCNT
|
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ldy #S.PS.PID
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.OWNERPID
|
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPMemMgrSPtr),y A = HI PTR
|
|
|
|
|
ply Y = LO PTR
|
|
|
|
|
clc X = Current hMem
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2017-06-28 14:34:11 +00:00
|
|
|
|
.9 rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
Mem.ReqFlags .BS 1 store requested Flags
|
|
|
|
|
*--------------------------------------
|
2017-10-27 06:36:46 +00:00
|
|
|
|
* Mem.AddSlot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* In:
|
|
|
|
|
* Y,A = Requested size
|
|
|
|
|
* Out:
|
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
Mem.AddSlot >STYA ZPMemMgrTmp1 save req size
|
2018-08-11 10:57:57 +00:00
|
|
|
|
ldx Mem.LastSlot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inx
|
|
|
|
|
beq .99 > 255 ERR:OUT OF SLOT
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
lda Mem.Free Compute base PTR=FREE-REQ size
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sbc ZPMemMgrTmp1
|
2017-10-27 06:36:46 +00:00
|
|
|
|
tay save new Mem.Free LO
|
|
|
|
|
lda Mem.Free+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sbc ZPMemMgrTmp1+1
|
2017-10-27 06:36:46 +00:00
|
|
|
|
pha save new Mem.Free HI
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
cpy Mem.LoMem
|
|
|
|
|
sbc Mem.LoMem+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcc .98 ERR out of mem
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
jsr Mem.NextSlot X,Y unmodified
|
2016-10-03 15:59:36 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
tya get back Mem.Free LO
|
2015-03-15 22:00:40 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
2017-10-27 06:36:46 +00:00
|
|
|
|
sta Mem.Free set as system Mem.Free value
|
2018-08-11 10:57:57 +00:00
|
|
|
|
sta (ZPMemMgrSPtr),y store it as base address of new slot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
iny
|
2017-10-27 06:36:46 +00:00
|
|
|
|
pla get back Mem.Free HI
|
|
|
|
|
sta Mem.Free+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda ZPMemMgrTmp1 get requested size
|
|
|
|
|
sta (ZPMemMgrSPtr),y setup slot LEN
|
|
|
|
|
iny
|
|
|
|
|
lda ZPMemMgrTmp1+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
stx Mem.LastSlot mark this slot allocated
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.98 pla discard new Mem.Free HI
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2018-10-21 20:54:07 +00:00
|
|
|
|
.99 lda #E.OOM
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-27 06:36:46 +00:00
|
|
|
|
Mem.NextSlot lda ZPMemMgrSPtr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
clc
|
2016-10-03 15:59:36 +00:00
|
|
|
|
adc #S.MEM
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta ZPMemMgrSPtr
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPMemMgrSPtr+1
|
|
|
|
|
.8 rts
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # FreeMem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* A = hMem To Free
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* none.
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* (X unmodified)
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*\--------------------------------------
|
2018-11-26 16:36:55 +00:00
|
|
|
|
K.FreeMem.ERRBAD .AZ "FreeMem:$%h=Bad hMem,BIN=%s\r\n"
|
|
|
|
|
K.FreeMem.ERRFREED .AZ "FreeMem:$%h=already freed,BIN=%s\r\n"
|
|
|
|
|
*--------------------------------------
|
2018-11-28 14:58:42 +00:00
|
|
|
|
K.FreeMem.BAD sec
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
|
|
|
|
|
K.FreeMem.FREED clc
|
2018-11-08 14:23:06 +00:00
|
|
|
|
phx
|
2018-11-28 14:58:42 +00:00
|
|
|
|
|
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
ldy #S.PS.hARGV
|
2018-11-26 16:36:55 +00:00
|
|
|
|
lda (pPS),y
|
|
|
|
|
jsr K.GetMemPtr
|
|
|
|
|
>PUSHYA
|
2018-10-17 15:31:29 +00:00
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
2016-10-03 15:59:36 +00:00
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
>PUSHBI 3
|
2018-11-28 14:58:42 +00:00
|
|
|
|
>LDYAI K.FreeMem.ERRBAD
|
|
|
|
|
plp
|
|
|
|
|
bcs .1
|
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
>LDYAI K.FreeMem.ERRFREED
|
2018-11-28 14:58:42 +00:00
|
|
|
|
|
|
|
|
|
.1 >SYSCALL printf
|
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
plx
|
2018-11-28 14:58:42 +00:00
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.FreeMem tay
|
2018-11-08 14:23:06 +00:00
|
|
|
|
beq K.FreeMem.BAD Slot=0, reserved by Kernel
|
2018-11-26 16:36:55 +00:00
|
|
|
|
|
2018-08-20 15:15:37 +00:00
|
|
|
|
cmp Mem.LastSlot
|
|
|
|
|
bcc .10
|
2018-11-08 14:23:06 +00:00
|
|
|
|
bne K.FreeMem.BAD
|
2018-08-20 15:15:37 +00:00
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
.10 pha
|
|
|
|
|
jsr K.GetMemByID X unmodified
|
2018-11-28 14:58:42 +00:00
|
|
|
|
lda (ZPMemMgrSPtr) In use ?
|
|
|
|
|
bmi .11
|
|
|
|
|
|
2018-11-26 16:36:55 +00:00
|
|
|
|
pla
|
2018-11-28 14:58:42 +00:00
|
|
|
|
bra K.FreeMem.FREED
|
|
|
|
|
|
|
|
|
|
.11 pla
|
|
|
|
|
|
2015-03-15 22:00:40 +00:00
|
|
|
|
ldy #S.MEM.REFCNT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPMemMgrSPtr),y Get count of those referencing this hMem
|
|
|
|
|
dec only one left ?
|
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bne .8 no, must be a code segment loaded several times
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
|
|
|
|
and #S.MEM.F.CODE CS: Any BINPATH to discard ?
|
|
|
|
|
sta (ZPMemMgrSPtr) Mark as FREE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
ldy #S.MEM.BIN
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemByID X unmodified
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bpl * ***MUST BE ALLOCATED***
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda #0 mark BINPATH slot as free
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta (ZPMemMgrSPtr)
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.1 lda Mem.LastSlot
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemByID X unmodified
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
2017-10-09 05:51:32 +00:00
|
|
|
|
bmi .8 used, exit
|
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.2 dec Mem.LastSlot free! get previous....
|
2018-08-21 13:12:47 +00:00
|
|
|
|
beq .80 empty list: go set Mem.Free=Mem.HiMem
|
2017-10-09 05:51:32 +00:00
|
|
|
|
|
2017-10-27 06:36:46 +00:00
|
|
|
|
lda Mem.LastSlot
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemByID X unmodified
|
2017-10-09 05:51:32 +00:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
|
|
|
|
bpl .2 free again! loop
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-10-09 05:51:32 +00:00
|
|
|
|
ldy #S.MEM.PTR
|
2017-10-27 06:36:46 +00:00
|
|
|
|
lda (ZPMemMgrSPtr),y set Mem.Free...
|
|
|
|
|
sta Mem.Free
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
2017-10-27 06:36:46 +00:00
|
|
|
|
sta Mem.Free+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2017-10-09 05:51:32 +00:00
|
|
|
|
|
2018-08-21 13:12:47 +00:00
|
|
|
|
.80 >LDYA Mem.HiMem
|
2017-10-27 06:36:46 +00:00
|
|
|
|
>STYA Mem.Free
|
2018-08-21 13:12:47 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # GetMemPtr
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* A = hMem
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* Y,A = PTR to MemBlock
|
|
|
|
|
* (X unmodified)
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
* Optimized for :
|
2017-10-27 06:36:46 +00:00
|
|
|
|
* Mem.Table is page aligned at $1800
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* S.MEM is 8 bytes
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.DO Mem.Table=$1800
|
2016-10-03 15:59:36 +00:00
|
|
|
|
.ELSE
|
|
|
|
|
!!!!!WARNING!!!!!
|
|
|
|
|
.FIN
|
|
|
|
|
.DO S.MEM=8
|
|
|
|
|
.ELSE
|
|
|
|
|
!!!!!WARNING!!!!!
|
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
2018-08-21 13:12:47 +00:00
|
|
|
|
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
|
|
|
|
|
* A = hMem
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* Y,A = ZPMemMgrSPtr = PTR to S.MEM
|
|
|
|
|
* (X unmodified)
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.GetMemByID sta ZPMemMgrSPtr
|
2017-10-27 06:36:46 +00:00
|
|
|
|
lda /Mem.Table/8
|
2016-10-03 15:59:36 +00:00
|
|
|
|
asl ZPMemMgrSPtr
|
|
|
|
|
rol
|
|
|
|
|
asl ZPMemMgrSPtr
|
|
|
|
|
rol
|
|
|
|
|
asl ZPMemMgrSPtr
|
|
|
|
|
rol
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta ZPMemMgrSPtr+1
|
2016-10-03 15:59:36 +00:00
|
|
|
|
ldy ZPMemMgrSPtr
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2017-09-05 15:17:10 +00:00
|
|
|
|
*/--------------------------------------
|
2018-10-26 06:16:14 +00:00
|
|
|
|
* # GetMemStat
|
|
|
|
|
* **In:**
|
|
|
|
|
* Y,A = Ptr to 24 bytes buffer
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* Buffer filled with memory stats
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.GetMemStat >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
|
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # NewStr
|
2017-09-05 15:17:10 +00:00
|
|
|
|
* Create a new copy of this C-String
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* Y,A = Ptr to source C-String
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-08-21 13:12:47 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* Y,A = PTR to String
|
|
|
|
|
* X = hMem (PSTR)
|
|
|
|
|
* CS : error
|
|
|
|
|
* A = SYS error code
|
2017-09-05 15:17:10 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.NewStr >STYA .1+1
|
2017-09-06 15:00:10 +00:00
|
|
|
|
>STYA .4+1
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-10-09 05:51:32 +00:00
|
|
|
|
ldy #0
|
2017-12-07 16:33:39 +00:00
|
|
|
|
lda #0
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-12-07 16:33:39 +00:00
|
|
|
|
.1 ldx $ffff,y
|
2017-09-06 15:00:10 +00:00
|
|
|
|
beq .2
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
2017-12-07 16:33:39 +00:00
|
|
|
|
inc
|
2017-09-06 15:00:10 +00:00
|
|
|
|
inc .1+2
|
|
|
|
|
bne .1
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-10-09 05:51:32 +00:00
|
|
|
|
.2 iny Add one for ending 0
|
2017-09-06 15:00:10 +00:00
|
|
|
|
bne .3
|
2017-12-07 16:33:39 +00:00
|
|
|
|
inc
|
2017-10-09 05:51:32 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.3 jsr K.GetMem
|
2017-09-05 15:17:10 +00:00
|
|
|
|
bcs .9
|
2017-09-06 15:00:10 +00:00
|
|
|
|
>STYA .5+1
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-09-06 15:00:10 +00:00
|
|
|
|
phy
|
|
|
|
|
pha
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-09-06 15:00:10 +00:00
|
|
|
|
ldy #0
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-09-06 15:00:10 +00:00
|
|
|
|
.4 lda $ffff,y
|
|
|
|
|
.5 sta $ffff,y
|
|
|
|
|
beq .8
|
|
|
|
|
iny
|
|
|
|
|
bne .4
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-09-06 15:00:10 +00:00
|
|
|
|
inc .4+2
|
|
|
|
|
inc .5+2
|
|
|
|
|
bne .4
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-09-06 15:00:10 +00:00
|
|
|
|
.8 pla
|
|
|
|
|
ply
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2018-01-15 06:50:44 +00:00
|
|
|
|
*/--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* # SListGetByID
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* PUSHB = hSList
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* PUSHW = KeyID
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* PUSHW = Data Ptr
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* PUSHW = Key Ptr
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* X,Y = Next KeyID
|
2018-01-15 06:50:44 +00:00
|
|
|
|
*\--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
K.SListGetByID >PULLW ZPSListKeyPtr
|
2018-01-17 16:31:32 +00:00
|
|
|
|
*/--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* # SListUpdateByID
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* PUSHB = hSList
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* PUSHW = KeyID
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* PUSHW = Data Ptr
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* A = Key Length
|
|
|
|
|
* X,Y = KeyID
|
2018-01-17 16:31:32 +00:00
|
|
|
|
*\--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
K.SListUpdateByID
|
|
|
|
|
>PULLW ZPSListDataPtr
|
|
|
|
|
>PULLW ZPSListID
|
|
|
|
|
bra K.SListPullH
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* # SListAdd
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* PUSHB = hSList
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* PUSHW = Key Ptr
|
|
|
|
|
* PUSHW = Data Ptr
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* A = Key Length
|
|
|
|
|
* X,Y = KeyID
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
K.SListAdd
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* # SListLookup
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* PUSHB = hSList
|
2018-03-30 15:21:42 +00:00
|
|
|
|
* PUSHW = Key Ptr
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* PUSHW = Data Ptr
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* A = Key Length
|
|
|
|
|
* X,Y = KeyID
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
K.SListLookup
|
2018-01-17 16:31:32 +00:00
|
|
|
|
*--------------------------------------
|
2018-03-30 15:21:42 +00:00
|
|
|
|
>PULLW ZPSListDataPtr
|
|
|
|
|
>PULLW ZPSListKeyPtr
|
|
|
|
|
K.SListPullH >PULLA
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* # SListNew
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-01-19 16:21:31 +00:00
|
|
|
|
* A=hSList
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-01-19 16:21:31 +00:00
|
|
|
|
K.SListNew
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # SListFree
|
2018-01-17 16:31:32 +00:00
|
|
|
|
* A=hSList
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.SListFree
|
2018-01-19 16:21:31 +00:00
|
|
|
|
*--------------------------------------
|
2018-01-30 16:24:45 +00:00
|
|
|
|
sta SETREADAUX
|
2018-01-17 16:31:32 +00:00
|
|
|
|
sta SETWRITEAUX
|
2018-01-19 16:21:31 +00:00
|
|
|
|
jsr X.SLIST
|
2018-01-17 16:31:32 +00:00
|
|
|
|
sta CLRREADAUX
|
2018-01-19 16:21:31 +00:00
|
|
|
|
sta CLRWRITEAUX
|
2018-01-17 16:31:32 +00:00
|
|
|
|
rts
|
2018-04-29 19:10:13 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # GetStkObjProp
|
2018-05-07 14:59:51 +00:00
|
|
|
|
* A = hObject (AUX Memory)
|
2018-05-04 14:55:29 +00:00
|
|
|
|
* Y = Property Index
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-05-04 14:55:29 +00:00
|
|
|
|
* Y,A = Property Value
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.GetStkObjProp phy
|
2018-05-04 14:55:29 +00:00
|
|
|
|
sta SETREADAUX
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemPtr
|
2018-05-04 14:55:29 +00:00
|
|
|
|
>STYA ZPMemMgrTmp1
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
lda (ZPMemMgrTmp1),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPMemMgrTmp1),y
|
|
|
|
|
ply
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # NewStkObj
|
2018-04-29 19:10:13 +00:00
|
|
|
|
* Y,A = Size Requested
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-04-29 19:10:13 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* YA = PTR to Mem (Uninitialised)
|
|
|
|
|
* X = hMem
|
|
|
|
|
* CS :
|
|
|
|
|
* A = EC
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.NewStkObj ldx #SYS.GetMem
|
2018-04-29 19:10:13 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
*/--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
* # FreeStkObj
|
2018-04-29 19:10:13 +00:00
|
|
|
|
* A = hMem To Free (AUX Memory)
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2018-04-29 19:10:13 +00:00
|
|
|
|
* none.
|
|
|
|
|
* (X,Y unmodified)
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 06:22:50 +00:00
|
|
|
|
K.FreeStkObj ldx #SYS.FreeMem
|
2018-04-17 15:25:45 +00:00
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
MEM.GoStkObj sta SETREADAUX
|
2018-04-29 19:10:13 +00:00
|
|
|
|
sta SETWRITEAUX
|
2018-04-17 15:25:45 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
jsr .1
|
2018-01-17 16:31:32 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
2018-01-17 16:31:32 +00:00
|
|
|
|
rts
|
2017-10-17 15:40:21 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
.1 jmp (SYS.Kernel.JMP,x)
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-12-07 16:33:39 +00:00
|
|
|
|
* # LoadStkObj
|
|
|
|
|
* Load a file in AUX memory (Stock Objects)
|
|
|
|
|
* PUSHW = AUXTYPE (Handled by....
|
|
|
|
|
* PUSHB = TYPE ...
|
|
|
|
|
* PUSHB = MODE ...
|
|
|
|
|
* PUSHW = PATH ...FOpen)
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-12-07 16:33:39 +00:00
|
|
|
|
* Y,A = File Length
|
|
|
|
|
* X = hMem of Loaded Object in AUX mem
|
2017-10-17 15:40:21 +00:00
|
|
|
|
*\--------------------------------------
|
2017-12-07 16:33:39 +00:00
|
|
|
|
K.LoadStkObj >SYSCALL LoadFile
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
stx .8+1 Save MAIN hMem
|
|
|
|
|
>STYA A2L Save LEN temporarly
|
|
|
|
|
|
2018-06-22 14:59:24 +00:00
|
|
|
|
jsr K.NewStkObj
|
2017-12-07 16:33:39 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
stx .80+1
|
|
|
|
|
>STYA A4L Save Destination Address in AUX
|
|
|
|
|
|
|
|
|
|
lda .8+1
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemPtr
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
|
|
|
|
>STYA A1L Save MAIN base Ptr
|
|
|
|
|
|
|
|
|
|
pha Add Allocated LEN
|
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc A2L
|
|
|
|
|
sta A2L
|
|
|
|
|
pla
|
|
|
|
|
adc A2L+1
|
|
|
|
|
sta A2L+1 to get End address in A2L/H
|
|
|
|
|
|
|
|
|
|
sec Main To Aux
|
|
|
|
|
jsr AuxMove
|
|
|
|
|
|
|
|
|
|
.8 lda #$ff SELF MODIFIED
|
2018-06-22 14:59:24 +00:00
|
|
|
|
jsr K.FreeMem release MAIN memory
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
|
|
|
|
.80 lda #$ff Returns AUX hMem
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pha
|
|
|
|
|
jsr .8
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2018-04-29 19:10:13 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MEM.GetKeyCharY sta CLRREADAUX
|
|
|
|
|
lda (ZPSListKeyPtr),y
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
beq MEM.IsDigit.9
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
MEM.IsIDValid cmp #'.'
|
|
|
|
|
beq MEM.IsDigit.8
|
|
|
|
|
|
|
|
|
|
cmp #'_'
|
|
|
|
|
beq MEM.IsDigit.8
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
MEM.IsDigitOrL cmp #'z'+1
|
|
|
|
|
bcs MEM.IsDigit.RTS
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcs MEM.IsDigit.8
|
|
|
|
|
|
|
|
|
|
MEM.IsDigitOrUC cmp #'Z'+1
|
|
|
|
|
bcs MEM.IsDigit.RTS
|
|
|
|
|
cmp #'A'
|
|
|
|
|
bcs MEM.IsDigit.8
|
|
|
|
|
|
|
|
|
|
MEM.IsDigit cmp #'9'+1
|
|
|
|
|
bcs MEM.IsDigit.RTS
|
|
|
|
|
cmp #'0'
|
|
|
|
|
bcs MEM.IsDigit.8
|
|
|
|
|
|
|
|
|
|
MEM.IsDigit.9 sec
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
MEM.IsDigit.RTS rts
|
2017-12-07 16:33:39 +00:00
|
|
|
|
|
2018-04-29 19:10:13 +00:00
|
|
|
|
MEM.IsDigit.8 clc
|
2016-11-01 21:34:29 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-05-25 15:09:14 +00:00
|
|
|
|
MEM.IsHexDigit jsr MEM.IsDigit
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
cmp #'A'
|
|
|
|
|
bcc MEM.IsDigit.9
|
|
|
|
|
cmp #'F'+1
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc MEM.IsDigit.9
|
|
|
|
|
cmp #'f'+1
|
|
|
|
|
bcs MEM.IsDigit.RTS
|
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
.1
|
|
|
|
|
* clc
|
|
|
|
|
sbc #'A'-11 cc so A->10 (11-CC)
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.8 and #$0F
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-04-29 19:10:13 +00:00
|
|
|
|
MEM.SetKeyCharY sta CLRWRITEAUX
|
|
|
|
|
sta (ZPSListKeyPtr),y
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MEM.GetDataByte sta CLRREADAUX
|
|
|
|
|
lda (ZPSListDataPtr)
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
bra MEM.SetDataByte.1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MEM.SetDataByte sta CLRWRITEAUX
|
|
|
|
|
sta (ZPSListDataPtr)
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
MEM.SetDataByte.1
|
|
|
|
|
inc ZPSListDataPtr
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPSListDataPtr+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MEM.TXTPTR.GetNext
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
lda (TXTPTR)
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
beq .9
|
|
|
|
|
inc TXTPTR
|
|
|
|
|
bne .9
|
|
|
|
|
inc TXTPTR+1
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2018-09-07 14:12:42 +00:00
|
|
|
|
MEM.SPtr1PPtr2 >STYA ZPPtr1
|
|
|
|
|
>PULLW ZPPtr2
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-10-25 15:31:41 +00:00
|
|
|
|
MEM.GetCharPtr1 lda (ZPPtr1)
|
|
|
|
|
beq MEM.GetCharPtr1.8
|
|
|
|
|
MEM.NextCharPtr1
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne MEM.GetCharPtr1.8
|
|
|
|
|
inc ZPPtr1+1 never Z
|
|
|
|
|
MEM.GetCharPtr1.8
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MEM.PutCharPtr2 sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
.8 rts
|
2018-11-23 16:20:19 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # GetPSStat
|
|
|
|
|
* **In:**
|
|
|
|
|
* Y,A = Ptr to K.PS.MAX*2+1 bytes buffer
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* Buffer filled with PS stats
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.GetPSStat >STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda CORE.InKernelStats
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.1 lda PS.Table.PID,x
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda PS.Table.hPS,x
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda PS.Table.Stats,x
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.2 inx
|
|
|
|
|
cpx #K.PS.MAX
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 tya
|
|
|
|
|
lsr
|
|
|
|
|
dec
|
|
|
|
|
sta (ZPPtr1)
|
|
|
|
|
rts
|
2018-10-25 15:31:41 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-22 16:39:41 +00:00
|
|
|
|
* 6502/65C02/65816 OPCODES
|
|
|
|
|
* Bit 3 : 1 = absolute addressing
|
|
|
|
|
* Bit 2-1-0 : opcode + @ length
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
|
|
|
|
|
BIN.65816
|
|
|
|
|
* TO DO : Make 2 different tables
|
|
|
|
|
* http://axis.llx.com/~nparker/a2/opcodes.html
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 65R02 OPCODES
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
|
|
|
|
|
BIN.65R02 .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS B.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.MEM
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|