***************************************************************** * Genesis 32X Sample Program * Genesis Main Routine * * Copyright SEGA of America inc. 1994 *---------------------------------------------------------------* ***************************************************************** MARSREV1 equ 0 ;0=REV2.0 ;1=REV1.0 section 68kdata resetflag ds.l 1 resetcode ds.l 8 section M68Kcode include sega.i include md.i ; genesis memory Map include ..\debugger\debug.i *---------------------------------------------------------------* ; Vector / genesis ID / 32x Initial Program include header.asm ; Genesis & 32X Header *---------------------------------------------------------------* main: bcs _error0 ; if cs=1 then ID error or Self check error move.l #0,resetflag ; clear the reset flag if cold start btst #15,d0 bne.b VresStart ; do this just in case bra _init VresStart: move.l #marsreg,a5 btst.b #ADEN,adapter(a5) bne AdapterEnable ; 32Xが有効になっているか? move.l #0,comm8(a5) move.l #l0,a0 ; copy from ROM to WRAM move.l #resetcode,a1 move.l a1,a2 move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ jmp (a2) ; jump workram l0: move.b #1,adapter(a5) ; switch back into MARS mode ; SH2 reset - wait 10ms - move.l #RestartIcd,a0 jmp (a0) ; jump ROM(+$880000) RestartIcd: move.l #$a10000,a5 move.l #-64,a4 move.w #3900,d7 ; 8 move.l #marsipl+$6e4,a1 jmp (a1) ; jump icd_mars.prg ?res_wait AdapterEnable: move.l #marsreg,a5 btst.b #RES,adapter(a5) bne _hotstart ; test if this was a warm start or a cold start bra.b RestartIcd ; go to hotstart if this is a reset ; otherwise jump into the icd code _init: move #$2700,sr ; init 68k status reg include lock.asm move #$2700,sr ; init 68k status reg lea marsreg,a5 .w: cmp.l #'M_OK',comm0(a5) ; SH2 Master OK ? bne .w .w1: cmp.l #'S_OK',comm4(a5) ; SH2 Slave OK ? bne .w1 ' move.l #"INIT",resetflag _hotstart: jsr SegaLogo moveq #0,d0 move.l d0,comm0(a5) ;tell sh2's all well move.l d0,comm4(a5) ;tell sh2's all well cmp.l #"INIT",resetflag bne _init if debug ;-------------------------------------------------------; ; NEXT COMES THE 68K DEBUGGER "MOVE" AND INIT ;-------------------------------------------------------; lea monitor_68000,a0 ;* move.l #$ff0000,a1 ;* move.l #(monitor_68000_end-monitor_68000)/4,d7 ;* @move_mon ;* move.l (a0)+,(a1)+ ;* dbra d7,@move_mon ;* ;* jsr $ff0000 ;* debugger will halt in this routine ;-------------------------------------------------------; ; 68K DEBUGGER NOW HAS THE HOOKS IN ROM IMAGE ; **NOTE, THE DEBUGGER STORES ITS VECTORS ON TOP OF YOUR ; VECTORS. THIS MEANS THE ROM IMAGE MUST NOT BE WRITE ; PROTECTED AT THIS POINT. ; TO WRITE PROTECT YOUR BINARY IMAGE YOU MUST INSTALL ; THE 68K BINARY HOOKS IN YOUR 68K VECTOR TABLE(S) ;-------------------------------------------------------; endif ;SetVdpRegister 01,$74 ; Turn on the display & the Vblank move.w #$8104,$c00004 ;IRQs/screen = OFF move.w #$2300,sr move.l #"INIT",resetflag @lp: nop nop bra @lp *---------------------------------------------------------------* * Error Routine *---------------------------------------------------------------* _error0: move.w #$2700,sr @lp: bra @lp cnop 0,4 ;* include "segalogo.asm" ;-------------------------------------------------------; ; THE 68K DEBUGGER BINARY COMES NEXT ;MUST BE LOCATED ON WORD BOUNDRY ;-------------------------------------------------------; ;* cnop 0,4 ;* monitor_68000 ;* incbin ..\debugger\mon68k.bin ;* 68K debugger monitor monitor_68000_end ;* ;-------------------------------------------------------; ; Include the sound sample ;-------------------------------------------------------; export soundstart, soundend cnop 0,4 soundstart incbin ..\data\test.wav soundend cnop 0,4 ;-------------------------------------------------------; ; Include picture of Celtic Woman ;-------------------------------------------------------; export picturestart cnop 0,4 picturestart incbin ..\data\celtic.bin cnop 0,4 end