src/mess/drivers/z1013.c
| r0 | r4547 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Z1013 driver by Miodrag Milanovic |
| 4 | |
| 5 | 22/04/2009 Preliminary driver. |
| 6 | |
| 7 | ****************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "driver.h" |
| 11 | #include "cpu/z80/z80.h" |
| 12 | #include "machine/z80pio.h" |
| 13 | #include "includes/z1013.h" |
| 14 | |
| 15 | /* Address maps */ |
| 16 | static ADDRESS_MAP_START(z1013_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 17 | AM_RANGE( 0x0000, 0xefff ) AM_RAM |
| 18 | AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_BASE(&z1013_video_ram) |
| 19 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // ROM |
| 20 | ADDRESS_MAP_END |
| 21 | |
| 22 | |
| 23 | /* Wires on Z80 PIO are switched */ |
| 24 | READ8_DEVICE_HANDLER(z1013_z80pio_r) |
| 25 | { |
| 26 | if ((offset & 1) ==0) return z80pio_d_r(device, offset >> 1); else return z80pio_c_r(device, offset >> 1); |
| 27 | } |
| 28 | |
| 29 | WRITE8_DEVICE_HANDLER(z1013_z80pio_w) |
| 30 | { |
| 31 | if ((offset & 1) ==0) |
| 32 | z80pio_d_w(device, offset >> 1, data); |
| 33 | else |
| 34 | z80pio_c_w(device, offset >> 1, data); |
| 35 | } |
| 36 | |
| 37 | static ADDRESS_MAP_START( z1013_io, ADDRESS_SPACE_IO, 8 ) |
| 38 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 39 | AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("z80pio", z1013_z80pio_r, z1013_z80pio_w) |
| 40 | AM_RANGE( 0x08, 0x08 ) AM_WRITE(z1013_keyboard_w) |
| 41 | ADDRESS_MAP_END |
| 42 | |
| 43 | /* Input ports */ |
| 44 | static INPUT_PORTS_START( z1013_8x4 ) |
| 45 | PORT_START("LINE0") |
| 46 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TAB) |
| 47 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 48 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 49 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_LSHIFT) |
| 50 | PORT_START("LINE1") |
| 51 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 52 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 53 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 54 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_LCONTROL) |
| 55 | PORT_START("LINE2") |
| 56 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| 57 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) |
| 58 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 59 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S3") PORT_CODE(KEYCODE_RSHIFT) |
| 60 | PORT_START("LINE3") |
| 61 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 62 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 63 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 64 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S4") PORT_CODE(KEYCODE_RCONTROL) |
| 65 | PORT_START("LINE4") |
| 66 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 67 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| 68 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 69 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 70 | PORT_START("LINE5") |
| 71 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| 72 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 73 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 74 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 75 | PORT_START("LINE6") |
| 76 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 77 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| 78 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 79 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 80 | PORT_START("LINE7") |
| 81 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) |
| 82 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 83 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 84 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) |
| 85 | INPUT_PORTS_END |
| 86 | |
| 87 | static INPUT_PORTS_START( z1013_8x8 ) |
| 88 | PORT_START("LINE0") |
| 89 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 90 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 91 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 92 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) |
| 93 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 94 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 95 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 96 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 97 | PORT_START("LINE1") |
| 98 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 99 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| 100 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 101 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 102 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 103 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 104 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 105 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 106 | PORT_START("LINE2") |
| 107 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 108 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 109 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) |
| 110 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| 111 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 112 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 113 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 114 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_V) |
| 115 | PORT_START("LINE3") |
| 116 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 117 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 118 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) |
| 119 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 120 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 121 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 122 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 123 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 124 | PORT_START("LINE4") |
| 125 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 126 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 127 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| 128 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 129 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 130 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 131 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_COLON) |
| 132 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) |
| 133 | PORT_START("LINE5") |
| 134 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) |
| 135 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) |
| 136 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_OPENBRACE) |
| 137 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_QUOTE) |
| 138 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) |
| 139 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 140 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 141 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) |
| 142 | PORT_START("LINE6") |
| 143 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) |
| 144 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) |
| 145 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 146 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 147 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 148 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 149 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 150 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 151 | PORT_START("LINE7") |
| 152 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 153 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 154 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 155 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) |
| 156 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) |
| 157 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) |
| 158 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 159 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) |
| 160 | INPUT_PORTS_END |
| 161 | |
| 162 | |
| 163 | /* Machine driver */ |
| 164 | static MACHINE_DRIVER_START( z1013 ) |
| 165 | /* basic machine hardware */ |
| 166 | MDRV_CPU_ADD("maincpu", Z80, XTAL_1MHz ) |
| 167 | MDRV_CPU_PROGRAM_MAP(z1013_mem, 0) |
| 168 | MDRV_CPU_IO_MAP(z1013_io, 0) |
| 169 | |
| 170 | MDRV_MACHINE_RESET( z1013 ) |
| 171 | |
| 172 | /* video hardware */ |
| 173 | MDRV_SCREEN_ADD("screen", RASTER) |
| 174 | MDRV_SCREEN_REFRESH_RATE(50) |
| 175 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 176 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 177 | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 178 | MDRV_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1) |
| 179 | |
| 180 | MDRV_PALETTE_LENGTH(2) |
| 181 | MDRV_PALETTE_INIT(black_and_white) |
| 182 | |
| 183 | MDRV_VIDEO_START(z1013) |
| 184 | MDRV_VIDEO_UPDATE(z1013) |
| 185 | |
| 186 | MDRV_Z80PIO_ADD( "z80pio", z1013_z80pio_intf ) |
| 187 | |
| 188 | /* snapshot */ |
| 189 | MDRV_SNAPSHOT_ADD("snapshot", z1013, "z80", 0) |
| 190 | MACHINE_DRIVER_END |
| 191 | |
| 192 | /* ROM definition */ |
| 193 | ROM_START( z1013 ) |
| 194 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 195 | ROM_LOAD( "mon_202.bin", 0xf000, 0x0800, CRC(5884EDAB) SHA1(c3a45ea5cc4da2b7c270068ba1e2d75916960709)) |
| 196 | ROM_REGION(0x0800, "gfx1",0) |
| 197 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088F) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 198 | ROM_END |
| 199 | |
| 200 | ROM_START( z1013a2 ) |
| 201 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 202 | ROM_LOAD( "mon_a2.bin", 0xf000, 0x0800, CRC(98B19B10) SHA1(97e158f589198cb96aae1567ee0aa6e47824027e)) |
| 203 | ROM_REGION(0x0800, "gfx1",0) |
| 204 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088F) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 205 | ROM_END |
| 206 | |
| 207 | /* Driver */ |
| 208 | |
| 209 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 210 | COMP( 1985, z1013, 0, 0, z1013, z1013_8x4, z1013, NULL, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x4)", 0) |
| 211 | COMP( 1985, z1013a2, z1013, 0, z1013, z1013_8x8, z1013, NULL, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x8)", 0) |
| 212 | |