The QuickEdit and WordFinder applications expect to execute from a 128KB Eprom. Their bank switching code uses static addressing, so if SpellMaster Spell-Master is not blown to the last eight banks in a card this will fail. Several fixes are needed to convert this code to relative bank addressing.
My fix makes the following improvements:
SpellMaster Spell-Master now runs in any slot, including Slot slot 0 (see Slot 0 Flash Downgrade )
It now runs in any eight adjacent banks, so fine for RomCombiner compilations of many multiple application ROMs on a single card.
It can now run as a RAM app using Installer on OZ 4.0 or lower. Unfortunately the RAM app support in OZ 4.6 through to OZ 5.0 does not guarantee consecutive bank allocation, so SpellMaster Spell-Master must run from a as card application on those versions.
Method
The Application DORs reveal that the application code resides in SPELL.63 (mostly WordFinder) and SPELL.62 (mostly QuickEdit, though some functions are called from SPELL.63). The remaining six banks, SPELL.56 to SPELL.61, comprise the dictionary.
By searching disassembling the two application banks using dzasm and searching for OS_Mgb calls, we can find where the code determines the current running bank. Using this it determines which slot it is running from and combines this information with the static bank numbers when switching banks.
This patching task was complicated by the WordFinder bank switching code being situated before the executable entry point, nestled in between the QuickEdit and WordFinder Application DORs. My initial disassembly starting at file offset $01D1 (entry point) had missed this.
SPELL.62
Original code location 1:
...
Code Block |
---|
; Address $C286, or offset $0286 in SPELL.62 .hook_function_in_bank_63 ; IN: ; A = Position in function jump table ($00 to $0A) ; PUSH AF ; F5 Store function input on stack LD C, $03 ; OE 03 OZ OS_Mgb ; E7 5A Get bank bound to segment 3 (running bank), stored in B INC B ; 04 Increment B to pick next bank address (SPELL.63) NOP ; 00 NOP ; 00 NOP ; 00 NOP ; 00 NOP ; 00 LD C, $01 ; 0E 01 OZ OS_Mpb ; E7 5D Bind SPELL.63 into segment 1 JP $7F80 ; C3 80 7F Jump to $7F80 in segment 1 (file offset $3F80) |
SPELL.63
Original code location 1:
...
Code Block |
---|
; Address $7F8B, or offset $3F8B in SPELL.63 LD C, $01 ; 0E 01 OZ OS_Mgb ; E7 5A Get bank bound to segment 1 (running bank), stored in B DEC B ; 05 Decrement B to pick preceding bank address (SPELL.62) NOP ; 00 NOP ; 00 NOP ; 00 NOP ; 00 NOP ; 00 LD C, $03 ; 0E 03 OZ OS_Mpb ; E7 5D Bind that bank address to segment 3 POP DE ; D1 POP BC ; C1 POP HL ; E1 POP AF ; F1 Restore register states from stack RET ; C9 Return |
Download Patches
These patches are published in the IPS format, popular for ROM patches.
...