dirkwhoffmann / Moira

A Motorola 68000 emulator written in C++
https://dirkwhoffmann.github.io/Moira
Other
109 stars 13 forks source link

Support caches #9

Open mras0 opened 2 years ago

mras0 commented 2 years ago

Ref: https://github.com/dirkwhoffmann/vAmiga/issues/730 https://github.com/dirkwhoffmann/Moira/issues/8

Long term it might be an idea to support caches properly as it's observable to programs. Attached is such an evil Amiga program (verified on a 68EC020). On a real 020 (Note: NOT later version) it should show a black screen. A blue screen is shown otherwise. (The test could be improved in many ways and assumes instruction cache is enabled).

cache.zip

Source:

start:
        move.w  #$7fff,$dff09a
        move.w  #$7fff,$dff096
        lea     $dff180,a0
        moveq   #0,d0
        move.b  #$0f,d1
        lea     .sup(pc),a1
        move.w  #$f00,(a0)
        lea     .inst+1(pc),a2
        move.l  a1,32.w
        moveq   #0,d2
        move.w  #$2000,sr
.sup
        tst.l   d2
        bne.b   .loop
        addq.l  #1,d2
        cnop    0,4
.loop:
        move.w  d0,(a0)
.inst   moveq   #0,d0
        move.b  d1,(a2)
        bra     .loop