The Final Replay on VICE

The Final Replay (TFR06) is a ROM replacement for the Retro Replay cartridge. It supports the network adapter RRNET very well and provides nice networking features like the codenet or WarpCopy64 (a high speed disk transfer tool).

Unfortunately, TFR06 does not run on the current version (1.20) of VICE. It simply hangs the emulator after a reset cycle if the RRNET emulation is enabled. Here is how to fix it:

As I already hacked a bit the TFE/RRNET driver of VICE (to toggle RRNET emulation correctly), the activated debug switches came in handy to track down the problem: The current emulation of the networking chip (a CS8900a) is not accurate enough for this and surely other applications.

The chips datasheet revealed that an important register is not emulated in VICE: after a reset of the chip the host has to wait until it is setup correctly. An “initialized correctly” bit is set at that time. TFR resets the cs8900a and waits for this bit… forever on VICE as there the register is alway set to 0…

A simple solution to this problem is to simply set this bit in the emulated chip. The following tiny patch adds this behaviour to release 1.20 (file src/c64/tfe.c):

@@ -453,6 +453,10 @@
         SET_PP_16(TFE_PP_ADDR_SE_BUSST,       0x0018);
         SET_PP_16(TFE_PP_ADDR_SE_TDR,         0x001C);

+        /* 4.4.19 Self Status Register, p. 65
+           Important: set INITD (Bit 7) to signal device is ready */
+        SET_PP_16(TFE_PP_ADDR_SE_SELFST,      0x0096);
+
         tfe_arch_post_reset();

         TFE_DEBUG_OUTPUT_REG();

Ok, now the init flag is always set, and does not zero in a reset condition. But any well written code that resets the chip and waits for a set init bit should run now…

Leave a Reply