trunk/src/mess/drivers/mbee.c
| r244892 | r244893 | |
| 5 | 5 | |
| 6 | 6 | system driver |
| 7 | 7 | Juergen Buchmueller, Jan 2000 |
| 8 | Robbbert 2008-2015 |
| 8 | 9 | |
| 9 | | Brett Selwood, Andrew Davies (technical assistance) |
| 10 | Assistance from: |
| 11 | Brett Selwood, Andrew Davies; E.J.Wordsworth (owner of Microbee Systems), |
| 12 | nama, ChickenMan, and the author of the "ubee512" emulator. |
| 10 | 13 | |
| 11 | | Various additions by Robbbert. |
| 14 | Keyboard notes are in video/microbee.c |
| 12 | 15 | |
| 13 | | Thanks to the author of the "ubee512" emulator for his help. |
| 14 | | |
| 15 | | TeleTerm roms dumped by ejwords. The correct slots found by ubee512 author. |
| 16 | | Swedish roms dumped by nama. The correct slots found by ubee512 author. |
| 17 | | |
| 18 | | Please note: the rom version 1.31 which appears to fit the 256TC is actually |
| 16 | 256tc: The 1.31 rom version which appears to fit the 256TC is actually |
| 19 | 17 | part of the Z80 emulation in the Matilda model. If you fit this rom into a real |
| 20 | 18 | 256TC, the floppy disk will not be detected. |
| 21 | 19 | |
| r244892 | r244893 | |
| 24 | 22 | |
| 25 | 23 | Floppy formats: |
| 26 | 24 | - All disks are the standard CPCEMU 'dsk' format. |
| 27 | | - Types are 9cm 80 track, and 13cm 40 track (single or double sided) |
| 25 | - Types are 9/13cm 40/80 track (single or double sided) |
| 28 | 26 | - 13cm has been specified as QD to prevent a nasty crash if an 80-track disk was mounted |
| 29 | 27 | - The tracks/sector layout is the same regardless of size |
| 30 | 28 | - Although certain models came with particular drives as standard, users could add |
| r244892 | r244893 | |
| 77 | 75 | intrq and drq are OR'd together, then gated to bit 7 of the data bus whenever |
| 78 | 76 | port 48 is activated on read. There are no interrupts used. |
| 79 | 77 | |
| 80 | | Tests of old keyboard. Start mbeeic. |
| 81 | | 1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar, |
| 82 | | it should only fire bullets. If it sometimes starts turning, |
| 83 | | thrusting or using the shield, then there is a problem. |
| 84 | | |
| 85 | | 2. Load SCAVENGER and make sure it doesn't go to the next level |
| 86 | | until you find the Exit. |
| 87 | | |
| 88 | | 3. At the Basic prompt, type in EDASM press enter. At the memory size |
| 89 | | prompt press enter. Now, make sure the keyboard works properly. |
| 90 | | |
| 91 | 78 | How to use the config switch for PIO B7: |
| 92 | 79 | - Teleterm: Must use RTC. Anything else makes teleterm go crazy. |
| 93 | 80 | - 256TC, 128, 128p: Doesn't seem to matter, leave at the default. |
| r244892 | r244893 | |
| 95 | 82 | - Other rom-based models: "VS" to make the Telcom clock work, or "Tied high". |
| 96 | 83 | - 56k: not sure yet, leave as "Tied high" until more is known. |
| 97 | 84 | |
| 98 | | How to use programs that need functions keys on models that use the old |
| 99 | | keyboard (for example, to run Simply Write on a 128k model). |
| 100 | | Press Ctrl+Shift+number, eg for F1 press hold down Ctrl Shift, press 1. |
| 101 | | |
| 102 | 85 | *************************************************************************** |
| 103 | 86 | |
| 104 | 87 | TODO/not working: |
| 105 | 88 | |
| 106 | 89 | - 256tc: Paste ignores shift key |
| 107 | | - All others: Paste drops most characters, shift operates randomly. |
| 90 | - All others: Paste drops most characters. |
| 108 | 91 | |
| 109 | 92 | - various fdc issues: |
| 110 | 93 | - B drive doesn't work with most disks. |
| 111 | 94 | - some disks cause MESS to freeze. |
| 112 | 95 | - ENMF pin missing from wd_fdc. |
| 113 | 96 | - incorrect timing for track register causes 256tc failure to boot a disk. |
| 114 | | - 56k model takes 120 seconds to boot a disk if loaded via command line. |
| 115 | 97 | |
| 116 | | - mbeeppc, mbee128p: In Basic, keyboard loses characters. Works fine in Wordbee. |
| 98 | - Simply Write has keyboard problems (in 128k, no keys work). |
| 117 | 99 | |
| 118 | 100 | - 256tc: At the menu, if F2 pressed to activate the Monitor, the emulated machine |
| 119 | 101 | crashes due to a bug in z80pio emulation. |
| r244892 | r244893 | |
| 222 | 204 | ADDRESS_MAP_UNMAP_HIGH |
| 223 | 205 | AM_RANGE(0x00, 0x03) AM_MIRROR(0x10) AM_DEVREADWRITE("z80pio", z80pio_device, read_alt, write_alt) |
| 224 | 206 | AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) |
| 225 | | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 226 | | AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 207 | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 208 | AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 227 | 209 | ADDRESS_MAP_END |
| 228 | 210 | |
| 229 | 211 | static ADDRESS_MAP_START(mbeeic_io, AS_IO, 8, mbee_state) |
| r244892 | r244893 | |
| 234 | 216 | AM_RANGE(0x09, 0x09) AM_WRITENOP /* Listed as "Colour Wait Off" or "USART 2651" but doesn't appear in the schematics */ |
| 235 | 217 | AM_RANGE(0x0a, 0x0a) AM_MIRROR(0x10) AM_WRITE(port0a_w) |
| 236 | 218 | AM_RANGE(0x0b, 0x0b) AM_MIRROR(0x10) AM_WRITE(port0b_w) |
| 237 | | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 238 | | AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 219 | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 220 | AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 239 | 221 | ADDRESS_MAP_END |
| 240 | 222 | |
| 241 | 223 | static ADDRESS_MAP_START(mbeepc_io, AS_IO, 8, mbee_state) |
| r244892 | r244893 | |
| 244 | 226 | AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) |
| 245 | 227 | AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP |
| 246 | 228 | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) |
| 247 | | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 248 | | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 229 | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 230 | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 249 | 231 | AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) |
| 250 | 232 | AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) |
| 251 | 233 | ADDRESS_MAP_END |
| r244892 | r244893 | |
| 256 | 238 | AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(port08_r, port08_w) |
| 257 | 239 | AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP |
| 258 | 240 | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_WRITE(port0b_w) |
| 259 | | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 260 | | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 241 | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 242 | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 261 | 243 | AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) |
| 262 | 244 | AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_low_r, port0a_w) |
| 263 | 245 | AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(telcom_high_r, port0a_w) |
| r244892 | r244893 | |
| 271 | 253 | AM_RANGE(0x0007, 0x0007) AM_MIRROR(0xff00) AM_READ(port07_r) |
| 272 | 254 | AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(port08_r, port08_w) |
| 273 | 255 | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) |
| 274 | | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 275 | | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 256 | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 257 | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 276 | 258 | AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) |
| 277 | 259 | AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) |
| 278 | 260 | AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xfe00) AM_READ(speed_low_r) |
| r244892 | r244893 | |
| 289 | 271 | AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) |
| 290 | 272 | AM_RANGE(0x09, 0x09) AM_WRITENOP |
| 291 | 273 | AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) |
| 292 | | AM_RANGE(0x0c, 0x0c) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 293 | | AM_RANGE(0x0d, 0x0d) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 274 | AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 275 | AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 294 | 276 | AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) |
| 295 | 277 | AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) |
| 296 | 278 | ADDRESS_MAP_END |
| r244892 | r244893 | |
| 305 | 287 | AM_RANGE(0x08, 0x08) AM_READWRITE(port08_r, port08_w) |
| 306 | 288 | AM_RANGE(0x09, 0x09) AM_WRITENOP |
| 307 | 289 | AM_RANGE(0x0b, 0x0b) AM_WRITE(port0b_w) |
| 308 | | AM_RANGE(0x0c, 0x0c) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 309 | | AM_RANGE(0x0d, 0x0d) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 290 | AM_RANGE(0x0c, 0x0c) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 291 | AM_RANGE(0x0d, 0x0d) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 310 | 292 | AM_RANGE(0x1c, 0x1f) AM_READWRITE(port1c_r, port1c_w) |
| 311 | 293 | AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write) |
| 312 | 294 | AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w) |
| r244892 | r244893 | |
| 324 | 306 | AM_RANGE(0x0209, 0x0209) AM_MIRROR(0xfd00) AM_READ(speed_high_r) |
| 325 | 307 | AM_RANGE(0x0009, 0x0009) AM_MIRROR(0xff00) AM_WRITENOP |
| 326 | 308 | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_WRITE(port0b_w) |
| 327 | | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 328 | | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 309 | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(m6545_index_w) |
| 310 | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(m6545_data_w) |
| 329 | 311 | // AM_RANGE(0x0010, 0x0013) AM_MIRROR(0xff00) Optional SN76489AN audio chip |
| 330 | 312 | AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(port18_r) |
| 331 | 313 | AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(port1c_r, port1c_w) |
| r244892 | r244893 | |
| 337 | 319 | // AM_RANGE(0x0068, 0x006f) AM_MIRROR(0xff00) Reserved for 8530 SCC (unused) |
| 338 | 320 | ADDRESS_MAP_END |
| 339 | 321 | |
| 340 | | static INPUT_PORTS_START( mbee ) |
| 322 | static INPUT_PORTS_START( oldkb ) |
| 341 | 323 | PORT_START("X.0") /* IN0 KEY ROW 0 [000] */ |
| 342 | 324 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') PORT_CHAR('`') |
| 343 | 325 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) |
| r244892 | r244893 | |
| 417 | 399 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 418 | 400 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("(Right)") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 419 | 401 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 402 | INPUT_PORTS_END |
| 420 | 403 | |
| 404 | static INPUT_PORTS_START( mbee ) |
| 405 | |
| 406 | PORT_INCLUDE( oldkb ) |
| 407 | |
| 421 | 408 | // Autorun on quickload |
| 422 | 409 | PORT_START("CONFIG") |
| 423 | 410 | PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") |
| 424 | 411 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 425 | 412 | PORT_CONFSETTING( 0x01, DEF_STR(Yes)) |
| 426 | 413 | // Wire links on motherboard |
| 427 | | PORT_CONFNAME( 0xc0, 0x80, "PIO B7") |
| 414 | PORT_CONFNAME( 0xc0, 0x00, "PIO B7") |
| 428 | 415 | PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock |
| 429 | 416 | PORT_CONFSETTING( 0x40, "RTC") // optional board usually not fitted |
| 430 | 417 | PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc |
| 431 | 418 | PORT_CONFSETTING( 0xc0, "Reserved for net") |
| 432 | 419 | INPUT_PORTS_END |
| 433 | 420 | |
| 421 | static INPUT_PORTS_START( mbee128 ) |
| 422 | |
| 423 | PORT_INCLUDE( oldkb ) |
| 424 | |
| 425 | // Autorun on quickload |
| 426 | PORT_START("CONFIG") |
| 427 | PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") |
| 428 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 429 | PORT_CONFSETTING( 0x01, DEF_STR(Yes)) |
| 430 | // Wire links on motherboard |
| 431 | PORT_CONFNAME( 0xc0, 0x40, "PIO B7") |
| 432 | PORT_CONFSETTING( 0x00, "VS") // sync pulse to enable telcom clock |
| 433 | PORT_CONFSETTING( 0x40, "RTC") // RTC IRQ for clock |
| 434 | PORT_CONFSETTING( 0x80, "Tied high") // default resistor to vcc |
| 435 | PORT_CONFSETTING( 0xc0, "Reserved for net") |
| 436 | INPUT_PORTS_END |
| 437 | |
| 434 | 438 | static INPUT_PORTS_START( mbee256 ) |
| 435 | 439 | PORT_START("Y.0") /* IN0 KEY ROW 0 [+00] */ |
| 436 | 440 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| r244892 | r244893 | |
| 1134 | 1138 | COMP( 1986, mbeeppc, mbee, 0, mbeeppc, mbee, mbee_state, mbeeppc, "Applied Technology", "Microbee Premium PC85" , 0 ) |
| 1135 | 1139 | COMP( 1986, mbeett, mbee, 0, mbeett, mbee256, mbee_state, mbeett, "Applied Technology", "Microbee Teleterm" , GAME_NOT_WORKING ) |
| 1136 | 1140 | COMP( 1986, mbee56, mbee, 0, mbee56, mbee, mbee_state, mbee56, "Applied Technology", "Microbee 56k" , GAME_NOT_WORKING ) |
| 1137 | | COMP( 1986, mbee128, mbee, 0, mbee128, mbee, mbee_state, mbee128, "Applied Technology", "Microbee 128k Standard" , GAME_NOT_WORKING ) |
| 1138 | | COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee, mbee_state, mbee128, "Applied Technology", "Microbee 128k Premium" , GAME_NOT_WORKING ) |
| 1141 | COMP( 1986, mbee128, mbee, 0, mbee128, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Standard" , GAME_NOT_WORKING ) |
| 1142 | COMP( 1986, mbee128p, mbee, 0, mbee128p, mbee128, mbee_state, mbee128, "Applied Technology", "Microbee 128k Premium" , GAME_NOT_WORKING ) |
| 1139 | 1143 | COMP( 1987, mbee256, mbee, 0, mbee256, mbee256, mbee_state, mbee256, "Applied Technology", "Microbee 256TC" , GAME_NOT_WORKING ) |
trunk/src/mess/video/mbee.c
| r244892 | r244893 | |
| 6 | 6 | |
| 7 | 7 | Rewritten by Robbbert |
| 8 | 8 | |
| 9 | Operation of old keyboard: |
| 10 | The design is taken from the SY6545 Application Note AN3. As the CRTC |
| 11 | renders the picture, the MA lines also scan the keyboard. When a keydown |
| 12 | is detected, the lightpen pin is activated, which sets bit 6 of the status |
| 13 | register. The CPU continuously monitors this register. Once bit 6 is set, |
| 14 | the CPU needs to determine which key is pressed. It firstly clears bit 6, |
| 15 | then sets port 0B to 1. This prevents the CRTC from scanning the keyboard |
| 16 | and causing interference. Next, the CPU writes an address to regs 18,19 and |
| 17 | then instigates the transparent access. This checks one keyboard row, which |
| 18 | if the pressed key is found, will once again set bit 6. If not found, the |
| 19 | next row will be checked. Once found, the CPU clears bit 6 and port 0B, then |
| 20 | works out the ascii key code of the pressed key. |
| 21 | |
| 22 | Tests of old keyboard. Start mbeeic. |
| 23 | 1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar, |
| 24 | it should only fire bullets. If it sometimes starts turning, |
| 25 | thrusting or using the shield, then there is a problem. |
| 26 | |
| 27 | 2. Load SCAVENGER and make sure it doesn't go to the next level |
| 28 | until you find the Exit. |
| 29 | |
| 30 | 3. At the Basic prompt, type in EDASM press enter. At the memory size |
| 31 | prompt press enter. Now, make sure the keyboard works properly. |
| 32 | |
| 33 | Old keyboard ToDo: |
| 34 | - Occasional characters dropped while typing |
| 35 | - Lots of characters dropped when pasting |
| 36 | - On mbee128p, Simply Write doesn't accept any input |
| 37 | |
| 38 | New keyboard ToDo: |
| 39 | - On mbeett, various problems caused by phantom characters. |
| 40 | |
| 9 | 41 | ****************************************************************************/ |
| 10 | 42 | |
| 11 | 43 | |
| r244892 | r244893 | |
| 156 | 188 | { |
| 157 | 189 | if (m_has_oldkb) |
| 158 | 190 | { |
| 159 | | offs &= 0x3f0; // safety check |
| 160 | 191 | UINT8 port = (offs >> 7) & 7; |
| 161 | 192 | UINT8 bit = (offs >> 4) & 7; |
| 162 | 193 | UINT8 extra = 0; |
| 163 | 194 | UINT8 data = m_io_oldkb[port]->read(); |
| 164 | | if ((port == 0) || (port == 2) || (port == 3)) |
| 165 | | extra = m_io_x7->read(); |
| 166 | | else |
| 167 | | if (port == 7) |
| 168 | | extra = data; |
| 169 | | |
| 170 | | bool keydown = ( data >> bit ) & 1; |
| 195 | bool keydown = BIT(data, bit); |
| 171 | 196 | |
| 172 | 197 | // This adds premium-style cursor keys to the old keyboard. |
| 173 | 198 | // They are used by the pc85 menu. Premium keyboards already |
| 174 | 199 | // have these keys fitted. |
| 175 | | if (!keydown && !m_is_premium && extra) |
| 200 | if (!keydown && !m_is_premium) |
| 176 | 201 | { |
| 177 | | if BIT(extra, 0) // cursor up |
| 178 | | { |
| 179 | | if( port == 7 && bit == 1 ) keydown = 1; |
| 180 | | if( port == 0 && bit == 5 ) keydown = 1; // control E |
| 181 | | } |
| 202 | if ((port == 0) || (port == 2) || (port == 3)) |
| 203 | extra = m_io_x7->read(); |
| 182 | 204 | else |
| 183 | | if BIT(extra, 2) // cursor down |
| 205 | if (port == 7) |
| 206 | extra = data; |
| 207 | |
| 208 | if (extra) |
| 184 | 209 | { |
| 185 | | if( port == 7 && bit == 1 ) keydown = 1; |
| 186 | | if( port == 3 && bit == 0 ) keydown = 1; // control X |
| 210 | if BIT(extra, 0) // cursor up |
| 211 | { |
| 212 | if( port == 7 && bit == 1 ) keydown = 1; |
| 213 | if( port == 0 && bit == 5 ) keydown = 1; // control E |
| 214 | } |
| 215 | else |
| 216 | if BIT(extra, 2) // cursor down |
| 217 | { |
| 218 | if( port == 7 && bit == 1 ) keydown = 1; |
| 219 | if( port == 3 && bit == 0 ) keydown = 1; // control X |
| 220 | } |
| 221 | else |
| 222 | if BIT(extra, 3) // cursor left |
| 223 | { |
| 224 | if( port == 7 && bit == 1 ) keydown = 1; |
| 225 | if( port == 2 && bit == 3 ) keydown = 1; // control S |
| 226 | } |
| 227 | else |
| 228 | if BIT(extra, 6) // cursor right |
| 229 | { |
| 230 | if( port == 7 && bit == 1 ) keydown = 1; |
| 231 | if( port == 0 && bit == 4 ) keydown = 1; // control D |
| 232 | } |
| 187 | 233 | } |
| 188 | | else |
| 189 | | if BIT(extra, 3) // cursor left |
| 190 | | { |
| 191 | | if( port == 7 && bit == 1 ) keydown = 1; |
| 192 | | if( port == 2 && bit == 3 ) keydown = 1; // control S |
| 193 | | } |
| 194 | | else |
| 195 | | if BIT(extra, 6) // cursor right |
| 196 | | { |
| 197 | | if( port == 7 && bit == 1 ) keydown = 1; |
| 198 | | if( port == 0 && bit == 4 ) keydown = 1; // control D |
| 199 | | } |
| 200 | 234 | } |
| 201 | 235 | |
| 202 | 236 | if( keydown ) |
| 203 | | { |
| 204 | | m_sy6545_reg[17] = offs; |
| 205 | | m_sy6545_reg[16] = (offs >> 8) & 0x3f; |
| 206 | | m_sy6545_status |= 0x40; //lpen_strobe |
| 207 | | } |
| 237 | m_crtc->assert_light_pen_input(); //lpen_strobe |
| 238 | |
| 208 | 239 | } |
| 209 | 240 | } |
| 210 | 241 | |
| r244892 | r244893 | |
| 223 | 254 | |
| 224 | 255 | ************************************************************/ |
| 225 | 256 | |
| 226 | | READ8_MEMBER( mbee_state::m6545_status_r ) |
| 227 | | { |
| 228 | | const rectangle &visarea = m_screen->visible_area(); |
| 229 | | |
| 230 | | UINT8 data = m_sy6545_status; // bit 6 = lpen strobe, bit 7 = update strobe |
| 231 | | int y = m_screen->vpos(); |
| 232 | | |
| 233 | | if( y < visarea.min_y || y > visarea.max_y ) |
| 234 | | data |= 0x20; /* vertical blanking */ |
| 235 | | |
| 236 | | return data; |
| 237 | | } |
| 238 | | |
| 239 | | READ8_MEMBER( mbee_state::m6545_data_r ) |
| 240 | | { |
| 241 | | UINT16 addr; |
| 242 | | UINT8 data = m_crtc->register_r( space, 0 ); |
| 243 | | |
| 244 | | switch( m_sy6545_ind ) |
| 245 | | { |
| 246 | | case 16: |
| 247 | | case 17: |
| 248 | | m_sy6545_status &= 0x80; // turn off lpen_strobe |
| 249 | | break; |
| 250 | | case 31: |
| 251 | | // This firstly pushes the contents of the transparent registers onto the MA lines, |
| 252 | | // then increments the address, then sets update strobe on. |
| 253 | | addr = (m_sy6545_reg[18] << 8) | m_sy6545_reg[19]; |
| 254 | | oldkb_matrix_r(addr); |
| 255 | | m_sy6545_reg[19]++; |
| 256 | | if (!m_sy6545_reg[19]) m_sy6545_reg[18]++; |
| 257 | | m_sy6545_status |= 0x80; // update_strobe |
| 258 | | break; |
| 259 | | } |
| 260 | | return data; |
| 261 | | } |
| 262 | | |
| 263 | 257 | WRITE8_MEMBER ( mbee_state::m6545_index_w ) |
| 264 | 258 | { |
| 265 | 259 | data &= 0x1f; |
| r244892 | r244893 | |
| 270 | 264 | WRITE8_MEMBER ( mbee_state::m6545_data_w ) |
| 271 | 265 | { |
| 272 | 266 | static const UINT8 sy6545_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0,0x3f,0xff}; |
| 273 | | UINT16 addr = 0; |
| 274 | 267 | |
| 275 | 268 | switch( m_sy6545_ind ) |
| 276 | 269 | { |
| r244892 | r244893 | |
| 279 | 272 | if( m_sy6545_reg[12] != data ) |
| 280 | 273 | memcpy(m_p_gfxram, memregion("gfx")->base() + (((data & 0x30) == 0x20) << 11), 0x800); |
| 281 | 274 | break; |
| 282 | | case 31: |
| 283 | | // This firstly pushes the contents of the transparent registers onto the MA lines, |
| 284 | | // then increments the address, then sets update strobe on. |
| 285 | | addr = (m_sy6545_reg[18] << 8) | m_sy6545_reg[19]; |
| 286 | | oldkb_matrix_r(addr); |
| 287 | | m_sy6545_reg[19]++; |
| 288 | | if (!m_sy6545_reg[19]) m_sy6545_reg[18]++; |
| 289 | | m_sy6545_status |= 0x80; // update_strobe |
| 290 | | break; |
| 291 | 275 | } |
| 292 | 276 | m_sy6545_reg[m_sy6545_ind] = data & sy6545_mask[m_sy6545_ind]; /* save data in register */ |
| 293 | 277 | m_crtc->register_w( space, 0, data ); |
| r244892 | r244893 | |
| 337 | 321 | |
| 338 | 322 | MC6845_ON_UPDATE_ADDR_CHANGED( mbee_state::crtc_update_addr ) |
| 339 | 323 | { |
| 340 | | // not sure what goes in here - parameters passed are device, address, strobe |
| 324 | // parameters passed are device, address, strobe(always 0) |
| 341 | 325 | // not used on 256TC |
| 326 | |
| 327 | oldkb_matrix_r(address); |
| 342 | 328 | } |
| 343 | 329 | |
| 344 | 330 | |
| r244892 | r244893 | |
| 496 | 482 | UINT8 i, r, b, g; |
| 497 | 483 | |
| 498 | 484 | /* set up 8 low intensity colours */ |
| 499 | | for (i = 0; i < 8; i++) |
| 485 | for (i = 0; i < 7; i++) |
| 500 | 486 | { |
| 501 | 487 | r = BIT(i, 0) ? 0xc0 : 0; |
| 502 | 488 | g = BIT(i, 1) ? 0xc0 : 0; |
| r244892 | r244893 | |
| 504 | 490 | palette.set_pen_color(i, rgb_t(r, g, b)); |
| 505 | 491 | } |
| 506 | 492 | |
| 493 | // colour 8 is dark grey, rather than black |
| 494 | palette.set_pen_color(8, rgb_t(96, 96, 96)); |
| 495 | |
| 507 | 496 | /* set up 8 high intensity colours */ |
| 508 | 497 | for (i = 9; i < 16; i++) |
| 509 | 498 | { |