;======================================================= ; Patch file to fix The Micro Xevious ROM to run on a Sega ; SC-3000 or SG-1000 (with an appropriate cart or multicart) ; This is a WLA-DX .asm file ; See Maxim's assembler tutorial if you need help getting it to compile ; http://www.smspower.org/maxim/HowToProgram/Lesson1 ; Nick 13 Dec 2011 ; SC-3000 Survivors ; http://sc-3000.com ; http://sc3000-multicart.com ;======================================================= ; Xevious needs a couple of modifications to run on an SC-3000 ; instead of a Samsung Gamboy / Master System clone. ; First, we have to init the PPI to read the Joystick column of the PPI inputs ; Second, they incorrectly left bit 7 set to zero on some of their writes ; to VDP register 1. This sets the TMS99XXA to 4KB RAM mode. ; That screws up some of the background tiles ; Third, there is a bad write to VDP register 6 that resets the sprite generator ; table back to $0000. That is why you end up flying a bunch of letters around ; the screen :) ; Note: Xevious requires 8Kb of RAM from $E000 to $FFFF ; So the cart must have on-board RAM ; RAM mirroring is not a problem. I checked in Meka and there are no writes ; to $8000 to $DFFF ; We have blank space from $3E80 to $3FE0. I hope that is genuine unused fill :) ;======================================================= .memorymap defaultslot 0 slotsize 32768 slot 0 $0000 .endme .rombankmap bankstotal 1 banksize 32768 banks 1 .endro .bank 0 slot 0 ; include the original ROM .org $0000 .incbin "Xevious(KR)_original.sms" .org $0001 ; replace the original jp $0064 instruction to our new entry point jp PPI_Fix ; The original code tried to write $00 to register $0E. ; If you look at the SMS VDP info you will see that writes to ; registers $0B to $0F are ignored. I think that is what should ; happen. So lets null out these operations and see what happens... ; I think the effect of the original code on a TMS9929A is ; to write $00 to register 6 which remaps the base address of ; the Sprite Generator Table from $3800 to $0000. That is why ; I was flying a bunch of letters around the screen :) .org $1870 nop nop nop nop nop nop ; ditto .org $1884 nop nop nop nop nop nop .org $18c4 ; original code wrote $42 to VDP register 1 ; ie. screen on, disable interrupts, keep graphics mode 2, 16x16 sprites, mag 0 ; But it incorrectly selects 4K VRAM - or it with $80 to set bit 7 .db $c2 .org $18cc ; original code wrote $62 to VDP register 1 ; ie. screen on, enable interrupts, keep graphics mode 2, 16x16 sprites, mag 0 ; But it incorrectly selects 4K VRAM - or it with $80 to set bit 7 .db $e2 ;======================================================== ; We have blank space from $3E80 to $3FE0. I hope that is genuine unused fill :) ; $0620 to $2000 *appears* to be unused .org $3e80 .db "SC-3000 Survivors Patch. Enable the joystick column " .db "of keyboard matrix and fix bad VDP writes.",0 PPI_Fix: .define sc_ppi_c $de .define sc_ppi_control $df ; Add our new intitialisation code here ; Make sure the joystick column of the keyboard matrix ; is selected. This is required for games like Yie Ar Kung Fu ; that never ran on an SC-3000 and just assume that sc_ppi_c ; has the joystick input. ld a,%10010010 ; initialise SC PPI: set I/O to mode 0, A+B in, C out out (sc_ppi_control),a nop ; paranoia - probably not required :) nop nop nop in a,(sc_ppi_c) or %00000111 out (sc_ppi_c), a ; and select the joystick column of keyboard matrix nop ; just for paranoia :) nop nop nop nop ; when done, jump back to the original init routine jp $0064