I think overall providing there is space left in the ROM, and if someone could help me with a "port" FASTROM.PRG. Then just copy TOS into TTRAM on boot up and not bother with any external programs at all.
Cannot remember now if MAPROM does anything else. But as TTram is setup in ST536 TOS, having a built in TOS relocation would pretty much polish the whole thing off I think anyway. I think with so many versions of MAPROM that has just become way too confusing to keep track of it all.
I assume I can "almost" just drop this code in.
Code: Select all
;----------------------------------------------
; check rom size and start address
; a3 = rom address
; d3 = rom size
;----------------------------------------------
move.l $4f2,a0 ; a0 = _sysbase
move.w 2(a0),d2
move.l #$30000,d3 ; d3 = 192Kb (Tos 1.xx)
cmp.w #$200,d2
bcs .romSizeOK
move.l #$40000,d3 ; d3 = 256Kb (Tos 2.xx)
cmp.w #$300,d2
bcs .romSizeOK
move.l #$80000,d3 ; d3 = 512Kb (Tos 3.xx / 4.xx)
.romSizeOK:
move.l 8(a0),a3 ; a3 = TOS start addr
cmp.l #$e00000,a3
beq .romAddrOK
cmp.l #$fc0000,a3
beq .romAddrOK
moveq.l #0,d3 ; zero size to indicate unsupported rom
.romAddrOK:
move.w d2,gTosVersion
move.l d3,gTosSize
move.l a3,gTosAddr
;----------------------------------------------
; allocate ram for rom + mmu tables
;----------------------------------------------
move.l #0,d4
IFNE OPT_RELO_RAM
move.l #$800,d4 ; EmuTOS = 2Kb
cmp.l #'ETOS',$2c(a0)
beq .ramSizeOK
move.l #$800,d4 ; Default = 2Kb
cmp.w #$206,d2
bne .ramSizeOK
move.l #$800,d4 ; TOS2.06 = 8Kb
.ramSizeOK:
ENDC
move.w d4,gMapRamSize
IFEQ OPT_RELO_ROM
move.l #0,d3
ENDC
move.l #$8000,d0 ; 32Kb for alignment
add.l #$2000,d0 ; 8Kb for tables
add.l d3,d0 ; rom size
add.l d4,d0 ; ram size
bsr AllocateFastRam
tst.l d0 ; memory allocated?
beq MainSUDone
add.l #$7FFF,d0 ; align to 32k pages
and.l #$FFFF8000,d0
move.l d0,a4 ; a4 = memory for rom + ram
add.l d3,d0
add.l d4,d0
move.l d0,a6 ; a6 = MMU table base address
move.l d0,a5 ;
add.l #256,a5 ; a5 = memory for extra tables
; disable mmu
move.l #$0,gMMU030_TC
dc.l $f0394000,gMMU030_TC
;----------------------------------------------
; prepare default mmu table at address d0
;----------------------------------------------
bsr MMU030_Install ; configure default MMU table as TT/Falcon
tst.l d0
beq MainSUDone
or.w #FLAG_MMU,gResultFlags
move.l #COOKIE_PMMU,d0 ; Write 'PMMU' cookie
move.l a6,d1
bsr CK_WriteJar
IFEQ OPT_RELO_ROM+OPT_RELO_RAM
rts
ENDC
; disable mmu
move.l #0,gMMU030_TC
dc.l $f0394000,gMMU030_TC
dc.l $f0002400 ; pflusha
bsr CPU_CacheClear
;----------------------------------------------
; map rom to fastram
;----------------------------------------------
IFNE OPT_RELO_ROM
bsr Relocate_Rom
tst.w d0
beq .reloRomDone
or.w #FLAG_RELO_ROM,gResultFlags
.reloRomDone:
ENDC
;----------------------------------------------
; map lowram to fastram
;----------------------------------------------
IFNE OPT_RELO_RAM
tst.w gMapRamSize
beq .reloRamDone
bsr Relocate_Ram
tst.w d0
beq .reloRamDone
or.w #FLAG_RELO_RAM,gResultFlags
.reloRamDone:
ENDC
;----------------------------------------------
; activate new mmu tables with 4k pagesize
;----------------------------------------------
move.l #$80b04449,gMMU030_TC ; enable, 2k pages, IS=0, TIA=4, TIB=4, TIC=4, TID=8
dc.l $f0394000,gMMU030_TC ; pmove addr,tc
dc.l $f0002400 ; pflusha
bsr CPU_CacheClear
MainSUDone:
rts
EDIT:
https://github.com/agranlund/tftools/tree/master/src
So annoyingly FASTROM.PRG be written in C. The original "old" MAPROM is in assembler but would have to be seriously stripped down to the bare minimum as I only have about 6K left in the ROM :(
Hopefully
@agranlund Can sort this out when he returns.