src/mess/drivers/alphatro.c
| r13689 | r13690 | |
| 43 | 43 | DECLARE_READ8_MEMBER(keyboard_r); |
| 44 | 44 | DECLARE_WRITE8_MEMBER(video_w); |
| 45 | 45 | DECLARE_READ8_MEMBER(video_r); |
| 46 | | DECLARE_READ8_MEMBER(vblank_r); |
| 46 | DECLARE_READ8_MEMBER(port10_r); |
| 47 | DECLARE_INPUT_CHANGED_MEMBER(alphatro_break); |
| 47 | 48 | |
| 48 | 49 | emu_timer* m_sys_timer; |
| 49 | 50 | UINT8 *m_p_videoram; |
| r13689 | r13690 | |
| 53 | 54 | virtual void machine_reset(); |
| 54 | 55 | virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 55 | 56 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 57 | |
| 56 | 58 | private: |
| 57 | 59 | static const device_timer_id SYSTEM_TIMER = 0; |
| 58 | | |
| 60 | UINT8 m_timer_bit; |
| 59 | 61 | }; |
| 60 | 62 | |
| 63 | READ8_MEMBER( alphatro_state::port10_r) |
| 64 | { |
| 65 | //return (space.machine().device<screen_device>("screen")->vblank() ? 0x00 : 0x80); |
| 66 | return (m_timer_bit ? 0x80 : 0x00); |
| 67 | } |
| 68 | |
| 61 | 69 | void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 62 | 70 | { |
| 63 | 71 | switch(id) |
| 64 | 72 | { |
| 65 | 73 | case SYSTEM_TIMER: |
| 66 | | device_set_input_line(m_maincpu,INPUT_LINE_IRQ0,HOLD_LINE); |
| 74 | { |
| 75 | if(m_timer_bit == 0) |
| 76 | m_timer_bit = 1; |
| 77 | else |
| 78 | m_timer_bit = 0; |
| 79 | } |
| 67 | 80 | break; |
| 68 | 81 | } |
| 69 | 82 | } |
| 70 | 83 | |
| 71 | | READ8_MEMBER( alphatro_state::vblank_r) |
| 72 | | { |
| 73 | | return (space.machine().device<screen_device>("screen")->vblank() ? 0x80 : 0x00); |
| 74 | | } |
| 75 | | |
| 76 | 84 | READ8_MEMBER( alphatro_state::keyboard_r ) |
| 77 | 85 | { |
| 78 | 86 | switch(offset) |
| r13689 | r13690 | |
| 165 | 173 | } |
| 166 | 174 | } |
| 167 | 175 | |
| 176 | INPUT_CHANGED_MEMBER( alphatro_state::alphatro_break ) |
| 177 | { |
| 178 | device_set_input_line(m_maincpu,INPUT_LINE_IRQ0,HOLD_LINE); |
| 179 | } |
| 180 | |
| 168 | 181 | static ADDRESS_MAP_START( alphatro_map, AS_PROGRAM, 8, alphatro_state ) |
| 169 | 182 | AM_RANGE(0x0000, 0xefff) AM_RAMBANK("bank1") // this is really ram, basic gets copied to here when it is needed |
| 170 | 183 | // AM_RANGE(0x6000, 0xdfff) AM_RAM |
| r13689 | r13690 | |
| 178 | 191 | static ADDRESS_MAP_START( alphatro_io, AS_IO, 8, alphatro_state ) |
| 179 | 192 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 180 | 193 | ADDRESS_MAP_UNMAP_HIGH |
| 181 | | AM_RANGE(0x10, 0x10) AM_READ(vblank_r) |
| 194 | AM_RANGE(0x10, 0x10) AM_READ(port10_r) |
| 182 | 195 | AM_RANGE(0x20, 0x2f) AM_READ(keyboard_r) // keyboard in? |
| 183 | 196 | AM_RANGE(0x50, 0x50) AM_DEVWRITE("crtc", mc6845_device, address_w) |
| 184 | 197 | AM_RANGE(0x51, 0x51) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) |
| r13689 | r13690 | |
| 290 | 303 | PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) |
| 291 | 304 | PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| 292 | 305 | |
| 306 | PORT_START("other") |
| 307 | PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF,alphatro_state,alphatro_break,0) |
| 293 | 308 | INPUT_PORTS_END |
| 294 | 309 | |
| 295 | 310 | static const gfx_layout charlayout = |
| r13689 | r13690 | |
| 314 | 329 | |
| 315 | 330 | void alphatro_state::machine_reset() |
| 316 | 331 | { |
| 332 | // do what the IPL does |
| 317 | 333 | UINT8* RAM = machine().device<ram_device>("ram")->pointer(); |
| 318 | 334 | UINT8* ROM = machine().region("maincpu")->base(); |
| 319 | 335 | cpu_set_reg(machine().device("maincpu"), STATE_GENPC, 0xe000); |
| 320 | 336 | memcpy(RAM,ROM,0x10000); // copy BASIC to RAM, which the undumped IPL is supposed to do. |
| 321 | 337 | memory_set_bankptr(machine(), "bank1",RAM); |
| 322 | | // m_sys_timer->adjust(attotime::zero,0,attotime::from_msec(10)); // interrupts aren't enabled yet, so not much point in setting this |
| 338 | |
| 339 | // probably not the correct, exact meaning of port is unknown, vblank/vsync is too slow. |
| 340 | m_sys_timer->adjust(attotime::from_usec(10),0,attotime::from_usec(10)); |
| 323 | 341 | } |
| 324 | 342 | |
| 325 | 343 | //static PALETTE_INIT( alphatro ) |