From ecd4c8934df3e8ea5c2639754c4e00407d21e245 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 5 Oct 2016 15:41:51 +0200 Subject: [PATCH] Uncompressed sectors from an IMD image now get their actual image buffer passed rather than the temporary buffer, fixes writing to IMD images; SVGA memory address is now latched with the mask divided by 2 in text mode, fixes OS/2 1.1 crashing the emulator. --- src/Makefile.mingw | 1 + src/disc_imd.c | 18 ++++++++++++++++-- src/vid_svga.c | 9 +++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/Makefile.mingw b/src/Makefile.mingw index d6a237e0f..55b0910e2 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -31,6 +31,7 @@ LIBS = -mwindows -lwinmm -lopenal.dll -lopenal -lddraw -ldinput8 -ldxguid -ld3d9 86Box.exe: $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ) $(CC) $(OBJ) $(DBOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box.exe" $(LIBS) + strip "86Box.exe" all : 86Box.exe diff --git a/src/disc_imd.c b/src/disc_imd.c index 966401309..53bb33d3e 100644 --- a/src/disc_imd.c +++ b/src/disc_imd.c @@ -580,9 +580,16 @@ void imd_seek(int drive, int track) id[2] = real_sector; id[3] = (n == 0xFF) ? n_map[actual_sector] : n; ssize = 128 << ((uint32_t) id[3]); - data = imd[drive].track_buffer[side] + track_buf_pos[side]; type = imd[drive].buffer[imd[drive].tracks[track][side].sector_data_offs[actual_sector]]; type = (type >> 1) & 7; + if (type & 1) + { + data = &(imd[drive].buffer[imd[drive].tracks[track][side].sector_data_offs[actual_sector] + 1]); + } + else + { + data = imd[drive].track_buffer[side] + track_buf_pos[side]; + } deleted = bad_crc = 0; if ((type == 2) || (type == 4)) deleted = 1; if ((type == 3) || (type == 4)) bad_crc = 1; @@ -607,12 +614,19 @@ void imd_seek(int drive, int track) ssize = 128 << ((uint32_t) id[3]); ordered_pos = imd[drive].xdf_ordered_pos[id[2]][side]; - data = imd[drive].track_buffer[side] + track_buf_pos[side]; type = imd[drive].buffer[imd[drive].tracks[track][side].sector_data_offs[ordered_pos]]; type = (type >> 1) & 7; deleted = bad_crc = 0; if ((type == 2) || (type == 4)) deleted = 1; if ((type == 3) || (type == 4)) bad_crc = 1; + if (type & 1) + { + data = &(imd[drive].buffer[imd[drive].tracks[track][side].sector_data_offs[ordered_pos] + 1]); + } + else + { + data = imd[drive].track_buffer[side] + track_buf_pos[side]; + } imd_sector_to_buffer(drive, track, side, data, ordered_pos, ssize); if (is_trackx) diff --git a/src/vid_svga.c b/src/vid_svga.c index 9a41776be..4c69bd9e0 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -587,13 +587,18 @@ void svga_recalctimings(svga_t *svga) extern int cyc_total; uint32_t svga_mask_addr(uint32_t addr, svga_t *svga) { + uint32_t limit_shift = 0; + if (!(svga->gdcreg[6] & 1)) + { + limit_shift = 1; + } if (svga->vrammask == (svga->vram_limit - 1)) { - return addr % svga->vram_limit; + return addr % (svga->vram_limit >> limit_shift); } else { - return addr & svga->vrammask; + return addr & (svga->vrammask >> limit_shift); } }