Re: [hatari-devel] Adding cache support for the MegaSTE -> DONE

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi

as a summer job, I worked on supporting the MegaSTE external 16 KB cache in Hatari :)

Thanks to Christian's tests on his MegaSTE by running some custom cache test programs it was possible to precisely measure the cache speed in various scenario, as well as confirming some cache logic (such as "reading a byte from RAM will in fact cache the whole 16 bit word")

Attached is a small program that will toggle between "8 MHz - no cache" and "16 MHz - cache" when Hatari runs in MegaSTE mode (will work on reald MegaSTE too)

You can run it from TOS 2 or EmuTos in MegaSTE mode and see for yourself the speed improvement when cache is enabled (for example gembench reports between 139% and 190% speed compared to normal 8 MHz)

Note that the cache needs to be flushed on every transfer when using Gemdos HD emulation, or normal FDC / HDC. Else this would transfer data to RAM without invalidating the cache (which has no means to know RAM has been modified), thus creating crashes in the emulated program sooner or later.


For programs making use of the MegaSTE's cache + 16 MHz speed, you can try the "Little -Me- Demo" by Overlanders
https://www.pouet.net/prod.php?which=90542

The demo will switch to 16 MHz with cache during the 3d parts.


Nicolas

Attachment: cac16.prg
Description: Binary data

; Toggle the MegaSTE between "8 MHz - no cache" and "16 MHz - cache"
;
; 2024/09/03	Nicolas Pomarede


        opt     x+

	; supervisor mode
	pea     0
	move.w  #$20,-(sp)
	trap    #1
	addq.l  #6,sp
	
	move.b	$ffff8e21.w,d0
	btst	#1,d0
	beq.s	set_16			; freq is 8 MHz, set to 16 MHz

;-- set cpu to 8 MHz, no cache
set_8
	move.b	#0,$ffff8e21.w
	bra.s	end

;-- set cpu to 16 MHz with cache
set_16
	move.b	#3,$ffff8e21.w

end
	clr.w   -(sp)			; exit program
	trap    #1



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/