src/mess/drivers/pro80.c
| r9677 | r9678 | |
| 4 | 4 | |
| 5 | 5 | 06/12/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | TODO: |
| 8 | - Cassette load/save |
| 9 | - Use messram for optional ram |
| 10 | - Fix Step command (don't works due of missing interrupt emulation) |
| 11 | |
| 7 | 12 | ****************************************************************************/ |
| 8 | 13 | |
| 14 | #define ADDRESS_MAP_MODERN |
| 15 | |
| 9 | 16 | #include "emu.h" |
| 10 | 17 | #include "cpu/z80/z80.h" |
| 18 | #include "pro80.lh" |
| 11 | 19 | |
| 12 | | static ADDRESS_MAP_START(pro80_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 20 | class pro80_state : public driver_device |
| 21 | { |
| 22 | public: |
| 23 | pro80_state(running_machine &machine, const driver_device_config_base &config) |
| 24 | : driver_device(machine, config) |
| 25 | { } |
| 26 | |
| 27 | void machine_reset(); |
| 28 | |
| 29 | WRITE8_MEMBER( digit_w ); |
| 30 | WRITE8_MEMBER( segment_w ); |
| 31 | READ8_MEMBER( kp_r ); |
| 32 | |
| 33 | UINT8 digit_sel; |
| 34 | }; |
| 35 | |
| 36 | |
| 37 | WRITE8_MEMBER( pro80_state::digit_w ) |
| 38 | { |
| 39 | // --xx xxxx digit select |
| 40 | // -x-- ---- cassette out |
| 41 | // x--- ---- ??? |
| 42 | digit_sel = data & 0x3f; |
| 43 | } |
| 44 | |
| 45 | WRITE8_MEMBER( pro80_state::segment_w ) |
| 46 | { |
| 47 | if (digit_sel) |
| 48 | { |
| 49 | if (!BIT(digit_sel, 0)) output_set_digit_value(0, data); |
| 50 | if (!BIT(digit_sel, 1)) output_set_digit_value(1, data); |
| 51 | if (!BIT(digit_sel, 2)) output_set_digit_value(2, data); |
| 52 | if (!BIT(digit_sel, 3)) output_set_digit_value(3, data); |
| 53 | if (!BIT(digit_sel, 4)) output_set_digit_value(4, data); |
| 54 | if (!BIT(digit_sel, 5)) output_set_digit_value(5, data); |
| 55 | |
| 56 | digit_sel = 0; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | READ8_MEMBER( pro80_state::kp_r ) |
| 61 | { |
| 62 | UINT8 data = 0x0f; |
| 63 | |
| 64 | if (!BIT(digit_sel, 0)) data &= input_port_read(space.machine, "LINE0"); |
| 65 | if (!BIT(digit_sel, 1)) data &= input_port_read(space.machine, "LINE1"); |
| 66 | if (!BIT(digit_sel, 2)) data &= input_port_read(space.machine, "LINE2"); |
| 67 | if (!BIT(digit_sel, 3)) data &= input_port_read(space.machine, "LINE3"); |
| 68 | if (!BIT(digit_sel, 4)) data &= input_port_read(space.machine, "LINE4"); |
| 69 | if (!BIT(digit_sel, 5)) data &= input_port_read(space.machine, "LINE5"); |
| 70 | |
| 71 | return data; |
| 72 | } |
| 73 | |
| 74 | static ADDRESS_MAP_START(pro80_mem, ADDRESS_SPACE_PROGRAM, 8, pro80_state) |
| 13 | 75 | ADDRESS_MAP_UNMAP_HIGH |
| 14 | 76 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 15 | 77 | AM_RANGE(0x1000, 0x13ff) AM_RAM |
| 16 | 78 | AM_RANGE(0x1400, 0x17ff) AM_RAM // 2nd RAM is optional |
| 17 | 79 | ADDRESS_MAP_END |
| 18 | 80 | |
| 19 | | static ADDRESS_MAP_START( pro80_io , ADDRESS_SPACE_IO, 8) |
| 81 | static ADDRESS_MAP_START( pro80_io , ADDRESS_SPACE_IO, 8, pro80_state) |
| 20 | 82 | ADDRESS_MAP_UNMAP_HIGH |
| 21 | 83 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 84 | //AM_RANGE(0x40, 0x43) Z80PIO |
| 85 | AM_RANGE(0x44, 0x47) AM_READ(kp_r) |
| 86 | AM_RANGE(0x48, 0x4b) AM_WRITE(digit_w) |
| 87 | AM_RANGE(0x4c, 0x4f) AM_WRITE(segment_w) |
| 22 | 88 | ADDRESS_MAP_END |
| 23 | 89 | |
| 24 | 90 | /* Input ports */ |
| 25 | 91 | static INPUT_PORTS_START( pro80 ) |
| 92 | PORT_START("LINE0") |
| 93 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CR") PORT_CODE(KEYCODE_L) |
| 94 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CW") PORT_CODE(KEYCODE_W) |
| 95 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SSt") PORT_CODE(KEYCODE_S) |
| 96 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Res") PORT_CODE(KEYCODE_EQUALS) |
| 97 | PORT_START("LINE1") |
| 98 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("EXE") PORT_CODE(KEYCODE_ENTER) |
| 99 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("NEx") PORT_CODE(KEYCODE_N) |
| 100 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("REx") PORT_CODE(KEYCODE_R) |
| 101 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MEx") PORT_CODE(KEYCODE_M) |
| 102 | PORT_START("LINE2") |
| 103 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 104 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7 [IY]") PORT_CODE(KEYCODE_7) |
| 105 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| 106 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 107 | PORT_START("LINE3") |
| 108 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 109 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6 [IX]") PORT_CODE(KEYCODE_6) |
| 110 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 111 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| 112 | PORT_START("LINE4") |
| 113 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 114 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5 [PC]") PORT_CODE(KEYCODE_5) |
| 115 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9 [H]") PORT_CODE(KEYCODE_9) |
| 116 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 117 | PORT_START("LINE5") |
| 118 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 119 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4 [SP]") PORT_CODE(KEYCODE_4) |
| 120 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8 [L]") PORT_CODE(KEYCODE_8) |
| 121 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 26 | 122 | INPUT_PORTS_END |
| 27 | 123 | |
| 28 | | |
| 29 | | static MACHINE_RESET(pro80) |
| 124 | void pro80_state::machine_reset() |
| 30 | 125 | { |
| 126 | digit_sel = 0; |
| 31 | 127 | } |
| 32 | 128 | |
| 33 | | static VIDEO_START( pro80 ) |
| 34 | | { |
| 35 | | } |
| 36 | | |
| 37 | | static VIDEO_UPDATE( pro80 ) |
| 38 | | { |
| 39 | | return 0; |
| 40 | | } |
| 41 | | |
| 42 | | static MACHINE_CONFIG_START( pro80, driver_device ) |
| 129 | static MACHINE_CONFIG_START( pro80, pro80_state ) |
| 43 | 130 | /* basic machine hardware */ |
| 44 | 131 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 45 | 132 | MDRV_CPU_PROGRAM_MAP(pro80_mem) |
| 46 | 133 | MDRV_CPU_IO_MAP(pro80_io) |
| 47 | 134 | |
| 48 | | MDRV_MACHINE_RESET(pro80) |
| 49 | | |
| 50 | 135 | /* video hardware */ |
| 51 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 52 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 53 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 54 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 55 | | MDRV_SCREEN_SIZE(640, 480) |
| 56 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 57 | | MDRV_PALETTE_LENGTH(2) |
| 58 | | MDRV_PALETTE_INIT(black_and_white) |
| 59 | | |
| 60 | | MDRV_VIDEO_START(pro80) |
| 61 | | MDRV_VIDEO_UPDATE(pro80) |
| 136 | MDRV_DEFAULT_LAYOUT(layout_pro80) |
| 62 | 137 | MACHINE_CONFIG_END |
| 63 | 138 | |
| 64 | 139 | /* ROM definition */ |