diff options
author | 2013-07-04 10:43:00 +0000 | |
---|---|---|
committer | 2013-07-04 10:43:00 +0000 | |
commit | 73dfc95f4230c0f402b66e0b6abdc7325f78abce (patch) | |
tree | e94a9a81367fcbafcf47379b65eb8786a287b0f6 /src/emu/machine/mc6843.c | |
parent | f0fa61c9650a7c2741508d76cc1607f5846403e6 (diff) |
(MESS)bml3: Add stub variants bml3mk2 (for MB-6891) and bml3mk5 [jedwidz]
(for MB-6892). For now these behave the same as bml3 (MB-6890).
Refactor disk controllers and kanji ROM as slot devices. This allows
switching between MP-1802 and MP-1805 disk controllers. MP-1805 disk
controller now works. Kanji ROM now works.
Keyboard scanning in 'counter disabled' mode now works.
imgtool: Add bml3 driver, supporting both single-density (MP-1805
controller) and double-density (MP-1802 controller) disks in D88 format.
mc6843: Work around floppy_get_device() not finding drives attached to a
slot device.Store all 8 bits in CTAR current track register, rather than
excluding bit 7 (needed for bml3 MP-1805 boot)
Diffstat (limited to 'src/emu/machine/mc6843.c')
-rw-r--r-- | src/emu/machine/mc6843.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/emu/machine/mc6843.c b/src/emu/machine/mc6843.c index 0166f69a111..a72949f23f1 100644 --- a/src/emu/machine/mc6843.c +++ b/src/emu/machine/mc6843.c @@ -118,14 +118,39 @@ INLINE mc6843_t* get_safe_token( device_t *device ) +static device_t* mc6843_floppy_image ( device_t *device, UINT8 drive ) +{ + device_t *img = floppy_get_device( device->machine(), drive ); + if (!img && device->owner()) { + // For slot devices, drives are typically attached to the slot rather than the machine + const char *floppy_name = NULL; + switch (drive) { + case 0: + floppy_name = FLOPPY_0; + break; + case 1: + floppy_name = FLOPPY_1; + break; + case 2: + floppy_name = FLOPPY_2; + break; + case 3: + floppy_name = FLOPPY_3; + break; + } + img = device->owner()->subdevice(floppy_name); + } + return img; +} + + static device_t* mc6843_floppy_image ( device_t *device ) { mc6843_t* mc6843 = get_safe_token( device ); - return floppy_get_device( device->machine(), mc6843->drive ); + return mc6843_floppy_image( device, mc6843->drive ); } - void mc6843_set_drive( device_t *device, int drive ) { mc6843_t* mc6843 = get_safe_token( device ); @@ -234,9 +259,10 @@ static void mc6843_finish_SEK( device_t *device ) device_t* img = mc6843_floppy_image( device ); /* seek to track */ - floppy_drive_seek( img, mc6843->GCR - mc6843->CTAR ); + // TODO: not sure how CTAR bit 7 is handled here, but this is the safest approach for now + floppy_drive_seek( img, mc6843->GCR - (mc6843->CTAR & 0x7F) ); - LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", device->machine().time().as_double(), mc6843->CTAR, mc6843->GCR, floppy_drive_get_current_track( img ) )); + LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", device->machine().time().as_double(), (mc6843->CTAR & 0x7F), mc6843->GCR, floppy_drive_get_current_track( img ) )); /* update state */ mc6843->CTAR = mc6843->GCR; @@ -672,7 +698,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) } case 1: /* Current-Track Address Register (CTAR) */ - mc6843->CTAR = data & 0x7f; + mc6843->CTAR = data; LOG(( "%f $%04x mc6843_w: set CTAR to %i %02X (actual=%i) \n", space.machine().time().as_double(), space.machine().firstcpu->pcbase( ), mc6843->CTAR, data, floppy_drive_get_current_track( mc6843_floppy_image( device ) ) )); @@ -776,7 +802,7 @@ static DEVICE_RESET( mc6843 ) /* setup/reset floppy drive */ for ( i = 0; i < 4; i++ ) { - device_t * img = floppy_get_device( device->machine(), i ); + device_t * img = mc6843_floppy_image( device, i ); floppy_mon_w(img, CLEAR_LINE); floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); floppy_drive_set_rpm( img, 300. ); |