[PATCH] Install a _FRB cookie when using TT RAM in Falcon mode |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- Subject: [PATCH] Install a _FRB cookie when using TT RAM in Falcon mode
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sun, 27 Jul 2025 15:18:38 +0200
Without a fast ram buffer, access to the floppy disk fails since
the FDC can only handle 24-bit addresses.
---
src/cartData.c | 88 ++++++++++++++++++++++---------------------
src/cart_asm.s | 26 +++++++++++++
src/cpu/hatari-glue.c | 9 +++++
3 files changed, 81 insertions(+), 42 deletions(-)
diff --git a/src/cartData.c b/src/cartData.c
index 705820d5..94452206 100644
--- a/src/cartData.c
+++ b/src/cartData.c
@@ -25,51 +25,55 @@ const char CartData_fileid[] = "Hatari cartData.c";
*/
const uint8_t Cart_data[] =
{
-0xab,0xcd,0xef,0x42,0x00,0x00,0x00,0x00,0x08,0xfa,0x00,0x58,0x00,0xfa,0x00,0x5e,
+0xab,0xcd,0xef,0x42,0x00,0x00,0x00,0x00,0x08,0xfa,0x00,0x58,0x00,0xfa,0x00,0x9c,
0x58,0x00,0x32,0x29,0x00,0x00,0x02,0x92,0x48,0x41,0x54,0x41,0x52,0x49,0x2e,0x54,
0x4f,0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x08,0x69,0x0a,0x66,0x02,
0x4e,0x73,0x2f,0x3a,0xff,0xf0,0x4e,0x75,0x4e,0x41,0x4f,0xef,0x00,0x10,0x4a,0x80,
0x6b,0xee,0x00,0x09,0x69,0xec,0x67,0xe8,0x2f,0x00,0x2f,0x08,0x3f,0x3c,0x00,0x49,
-0x4e,0x41,0x5c,0x8f,0x20,0x1f,0x4e,0x73,0xa0,0x00,0x00,0x0a,0x4e,0x75,0x48,0x7a,
-0x00,0x16,0x3f,0x3c,0x00,0x09,0x4e,0x41,0x5c,0x8f,0x3f,0x3c,0x00,0x07,0x4e,0x41,
-0x54,0x8f,0x42,0x67,0x4e,0x41,0x1b,0x45,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
-0x20,0x20,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,
-0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x0d,0x0a,0x20,0x20,0x20,
-0x20,0x20,0x20,0x20,0x20,0x48,0x61,0x74,0x61,0x72,0x69,0x20,0x6b,0x65,0x79,0x62,
-0x6f,0x61,0x72,0x64,0x20,0x73,0x68,0x6f,0x72,0x74,0x63,0x75,0x74,0x73,0x0d,0x0a,
-0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,
+0x4e,0x41,0x5c,0x8f,0x20,0x1f,0x4e,0x73,0xa0,0x00,0x00,0x0a,0x66,0x3c,0x42,0x67,
+0x2f,0x3c,0x00,0x01,0x02,0x00,0x3f,0x3c,0x00,0x44,0x4e,0x41,0x50,0x8f,0x4a,0x80,
+0x67,0x28,0xd0,0xbc,0x00,0x00,0x01,0xff,0xc0,0xbc,0xff,0xff,0xfe,0x00,0x20,0x78,
+0x05,0xa0,0x50,0x88,0x4a,0x90,0x66,0xfa,0x22,0x28,0x00,0x04,0x67,0x0c,0x20,0xfc,
+0x5f,0x46,0x52,0x42,0x20,0xc0,0x42,0x98,0x20,0xc1,0x4e,0x75,0x48,0x7a,0x00,0x16,
+0x3f,0x3c,0x00,0x09,0x4e,0x41,0x5c,0x8f,0x3f,0x3c,0x00,0x07,0x4e,0x41,0x54,0x8f,
+0x42,0x67,0x4e,0x41,0x1b,0x45,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,
-0x3d,0x0d,0x0a,0x0d,0x0a,0x20,0x46,0x31,0x31,0x20,0x3a,0x20,0x74,0x6f,0x67,0x67,
-0x6c,0x65,0x20,0x66,0x75,0x6c,0x6c,0x73,0x63,0x72,0x65,0x65,0x6e,0x2f,0x77,0x69,
-0x6e,0x64,0x6f,0x77,0x65,0x64,0x20,0x6d,0x6f,0x64,0x65,0x0d,0x0a,0x20,0x46,0x31,
-0x32,0x20,0x3a,0x20,0x61,0x63,0x74,0x69,0x76,0x61,0x74,0x65,0x20,0x74,0x68,0x65,
-0x20,0x73,0x65,0x74,0x75,0x70,0x20,0x47,0x55,0x49,0x20,0x6f,0x66,0x20,0x48,0x61,
-0x74,0x61,0x72,0x69,0x0d,0x0a,0x0d,0x0a,0x41,0x6c,0x6c,0x20,0x6f,0x74,0x68,0x65,
-0x72,0x20,0x73,0x68,0x6f,0x72,0x74,0x63,0x75,0x74,0x73,0x20,0x61,0x72,0x65,0x20,
-0x61,0x63,0x74,0x69,0x76,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x0d,0x0a,0x70,0x72,
-0x65,0x73,0x73,0x69,0x6e,0x67,0x20,0x41,0x6c,0x74,0x47,0x72,0x20,0x6f,0x72,0x20,
-0x52,0x69,0x67,0x68,0x74,0x2d,0x41,0x6c,0x74,0x20,0x6f,0x72,0x20,0x4d,0x65,0x74,
-0x61,0x20,0x6b,0x65,0x79,0x0d,0x0a,0x74,0x6f,0x67,0x65,0x74,0x68,0x65,0x72,0x20,
-0x77,0x69,0x74,0x68,0x20,0x6f,0x6e,0x65,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,
-0x66,0x6f,0x6c,0x6c,0x6f,0x77,0x69,0x6e,0x67,0x20,0x6b,0x65,0x79,0x73,0x3a,0x0d,
-0x0a,0x0d,0x0a,0x20,0x61,0x20,0x3a,0x20,0x52,0x65,0x63,0x6f,0x72,0x64,0x20,0x61,
-0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x0d,0x0a,0x20,0x67,0x20,0x3a,0x20,0x47,
-0x72,0x61,0x62,0x20,0x61,0x20,0x73,0x63,0x72,0x65,0x65,0x6e,0x73,0x68,0x6f,0x74,
-0x0d,0x0a,0x20,0x69,0x20,0x3a,0x20,0x4c,0x65,0x61,0x76,0x65,0x20,0x66,0x75,0x6c,
-0x6c,0x20,0x73,0x63,0x72,0x65,0x65,0x6e,0x20,0x26,0x20,0x69,0x63,0x6f,0x6e,0x69,
-0x66,0x79,0x20,0x77,0x69,0x6e,0x64,0x6f,0x77,0x0d,0x0a,0x20,0x6a,0x20,0x3a,0x20,
-0x6a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x20,0x76,0x69,0x61,0x20,0x6b,0x65,0x79,
-0x20,0x6a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x20,0x6f,0x6e,0x2f,0x6f,0x66,0x66,
-0x0d,0x0a,0x20,0x6d,0x20,0x3a,0x20,0x6d,0x6f,0x75,0x73,0x65,0x20,0x67,0x72,0x61,
-0x62,0x0d,0x0a,0x20,0x72,0x20,0x3a,0x20,0x77,0x61,0x72,0x6d,0x20,0x72,0x65,0x73,
-0x65,0x74,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x53,0x54,0x0d,0x0a,0x20,0x63,
-0x20,0x3a,0x20,0x63,0x6f,0x6c,0x64,0x20,0x72,0x65,0x73,0x65,0x74,0x20,0x6f,0x66,
-0x20,0x74,0x68,0x65,0x20,0x53,0x54,0x0d,0x0a,0x20,0x73,0x20,0x3a,0x20,0x65,0x6e,
-0x61,0x62,0x6c,0x65,0x2f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x20,0x73,0x6f,0x75,
-0x6e,0x64,0x0d,0x0a,0x20,0x71,0x20,0x3a,0x20,0x71,0x75,0x69,0x74,0x20,0x74,0x68,
-0x65,0x20,0x65,0x6d,0x75,0x6c,0x61,0x74,0x6f,0x72,0x0d,0x0a,0x20,0x78,0x20,0x3a,
-0x20,0x74,0x6f,0x67,0x67,0x6c,0x65,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2f,0x6d,
-0x61,0x78,0x20,0x73,0x70,0x65,0x65,0x64,0x0d,0x0a,0x20,0x79,0x20,0x3a,0x20,0x65,
-0x6e,0x61,0x62,0x6c,0x65,0x2f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x20,0x73,0x6f,
-0x75,0x6e,0x64,0x20,0x72,0x65,0x63,0x6f,0x72,0x64,0x69,0x6e,0x67,0x0d,0x0a,0x00,
+0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,
+0x20,0x20,0x20,0x48,0x61,0x74,0x61,0x72,0x69,0x20,0x6b,0x65,0x79,0x62,0x6f,0x61,
+0x72,0x64,0x20,0x73,0x68,0x6f,0x72,0x74,0x63,0x75,0x74,0x73,0x0d,0x0a,0x20,0x20,
+0x20,0x20,0x20,0x20,0x20,0x20,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,
+0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x0d,
+0x0a,0x0d,0x0a,0x20,0x46,0x31,0x31,0x20,0x3a,0x20,0x74,0x6f,0x67,0x67,0x6c,0x65,
+0x20,0x66,0x75,0x6c,0x6c,0x73,0x63,0x72,0x65,0x65,0x6e,0x2f,0x77,0x69,0x6e,0x64,
+0x6f,0x77,0x65,0x64,0x20,0x6d,0x6f,0x64,0x65,0x0d,0x0a,0x20,0x46,0x31,0x32,0x20,
+0x3a,0x20,0x61,0x63,0x74,0x69,0x76,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x73,
+0x65,0x74,0x75,0x70,0x20,0x47,0x55,0x49,0x20,0x6f,0x66,0x20,0x48,0x61,0x74,0x61,
+0x72,0x69,0x0d,0x0a,0x0d,0x0a,0x41,0x6c,0x6c,0x20,0x6f,0x74,0x68,0x65,0x72,0x20,
+0x73,0x68,0x6f,0x72,0x74,0x63,0x75,0x74,0x73,0x20,0x61,0x72,0x65,0x20,0x61,0x63,
+0x74,0x69,0x76,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x0d,0x0a,0x70,0x72,0x65,0x73,
+0x73,0x69,0x6e,0x67,0x20,0x41,0x6c,0x74,0x47,0x72,0x20,0x6f,0x72,0x20,0x52,0x69,
+0x67,0x68,0x74,0x2d,0x41,0x6c,0x74,0x20,0x6f,0x72,0x20,0x4d,0x65,0x74,0x61,0x20,
+0x6b,0x65,0x79,0x0d,0x0a,0x74,0x6f,0x67,0x65,0x74,0x68,0x65,0x72,0x20,0x77,0x69,
+0x74,0x68,0x20,0x6f,0x6e,0x65,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x66,0x6f,
+0x6c,0x6c,0x6f,0x77,0x69,0x6e,0x67,0x20,0x6b,0x65,0x79,0x73,0x3a,0x0d,0x0a,0x0d,
+0x0a,0x20,0x61,0x20,0x3a,0x20,0x52,0x65,0x63,0x6f,0x72,0x64,0x20,0x61,0x6e,0x69,
+0x6d,0x61,0x74,0x69,0x6f,0x6e,0x0d,0x0a,0x20,0x67,0x20,0x3a,0x20,0x47,0x72,0x61,
+0x62,0x20,0x61,0x20,0x73,0x63,0x72,0x65,0x65,0x6e,0x73,0x68,0x6f,0x74,0x0d,0x0a,
+0x20,0x69,0x20,0x3a,0x20,0x4c,0x65,0x61,0x76,0x65,0x20,0x66,0x75,0x6c,0x6c,0x20,
+0x73,0x63,0x72,0x65,0x65,0x6e,0x20,0x26,0x20,0x69,0x63,0x6f,0x6e,0x69,0x66,0x79,
+0x20,0x77,0x69,0x6e,0x64,0x6f,0x77,0x0d,0x0a,0x20,0x6a,0x20,0x3a,0x20,0x6a,0x6f,
+0x79,0x73,0x74,0x69,0x63,0x6b,0x20,0x76,0x69,0x61,0x20,0x6b,0x65,0x79,0x20,0x6a,
+0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x20,0x6f,0x6e,0x2f,0x6f,0x66,0x66,0x0d,0x0a,
+0x20,0x6d,0x20,0x3a,0x20,0x6d,0x6f,0x75,0x73,0x65,0x20,0x67,0x72,0x61,0x62,0x0d,
+0x0a,0x20,0x72,0x20,0x3a,0x20,0x77,0x61,0x72,0x6d,0x20,0x72,0x65,0x73,0x65,0x74,
+0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x53,0x54,0x0d,0x0a,0x20,0x63,0x20,0x3a,
+0x20,0x63,0x6f,0x6c,0x64,0x20,0x72,0x65,0x73,0x65,0x74,0x20,0x6f,0x66,0x20,0x74,
+0x68,0x65,0x20,0x53,0x54,0x0d,0x0a,0x20,0x73,0x20,0x3a,0x20,0x65,0x6e,0x61,0x62,
+0x6c,0x65,0x2f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x20,0x73,0x6f,0x75,0x6e,0x64,
+0x0d,0x0a,0x20,0x71,0x20,0x3a,0x20,0x71,0x75,0x69,0x74,0x20,0x74,0x68,0x65,0x20,
+0x65,0x6d,0x75,0x6c,0x61,0x74,0x6f,0x72,0x0d,0x0a,0x20,0x78,0x20,0x3a,0x20,0x74,
+0x6f,0x67,0x67,0x6c,0x65,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2f,0x6d,0x61,0x78,
+0x20,0x73,0x70,0x65,0x65,0x64,0x0d,0x0a,0x20,0x79,0x20,0x3a,0x20,0x65,0x6e,0x61,
+0x62,0x6c,0x65,0x2f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x20,0x73,0x6f,0x75,0x6e,
+0x64,0x20,0x72,0x65,0x63,0x6f,0x72,0x64,0x69,0x6e,0x67,0x0d,0x0a,0x00
};
diff --git a/src/cart_asm.s b/src/cart_asm.s
index fd6e4a57..5ea4155e 100644
--- a/src/cart_asm.s
+++ b/src/cart_asm.s
@@ -74,6 +74,32 @@ pexec:
sys_init:
dc.w $A000 ; Line-A init (needed for VDI resolutions)
dc.w SYSINIT_OPCODE ; Illegal opcode to call OpCode_SysInit()
+ bne.s sys_init_done
+ ; If we provide TT RAM in Falcon mode, we have to install a _FRB
+ ; cookie, too. Reserve some RAM with Mxalloc() for this.
+ clr.w -(sp) ; ST-RAM only
+ move.l #65536 + 512,-(sp) ; Size
+ move.w #68,-(sp)
+ trap #1 ; Mxalloc
+ addq.l #8,sp
+ tst.l d0
+ beq.s sys_init_done
+ add.l #511,d0
+ and.l #$fffffe00,d0 ; Align buffer to 512 byte boundary
+ move.l $5a0.s,a0 ; Get cookie jar pointer
+ ; Since we run this with TOS 4.x only, we can assume that the jar is
+ ; available and that there is at least one entry in the jar already
+cj_loop:
+ addq.l #8,a0
+ tst.l (a0)
+ bne.s cj_loop
+ move.l 4(a0),d1 ; Jar size
+ beq.s sys_init_done
+ move.l #'_FRB',(a0)+ ; Install the _FRB cookie
+ move.l d0,(a0)+
+ clr.l (a0)+ ; New cookie jar end marker
+ move.l d1,(a0)+
+sys_init_done:
rts
diff --git a/src/cpu/hatari-glue.c b/src/cpu/hatari-glue.c
index e4b8e90c..ecccd9ec 100644
--- a/src/cpu/hatari-glue.c
+++ b/src/cpu/hatari-glue.c
@@ -227,6 +227,8 @@ static bool is_cart_pc(void)
*/
uae_u32 REGPARAM3 OpCode_SysInit(uae_u32 opcode)
{
+ uint16_t sr = M68000_GetSR();
+
if (is_cart_pc())
{
/* Add any drives mapped by TOS in the interim */
@@ -258,6 +260,13 @@ uae_u32 REGPARAM3 OpCode_SysInit(uae_u32 opcode)
fill_prefetch();
}
+ if (Config_IsMachineFalcon() && TTmemory && !bIsEmuTOS)
+ sr |= SR_ZERO;
+ else
+ sr &= ~SR_ZERO;
+
+ M68000_SetSR(sr);
+
return 4 * CYCLE_UNIT / 2;
}
--
2.50.1
--MP_/R5biUdMyUhrLJBchV9eRQIT--