src/mess/drivers/cfx9850.c
| r10092 | r10093 | |
| 2 | 2 | |
| 3 | 3 | Driver for Casio CFX-9850 |
| 4 | 4 | |
| 5 | To operate: |
| 6 | The unit is switched off by default, you have to switch it on by pressing 'Q'. |
| 7 | |
| 8 | Debugging information: |
| 9 | First make sure system is initialized (g 10b3). |
| 10 | At cs=23, ip=d1a4,d1af,d1ba,d1c5,d1d0,d1db,d1ea,d1f9,d208,d217,d226,d235,d244 |
| 11 | are routines which fill display ram with patterns. |
| 12 | |
| 5 | 13 | ***************************************************************************/ |
| 6 | 14 | |
| 7 | 15 | #include "emu.h" |
| r10092 | r10093 | |
| 28 | 36 | // AM_RANGE( 0x110000, 0x11ffff ) /* some memory mapped i/o? */ |
| 29 | 37 | AM_RANGE( 0x200000, 0x27ffff ) AM_ROM AM_REGION( "bios", 0 ) |
| 30 | 38 | AM_RANGE( 0x400000, 0x40ffff ) AM_RAM |
| 31 | | AM_RANGE( 0x600000, 0x601fff ) AM_MIRROR(0xe000) AM_RAM AM_BASE_MEMBER( cfx9850_state, display_ram ) |
| 39 | AM_RANGE( 0x600000, 0x601fff ) AM_MIRROR(0xf800) AM_RAM AM_BASE_MEMBER( cfx9850_state, display_ram ) |
| 32 | 40 | // AM_RANGE( 0xe10000, 0xe1ffff ) /* some memory mapped i/o? */ |
| 33 | 41 | ADDRESS_MAP_END |
| 34 | 42 | |
| r10092 | r10093 | |
| 175 | 183 | INPUT_PORTS_END |
| 176 | 184 | |
| 177 | 185 | |
| 186 | static PALETTE_INIT( cfx9850 ) |
| 187 | { |
| 188 | palette_set_color_rgb( machine, 0, 0xff, 0xff, 0xff ); |
| 189 | palette_set_color_rgb( machine, 1, 0x00, 0x00, 0xff ); |
| 190 | palette_set_color_rgb( machine, 2, 0x00, 0xff, 0x00 ); |
| 191 | palette_set_color_rgb( machine, 3, 0xff, 0x00, 0x00 ); |
| 192 | } |
| 193 | |
| 194 | |
| 195 | static VIDEO_UPDATE( cfx9850 ) |
| 196 | { |
| 197 | cfx9850_state *state = screen->machine->driver_data<cfx9850_state>(); |
| 198 | UINT16 offset = 0; |
| 199 | |
| 200 | for ( int i = 0; i < 16; i++ ) |
| 201 | { |
| 202 | int x = 120 - i * 8; |
| 203 | |
| 204 | for ( int j = 0; j < 64; j++ ) |
| 205 | { |
| 206 | UINT8 data1 = state->display_ram[ offset ]; |
| 207 | UINT8 data2 = state->display_ram[ offset + 0x400 ]; |
| 208 | |
| 209 | for ( int b = 0; b < 8; b++ ) |
| 210 | { |
| 211 | *BITMAP_ADDR16(bitmap, 63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); |
| 212 | data1 <<= 1; |
| 213 | data2 <<= 1; |
| 214 | } |
| 215 | |
| 216 | offset++; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | return 0; |
| 221 | } |
| 222 | |
| 223 | |
| 178 | 224 | static MACHINE_CONFIG_START( cfx9850, cfx9850_state ) |
| 179 | 225 | |
| 180 | 226 | MCFG_CPU_ADD( "maincpu", HCD62121, 4300000 ) /* 4.3 MHz */ |
| r10092 | r10093 | |
| 188 | 234 | MCFG_SCREEN_VISIBLE_AREA( 0, 127, 0, 63 ) |
| 189 | 235 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| 190 | 236 | |
| 237 | MCFG_VIDEO_UPDATE( cfx9850 ) |
| 238 | |
| 191 | 239 | /* TODO: It uses a color display, but I'm being lazy here. 3 colour lcd */ |
| 192 | | MCFG_PALETTE_LENGTH( 2 ) |
| 193 | | MCFG_PALETTE_INIT(black_and_white) |
| 240 | MCFG_PALETTE_LENGTH( 4 ) |
| 241 | MCFG_PALETTE_INIT( cfx9850 ) |
| 194 | 242 | |
| 195 | 243 | MACHINE_CONFIG_END |
| 196 | 244 | |