Yet Another SEGA GAME GEAR Emulator その9

COLECOVISIONのゲームをGAME GEARに移植する件ですが、メモリーマップを変更しました。

http://www.geocities.jp/parallel_computer_inc/android.html

f:id:tanam:20140621234410p:image:w360

以前の8000H-BFFFHでは、アドレス変換がRAMだけに限定されるメリットがありましたが、ROMサイズが16KBまでとなっていました。今回の4000H-BFFFHでは32KBまで対応できます。

0000H-1FFFH coleco29.bin
2000H-3FFFH sc-3000 keyboard program
4000H-BFFFH burger.col

SC-3000用入力ルーチンは変更ありません。メモリマップの変更によりSC-3000でも実行出来るはずです。

> copy /b coleco29.bin+sc3k.bin COLECO.ROM

coleco29.asm


(省略)

;***************************************
; RAM usage
;***************************************

		ORG	C000H

		DS	12		; default CtlState storage?
		DS	20
SndArray	DS	2		; music array pointer?
NoiseP		DS	2		; Pointer to program for noise generator
Tone1P		DS	2		; Pointer to program for tone1 generator
Tone2P		DS	2		; Pointer to program for tone2 generator
Tone3P		DS	2		; Pointer to program for tone3 generator
NoiseCtlShad	DS	1		; Noise control register shadow

		ORG	C3B9H

Stack		DS	1		; Default initial stack pointer
ParmArea	DS	9		; Parameter storage for PCOPY parameters
VDP0Shad	DS	1		; VDP register 0 shadow
VDP1Shad	DS	1		; VDP register 1 shadow
		DS	1		; unused?
D73C6		DS	1		; flag byte?
WrtRAMSprt	DS	1		; BlkWrtVRAM to RAM sprite attr table if =1
RandSeed	DS	2		; Random number seed
D73CA		DS	1		; unknown
D73CB		DS	1		; unknown
D73CC		DS	1		; unknown
D73CD		DS	2		; unknown
D73CF		DS	2		; unknown
D73D1		DS	2		; unknown
TimerList	DS	2		; Pointer to timer list
TimerAux	DS	2		; Pointer to end of timer aux storage
RawCtlState	DS	20		; Raw controller state table (2 x 10 bytes)
PulseCnt1	DS	1		; Pulse counter #1
PulseCnt2	DS	1		; Pulse counter #2
		DS	1		; unused?
Joy1Shad	DS	1		; shadow for joystick #1
Joy2Shad	DS	1		; shadow for joystick #2
Key1Shad	DS	1		; shadow for keypad #1
Key2Shad	DS	1		; shadow for keypad #2
VDPBaseShad	EQU	$		; shadow for VDP table base addresses
SprtTabShad	DS	2		;   shadow for sprite table VRAM base addr
SprtPatTabShad	DS	2		;   shadow for sprite pattern generator VRAM base addr
NameTabShad	DS	2		;   shadow for name table VRAM base address
PatGenTabShad	DS	2		;   shadow for pattern generator VRAM base addr
ClrTabShad	DS	2		;   shadow for color table VRAM base address
		DS	2		; unused?
D73FE		DS	2		; temp3

;***************************************
; Cartridge header addresses
;***************************************

		ORG	4000H

Cart_Sig	DS	2		; AA55 = title screen, 55AA = no screen
RamSprtTab	DS	2		; RAM sprite attribute table pointer
RAMSprtIdx	DS	2		; sprite index table pointer
VDP_Temp	DS	2		; pointer to temp image storage (up to 40 bytes used)
CtlState	DS	2		; pointer to controller state table (2 + 2x5 bytes)
Cart_Start	DS	2		; start of cart code
V_RST_08H	DS	3		; RST 08H vector
V_RST_10H	DS	3		; RST 10H vector
V_RST_18H	DS	3		; RST 18H vector
V_RST_20H	DS	3		; RST 20H vector
V_RST_28H	DS	3		; RST 28H vector
V_RST_30H	DS	3		; RST 30H vector
V_RST_38H	DS	3		; RST 38H vector
V_NMI		DS	3		; NMI vector (vertical blank interrupt)
Cart_Title	DS	0		; Title string "LINE 3/LINE 2/yyyy"

;***************************************
; Offsets into data blocks
;***************************************

;		Offsets into RawCtlState

RawCtlLeft	EQU	00H		; raw left controller state
RawCtlRight	EQU	0AH		; raw right controller state

;		Offsets into RawCtlLeft and RawCtlRight

RawCtlLFBit	EQU	00H		; previous left fire bit
RawCtlLFState	EQU	01H		; left fire button state
RawCtlDBits	EQU	02H		; previous directional bits
RawCtlDState	EQU	03H		; directionals state
;		EQU	04H		; unused?
;		EQU	05H		; unused?
RawCtlRFBit	EQU	06H		; previous right fire bit
RawCtlRFState	EQU	07H		; right fire button state
RawCtlKPBit	EQU	08H		; previous keypad bits
RawCtlKPState	EQU	09H		; keypad state

;		Offsets into CtlState table

CtlStateLFlag	EQU	00H		; left controller flags
CtlStateRFlag	EQU	01H		; right controller flags
CtlStateLeft	EQU	02H		; left controller state
CtlStateRight	EQU	07H		; right controller state

;		CtlStateLF/CtlStateRF bits

CtlCheckMe	EQU	80H	; 7	; if =0, do not check this ctrl at all
;		EQU	40H	; 6	; unused?
;		EQU	20H	; 5	; unused?
CtlCheckKP	EQU	10H	; 4	; check keypad
CtlCheckRFire	EQU	08H	; 3	; check right fire button
CtlCheckSpinner	EQU	04H	; 2	; check spinner
CtlCheckDir	EQU	02H	; 1	; check directionals
CtlCheckLFire	EQU	01H	; 0	; check left fire button

;		Offsets into CtlStateLeft and CtlStateRight

CtlStateLFire	EQU	00H		; left fire button
CtlStateDir	EQU	01H		; directionals
CtlStateSpin	EQU	02H		; spinner value
CtlStateRFire	EQU	03H		; right fire button
CtlStateKey	EQU	04H		; key code

;***************************************
; I/O port addresses
;***************************************

IO_KP_Select	EQU	080H		; Keypad select output port
IO_Joy_Select	EQU	0C0H		; Joystick select output port
IO_Joy1		EQU	0DCH		; Joystick 1 input port
IO_Joy2		EQU	0DDH		; Joystick 2 input port
IO_Sound	EQU	07FH		; Sound chip output port
IO_VDP_Data	EQU	0BEH		; VDP data port
IO_VDP_Addr	EQU	0BFH		; VDP VRAM address output port
IO_VDP_Status	EQU	0BFH		; VDP status input port

(省略)