From c5c3732cbb21f1e84ecc2c327af0135bfe9fc039 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 26 Apr 2018 17:37:44 +0200 Subject: [PATCH] Fixed some bugs. --- src/disk/hdc_xta.c | 65 +-------------- src/machine/m_ps1_hdc.c | 170 +--------------------------------------- src/video/vid_svga.c | 4 +- src/win/86Box.rc | 8 +- src/win/resource.h | 61 +++++++------- 5 files changed, 37 insertions(+), 271 deletions(-) diff --git a/src/disk/hdc_xta.c b/src/disk/hdc_xta.c index 8771e2283..2e83e051b 100644 --- a/src/disk/hdc_xta.c +++ b/src/disk/hdc_xta.c @@ -46,7 +46,7 @@ * * NOTE: The XTA interface is 0-based for sector numbers !! * - * Version: @(#)hdc_ide_xta.c 1.0.6 2018/04/26 + * Version: @(#)hdc_ide_xta.c 1.0.7 2018/04/26 * * Author: Fred N. van Kempen, * @@ -401,11 +401,6 @@ do_format(hdc_t *dev, drive_t *drive, dcb_t *dcb) dev->head = dcb->head; dev->sector = 0; -#ifdef ENABLE_HDC_LOG - xta_log("%s: format_%s(%d) %d,%d\n", dev->name, - (dcb->cmd==CMD_FORMAT_DRIVE)?"drive":"track", - drive->id, dev->track, dev->head); -#endif /* Activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); @@ -467,10 +462,6 @@ hdc_callback(void *priv) switch (dcb->cmd) { case CMD_TEST_READY: -#ifdef ENABLE_HDC_LOG - xta_log("%s: test_ready(%d) ready=%d\n", - dev->name, dcb->drvsel, drive->present); -#endif if (! drive->present) { dev->comp |= COMP_ERR; dev->sense = ERR_NOTRDY; @@ -479,10 +470,6 @@ hdc_callback(void *priv) break; case CMD_RECALIBRATE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: recalibrate(%d) ready=%d\n", - dev->name, dcb->drvsel, drive->present); -#endif if (! drive->present) { dev->comp |= COMP_ERR; dev->sense = ERR_NOTRDY; @@ -495,10 +482,6 @@ hdc_callback(void *priv) case CMD_READ_SENSE: switch(dev->state) { case STATE_IDLE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: sense(%d)\n", - dev->name, dcb->drvsel); -#endif dev->buf_idx = 0; dev->buf_len = 4; dev->buf_ptr = dev->data; @@ -549,12 +532,6 @@ hdc_callback(void *priv) case STATE_SEND: /* Activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); -#ifdef ENABLE_HDC_LOG - xta_log("%s: read_%s(%d: %d,%d,%d) cnt=%d\n", - dev->name, (no_data)?"verify":"sector", - drive->id, dev->track, dev->head, - dev->sector, dev->count); -#endif do_send: /* Get address of sector to load. */ if (get_sector(dev, drive, &addr)) { @@ -616,12 +593,6 @@ do_send: case STATE_SDONE: dev->buf_idx = 0; if (--dev->count == 0) { -#ifdef ENABLE_HDC_LOG - xta_log("%s: read_%s(%d) DONE\n", - dev->name, - (no_data)?"verify":"sector", - drive->id); -#endif /* De-activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 0); @@ -672,12 +643,6 @@ do_send: case STATE_RECV: /* Activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); -#ifdef ENABLE_HDC_LOG - xta_log("%s: write_%s(%d: %d,%d,%d) cnt=%d\n", - dev->name, (no_data)?"verify":"sector", - dcb->drvsel, dev->track, - dev->head, dev->sector, dev->count); -#endif do_recv: /* Ready to transfer the data in. */ dev->state = STATE_RDATA; @@ -743,11 +708,6 @@ do_recv: dev->buf_idx = 0; if (--dev->count == 0) { -#ifdef ENABLE_HDC_LOG - xta_log("HDC: write_%s(%d) DONE\n", - (no_data)?"verify":"sector", - drive->id); -#endif /* De-activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 0); @@ -778,10 +738,6 @@ do_recv: case CMD_SEEK: /* Seek to cylinder. */ val = (dcb->cyl_low | (dcb->cyl_high << 8)); -#ifdef ENABLE_HDC_LOG - xta_log("%s: seek(%d) %d/%d ready=%d\n", dev->name, - dcb->drvsel, val, drive->cur_cyl, drive->present); -#endif if (drive->present) { do_seek(dev, drive, val); if (val != drive->cur_cyl) { @@ -811,11 +767,6 @@ do_recv: (params->cyl_high << 8) | params->cyl_low; drive->hpc = params->heads; drive->spt = 17 /*hardcoded*/; -#ifdef ENABLE_HDC_LOG - xta_log("%s: set_params(%d) cyl=%d,hd=%d,spt=%d\n", - dev->name, dcb->drvsel, drive->tracks, - drive->hpc, drive->spt); -#endif dev->status &= ~STAT_REQ; set_intr(dev); break; @@ -825,10 +776,6 @@ do_recv: case CMD_WRITE_SECTOR_BUFFER: switch (dev->state) { case STATE_IDLE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: write_sector_buffer()\n", - dev->name); -#endif dev->buf_idx = 0; dev->buf_len = 512; dev->state = STATE_RDATA; @@ -873,9 +820,6 @@ do_recv: case CMD_RAM_DIAGS: switch(dev->state) { case STATE_IDLE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: ram_diags\n", dev->name); -#endif dev->state = STATE_RDONE; dev->callback = 5*HDC_TIME; break; @@ -889,10 +833,6 @@ do_recv: case CMD_DRIVE_DIAGS: switch(dev->state) { case STATE_IDLE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: drive_diags(%d) ready=%d\n", - dev->name, dcb->drvsel, drive->present); -#endif if (drive->present) { dev->state = STATE_RDONE; dev->callback = 5*HDC_TIME; @@ -912,9 +852,6 @@ do_recv: case CMD_CTRL_DIAGS: switch(dev->state) { case STATE_IDLE: -#ifdef ENABLE_HDC_LOG - xta_log("%s: ctrl_diags\n", dev->name); -#endif dev->state = STATE_RDONE; dev->callback = 10*HDC_TIME; break; diff --git a/src/machine/m_ps1_hdc.c b/src/machine/m_ps1_hdc.c index 4a444687a..7921281c9 100644 --- a/src/machine/m_ps1_hdc.c +++ b/src/machine/m_ps1_hdc.c @@ -43,7 +43,7 @@ * Type table with the main code, so the user can only select * items from that list... * - * Version: @(#)m_ps1_hdc.c 1.0.4 2018/04/26 + * Version: @(#)m_ps1_hdc.c 1.0.5 2018/04/26 * * Author: Fred N. van Kempen, * @@ -555,102 +555,6 @@ next_sector(hdc_t *dev, drive_t *drive) } -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) -static void -dump_ssb(ssb_t *ssb) -{ - char temp[1024]; - char *sp = temp; - uint8_t *ptr = (uint8_t *)ssb; - int i; - - sprintf(temp, "Current SSB:\n ["); - sp += strlen(sp); - for (i = 0; i < sizeof(ssb_t); i++) { - sprintf(sp, " %02X", *ptr++); - sp += strlen(sp); - } - sprintf(sp, " ]\n"); sp += strlen(sp); - - sprintf(sp, " Status 0: T0=%d CE=%d WF=%d SE=%d NR=%d\n", - ssb->track_0, ssb->cylinder_err, ssb->write_fault, - ssb->seek_end, ssb->not_ready); - sp += strlen(sp); - - sprintf(sp, " Status 1: ID=%d WC=%d BT=%d AM=%d ET=%d EF=%d\n", - ssb->id_not_found, ssb->wrong_cyl, ssb->all_bit_set, - ssb->mark_not_found, ssb->ecc_crc_err, ssb->ecc_crc_field); - sp += strlen(sp); - - sprintf(sp, " Status 2: HEADSEL=%d DS=%d RG=%d RR=%d\n", - ssb->headsel_state, ssb->defective_sector, ssb->retried_ok, - ssb->need_reset); - sp += strlen(sp); - - sprintf(sp, " Last : CYL=%d HEAD=%d SECTOR=%d DS=%d SIZE=%d\n", - (ssb->last_cyl_high<<8)|ssb->last_cyl_low, ssb->last_head, - ssb->last_sect, ssb->last_def_sect, (128<sect_size)); - sp += strlen(sp); - - sprintf(sp, " Current : CYL=%d HEAD=%d CORR=%d RETR=%d\n", - (ssb->curr_cyl_high<<8)|ssb->curr_cyl_low, ssb->curr_head, - ssb->sect_corr, ssb->retries); - sp += strlen(sp); - - sprintf(sp, " Misc : Syndrome=%02X DRIVE_TYPE=%d\n", - ssb->cmd_syndrome, ssb->drive_type); - -#if 0 - pclog("HDC: %s\n", temp); -#endif -} - - -static void -dump_ccb(hdc_t *dev, ccb_t *ccb) -{ - char temp[1024]; - char *sp = temp; - - sprintf(temp, "Incoming CCB:\n"); - sp += strlen(sp); - sprintf(sp, " CMD=%02X EC/P=%d DS=%d AS=%d ND=%d\n", - ccb->cmd, ccb->ec_p, ccb->mbz1, ccb->auto_seek, ccb->no_data); - sp += strlen(sp); - sprintf(sp, " CYL=%d HEAD=%d SECTOR=%d COUNT=%d\n", - ((ccb->cyl_high<<8)|ccb->cyl_low), ccb->head, ccb->sector, ccb->count); - -#if 0 - pclog("HDC: %s\n", temp); -#endif -}; - - -static void -dump_fcb(fcb_t *fcb, int count) -{ - char temp[1024]; - char *sp = temp; - - sprintf(temp, "Incoming FCB:\n"); - - while (count--) { - sp += strlen(sp); - sprintf(sp, " CYL=%4d HEAD=%2d DS=%d", - ((fcb->cyl_high << 8) | fcb->cyl_low), - fcb->head, fcb->defective_sector); - sp += strlen(sp); - sprintf(sp, " SECTOR=%2d FILL=%02X\n", fcb->sector, fcb->fill); - fcb++; - } - -#if 0 - pclog("HDC: %s\n", temp); -#endif -} -#endif - - /* Finish up. Repeated all over, so a function it is now. */ static void do_finish(hdc_t *dev) @@ -725,9 +629,6 @@ do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb) while (dev->buf_idx < dev->buf_len) { val = dma_channel_read(dev->dma); if (val == DMA_NODATA) { -#if 0 - pclog("HDC: CMD_FORMAT out of data (idx=%d, len=%d)!\n", dev->buf_idx, dev->buf_len); -#endif dev->intstat |= ISR_EQUIP_CHECK; dev->ssb.need_reset = 1; intr = 1; @@ -747,21 +648,12 @@ do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb) /* Point to the FCB we got. */ #if 0 fcb = (fcb_t *)dev->data; -#endif -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - dump_fcb(fcb, ccb->count); #endif dev->state = STATE_FINIT; /*FALLTHROUGH*/ case STATE_FINIT: do_fmt: -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: format_%s(%d) %d,%d\n", - (ccb->cmd==CMD_FORMAT_DRIVE)?"drive":"track", - drive->id, dev->track, dev->head); -#endif - /* Activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); @@ -856,9 +748,6 @@ hdc_callback(void *priv) /*FALLTHROUGH*/ case CMD_READ_SECTORS: -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - if (dev->state == STATE_IDLE) dump_ccb(dev, ccb); -#endif if (! drive->present) { dev->ssb.not_ready = 1; do_finish(dev); @@ -890,13 +779,6 @@ hdc_callback(void *priv) ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); do_send: -#ifdef ENABLE_HDC_LOG - pclog("HDC: read_%s(%d: %d,%d,%d) cnt=%d\n", - (no_data)?"verify":"sector", drive->id, - dev->track, dev->head, dev->sector, - dev->count); -#endif - /* Get address of sector to load. */ if (get_sector(dev, drive, &addr)) { /* De-activate the status icon. */ @@ -962,11 +844,6 @@ do_send: case STATE_SDONE: dev->buf_idx = 0; if (--dev->count == 0) { -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: read_%s(%d) DONE\n", - (no_data)?"verify":"sector", - drive->id); -#endif /* De-activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 0); @@ -988,9 +865,6 @@ do_send: case CMD_READ_EXT: /* READ_EXT */ case CMD_READ_ID: /* READ_ID */ -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - if (dev->state == STATE_IDLE) dump_ccb(dev, ccb); -#endif if (! drive->present) { dev->ssb.not_ready = 1; do_finish(dev); @@ -1002,13 +876,6 @@ do_send: break; case CMD_RECALIBRATE: /* RECALIBRATE */ -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - dump_ccb(dev, ccb); -#endif -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: recalibrate(%d) ready=%d\n", - drive->id, drive->present); -#endif if (drive->present) { dev->track = drive->cur_cyl = 0; } else { @@ -1024,9 +891,6 @@ do_send: /*FALLTHROUGH*/ case CMD_WRITE_SECTORS: -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - dump_ccb(dev, ccb); -#endif if (! drive->present) { dev->ssb.not_ready = 1; do_finish(dev); @@ -1057,12 +921,6 @@ do_send: /* Activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 1); do_recv: -#ifdef ENABLE_HDC_LOG - hdc_log("HDC write_%s(%d: %d,%d,%d) cnt=%d\n", - (no_data)?"verify":"sector", drive->id, - dev->track, dev->head, dev->sector, - dev->count); -#endif /* Ready to transfer the data in. */ dev->state = STATE_RDATA; dev->buf_idx = 0; @@ -1129,11 +987,6 @@ do_recv: dev->buf_idx = 0; if (--dev->count == 0) { -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: write_%s(%d) DONE\n", - (no_data)?"verify":"sector", - drive->id); -#endif /* De-activate the status icon. */ ui_sb_update_icon(SB_HDD|HDD_BUS_XTA, 0); @@ -1155,16 +1008,10 @@ do_recv: case CMD_FORMAT_DRIVE: case CMD_FORMAT_TRACK: -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - if (dev->state == STATE_IDLE) dump_ccb(dev, ccb); -#endif do_format(dev, drive, ccb); break; case CMD_SEEK: -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - dump_ccb(dev, ccb); -#endif if (! drive->present) { dev->ssb.not_ready = 1; do_finish(dev); @@ -1179,23 +1026,12 @@ do_recv: val = do_seek(dev, drive, (ccb->cyl_low|(ccb->cyl_high<<8))); } -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: %s(%d) cyl=%d, err=%d\n", - (ccb->ec_p)?"park":"seek", - drive->id, drive->cur_cyl, val); -#endif if (! val) dev->ssb.seek_end = 1; do_finish(dev); break; default: -#ifdef ENABLE_HDC_LOG - hdc_log("HDC: unknown command - %02x\n", ccb->cmd); -# ifdef _DEBUG - dump_ccb(dev, ccb); -# endif -#endif dev->intstat |= ISR_INVALID_CMD; do_finish(dev); } @@ -1238,10 +1074,6 @@ hdc_send_ssb(hdc_t *dev) dev->buf_len = sizeof(dev->ssb); dev->buf_ptr = (uint8_t *)&dev->ssb; -#if defined(ENABLE_HDC_LOG) && defined(_DEBUG) - dump_ssb(&dev->ssb); -#endif - /* Done with the SSB. */ dev->attn &= ~ATT_SSB; } diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 2fca45358..894ab57f3 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -11,7 +11,7 @@ * This is intended to be used by another SVGA driver, * and not as a card in it's own right. * - * Version: @(#)vid_svga.c 1.0.29 2018/04/26 + * Version: @(#)vid_svga.c 1.0.30 2018/04/26 * * Authors: Sarah Walker, * Miran Grca, @@ -796,7 +796,7 @@ svga_init(svga_t *svga, void *p, int memsize, svga->vram_max = memsize; svga->vram_display_mask = svga->vram_mask = memsize - 1; svga->decode_mask = 0x7fffff; - svga->changedvram = malloc(0x800000 >> 12); + svga->changedvram = malloc(memsize >> 12); svga->recalctimings_ex = recalctimings_ex; svga->video_in = video_in; svga->video_out = video_out; diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 33dea1d55..1def56cfa 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)86Box.rc 1.0.33 2018/04/26 + * Version: @(#)86Box.rc 1.0.34 2018/04/26 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -117,11 +117,9 @@ BEGIN POPUP "&Tools" BEGIN MENUITEM "&Settings...", IDM_CONFIG - MENUITEM SEPARATOR - MENUITEM "S&tatus", IDM_STATUS - MENUITEM "Take s&creenshot\tCtrl+F11", IDM_ACTION_SCREENSHOT - MENUITEM SEPARATOR MENUITEM "&Update status bar icons", IDM_UPDATE_ICONS + MENUITEM SEPARATOR + MENUITEM "Take s&creenshot\tCtrl+F11", IDM_ACTION_SCREENSHOT END #if defined(ENABLE_LOG_TOGGLES) || defined(ENABLE_LOG_COMMANDS) POPUP "&Logging" diff --git a/src/win/resource.h b/src/win/resource.h index 6bf1d7956..1abac6723 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -8,7 +8,7 @@ * * Windows resource defines. * - * Version: @(#)resource.h 1.0.23 2018/03/26 + * Version: @(#)resource.h 1.0.24 2018/04/26 * * Authors: Sarah Walker, * Miran Grca, @@ -240,36 +240,35 @@ #define IDM_CONFIG 40020 #define IDM_CONFIG_LOAD 40021 #define IDM_CONFIG_SAVE 40022 -#define IDM_STATUS 40030 -#define IDM_UPDATE_ICONS 40040 -#define IDM_VID_RESIZE 40050 -#define IDM_VID_REMEMBER 40051 -#define IDM_VID_DDRAW 40060 -#define IDM_VID_D3D 40061 -#define IDM_VID_VNC 40062 -#define IDM_VID_RDP 40063 -#define IDM_VID_SCALE_1X 40064 -#define IDM_VID_SCALE_2X 40065 -#define IDM_VID_SCALE_3X 40066 -#define IDM_VID_SCALE_4X 40067 -#define IDM_VID_FULLSCREEN 40070 -#define IDM_VID_FS_FULL 40071 -#define IDM_VID_FS_43 40072 -#define IDM_VID_FS_SQ 40073 -#define IDM_VID_FS_INT 40074 -#define IDM_VID_FS_KEEPRATIO 40075 -#define IDM_VID_FORCE43 40076 -#define IDM_VID_OVERSCAN 40077 -#define IDM_VID_INVERT 40079 -#define IDM_VID_CGACON 40080 -#define IDM_VID_GRAYCT_601 40085 -#define IDM_VID_GRAYCT_709 40086 -#define IDM_VID_GRAYCT_AVE 40087 -#define IDM_VID_GRAY_RGB 40090 -#define IDM_VID_GRAY_MONO 40091 -#define IDM_VID_GRAY_AMBER 40092 -#define IDM_VID_GRAY_GREEN 40093 -#define IDM_VID_GRAY_WHITE 40094 +#define IDM_UPDATE_ICONS 40030 +#define IDM_VID_RESIZE 40040 +#define IDM_VID_REMEMBER 40041 +#define IDM_VID_DDRAW 40050 +#define IDM_VID_D3D 40051 +#define IDM_VID_VNC 40052 +#define IDM_VID_RDP 40053 +#define IDM_VID_SCALE_1X 40054 +#define IDM_VID_SCALE_2X 40055 +#define IDM_VID_SCALE_3X 40056 +#define IDM_VID_SCALE_4X 40057 +#define IDM_VID_FULLSCREEN 40060 +#define IDM_VID_FS_FULL 40061 +#define IDM_VID_FS_43 40062 +#define IDM_VID_FS_SQ 40063 +#define IDM_VID_FS_INT 40064 +#define IDM_VID_FS_KEEPRATIO 40065 +#define IDM_VID_FORCE43 40066 +#define IDM_VID_OVERSCAN 40067 +#define IDM_VID_INVERT 40069 +#define IDM_VID_CGACON 40070 +#define IDM_VID_GRAYCT_601 40075 +#define IDM_VID_GRAYCT_709 40076 +#define IDM_VID_GRAYCT_AVE 40077 +#define IDM_VID_GRAY_RGB 40080 +#define IDM_VID_GRAY_MONO 40081 +#define IDM_VID_GRAY_AMBER 40082 +#define IDM_VID_GRAY_GREEN 40083 +#define IDM_VID_GRAY_WHITE 40084 #define IDM_LOG_BREAKPOINT 51201 #define IDM_DUMP_VRAM 51202 // should be an Action