roms[2] = 53;
roms[3] = 56;
roms[4] = -1;
- //roms[0] = 56;
+ roms[0] = 53;
rombankswitcher = 0;
rombank = 0;
#include "keyboard.h"
#include "uae.h"
#include "amax.h"
+#include "ersatz.h"
//#define CIAA_DEBUG_R
//#define CIAA_DEBUG_W
static int kbstate, kback, ciaasdr_unread;
static unsigned int sleepyhead;
-#ifdef TOD_HACK
-static int tod_hack, tod_hack_delay;
-#endif
-
static uae_u8 serbits;
static int warned = 10;
}
}
+
+#ifdef TOD_HACK
+static uae_u64 tod_hack_tv, tod_hack_tod, tod_hack_tod_last;
+static void tod_hack_reset (void)
+{
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ tod_hack_tv = (uae_u64)tv.tv_sec * 1000000 + tv.tv_usec;
+ tod_hack_tod = ciaatod;
+ tod_hack_tod_last = tod_hack_tod;
+}
+#endif
+
+static void do_tod_hack (int dotod)
+{
+ struct timeval tv;
+ static int oldrate;
+ uae_u64 t, rate;
+ int docount = 0;
+
+ if (currprefs.cs_ciaatod == 0)
+ rate = vblank_hz;
+ else if (currprefs.cs_ciaatod == 1)
+ rate = 50;
+ else
+ rate = 60;
+ if (rate != oldrate || ciaatod != tod_hack_tod_last) {
+ tod_hack_reset ();
+ oldrate = rate;
+ docount = 1;
+ write_log ("TOD HACK reset %d\n", rate);
+ }
+ if (!dotod && currprefs.cs_ciaatod == 0)
+ return;
+ gettimeofday (&tv, NULL);
+ t = (uae_u64)tv.tv_sec * 1000000 + tv.tv_usec;
+ if (t - tod_hack_tv >= 1000000 / rate) {
+ tod_hack_tv += 1000000 / rate;
+ docount = 1;
+ }
+ if (docount) {
+ ciaatod++;
+ ciaatod &= 0x00ffffff;
+ tod_hack_tod_last = ciaatod;
+ ciaa_checkalarm (0);
+ }
+}
+
static int resetwarning_phase, resetwarning_timer;
static void setcode (uae_u8 keycode)
}
}
-void CIA_hsync_handler (void)
+void CIA_hsync_handler (int dotod)
{
- if (ciabtodon) {
+ if (ciabtodon && dotod) {
ciabtod++;
ciabtod &= 0xFFFFFF;
ciab_checkalarm (1);
}
+ if (currprefs.tod_hack && ciaatodon)
+ do_tod_hack (dotod);
+
if (resetwarning_phase) {
resetwarning_check ();
while (keys_available ())
if (ciaasdr_unread == 3)
ciaaicr |= 8;
if (ciaasdr_unread < 3)
- ciaasdr_unread = 0; /* give up on this key event after unread for a long time */
+ ciaasdr_unread = 0; /* give up on this key event after unread for a long time */
}
}
}
-#ifdef TOD_HACK
-static void tod_hack_reset (void)
-{
- struct timeval tv;
- uae_u32 rate = currprefs.ntscmode ? 60 : 50;
- gettimeofday (&tv, NULL);
- tod_hack = (uae_u32)(((uae_u64)tv.tv_sec) * rate + tv.tv_usec / (1000000 / rate));
- tod_hack -= ciaatod;
- tod_hack_delay = 10 * 50;
-}
-#endif
-
static int led_times;
static unsigned long led_on, led_cycle;
led_cycle = get_cycles ();
}
-void CIA_vsync_handler (void)
+void CIA_vsync_handler (int dotod)
{
led_vsync ();
#ifdef TOD_HACK
- if (currprefs.tod_hack && ciaatodon) {
- struct timeval tv;
- uae_u32 t, nt, rate = currprefs.ntscmode ? 60 : 50;
-
- if (tod_hack_delay > 0) {
- tod_hack_delay--;
- if (tod_hack_delay == 0) {
- tod_hack_reset ();
- tod_hack_delay = 0;
- write_log ("TOD_HACK re-initialized CIATOD=%06X\n", ciaatod);
- }
- }
- if (tod_hack_delay == 0) {
- gettimeofday (&tv, NULL);
- t = (uae_u32)(((uae_u64)tv.tv_sec) * rate + tv.tv_usec / (1000000 / rate));
- nt = t - tod_hack;
- if ((nt < ciaatod && ciaatod - nt < 10) || nt == ciaatod)
- return; /* try not to count backwards */
- ciaatod = nt;
- ciaatod &= 0xffffff;
- ciaa_checkalarm (0);
- return;
- }
- }
+ if (currprefs.tod_hack)
+ return;
#endif
- if (ciaatodon) {
+ if (ciaatodon && dotod) {
ciaatod++;
ciaatod &= 0xFFFFFF;
ciaa_checkalarm (1);
ciaatod = (ciaatod & ~0xff) | val;
ciaatodon = 1;
ciaa_checkalarm (0);
-#ifdef TOD_HACK
- if (currprefs.tod_hack)
- tod_hack_reset ();
-#endif
}
break;
case 9:
void CIA_reset (void)
{
#ifdef TOD_HACK
- tod_hack = 0;
+ tod_hack_tv = 0;
+ tod_hack_tod = 0;
if (currprefs.tod_hack)
tod_hack_reset ();
#endif
hzc = 1;
if (beamcon0 & 0x80)
hack_vpos = -1;
+ if (beamcon0 != new_beamcon0)
+ write_log ("BEAMCON0 %04x -> %04x\n", beamcon0, new_beamcon0);
beamcon0 = new_beamcon0;
- isntsc = beamcon0 & 0x20 ? 0 : 1;
+ isntsc = (beamcon0 & 0x20) ? 0 : 1;
+ if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
+ isntsc = currprefs.ntscmode ? 1 : 0;
if (hack_vpos > 0) {
if (maxvpos == hack_vpos)
return;
if (v != new_beamcon0) {
new_beamcon0 = v;
if (v & ~0x20)
- write_log ("warning: %04X written to BEAMCON0\n", v);
+ write_log ("warning: %04X written to BEAMCON0 PC=%08X\n", v, M68K_GETPC);
}
}
}
}
}
-static void CIA_vsync_prehandler (void)
+static void CIA_vsync_prehandler (int dotod)
{
- CIA_vsync_handler ();
+ CIA_vsync_handler (dotod);
#if 0
if (input_recording > 0) {
inprec_rstart(INPREC_CIAVSYNC);
eventtab[ev_hsync].evtime += get_cycles () - eventtab[ev_hsync].oldcycles;
eventtab[ev_hsync].oldcycles = get_cycles ();
- CIA_hsync_handler ();
+ CIA_hsync_handler (!(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock));
if (currprefs.cs_ciaatod > 0) {
static int cia_hsync;
cia_hsync -= 256;
if (cia_hsync <= 0) {
- CIA_vsync_prehandler ();
+ CIA_vsync_prehandler (1);
cia_hsync += ((MAXVPOS_PAL * MAXHPOS_PAL * 50 * 256) / (maxhpos * (currprefs.cs_ciaatod == 2 ? 60 : 50)));
}
}
#endif
vsync_counter++;
if (currprefs.cs_ciaatod == 0)
- CIA_vsync_prehandler ();
+ CIA_vsync_prehandler (!(bplcon0 & 2) || ((bplcon0 & 2) && currprefs.genlock));
}
DISK_hsync (maxhpos);
#define hf_log write_log
#undef hf_log2
#define hf_log2 write_log
+#undef hf_log3
+#define hf_log3 write_log
#undef scsi_log
#define scsi_log write_log
#endif
offset *= hfd->blocksize;
len = rl (cmdbuf + 7 - 2) & 0xffff;
len *= hfd->blocksize;
- if (checkbounds(hfd, offset, len))
+ if (checkbounds (hfd, offset, len))
scsi_len = (uae_u32)cmd_readx (hfd, scsi_data, offset, len);
break;
case 0x2a: /* WRITE (10) */
offset *= hfd->blocksize;
len = rl (cmdbuf + 7 - 2) & 0xffff;
len *= hfd->blocksize;
- if (checkbounds(hfd, offset, len))
+ if (checkbounds (hfd, offset, len))
scsi_len = (uae_u32)cmd_writex (hfd, scsi_data, offset, len);
break;
+#if 0
+ case 0x2f: /* VERIFY */
+ {
+ int bytchk = cmdbuf[1] & 2;
+ if (nodisk (hfd))
+ goto nodisk;
+ offset = rl (cmdbuf + 2);
+ offset *= hfd->blocksize;
+ len = rl (cmdbuf + 7 - 2) & 0xffff;
+ len *= hfd->blocksize;
+ if (checkbounds (hfd, offset, len)) {
+ uae_u8 *vb = xmalloc (hfd->blocksize);
+ while (len > 0) {
+ int len = cmd_readx (hfd, vb, offset, hfd->blocksize);
+ if (bytchk) {
+ if (memcmp (vb, scsi_data, hfd->blocksize))
+ goto miscompare;
+ scsi_data += hfd->blocksize;
+ }
+ offset += hfd->blocksize;
+ }
+ xfree (vb);
+ }
+ }
+ break;
+#endif
case 0x35: /* SYNCRONIZE CACHE (10) */
if (nodisk (hfd))
goto nodisk;
s[12] = 0x24; /* ILLEGAL FIELD IN CDB */
ls = 12;
break;
+miscompare:
+ lr = -1;
+ status = 2; /* CHECK CONDITION */
+ s[0] = 0x70;
+ s[2] = 5; /* ILLEGAL REQUEST */
+ s[12] = 0x1d; /* MISCOMPARE DURING VERIFY OPERATION */
+ ls = 12;
+ break;
}
*data_len = scsi_len;
*reply_len = lr;
*/
extern void CIA_reset (void);
-extern void CIA_vsync_handler (void);
-extern void CIA_hsync_handler (void);
+extern void CIA_vsync_handler (int);
+extern void CIA_hsync_handler (int);
extern void CIA_handler (void);
extern void diskindex_handler (void);
#endif
if (p->maprom && !p->address_space_24)
p->maprom = 0x0f000000;
+ if (p->tod_hack && p->cs_ciaatod == 0)
+ p->cs_ciaatod = p->ntscmode ? 2 : 1;
target_fixup_options (p);
}
{ "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL,
0xffffffff, 0, 0, 0, 0, 0, "HRTMon" },
- { "A590/A2091 SCSI boot ROM", 0, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { "A590/A2091 SCSI boot ROM", 6, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x8396cf4e, 0x5E03BC61,0x8C862ABE,0x7BF79723,0xB4EEF4D2,0x1859A0F2 },
ALTROM(53, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xb0b8cf24,0xfcf40175,0x05f4d441,0x814b45d5,0x59c19eab,0x43816b30)
ALTROM(53, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2e77bbff,0x8a098845,0x068f32cf,0xa4d34a27,0x8cd290f6,0x1d35a52c)
- { "A590/A2091 SCSI boot ROM", 0, 0, 6, 6, "A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { "A590/A2091 SCSI boot ROM", 6, 6, 6, 6, "A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x33e00a7a, 0x739BB828,0xE874F064,0x9360F59D,0x26B5ED3F,0xBC99BB66 },
ALTROM(54, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xe536bbb2,0xfd7f8a6d,0xa18c1b02,0xd07eb990,0xc2467a24,0x183ede12)
ALTROM(54, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0xc0871d25,0xe155f18a,0xbb90cf82,0x0589c15e,0x70559d3b,0x6b391af8)
- { "A590/A2091 SCSI boot ROM", 0, 0, 7, 0, "A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { "A590/A2091 SCSI boot ROM", 7, 0, 7, 0, "A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x714a97a2, 0xE50F01BA,0xF2899892,0x85547863,0x72A82C33,0x3C91276E },
ALTROM(55, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xa9ccffed,0x149f5bd5,0x2e2d2990,0x4e3de483,0xb9ad7724,0x48e9278e)
ALTROM(55, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2942747a,0xdbd7648e,0x79c75333,0x7ff3e4f4,0x91de224b,0xf05e6bb6)
- { "A590/A2091 SCSI Guru boot ROM", 0, 0, 6, 14, "A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { "A590/A2091 SCSI Guru boot ROM", 6, 14, 6, 14, "A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x04e52f93, 0x6DA21B6F,0x5E8F8837,0xD64507CD,0x8A4D5CDC,0xAC4F426B },
- { "A4091 SCSI boot ROM", 0, 0, 40, 9, "A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
+ { "A4091 SCSI boot ROM", 40, 9, 40, 9, "A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
0x00000000, 0, 0, 0, 0, 0 },
- { "A4091 SCSI boot ROM", 0, 0, 40, 13, "A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
+ { "A4091 SCSI boot ROM", 40, 13, 40, 13, "A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA },
{ "Arcadia OnePlay 2.11", 0, 0, 0, 0, "ARCADIA\0", 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
osl2 = currprefs.gfx_filter_scanlineratio;
sl4 = currprefs.gfx_filter_scanlines * 16 / 100;
sl42 = currprefs.gfx_filter_scanlinelevel * 16 / 100;
- if (sl4 > 15) sl4 = 15;
- if (sl42 > 15) sl42 = 15;
+ if (sl4 > 15)
+ sl4 = 15;
+ if (sl42 > 15)
+ sl42 = 15;
l1 = currprefs.gfx_filter_scanlineratio & 15;
l2 = currprefs.gfx_filter_scanlineratio >> 4;
return;
}
sld = (uae_u8*)locked.pBits;
- for (y = 0; y < window_h; y++)
- memset (sld + y * locked.Pitch, 0, window_w * 2);
- for (y = 1; y < window_h; y += l1 + l2) {
- for (yy = 0; yy < l2 && y + yy < window_h; yy++) {
- for (x = 0; x < window_w; x++) {
+ for (y = 0; y < required_sl_texture_h; y++)
+ memset (sld + y * locked.Pitch, 0, required_sl_texture_w * 2);
+ for (y = 1; y < required_sl_texture_h; y += l1 + l2) {
+ for (yy = 0; yy < l2 && y + yy < required_sl_texture_h; yy++) {
+ for (x = 0; x < required_sl_texture_w; x++) {
/* 16-bit, A4R4G4B4 */
uae_u8 sll = sl42;
p = &sld[(y + yy) * locked.Pitch + (x * 2)];
static int reloadcursor, cursorvisible, cursordeactivate;
static uaecptr boardinfo;
static int interrupt_enabled;
+int p96vblank;
static uaecptr uaegfx_resname,
uaegfx_resid,
void init_hz_p96 (void)
{
- int rate;
-
p96syncrate = maxvpos * vblank_hz;
if (currprefs.win32_rtgvblankrate < 0)
- rate = DirectDraw_CurrentRefreshRate ();
+ p96vblank = DirectDraw_CurrentRefreshRate ();
else if (currprefs.win32_rtgvblankrate == 0)
- rate = abs (currprefs.gfx_refreshrate);
+ p96vblank = vblank_hz;
else
- rate = currprefs.win32_rtgvblankrate;
- if (rate <= 0)
- rate = 60;
- p96syncrate /= rate;
+ p96vblank = currprefs.win32_rtgvblankrate;
+ if (p96vblank <= 0)
+ p96vblank = 60;
+ p96syncrate /= p96vblank;
}
/* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */
#define WINUAEPUBLICBETA 1
-#define WINUAEBETA "6"
-#define WINUAEDATE MAKEBD(2008, 10, 26)
+#define WINUAEBETA "7"
+#define WINUAEDATE MAKEBD(2008, 11, 2)
#define WINUAEEXTRA ""
#define WINUAEREV ""
c |= currprefs.gfx_filter_saturation != changed_prefs.gfx_filter_saturation ? (1|8) : 0;
c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1|8) : 0;
//c |= currprefs.gfx_filter_ != changed_prefs.gfx_filter_ ? (1|8) : 0;
-
+
c |= currprefs.gfx_resolution != changed_prefs.gfx_resolution ? (2 | 8) : 0;
c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl ? (2 | 8) : 0;
c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? (2 | 8) : 0;
tt = dfx[led - 1];
tt[0] = 0;
if (strlen (p + j) > 0)
- sprintf (tt, "%s (CRC=%08X)", p + j, gui_data.crc32[led - 1]);
+ sprintf (tt, "%s [CRC=%08X]", p + j, gui_data.crc32[led - 1]);
} else if (led == 0) {
pos = 3;
ptr = strcpy (drive_text + pos * 16, "Power");
pos = 5;
ptr = strcpy (drive_text + pos * 16, "CD");
} else if (led == 7) {
+ extern int p96vblank;
pos = 2;
ptr = drive_text + pos * 16;
- sprintf (ptr, "FPS: %.1f", (double)(gui_data.fps / 10.0));
+ if (picasso_on)
+ sprintf (ptr, "%d [%.1f]", p96vblank, (double)(gui_data.fps / 10.0));
+ else
+ sprintf (ptr, "FPS: %.1f", (double)(gui_data.fps / 10.0));
if (pause_emulation)
strcpy (ptr, "PAUSED");
} else if (led == 8) {
+Beta 7:
+
+- fixed D3D scanline missing right edge
+- OCS NTSC chipset always used PAL rates
+- windowed RTG mode FPS counter shows both RTG and chipset refresh
+ rates "<RTG> [<chipset]"
+- CIA TOD didn't stop when genlock mode was enabled without genlock
+ (caused KS to detect wrong timing mode, result was most OS time
+ functions, including CLI wait-command, counted incorrectly if
+ configured chipset refresh rate was different than current refresh
+ rate. Bug since the beginning of time but genlock option made this
+ worse because old "genlock always connected" feature hide this bug..
+ (CIA-A TOD configured to PS tick didn't have this problem)
+- Syncronize clock improved. Automatically enables PS supply tick mode
+ (CIA-A TOD = sysclock only if it uses PS supply tick) and also counts
+ "lost" ticks when emulation is stopped (for example GUI is open)
+ This is still a hack but at least it seems to work now :)
+
Beta 6:
- Picasso96 vblank rewritten again, now uses build-in Picasso96 vblank
#include "filesys.h"
#include "blkdev.h"
-static int outcmd[] = { 0x0a, 0x2a, 0xaa, -1 };
+static int outcmd[] = { 0x0a, 0x2a, 0x2f, 0xaa, -1 };
static int incmd[] = { 0x03, 0x08, 0x12, 0x1a, 0x25, 0x28, 0x37, 0x42, 0x43, 0xa8, -1 };
static int nonecmd[] = { 0x00, 0x35, -1 };