@@ -64,10 +64,12 @@ SYSTEM_INCLUDES
64
64
incdir asm_include:
65
65
include lvo/exec_lib.i
66
66
include lvo/expansion_lib.i
67
+ include lvo/intuition_lib.i
67
68
include exec/exec.i
68
69
include libraries/expansionbase.i
69
70
include hardware/intbits.i
70
71
include utility/tagitem.i
72
+ include intuition/intuition.i
71
73
ENDC
72
74
73
75
;debug
@@ -513,18 +515,57 @@ DataTable:
513
515
move.l a1 ,gbi_SetSpriteColor(a2 )
514
516
ENDC
515
517
518
+ ; Only bother with MMU flags if there is a (real) 68060 present
519
+ ; A softcore CPU is fully snooped, so no need..
520
+ move.l gbi_ExecBase(a2 ),a6
521
+ btst #7 ,AttnFlags+1 (a6 ) ; AFB_68060
522
+ beq .skipCM
523
+
516
524
; Try to set memory region MMU flags via mmu.library first
517
525
move.l gbi_MemoryBase(a2 ),a0
518
526
move.l gbi_MemorySize(a2 ),d0
519
527
move.l #MAPP_CACHEINHIBIT|MAPP_IMPRECISE|MAPP_NONSERIALIZED,d1
520
- move.l gbi_ExecBase(a2 ),a6
521
528
bsr SetMMU
522
529
cmp.l #-1 ,d0
523
- bne.b .skip
530
+ bne .skipCM
531
+
532
+ BUG "mmu.library failed"
533
+
534
+ ; Ok, no mmu.library - let's try with the P96 flag BIF_CACHEMODECHANGE
535
+ ; This is however not supported since P96 v3.2.4 (rtg.library 42.1226)
536
+ ; Let's check the currently running rtg.library version and warn the user if that's the case
537
+
538
+ moveq .l #42 ,d0
539
+ lea .rtgName(pc ),a1
540
+ CALLLIB _LVOOpenLibrary (libName, version)
541
+
542
+ tst .l d0
543
+ bne.b .gotRTG
544
+
545
+ BUG "Unable to open rtg.library v42"
546
+ bra.b .changeCM
547
+
548
+ .gotRTG:
549
+ movea.l d0 ,a1
550
+ move.w LIB_REVISION(a1 ),-(sp )
551
+ move.w LIB_VERSION(a1 ),-(sp )
552
+ CALLLIB _LVOCloseLibrary (library)
553
+
554
+ move.l (sp )+,d0 ; <LIB_VERSION> | <LIB_REVISION>
524
555
525
- ; mmu.library failed - let's try with the P96 flags
556
+ BUG "P96 / rtg.library %d.%d" ,d0
557
+
558
+ cmpi.l #(42 <<16 )|(1226 ),d0
559
+ blt.b .changeCM
560
+
561
+ BUG "rtg.library 42.1226 and later - show alert!"
562
+ bra.b .errorMMU
563
+
564
+ .changeCM:
565
+ BUG "Using BIF_CACHEMODECHANGE to change MMU flags for %lx/%lx" , gbi_MemoryBase(a2 ), gbi_MemorySize(a2 )
526
566
ori.l #BIF_CACHEMODECHANGE,gbi_Flags(a2 )
527
- .skip
567
+
568
+ .skipCM
528
569
move.l gbi_MemoryBase(a2 ),(gbi_MemorySpaceBase,a2 )
529
570
move.l gbi_MemorySize(a2 ),(gbi_MemorySpaceSize,a2 )
530
571
@@ -537,6 +578,29 @@ DataTable:
537
578
movem .l (sp )+,a2 /a5 /a6
538
579
rts
539
580
581
+ .errorMMU:
582
+ moveq .l #37 ,d0
583
+ lea.l .intuiName(pc ),a1
584
+ CALLLIB _LVOOpenLibrary (libName, version)
585
+ tst .l d0
586
+ beq.b .skipCM
587
+
588
+ movea.l d0 ,a6
589
+ moveq.l #RECOVERY_ALERT,d0
590
+ lea.l .noMMUmsg(pc ),a0
591
+ moveq .l #30 ,d1
592
+ CALLLIB _LVODisplayAlert ( AlertNumber, String, Height )
593
+
594
+ movea.l a6 ,a1
595
+ CALLLIB _LVOCloseLibrary (library)
596
+
597
+ bra.b .skipCM
598
+
599
+ .rtgName: dc.b 'rtg.library',0
600
+ .intuiName: dc.b 'intuition.library',0
601
+ .noMMUmsg dc.b $00 , $28 , $10 , "Replay.card with P96 v3.2.4+ (rtg.library 42.1226) requires mmu.library" , $00 , $00
602
+ even
603
+
540
604
;------------------------------------------------------------------------------
541
605
SetSwitch:
542
606
;------------------------------------------------------------------------------
0 commit comments