src/mess/drivers/mycom.c
| r9455 | r9456 | |
| 16 | 16 | a - shiftlock (toggle). You can then enter any lowercase character. |
| 17 | 17 | c - clear screen and home cursor |
| 18 | 18 | d - insert |
| 19 | | f - vertical tab (cursor up) |
| 19 | f - vertical tab (cursor up) You can scroll backwards with this, |
| 20 | and you can reuse old input lines. |
| 20 | 21 | u - cursor right |
| 21 | 22 | - There are switches on the right-hand side which are connected directly |
| 22 | 23 | to one of the PIAs. The switches (not emulated): |
| r9455 | r9456 | |
| 33 | 34 | Internally, this turns the Kana bit off/on. On our keyboard, hold down |
| 34 | 35 | the ALT key to get Kana; release it to get English. |
| 35 | 36 | |
| 36 | | TODO: |
| 37 | | - SN doesn't seem to work properly, needs to find out what's the WE bit |
| 38 | | for. |
| 39 | | - Hook-up FDC (only the basic components have been added) |
| 40 | | - Hook-up CMT load / save; (save works, load does not) |
| 37 | TODO/info: |
| 38 | - Sound not working. See the info down the page. |
| 39 | - FDC, type 1771, single sided, capacity 143KBytes, not connected up |
| 40 | - Cassette doesn't load |
| 41 | 41 | - Printer |
| 42 | | - RTC |
| 42 | - RTC, type MSM5832RS, unemulated device |
| 43 | 43 | - Keyboard lookup table for Kana and Shifted Kana |
| 44 | 44 | - Keyboard autorepeat |
| 45 | 45 | |
| r9455 | r9456 | |
| 56 | 56 | #include "devices/flopdrv.h" |
| 57 | 57 | #include "formats/basicdsk.h" |
| 58 | 58 | |
| 59 | | static UINT8 mc6845_reg[32]; /* registers */ |
| 60 | | static UINT8 mc6845_ind; /* register index */ |
| 61 | | static const UINT8 mc6845_mask[32]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; |
| 62 | 59 | static running_device *mc6845; |
| 60 | static running_device *mycom_audio; |
| 63 | 61 | static running_device *mycom_cassette; |
| 62 | static running_device *mycom_fdc; |
| 64 | 63 | static UINT8 *vram; |
| 65 | 64 | static UINT8 *gfx_rom; |
| 66 | 65 | static UINT16 vram_addr; |
| 67 | 66 | static UINT8 keyb_press,keyb_press_flag; |
| 68 | | static UINT8 video_mode,sn_we; |
| 67 | static UINT8 mycom_0a,sn_we; |
| 69 | 68 | static UINT32 upper_sw; |
| 70 | 69 | static UINT8 *RAM; |
| 71 | 70 | |
| r9455 | r9456 | |
| 88 | 87 | UINT16 mem,x; |
| 89 | 88 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 90 | 89 | |
| 91 | | if(video_mode & 0x40) |
| 90 | if (mycom_0a & 0x40) |
| 92 | 91 | { |
| 93 | 92 | for (x = 0; x < x_count; x++) // lores pixels |
| 94 | 93 | { |
| r9455 | r9456 | |
| 157 | 156 | RAM[offset | 0xc000] = data; |
| 158 | 157 | } |
| 159 | 158 | |
| 160 | | static READ8_HANDLER( mycom_6845_r ) |
| 161 | | { |
| 162 | | if (!offset) |
| 163 | | return 0; |
| 164 | | |
| 165 | | /* need to read the start registers or scroll wont work */ |
| 166 | | if ((mc6845_ind & 0x1e) == 0x0c) |
| 167 | | return mc6845_reg[mc6845_ind]; |
| 168 | | else |
| 169 | | return mc6845_register_r(mc6845, 0); |
| 170 | | } |
| 171 | | |
| 172 | | static WRITE8_HANDLER( mycom_6845_w ) |
| 173 | | { |
| 174 | | if(offset == 0) |
| 175 | | { |
| 176 | | mc6845_ind = data; |
| 177 | | mc6845_address_w(mc6845, 0, data); |
| 178 | | } |
| 179 | | else |
| 180 | | { |
| 181 | | mc6845_reg[mc6845_ind] = data & mc6845_mask[mc6845_ind]; |
| 182 | | mc6845_register_w(mc6845, 0,data); |
| 183 | | } |
| 184 | | } |
| 185 | | |
| 186 | 159 | static READ8_HANDLER( vram_data_r ) |
| 187 | 160 | { |
| 188 | 161 | return vram[vram_addr]; |
| r9455 | r9456 | |
| 204 | 177 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 205 | 178 | AM_RANGE(0x00, 0x00) AM_WRITE(mycom_00_w) |
| 206 | 179 | AM_RANGE(0x01, 0x01) AM_READWRITE(vram_data_r,vram_data_w) |
| 207 | | AM_RANGE(0x02, 0x03) AM_READWRITE(mycom_6845_r,mycom_6845_w) |
| 180 | AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("crtc", mc6845_status_r,mc6845_address_w) |
| 181 | AM_RANGE(0x03, 0x03) AM_DEVREADWRITE("crtc", mc6845_register_r,mc6845_register_w) |
| 208 | 182 | AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_0", i8255a_r, i8255a_w) |
| 209 | 183 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w) |
| 210 | 184 | AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("ppi8255_2", i8255a_r, i8255a_w) |
| r9455 | r9456 | |
| 340 | 314 | { |
| 341 | 315 | vram_addr = (vram_addr & 0x700) | data; |
| 342 | 316 | |
| 317 | sn_we = data; |
| 343 | 318 | /* doesn't work? */ |
| 344 | | //printf("%02x %02x\n",data,sn_we); |
| 319 | //printf(":%X ",data); |
| 345 | 320 | //if(sn_we) |
| 346 | | // sn76496_w(device->machine->device("sn1"), 0, data); |
| 321 | //sn76496_w(mycom_audio, 0, data); |
| 347 | 322 | } |
| 348 | 323 | |
| 349 | 324 | static WRITE8_DEVICE_HANDLER( mycom_06_w ) |
| r9455 | r9456 | |
| 391 | 366 | -x-- ---- video mode (0= tile, 1 = bitmap) |
| 392 | 367 | --x- ---- PSG Chip Select bit |
| 393 | 368 | ---x ---- PSG Write Enable bit |
| 394 | | ---- x--- cmt remote |
| 369 | ---- x--- cmt remote (defaults to on) |
| 395 | 370 | ---- -x-- cmt output |
| 396 | 371 | ---- --x- printer reset |
| 397 | 372 | ---- ---x printer strobe |
| 398 | 373 | */ |
| 399 | 374 | |
| 375 | if ((mycom_0a & 8) != (data & 8)) |
| 376 | cassette_change_state(mycom_cassette, |
| 377 | (data & 8) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 378 | |
| 400 | 379 | if (data & 8) // motor on |
| 401 | 380 | cassette_output(mycom_cassette, (data & 4) ? -1.0 : +1.0); |
| 402 | 381 | |
| 403 | | video_mode = data & 0xc0; |
| 404 | | sn_we = data & 0x10; |
| 405 | | // printf("%02x\n",data & 0x10); |
| 382 | if ((data & 0x80) != (mycom_0a & 0x80)) |
| 383 | mc6845_set_clock(mc6845, (data & 0x80) ? 1008000 : 2016000); |
| 384 | |
| 385 | mycom_0a = data; |
| 386 | |
| 387 | /* Info about sound |
| 388 | - uses a SN76489N chip at an unknown clock |
| 389 | - each time a key is pressed, 4 lots of data are output to port 4 |
| 390 | - after each data byte, there is a 4 byte control sequence to port 0a |
| 391 | - the control sequence is 9F,8F,AF,BF |
| 392 | - the data bytes are 8D,01,9F,9F |
| 393 | - the end result is silence :( */ |
| 394 | |
| 395 | // no sound comes out |
| 396 | if ((data & 0x30)==0) |
| 397 | sn76496_w(mycom_audio, 0, sn_we); |
| 406 | 398 | } |
| 407 | 399 | |
| 408 | 400 | static I8255A_INTERFACE( ppi8255_intf_0 ) |
| r9455 | r9456 | |
| 490 | 482 | |
| 491 | 483 | static MACHINE_START(mycom) |
| 492 | 484 | { |
| 485 | mycom_audio = machine->device("sn1"); |
| 493 | 486 | mycom_cassette = machine->device("cassette"); |
| 487 | mycom_fdc = machine->device("fdc"); |
| 494 | 488 | RAM = memory_region(machine, "maincpu"); |
| 495 | 489 | timer_pulse(machine, ATTOTIME_IN_HZ(20), NULL, 0, mycom_kbd); |
| 496 | 490 | } |
| r9455 | r9456 | |
| 499 | 493 | { |
| 500 | 494 | memory_set_bank(machine, "boot", 1); |
| 501 | 495 | upper_sw = 0x10000; |
| 496 | mycom_0a = 0; |
| 502 | 497 | } |
| 503 | 498 | |
| 504 | 499 | static DRIVER_INIT( mycom ) |
| r9455 | r9456 | |
| 509 | 504 | |
| 510 | 505 | static MACHINE_CONFIG_START( mycom, driver_device ) |
| 511 | 506 | /* basic machine hardware */ |
| 512 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 507 | MDRV_CPU_ADD("maincpu",Z80, XTAL_10MHz / 4) |
| 513 | 508 | MDRV_CPU_PROGRAM_MAP(mycom_map) |
| 514 | 509 | MDRV_CPU_IO_MAP(mycom_io) |
| 515 | 510 | |
| r9455 | r9456 | |
| 531 | 526 | MDRV_PALETTE_INIT(black_and_white) |
| 532 | 527 | MDRV_GFXDECODE(mycom) |
| 533 | 528 | |
| 534 | | MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf) /* unknown clock, hand tuned to get ~60 fps */ |
| 529 | /* Manual states clock is 1.008mhz for 40 cols, and 2.016 mhz for 80 cols. |
| 530 | The CRTC is a HD46505S - same as a 6845. The start registers need to be readable. */ |
| 531 | MDRV_MC6845_ADD("crtc", MC6845, 1008000, mc6845_intf) |
| 535 | 532 | |
| 536 | 533 | MDRV_VIDEO_START(mycom) |
| 537 | 534 | MDRV_VIDEO_UPDATE(mycom) |
| r9455 | r9456 | |
| 539 | 536 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 540 | 537 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 541 | 538 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 542 | | MDRV_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider |
| 539 | MDRV_SOUND_ADD("sn1", SN76489, 1996800) // unknown clock / divider |
| 543 | 540 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 544 | 541 | |
| 545 | 542 | /* Devices */ |