Re: DFB1 Support thread
Posted: 24 Nov 2022 15:36
This is what MAPROM2.2 does:-
Which, assuming cookie writing succeeds -- and it extends the jar if not -- looks ok to me.
Crucially, which is what I forgot when I wrote my first AltRAM declaration program, is to TSR.
gSYS_TsrSize is initialsied here:
Now, I don't know enough about TSRs, nor assembly, nor TOS to know a) what's happening here and b) what happens to the Mxalloc()'d memory for the FRB at this point. Does Ptermres() stop the release of all memory Mxalloc()'d by a process?
'Cos if not, I can see a problem.
BW
Code: Select all
TTRAM_Install:
; inputs:
; d0: size
;--------------------------------------------------------------
move.l d0,-(sp) ; size
move.l #TTRL_MEMBOTTOM,-(sp) ; start
move.w #20,-(sp) ; maddalt(size, start)
trap #1 ;
add.l #6,sp ; keep size on stack
tst.l d0 ; tos supports altram?
bne .fail
move.w #0,-(sp) ; allocate st-ram only
move.l #$10000,-(sp) ; 64Kb
move.w #68,-(sp) ; Mxalloc
trap #1
addq.l #8,sp
tst.l d0 ; failed to allocate?
beq .fail
cmp.l #-32,d0 ; mxalloc not available?
beq .fail
move.l d0,d1 ; 64Kb fastram buffer
move.l #$5f465242,d0 ; '_FRB'
bsr CK_WriteJar ; write cookie
move.l (sp)+,d0
move.l #TTRL_MEMBOTTOM,d1
add.l d0,d1 ; d1 = memtop
move.l d1,$5a4.w ; write fastram top
move.l #TTRL_FASTRAMMAGIC,$5a8.w ; write fastram magic
rts
.fail:
addq.l #4,sp
moveq.l #0,d0
rts
Crucially, which is what I forgot when I wrote my first AltRAM declaration program, is to TSR.
Code: Select all
SYS_QuitKeepResident:
;--------------------------------------------------------------
move.w #0,-(sp) ; Ptermres()
lea gSYS_TsrSize(pc),a0
move.l (a0),-(sp)
move.w #49,-(sp)
trap #1
addq.l #8,sp
Code: Select all
_entrypoint
;--------------------------------------------------------------
move.l 4(sp),a0 ; a0 = basepage
lea gSYS_Stack(pc),sp ; initalize stack
move.l #100,d0 ; basepage size
add.l #$1000,d0 ;
add.l $c(a0),d0 ; text size
add.l $14(a0),d0 ; data size
add.l $1c(a0),d0 ; bss size
lea gSYS_TsrSize(pc),a1
move.l d0,(a1)
'Cos if not, I can see a problem.
BW