starting SMS work
[picodrive.git] / pico / sms.c
1 #include "pico_int.h"
2
3 static unsigned char z80_sms_in(unsigned short p)
4 {
5   elprintf(EL_ANOMALY, "Z80 port %04x read", p);
6   return 0xff;
7 }
8
9 static void z80_sms_out(unsigned short p, unsigned char d)
10 {
11   elprintf(EL_ANOMALY, "Z80 port %04x write %02x", p, d);
12 }
13
14 static unsigned char MEMH_FUNC xread(unsigned short a)
15 {
16   elprintf(EL_ANOMALY, "Z80 read  [%04x]", a);
17   return 0;
18 }
19
20 static void MEMH_FUNC xwrite(unsigned int a, unsigned char data)
21 {
22   elprintf(EL_ANOMALY, "Z80 write [%04x] %02x", a, data);
23 }
24
25 void PicoPowerMS(void)
26 {
27 }
28
29 void PicoMemSetupMS(void)
30 {
31   z80_map_set(z80_read_map, 0x0000, 0xbfff, Pico.rom, 0);
32   z80_map_set(z80_read_map, 0xc000, 0xdfff, Pico.zram, 0);
33   z80_map_set(z80_read_map, 0xe000, 0xffff, xread, 1);
34
35   z80_map_set(z80_write_map, 0x0000, 0xbfff, Pico.rom, 0);
36   z80_map_set(z80_write_map, 0xc000, 0xdfff, Pico.zram, 0);
37   z80_map_set(z80_write_map, 0xe000, 0xffff, xwrite, 1);
38  
39 #ifdef _USE_DRZ80
40   drZ80.z80_in = z80_sms_in;
41   drZ80.z80_out = z80_sms_out;
42 #endif
43 #ifdef _USE_CZ80
44   Cz80_Set_Fetch(&CZ80, 0x0000, 0xbfff, (UINT32)Pico.rom);
45   Cz80_Set_Fetch(&CZ80, 0xc000, 0xdfff, (UINT32)Pico.zram);
46   Cz80_Set_INPort(&CZ80, z80_sms_in);
47   Cz80_Set_OUTPort(&CZ80, z80_sms_out);
48 #endif
49 }
50
51 void PicoFrameMS(void)
52 {
53   z80_run(OSC_NTSC / 13 / 60);
54 }
55