Previous 199869 Revisions Next

r21600 Tuesday 5th March, 2013 at 17:45:11 UTC by Fabio Priuli
minor cleanup. nw.
[src/mess/machine]snesobc1.c

trunk/src/mess/machine/snesobc1.c
r21599r21600
1717   int address;
1818   int offset;
1919   int shift;
20   UINT8 ram[0x2000];
2021};
2122
2223static snes_obc1_state obc1_state;
r21599r21600
3031   switch (address)
3132   {
3233      case 0x1ff0:
33         value = snes_ram[obc1_state.offset + (obc1_state.address << 2) + 0];
34         value = obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 0];
3435         break;
3536
3637      case 0x1ff1:
37         value = snes_ram[obc1_state.offset + (obc1_state.address << 2) + 1];
38         value = obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 1];
3839         break;
3940
4041      case 0x1ff2:
41         value = snes_ram[obc1_state.offset + (obc1_state.address << 2) + 2];
42         value = obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 2];
4243         break;
4344
4445      case 0x1ff3:
45         value = snes_ram[obc1_state.offset + (obc1_state.address << 2) + 3];
46         value = obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 3];
4647         break;
4748
4849      case 0x1ff4:
49         value = snes_ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200];
50         value = obc1_state.ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200];
5051         break;
5152
5253      default:
53         value = snes_ram[address];
54         value = obc1_state.ram[address];
5455         break;
5556   }
5657
r21599r21600
6667   switch(address)
6768   {
6869      case 0x1ff0:
69         snes_ram[obc1_state.offset + (obc1_state.address << 2) + 0] = data;
70         obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 0] = data;
7071         break;
7172
7273      case 0x1ff1:
73         snes_ram[obc1_state.offset + (obc1_state.address << 2) + 1] = data;
74         obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 1] = data;
7475         break;
7576
7677      case 0x1ff2:
77         snes_ram[obc1_state.offset + (obc1_state.address << 2) + 2] = data;
78         obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 2] = data;
7879         break;
7980
8081      case 0x1ff3:
81         snes_ram[obc1_state.offset + (obc1_state.address << 2) + 3] = data;
82         obc1_state.ram[obc1_state.offset + (obc1_state.address << 2) + 3] = data;
8283         break;
8384
8485      case 0x1ff4:
85         temp = snes_ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200];
86         temp = obc1_state.ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200];
8687         temp = (temp & ~(3 << obc1_state.shift)) | ((data & 0x03) << obc1_state.shift);
87         snes_ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200] = temp;
88         obc1_state.ram[obc1_state.offset + (obc1_state.address >> 2) + 0x200] = temp;
8889         break;
8990
9091      case 0x1ff5:
9192         obc1_state.offset = (data & 0x01) ? 0x1800 : 0x1c00;
92         snes_ram[address & 0x1fff] = data;
93         obc1_state.ram[address & 0x1fff] = data;
9394         break;
9495
9596      case 0x1ff6:
9697         obc1_state.address = data & 0x7f;
9798         obc1_state.shift = (data & 0x03) << 1;
98         snes_ram[address & 0x1fff] = data;
99         obc1_state.ram[address & 0x1fff] = data;
99100         break;
100101
101102      default:
102         snes_ram[address & 0x1fff] = data;
103         obc1_state.ram[address & 0x1fff] = data;
103104         break;
104105   }
105106}
106107
107108void obc1_init( running_machine &machine )
108109{
109   obc1_state.offset  = (snes_ram[0x1ff5] & 0x01) ? 0x1800 : 0x1c00;
110   obc1_state.address = (snes_ram[0x1ff6] & 0x7f);
111   obc1_state.shift   = (snes_ram[0x1ff6] & 0x03) << 1;
110   memset(obc1_state.ram, 0x00, sizeof(obc1_state.ram));
111   obc1_state.offset  = (obc1_state.ram[0x1ff5] & 0x01) ? 0x1800 : 0x1c00;
112   obc1_state.address = (obc1_state.ram[0x1ff6] & 0x7f);
113   obc1_state.shift   = (obc1_state.ram[0x1ff6] & 0x03) << 1;
112114
113115   state_save_register_global(machine, obc1_state.offset);
114116   state_save_register_global(machine, obc1_state.address);
115117   state_save_register_global(machine, obc1_state.shift);
118   state_save_register_global_array(machine, obc1_state.ram);
116119}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team