📄 megasys1.c
字号:
/***************************************************************************
-= Jaleco Mega System 1 =-
driver by Luca Elia (eliavit@unina.it)
Game System Dumped? Supported?
------------------------------------------------------
64th Street C AraCORN Yes
Astyanax ? Yes encrypted
Avenging Spirit B AraCORN Yes
Cybattler ? AraCORN encrypted
Earth Defense Force B AraCORN Yes
Hachoo ? AraCORN encrypted
Legend of Makaj Z AraCORN Yes
P-47 (World) A Yes Yes
P-47 (Japan) A J-rom Yes
Phantasm* A? J-Rom encrypted
Plus Alpha ? J-Rom encrypted
RodLand (World) A? AraCORN encrypted
RodLand (Japan) A Yes Yes
Saint Dragon ? J-Rom encrypted
Soldam ? No? -
------------------------------------------------------
* Japanese version of Avenging Spirit
Hardware Main CPU Sound CPU Sound Chips
----------------------------------------------------------------
MS1 - Z 68000 Z80 YM2203c
MS1 - A 68000 68000 YM2151 OKI-M6295 x 2
MS1 - B 68000 68000 YM2151 OKI-M6295 x 2
MS1 - C 68000 68000 YM2151 OKI-M6295 x 2 YM3012
----------------------------------------------------------------
Main CPU RW MS1-A MS1-B MS1-C
-------------------------------------------------------------
ROM R 000000-03ffff 000000-03ffff 000000-07ffff
ROM R - 080000-0bffff -
VideoRegs W 084000-0843ff 044000-0443ff 0c0000-0cffff
Palette RW 088000-0887ff 048000-0487ff 0f8000-0f87ff
Object RAM RW 08e000-08ffff 04e000-04ffff 0d2000-0d3fff
Scroll 1 RW 090000-093fff 050000-053fff 0e0000-0e3fff
Scroll 2 RW 094000-097fff 054000-057fff 0e8000-0ebfff
Scroll 3 RW 098000-09bfff 058000-05bfff 0f0000-0f3fff
Work RAM RW 0f0000-0fffff 060000-07ffff* ff0000-ffffff
Input Ports R 080000-080009 0e0000-0e0001** 0d8000-d80001**
-------------------------------------------------------------
* Avenging spirit ram starts at 070000
** Through protection
Sound CPU RW MS1-A MS1-B MS1-C
-------------------------------------------------------------
ROM R 000000-01ffff 000000-03ffff 000000-01ffff
Soundlatch R 040000-040001 < 060000-060001
Soundlatch2 W 060000-060001 < <
? W - 040000-040001 <
2151 reg W 080000-080001 < <
2151 data W 080002-080003 < <
2151 status R 080002-080003 < <
6295 data 0 W 0a0000-0a0003 < <
6295 stat 0 R 0a0000-0a0001 < <
6295 data 1 W 0c0000-0c0003 < <
6295 stat 1 R 0c0000-0c0001 < <
RAM RW 0f0000-0f3fff 0e0000-0effff? <
-------------------------------------------------------------
----------------------- Alien Command -----------------------
interrupt: 1] 4f0: rte 2] 44a: rte
3] 484: 4,5,6,7] 4f0: rte
ram check: b8000-bffff objectram? a0000-a3fff bg1?
b0000-b3fff bg3? f8000-f8fff palette?
f0064->82000 f006c->82100
f0068->82002 f0070->82102
f0060->82004 f0062->82104 82208<-0 watchdog
9a8 print string: (a7)->string=x.w,y.w,attr.w,(char.b)*,0
dest = b0000, line = 40
------------------------- Rodland ---------------------------
interrupt: 1] 418->3864: rts
2] 420: move.w #-1,f0010; jsr 3866
3] 430: rte 4,5,6,7] 434: rte
213da print test error (20c12 = string address 0-4)
f0018->84200 f0020->84208 f0028->84008
f001c->84202 f0024->8420a f002c->8400a
f0012->84204 f0014->8420c f0016->8400c
7fe d0.w -> 84000.w & f000e.w
81a d0/d1/d2 & $D -> 84204 / 8420c /8400c
----------------------- Avenging Spirit ---------------------
interrupt: 1] rte
2,3, 5,6,7] move.w $e0000.l, $78e9e.l
andi.w #$ff, $78e9e.l
4] 78b20 software watchdog (78ea0 enables it)
fd6 reads e0000 (values FF,06,34,35,36,37)
ffa e0000<-6 test
******** Level: 79584.w ************
-------------------------- 64th Street ----------------------
interrupt: 1] 10eac: disabled while b6c4=6 (10fb6 test)
if (8b1c) 8b1c<-0
color cycle scroll 4
copies 800 bytes 98da->8008
2] 10f28: switch b6c4
0 RTE
2 10f44: M[b6c2]<-d8000. b6c4<-4
4 10f6c: next b6c2 & d8000. if (b6c2>A)
b6c2,4<-0 else b6c4<-2
6 10f82: b6c6<-(d8001) b6c7<-FF (test)
3] RTE
4] 10ed0: disabled while b6c4=6 (10fb6 test)
watchdog 8b1e
many routines...
b6c2<-0
13ca print a string: a7->screen disp.l(base=f0004),src.l
13ea print a string: a1->(chars)*
1253c hw test (table of tests at 125c6) *TRAP#D*
125f8 mem test (table of mem tests at 126d4)
1278e input test (table of tests at 12808)
128a8 sound test 12a08 crt test
12aca dsw test (b68e.w = dswa.b|dswb.b)
8b1e.w incremented by int4, when >= b TRAP#E (software watchdog error)
******* ff9df8.w level *******
------------------------------- EDF -------------------------
interrupt: 1] rte 7] rte
2,3] 543C: move.w $e0000.l, $60da6.l
move.w #$ffff, $60da8.l
4,5,6] 5928 + move.w #$ffff, $60010.l
616f4.w lives
********* 60d8a.w level(1..) ********
89e (a7)+ -> 44000.w & 6000e.w
8cc (a7)+ -> 44204.w ; 4420c.w ; 4400c.w
fc0 (a7)+ -> 58000 (string)
if t(x) = ((x^2)>>4)&0xff and e0000(x) is the magic function,
test at 554c wants t(t(e0000(0xf0))) == e0000(6)
---------------------------- Priorities ---------------------
p0 = scroll 1 p1 = scroll 2 p2 = scroll3 s = all sprites
s0 = sprites with color 0-3 s1 = sprites with color 4-7
s2 = sprites with color 8-b s3 = sprites with color c-f
order is : below -> over
Priorities for: P47j (MS1-A)
Flags: txt always 0010, fg 0000, others 0 (unless otherwise stated).
P47j does not exploit low and hi sprite priorities at all, during gameplay.
enab bg notes/what's the correct sprites-fg pos
t.sprite test 1 000e 001c txt:0013
t.sprite test 2 000f 001c *84100:0101* txt:0013 p1=column
-.copyright scr 000f 0002 *84300:0010* txt:0012
-.game logo 010c dis. txt:0013
-.hi scores 010c dis. *sprite should go above txt* txt:0012
0.lev0 020f 0000 p0 s p1
1.clouds 000f 0002 p0 p1 s
2.north africa 020f 0002 p0 s p1
3.ship 020f 0000 p0 s p1
4.ardennes 000f 0001 p0 p1 s
5.desert 020f 0001 p0 s p1
6.desert+sea 020f 0002 p0 s p1
7.sea+snow 020f 0000 p0 s p1
[Repeats?]
Priorities for: 64th Street (MS1-C)
Flags: txt always 0011, fg 0001, others 0 (unless otherwise stated).
enab bg notes/not empty screens/what's the correct sprites-fg pos
-.intro 000f 0002 - no p1 bg 0123---- sx++, sy=0
0.lev 1 010f 0001 p0 s p1 bg 01234--- max sx 3f0 fg 01234567 max sx 5e8
1.lev 2 010f 0001 p0 s p1 bg 012----- max sx 1e2 fg 012----- max sx 1e2
2.train 030f 0000 p0 p1 s bg 01234567 01234567 sx++ sy = 0 fg 01------ 01------ 01------ 01------ max sx 100. sy 0/100
3.port 050f 0001 2200=0100 bg: 0123---- 0123---- 0123---- 0123---- sx ? sy 0/1/2/300 fg: 012345-- 012345--sx ? sy 0/100
p0 s2/3 p1 s0/1 (player0, men0&1, splash3, fallen2&3)
4.boat1 010f 0001 p0 s p1
5.boat2 030f 0001 p0 p1 s
6.boat3 010f 0001 - no p1
7.rail 050f 0001 2200=0100
p0 s2/3 p1 s0/1 (player0, men0&1, box+pieces1, brokenbox3, fallen3)
8.tunne 030f 0001 p0 p1 s
9.facto 010f 0001 p0 s p1
a.fact2 020f 0001 p1 p0 s *bg&fg reversed*
b.fact3 020f 0001 p1 p0 s *bg&fg reversed*
c.fact4 030f 0001 p0 p1 s
d.stree 030f 0001 ""
e.palac 030f 0001 ""
f.pal<- 030f 0001 ""
0.palac 030f 0001 ""
1.pal<- 030f 0001 ""
[Continues to 0x15, I'm bored!]
Priorities for: Avenging Spirit (MS1-B)
Flags: txt always 0011, fg&bg 1, others 0 (unless otherwise stated).
enab notes/what's the correct sprites-fg pos
0.city 000f p1 p0 s
1.snakes 0c0f 44100=100
s2 p1 s0/3 p0 (player3, fire2, snake+laser0)
2.factory 020f p1 s p0
3.lift boss 010f p0 p1 s
4.city+lifts 010f p0 p1 s
5.snake boss 000f p1 p0 s
6.sewers 030f p0 s p1
7.end of sewers 030f p0 s p1
8.boss 0e0f 44100=100
p1 s2/3 p0 s0 (player3, boss+expl+fire2, splash0)
9.road 000f p1 p0 s
a.factory 020f p1 s p0
b.boss(flying) 000f -- p0 s
c.airport win 000f p1 p0 s
door 030f p0 s p1 (ghost=s1 above all?)
d.final level 000f p1 p0 s
0000 s3p1s2p0s1p2s0
s0 over s1 over p0 s2 over p1 s3 over p0
0 1 0 1 p0 s2/s3 p1 s0/s1 C
1 1 0 0 s2 p1 s3/s0 p0 s1? B
1 1 1 0 p1 s2/s3 p0 s0 s1? B
0 0 0 0 p0? s2/s3 p1 s0/s1 A
Priorities for: edf (MS1-B)
Flags: txt always 0010, fg 0000, others 0 (unless otherwise stated).
edf does not exploit low and hi sprite priorities at all, during gameplay.
enab bg notes/what's the correct sprites-fg pos
-.intro scr 020f b0 f0 t12 p0 s p1 -notxt
-.edf logo 010f b0 f0 t12 p0 s? p2 s? p1 !!!
-.weapon0 020f b0 f0 t12 p0 s p1 p2
-.weapon1 000f b0 f0 t12 p0 p1 s p2
1.lev1 020f b0 f0 t12 p0 p1 s p2
000f b0 f0 t12 p0 s p1 p2
4.sea 000f b0 f0 t12 p0 p1 s p2
5.rtype 000f b0 f0 t12 p0 p1 s p2
6.space 000f b0 f0 t12 p0 p1 s p2
------------------------------ P - 47 -----------------------
initial: PC = 400 SP = fff00
interrupts: 2] 540 1/3-7] 758 RTE
517a print word string: (a6)+,(a5)+$40. FFFF ends
5dbc print string(s) to (a1)+$40: a6-> len.b,x.b,y.b,(chars.b)*
726a prints screen
7300 ram test
7558 ip test
75e6(7638 loop) sound test
84300.w <-f1002.w ?portrait F/F on(0x0100)/off(0x0000)
84308.w <-f1004.w sound code
7736(7eb4 loop) scroll 1 test
9809c color
980a0 hscroll
980a4 vscroll
980a8 charsize
7e1e prepare screen
7e84 get user input
7faa vhscroll
80ce print value.l from a0
785c(78b8 loop) obj check 1 84000.w <-0x0E 84100.w <-0x101
9804c size
98050 number (0e.w bit 11-0)
98054 color code (08.w bit 2-0)
98058 H flip (08.w bit 6)
9805c V flip (08.w bit 7)
98060 priority (08.w bit 3)
98064 mosaic (08.w bit 11-8)
98068 mosaic sol. (08.w bit 12)
7afe(7cfe loop) obj check 2 84000.w <-0x0f 84100.w <-0x00
9804a obj num (a4-8e000)/8
9804e H-rev a4+02.w
98052 V-rev a4+04.w
98056 CG-rev a4+06.w
9805a Rem.Eff bit 4 of 84100
98060 Rem.Num bit 3-0 of 84100 (see 7dd4)
TRAP#2 pause?
f0104.w initial lives
f002a/116.w <-!80000
f0810.w <-!80002
f0c00.w <-!80004
******* f0018.w level *******
To Do
-----
- Support encrypted games
- Understand how priorities *really* work
- Understand an handful of unknown bits in video regs
- Flip Screen support
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
/* videohrdw has access to these */
unsigned char *scrollram[3],*scrollram_dirty[3];
unsigned char *objectram, *videoregs, *ram;
int scrollx[3],scrolly[3],scrollflag[3],nx[3],ny[3];
int active_layers, spritebank, screenflag, spriteflag, hardware_type;
int bg, fg, txt;
/* videohrdw variables */
extern struct osd_bitmap *scroll_bitmap[3];
/* videohrdw functions */
int vh_start(void);
void vh_stop(void);
void vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void mark_dirty_all(void);
void mark_dirty(int n);
int ip_select;
struct GameDriver avspirit_driver;
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
void megasys1_init_machine(void)
{
int i;
return;
/* reset global variables to zero */
for (i = 0; i < 3; i++)
{
scrollx[i] = 0;
scrolly[i] = 0;
scrollflag[i] = 0;
}
ip_select = 0;
active_layers = 0;
spritebank = 0;
screenflag = 0;
spriteflag = 0;
}
/*
We have bit scrambling on words:
fedc ba98 7654 3210 encry
d0a9 6ebf 5c72 3814 clear
142a 20ca clear
d011 4541 clear correct
*2= 8a82 ^ 0248 = 8aca
0248
encry clear
0008 0008 bit 3(clear) is bit 3(encry)
0002 0002 bit 1(clear) is bit 1(encry)
4000 0400 bit a(clear) is bit e(encry)
ffef fffe bit 0(clear) is bit 4(encry)
0400 2000 bit d(clear) is bit a(encry)
0480 2020 bit 5(clear) is bit 7(encry)
6000 8400 bit f(clear) is bit d(encry)
011a 000f bit 2(clear) is bit 8(encry)
5100 0444 bit 6(clear) is bit c(encry)
4184 0434 bit 4(clear) is bit 2(encry)
7fff feff bit 8(clear) is bit f(encry)
b1be 01ff bit 7(clear) is bit 5(encry)
8204 1110 bit c(clear) is bit 9(encry)
5007 4452 bit e(clear) is bit 0(encry)
But... on addresses t: t|0x0248==t, it's different
*/
static void rom_decode(void)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -