src/mess/drivers/pc100.c
| r11783 | r11784 | |
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | 6 | - kanji rom has offsetted data for whatever reason. |
| 7 | | - i8259 is bugged, program flow eventually jumps to la-la-land |
| 7 | - there's a regression with push/pop sp, when it triggers an iret program |
| 8 | flow jumps to la-la-land |
| 8 | 9 | |
| 9 | 10 | ****************************************************************************/ |
| 10 | 11 | |
| r11783 | r11784 | |
| 30 | 31 | struct{ |
| 31 | 32 | UINT8 shift; |
| 32 | 33 | UINT16 mask; |
| 34 | UINT16 vstart; |
| 35 | UINT8 addr; |
| 36 | UINT8 reg[8]; |
| 33 | 37 | }m_crtc; |
| 34 | 38 | }; |
| 35 | 39 | |
| r11783 | r11784 | |
| 46 | 50 | int dot; |
| 47 | 51 | int pen[4],pen_i; |
| 48 | 52 | |
| 49 | | count = 0; |
| 53 | count = ((state->m_crtc.vstart + 0x20) * 0x40); |
| 50 | 54 | |
| 51 | 55 | for(y=0;y<512;y++) |
| 52 | 56 | { |
| 57 | count &= 0xffff; |
| 58 | |
| 53 | 59 | for(x=0;x<1024/16;x++) |
| 54 | 60 | { |
| 55 | 61 | for(xi=0;xi<16;xi++) |
| r11783 | r11784 | |
| 128 | 134 | static READ8_HANDLER( pc100_key_r ) |
| 129 | 135 | { |
| 130 | 136 | if(offset) |
| 131 | | return 0x2d; // bit 5: horizontal/vertical monitor dsw |
| 137 | return input_port_read(space->machine(), "DSW"); // bit 5: horizontal/vertical monitor dsw |
| 132 | 138 | |
| 133 | 139 | return 0; |
| 134 | 140 | } |
| r11783 | r11784 | |
| 173 | 179 | state->m_crtc.shift = data & 0xf; |
| 174 | 180 | } |
| 175 | 181 | |
| 182 | static READ8_HANDLER( pc100_vs_vreg_r ) |
| 183 | { |
| 184 | pc100_state *state = space->machine().driver_data<pc100_state>(); |
| 185 | |
| 186 | if(offset) |
| 187 | return state->m_crtc.vstart >> 8; |
| 188 | |
| 189 | return state->m_crtc.vstart & 0xff; |
| 190 | } |
| 191 | |
| 192 | static WRITE8_HANDLER( pc100_vs_vreg_w ) |
| 193 | { |
| 194 | pc100_state *state = space->machine().driver_data<pc100_state>(); |
| 195 | |
| 196 | if(offset) |
| 197 | state->m_crtc.vstart = (state->m_crtc.vstart & 0xff) | (data << 8); |
| 198 | else |
| 199 | state->m_crtc.vstart = (state->m_crtc.vstart & 0xff00) | (data & 0xff); |
| 200 | } |
| 201 | |
| 202 | static WRITE8_HANDLER( pc100_crtc_addr_w ) |
| 203 | { |
| 204 | pc100_state *state = space->machine().driver_data<pc100_state>(); |
| 205 | |
| 206 | state->m_crtc.addr = data & 7; |
| 207 | } |
| 208 | |
| 209 | static WRITE8_HANDLER( pc100_crtc_data_w ) |
| 210 | { |
| 211 | pc100_state *state = space->machine().driver_data<pc100_state>(); |
| 212 | |
| 213 | state->m_crtc.reg[state->m_crtc.addr] = data; |
| 214 | } |
| 215 | |
| 216 | |
| 176 | 217 | /* everything is 8-bit bus wide */ |
| 177 | 218 | static ADDRESS_MAP_START(pc100_io, AS_IO, 16) |
| 178 | 219 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_r, pic8259_w, 0x00ff) // i8259 |
| r11783 | r11784 | |
| 184 | 225 | AM_RANGE(0x22, 0x25) AM_WRITE8(pc100_output_w,0x00ff) //i/o, keyboard, mouse |
| 185 | 226 | // AM_RANGE(0x28, 0x2b) i8251 |
| 186 | 227 | AM_RANGE(0x30, 0x31) AM_READWRITE8(pc100_shift_r,pc100_shift_w,0x00ff) // crtc shift |
| 187 | | // AM_RANGE(0x38, 0x39) crtc address reg |
| 188 | | // AM_RANGE(0x3a, 0x3b) crtc data reg |
| 189 | | // AM_RANGE(0x3c, 0x3f) crtc vertical start position |
| 228 | AM_RANGE(0x38, 0x39) AM_WRITE8(pc100_crtc_addr_w,0x00ff) //crtc address reg |
| 229 | AM_RANGE(0x3a, 0x3b) AM_WRITE8(pc100_crtc_data_w,0x00ff) //crtc data reg |
| 230 | AM_RANGE(0x3c, 0x3f) AM_READWRITE8(pc100_vs_vreg_r,pc100_vs_vreg_w,0x00ff) //crtc vertical start position |
| 190 | 231 | AM_RANGE(0x40, 0x5f) AM_RAM_WRITE(pc100_paletteram_w) AM_BASE_MEMBER(pc100_state,m_palram) |
| 191 | 232 | // AM_RANGE(0x60, 0x61) crtc command (16-bit wide) |
| 192 | 233 | AM_RANGE(0x80, 0x81) AM_READWRITE(pc100_kanji_r,pc100_kanji_w) |
| r11783 | r11784 | |
| 197 | 238 | |
| 198 | 239 | /* Input ports */ |
| 199 | 240 | static INPUT_PORTS_START( pc100 ) |
| 241 | PORT_START("DSW") |
| 242 | PORT_DIPNAME( 0x01, 0x01, "DSW" ) |
| 243 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 244 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 245 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 246 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 247 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 248 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 249 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 250 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 251 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 252 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 253 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 254 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 255 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 256 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 257 | PORT_DIPNAME( 0x20, 0x20, "Monitor" ) |
| 258 | PORT_DIPSETTING( 0x20, "Horizontal" ) |
| 259 | PORT_DIPSETTING( 0x00, "Vertical" ) |
| 260 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 261 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 262 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 263 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 264 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 265 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 200 | 266 | INPUT_PORTS_END |
| 201 | 267 | |
| 202 | 268 | static const gfx_layout kanji_layout = |