From 09b1d473d8ef01cf6c71a97162cea00e2b0ffa13 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Tue, 29 Apr 2008 16:17:42 +0000 Subject: [PATCH] =?utf8?q?FDC=20fix=208/10=20(Herv=C3=A9=20Poussineau):=20?= =?utf8?q?-=20Replaces=20bootsel=20field=20by=20the=20whole=20tdr=20regist?= =?utf8?q?er.=20It=20may=20be=20easier=20if=20we=20want=20to=20later=20add?= =?utf8?q?=20support=20for=20tapes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4288 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/fdc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index 2062011..1aec99e 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -467,10 +467,10 @@ struct fdctrl_t { uint8_t sra; uint8_t srb; uint8_t dor; + uint8_t tdr; uint8_t dsr; uint8_t msr; uint8_t cur_drv; - uint8_t bootsel; uint8_t status0; uint8_t status1; uint8_t status2; @@ -606,13 +606,13 @@ static void fdc_save (QEMUFile *f, void *opaque) /* Controller state */ qemu_put_8s(f, &s->sra); qemu_put_8s(f, &s->srb); + qemu_put_8s(f, &s->tdr); qemu_put_8s(f, &s->dsr); qemu_put_8s(f, &s->msr); qemu_put_8s(f, &s->status0); qemu_put_8s(f, &s->status1); qemu_put_8s(f, &s->status2); qemu_put_8s(f, &s->cur_drv); - qemu_put_8s(f, &s->bootsel); /* Command FIFO */ qemu_put_buffer(f, s->fifo, FD_SECTOR_LEN); qemu_put_be32s(f, &s->data_pos); @@ -651,13 +651,13 @@ static int fdc_load (QEMUFile *f, void *opaque, int version_id) /* Controller state */ qemu_get_8s(f, &s->sra); qemu_get_8s(f, &s->srb); + qemu_get_8s(f, &s->tdr); qemu_get_8s(f, &s->dsr); qemu_get_8s(f, &s->msr); qemu_get_8s(f, &s->status0); qemu_get_8s(f, &s->status1); qemu_get_8s(f, &s->status2); qemu_get_8s(f, &s->cur_drv); - qemu_get_8s(f, &s->bootsel); /* Command FIFO */ qemu_get_buffer(f, s->fifo, FD_SECTOR_LEN); qemu_get_be32s(f, &s->data_pos); @@ -762,12 +762,15 @@ static void fdctrl_reset (fdctrl_t *fdctrl, int do_irq) static inline fdrive_t *drv0 (fdctrl_t *fdctrl) { - return &fdctrl->drives[fdctrl->bootsel]; + return &fdctrl->drives[(fdctrl->tdr & FD_TDR_BOOTSEL) >> 2]; } static inline fdrive_t *drv1 (fdctrl_t *fdctrl) { - return &fdctrl->drives[1 - fdctrl->bootsel]; + if ((fdctrl->tdr & FD_TDR_BOOTSEL) < (1 << 2)) + return &fdctrl->drives[1]; + else + return &fdctrl->drives[0]; } static fdrive_t *get_cur_drv (fdctrl_t *fdctrl) @@ -848,11 +851,8 @@ static void fdctrl_write_dor (fdctrl_t *fdctrl, uint32_t value) /* Tape drive register : 0x03 */ static uint32_t fdctrl_read_tape (fdctrl_t *fdctrl) { - uint32_t retval = 0; + uint32_t retval = fdctrl->tdr; - /* Disk boot selection indicator */ - retval |= fdctrl->bootsel << 2; - /* Tape indicators: never allowed */ FLOPPY_DPRINTF("tape drive register: 0x%02x\n", retval); return retval; @@ -867,7 +867,7 @@ static void fdctrl_write_tape (fdctrl_t *fdctrl, uint32_t value) } FLOPPY_DPRINTF("tape drive register set to 0x%02x\n", value); /* Disk boot selection indicator */ - fdctrl->bootsel = (value & FD_TDR_BOOTSEL) >> 2; + fdctrl->tdr = value & FD_TDR_BOOTSEL; /* Tape indicators: never allow */ } -- 2.7.4