[hatari-devel] Fix display of Atari logo with extended VDI resolutions

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


HI

attached is a patch that fixes this problem for TOS 2.06 and 3.06. I haven't 
found yet a solution for 4.x, but AFAIK that version already uses VDI calls 
for this purpose, all that needs to be done is to make sure that the LineA 
variables are patched before this happens.

I had to insert the SYSINIT_OPCODE into the sequence, so that the LineA 
variables are fixed by OpCode_SysInit(). If you don't like that, you have to 
find a way to get the neccesary information. All that the actual drawing 
function needs is the number of bytes/screenline (v_lin_wr) and the number of 
planes.

Greetings,
Thorsten
diff -r d527521e02dc src/cpu/hatari-glue.c
--- a/src/cpu/hatari-glue.c	Mon Nov 14 00:21:09 2016 +0200
+++ b/src/cpu/hatari-glue.c	Tue Nov 15 15:08:58 2016 +0100
@@ -166,6 +166,19 @@
 }
 
 
+static bool is_rom_pc(void)
+{
+	Uint32 pc = M68000_GetPC();
+
+	if (ConfigureParams.System.bAddressSpace24 || (pc >> 24) == 0xff)
+	{
+		pc &= 0x00ffffff;	/* Mask to 24-bit address */
+	}
+
+	return pc >= 0xe7e000 && pc < 0xe7ffff;
+}
+
+
 /**
  * This function will be called at system init by the cartridge routine
  * (after gemdos init, before booting floppies).
@@ -190,6 +203,10 @@
 		VDI_LineA(regs.regs[0], regs.regs[9]);
 
 		CpuDoNOP ();
+	} else if (is_rom_pc())
+	{
+		VDI_LineA(regs.regs[0], regs.regs[9]);
+		CpuDoNOP ();
 	}
 	else
 	{
diff -r d527521e02dc src/tos.c
--- a/src/tos.c	Mon Nov 14 00:21:09 2016 +0200
+++ b/src/tos.c	Tue Nov 15 15:08:58 2016 +0100
@@ -135,6 +135,7 @@
 static const char pszNoPmmu[] = "disable PMMU access";
 static const char pszFix060[] = "replace code for 68060";
 static const char pszFalconExtraRAM[] = "enable extra TT RAM on Falcon";
+static const char pszAtariLogo[] = "draw Atari Logo";
 
 //static Uint8 pRtsOpcode[] = { 0x4E, 0x75 };  /* 0x4E75 = RTS */
 static const Uint8 pNopOpcodes[] = { 0x4E, 0x71, 0x4E, 0x71, 0x4E, 0x71, 0x4E, 0x71,
@@ -145,6 +146,44 @@
 static const Uint8 pRomCheckOpcode306[] = { 0x60, 0x00, 0x00, 0xB0 };  /* BRA $e00886 */
 static const Uint8 pRomCheckOpcode404[] = { 0x60, 0x00, 0x00, 0x94 };  /* BRA $e00746 */
 static const Uint8 pBraOpcode[] = { 0x60 };  /* 0x60XX = BRA */
+static const Uint8 pAtariLogo1[] = { 0x4e, 0xb9, 0x00, 0xe7, 0xef, 0x00, 0x60, 0x42 };  /* JSR $e7ef00; bra logodone */
+
+/*
+ * Routine for drawing the Atari logo.
+ * When this function is called, A0 contains a pointer to a 96x86x1 image.
+ * We cannot use the vdi yet (the screen workstation has not yet been opened),
+ * but we can take into account extended VDI modes.
+ */
+static const Uint8 pAtariLogo2[] = {
+	0x2f, 0x08,                 /* move.l    a0,-(a7) */
+	0xa0, 0x00,                 /* linea init */
+	0x00, SYSINIT_OPCODE,
+	0x3e, 0x10,                 /* move.w    0(a0),d7 ; get planes */
+	0x42, 0x86,                 /* clr.l     d6 */
+	0x3c, 0x28, 0x00, 0x02,     /* move.w    2(a0),d6 ; get bytes per line */
+	0x20, 0x5f,                 /* movea.l   (a7)+,a0 */
+	0x22, 0x78, 0x04, 0x4e,     /* movea.l   (_v_bas_ad).w,a1 */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 ; start drawing at 5th line */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 */
+	0x30, 0x3c, 0x00, 0x55,     /* move.w    #$0055,d0 ; 86 lines of data */
+/* logocol1: */
+	0x72, 0x05,                 /* moveq.l   #5,d1 ; 6 words of data per line */
+	0x24, 0x49,                 /* movea.l   a1,a2 */
+/* logocol2: */
+	0x34, 0x18,                 /* move.w    (a0)+,d2 */
+	0x36, 0x07,                 /* move.w    d7,d3 */
+	0x53, 0x43,                 /* subq.w    #1,d3 */
+/* logocol3: */
+	0x34, 0xc2,                 /* move.w    d2,(a2)+ */
+	0x51, 0xcb, 0xff, 0xfc,     /* dbf       d3,logocol3 */
+	0x51, 0xc9, 0xff, 0xf2,     /* dbf       d1,logocol2 */
+	0xd3, 0xc6,                 /* adda.l    d6,a1 */
+	0x51, 0xc8, 0xff, 0xe8,     /* dbf       d0,logocol1 */
+	0x4e, 0x75,                 /* rts */
+};
 
 static const Uint8 p060movep1[] = {	/* replace MOVEP */
 	0x70, 0x0c,			/* moveq #12,d0 */
@@ -235,12 +274,16 @@
   /* as we've changed bytes in the ROM! So, just skip anyway! */
   { 0x206, -1, pszRomCheck, TP_ALWAYS, 0xE007FA, 0x2E3C0001, 4, pRomCheckOpcode206 },
   { 0x206, -1, pszDmaBoot, TP_HDIMAGE_OFF, 0xE00898, 0x610000E0, 4, pNopOpcodes }, /* BSR.W $E0097A */
+  { 0x206, -1, pszAtariLogo, TP_ALWAYS, 0xE0076C, 0x1038044c, sizeof( pAtariLogo1 ), pAtariLogo1 },
+  { 0x206, -1, pszAtariLogo, TP_ALWAYS, 0xE7EF00, 0xffffffff, sizeof( pAtariLogo2 ), pAtariLogo2 },
 
   { 0x306, -1, pszRomCheck, TP_ALWAYS, 0xE007D4, 0x2E3C0001, 4, pRomCheckOpcode306 },
   { 0x306, -1, pszNoPmmu, TP_ANTI_PMMU, 0xE00068, 0xF0394000, 24, pNopOpcodes }, /* pmove : TC=0 TT0=0 TT1=0 -> disable MMU */
   { 0x306, -1, pszNoPmmu, TP_ANTI_PMMU, 0xE01702, 0xF0394C00, 32, pNopOpcodes }, /* pmove : CRP=80000002 00000700 TC=80f04445 TT0=017e8107 TT1=807e8507 -> */
   { 0x306, -1, pszFix060, TP_FIX_060, 0xe024dc, 0x01C80000, 12, p060movep1 },
   { 0x306, -1, pszFix060, TP_FIX_060, 0xe024fa, 0x01C80000, 12, p060movep1 },
+  { 0x306, -1, pszAtariLogo, TP_ALWAYS, 0xE00754, 0x1038044c, sizeof( pAtariLogo1 ), pAtariLogo1 },
+  { 0x306, -1, pszAtariLogo, TP_ALWAYS, 0xE7EF00, 0xffffffff, sizeof( pAtariLogo2 ), pAtariLogo2 },
 
   { 0x400, -1, pszNoPmmu, TP_ANTI_PMMU, 0xE00064, 0xF0394000, 24, pNopOpcodes }, /* pmove : TC=0 TT0=0 TT1=0 -> disable MMU */
   { 0x400, -1, pszNoPmmu, TP_ANTI_PMMU, 0xE0148A, 0xF0394C00, 32, pNopOpcodes },


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