PUAE 2.4.2 beta6

This commit is contained in:
Mustafa Tufan 2012-07-12 13:37:13 +03:00
parent cba8d2107e
commit c05db15a68
22 changed files with 776 additions and 578 deletions

3
README
View File

@ -47,6 +47,9 @@ Compiling PUAE
---------------------------------------------------
See the docs/compiling.txt
i use xcode 4.3.3, sdl 1.2.15, macosx 10.7.4
(build_macos_cocoa)
Bug Reports
---------------------------------------------------

View File

@ -223,7 +223,7 @@ static uae_u32 REGPARAM2 uae_puts (TrapContext *context)
void rtarea_init_mem (void)
{
rtarea = mapped_malloc (0x10000, _T("rtarea"));
rtarea = mapped_malloc (RTAREA_SIZE, _T("rtarea"));
if (!rtarea) {
write_log (_T("virtual memory exhausted (rtarea)!\n"));
abort ();
@ -242,7 +242,7 @@ void rtarea_init (void)
init_traps ();
rtarea_init_mem ();
memset (rtarea, 0, 0x10000);
memset (rtarea, 0, RTAREA_SIZE);
_stprintf (uaever, _T("uae-%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
@ -273,11 +273,18 @@ void rtarea_init (void)
#ifdef FILESYS
filesys_install_code ();
#endif
uae_boot_rom_size = here () - rtarea_base;
if (uae_boot_rom_size >= RTAREA_TRAPS) {
write_log (_T("RTAREA_TRAPS needs to be increased!"));
abort ();
}
#ifdef PICASSO96
uaegfx_install_code ();
uaegfx_install_code (rtarea_base + RTAREA_RTG);
#endif
uae_boot_rom_size = here() - rtarea_base;
org (RTAREA_TRAPS);
init_extended_traps ();
}

View File

@ -2867,6 +2867,8 @@ void compute_framesync (void)
if (cr->locked == false) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
if (cr->commands[0])
write_log (_T("CMD1: '%s'\n"), cr->commands);
break;
} else {
v = cr->rate;
@ -2877,6 +2879,8 @@ void compute_framesync (void)
if (v > 0) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
if (cr->commands[0])
write_log (_T("CMD2: '%s'\n"), cr->commands);
}
} else {
if (cr->locked == false)
@ -2885,6 +2889,8 @@ void compute_framesync (void)
v = cr->rate;
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
if (cr->commands[0])
write_log (_T("CMD3: '%s'\n"), cr->commands);
}
found = true;
break;
@ -2966,7 +2972,7 @@ void compute_framesync (void)
compute_vsynctime ();
write_log (_T("%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d (%s)\n"),
write_log (_T("%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d (%s) D=%d RTG=%d\n"),
isntsc ? _T("NTSC") : _T("PAL"),
islace ? _T(" lace") : _T(""),
doublescan > 0 ? _T(" dblscan") : _T(""),
@ -2974,7 +2980,8 @@ void compute_framesync (void)
(double)(currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle () ? 0.5 : 0)),
maxhpos, maxvpos, lof_store ? 1 : 0,
cr ? cr->index : -1,
cr != NULL && cr->label != NULL ? cr->label : _T("<?>")
cr != NULL && cr->label != NULL ? cr->label : _T("<?>"),
currprefs.gfx_apmode[picasso_on ? 1 : 0].gfx_display, picasso_on
);
config_changed = 1;
@ -4500,12 +4507,14 @@ static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
static void dump_copper (TCHAR *error, int until_hpos)
{
write_log (_T("%s: vpos=%d until_hpos=%d\n"),
error, vpos, until_hpos);
write_log (_T("\n"));
write_log (_T("%s: vpos=%d until_hpos=%d vp=%d\n"),
error, vpos, until_hpos, vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80));
write_log (_T("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04X ci2=%04X\n"),
cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2);
write_log (_T("cstate=%d ip=%x SPCFLAGS=%x\n"),
cop_state.state, cop_state.ip, regs.spcflags);
write_log (_T("cstate=%d ip=%x SPCFLAGS=%x iscline=%d\n"),
cop_state.state, cop_state.ip, regs.spcflags, copper_enabled_thisline);
write_log (_T("\n"));
}
// "emulate" chip internal delays, not the right place but fast and 99.9% programs
@ -5430,10 +5439,11 @@ static bool framewait (void)
frame_time_t now;
flipdelay = 0;
curr_time = vsync_busywait_end (&flipdelay);
if (!frame_rendered && !picasso_on)
frame_rendered = render_screen (false);
curr_time = vsync_busywait_end (&flipdelay);
status = vsync_busywait_do (&freetime, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
status = vsync_busywait_do (&freetime, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
vsync_busywait_start ();
now = uae_gethrtime ();
@ -6932,7 +6942,7 @@ static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int n
case 0x020: DSKPTH (value); break;
case 0x022: DSKPTL (value); break;
case 0x024: DSKLEN (value, hpos); break;
case 0x026: DSKDAT (value); break;
case 0x026: /* DSKDAT (value). Writing to DMA write registers won't do anything */; break;
case 0x02A: VPOSW (value); break;
case 0x02C: VHPOSW (value); break;

View File

@ -1167,6 +1167,9 @@ static void rand_shifter (void)
static void set_steplimit (drive *drv)
{
// emulate step limit only if cycle-exact or approximate CPU speed
if (currprefs.m68k_speed != 0)
return;
drv->steplimit = 10;
drv->steplimitcycle = get_cycles ();
}
@ -1924,7 +1927,11 @@ static int drive_write_pcdos (drive *drv)
secbuf[3] = 0xfb;
while (secwritten < drvsec) {
int mfmcount;
mfmcount = 0;
while (getmfmword (mbuf, shift) != 0x4489) {
mfmcount++;
if (mbuf >= mend)
return 1;
shift++;
@ -1932,12 +1939,20 @@ static int drive_write_pcdos (drive *drv)
shift = 0;
mbuf++;
}
if (sector >= 0 && mfmcount / 16 >= 43)
sector = -1;
}
mfmcount = 0;
while (getmfmword (mbuf, shift) == 0x4489) {
mfmcount++;
if (mbuf >= mend)
return 1;
mbuf++;
}
if (mfmcount < 3) // ignore if less than 3 sync markers
continue;
mark = mfmdecode(&mbuf, shift);
if (mark == 0xfe) {
uae_u8 tmp[8];
@ -1951,6 +1966,11 @@ static int drive_write_pcdos (drive *drv)
tmp[0] = 0xa1; tmp[1] = 0xa1; tmp[2] = 0xa1; tmp[3] = mark;
tmp[4] = cyl; tmp[5] = head; tmp[6] = sector; tmp[7] = size;
// skip 28 bytes
for (i = 0; i < 28; i++)
mfmdecode (&mbuf, shift);
if (get_crc16 (tmp, 8) != crc || cyl != drv->cyl || head != side || size != 2 || sector < 1 || sector > drv->num_secs) {
write_log (_T("PCDOS: track %d, corrupted sector header\n"), drv->cyl * 2 + side);
return 1;
@ -1958,7 +1978,7 @@ static int drive_write_pcdos (drive *drv)
sector--;
continue;
}
if (mark != 0xfb) {
if (mark != 0xfb && mark != 0xfa) {
write_log (_T("PCDOS: track %d: unknown address mark %02X\n"), drv->cyl * 2 + side, mark);
continue;
}

View File

@ -34,7 +34,7 @@ static int drive_write_adf_amigados (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *write
do {
while (*mbuf++ != 0x4489) {
if (mbuf >= mend) {
write_log ("* track %d, unexpected end of data\n", track);
write_log (_T("* track %d, unexpected end of data\n"), track);
return 1;
}
}
@ -47,7 +47,7 @@ static int drive_write_adf_amigados (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *write
trackoffs = (id & 0xff00) >> 8;
if (trackoffs > 10) {
write_log ("* track %d, corrupt sector number %d\n", track, trackoffs);
write_log (_T("* track %d, corrupt sector number %d\n"), track, trackoffs);
goto next;
}
/* this sector is already ok? */
@ -62,7 +62,7 @@ static int drive_write_adf_amigados (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *write
dlong = (odd << 1) | even;
if (dlong) {
write_log ("* track %d, sector %d header crc error\n", track, trackoffs);
write_log (_T("* track %d, sector %d header crc error\n"), track, trackoffs);
goto next;
}
chksum ^= odd ^ even;
@ -90,7 +90,7 @@ static int drive_write_adf_amigados (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *write
}
mbuf += 256;
if (chksum) {
write_log ("* track %d, sector %d data crc error\n", track, trackoffs);
write_log (_T("* track %d, sector %d data crc error\n"), track, trackoffs);
goto next;
}
memcpy (writebuffer + trackoffs * 512, secbuf + 32, 512);
@ -156,7 +156,7 @@ static uae_u8 mfmdecode (uae_u16 **mfmp, int shift)
return out;
}
static int drive_write_adf_pc (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize)
static int drive_write_adf_pc (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsecs)
{
int sectors, shift, sector, i;
uae_u8 mark;
@ -171,17 +171,16 @@ static int drive_write_adf_pc (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer
sector = -1;
shift = 0;
mend -= (4 + 16 + 8 + 512);
mfmcount = 0;
for (;;) {
*outsecs = sectors;
*outsize = sectors * 512;
mfmcount = 0;
while (getmfmword (mbuf, shift) != 0x4489) {
mfmcount++;
if (mbuf >= mend) {
if (sectors >= 7) {
*outsize = sectors * 512;
if (sectors >= 1)
return 0;
}
write_log ("* track %d, unexpected end of data\n", track);
write_log (_T("* track %d, unexpected end of data\n"), track);
return 1;
}
shift++;
@ -189,20 +188,21 @@ static int drive_write_adf_pc (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer
shift = 0;
mbuf++;
}
if (sector >= 0 && mfmcount / 16 >= 43)
sector = -1;
}
mfmcount++;
mfmcount = 0;
while (getmfmword (mbuf, shift) == 0x4489) {
mfmcount++;
if (mbuf >= mend) {
if (sectors >= 7) {
*outsize = sectors * 512;
if (sectors >= 1)
return 0;
}
return 1;
}
mbuf++;
}
mfmcount = 0;
if (mfmcount < 3) // ignore if less than 3 sync markers
continue;
mark = mfmdecode (&mbuf, shift);
if (mark == 0xfe) {
uae_u8 tmp[8];
@ -216,41 +216,48 @@ static int drive_write_adf_pc (uae_u16 *mbuf, uae_u16 *mend, uae_u8 *writebuffer
tmp[0] = 0xa1; tmp[1] = 0xa1; tmp[2] = 0xa1; tmp[3] = mark;
tmp[4] = cyl; tmp[5] = head; tmp[6] = sector; tmp[7] = size;
// skip 28 bytes
for (i = 0; i < 28; i++)
mfmdecode (&mbuf, shift);
if (get_crc16 (tmp, 8) != crc || cyl != track / 2 || head != (track & 1) || size != 2 || sector < 1 || sector > 20) {
write_log ("PCDOS: track %d, corrupted sector header\n", track);
write_log (_T("PCDOS: track %d, corrupted sector header\n"), track);
continue;
}
sector--;
continue;
}
if (mark != 0xfb) {
write_log ("PCDOS: track %d: unknown address mark %02X\n", track, mark);
if (mark != 0xfb && mark != 0xfa) {
write_log (_T("PCDOS: track %d: unknown address mark %02X\n"), track, mark);
continue;
}
if (sector < 0)
if (sector < 0) {
write_log (_T("PCDOS: track %d: data mark without header\n"), track);
continue;
}
for (i = 0; i < 512; i++)
secbuf[i + 4] = mfmdecode (&mbuf, shift);
sectors++;
memcpy (writebuffer + sector * 512, secbuf + 4, 512);
sector = 0;
crc = (mfmdecode (&mbuf, shift) << 8) | mfmdecode (&mbuf, shift);
if (get_crc16 (secbuf, 3 + 1 + 512) != crc) {
write_log ("PCDOS: track %d, sector %d data checksum error\n",
write_log (_T("PCDOS: track %d, sector %d data checksum error\n"),
track, sector + 1);
continue;
}
memcpy (writebuffer + sector * 512, secbuf + 4, 512);
sectors++;
sector = -1;
}
}
int ispctrack(uae_u16 *amigamfmbuffer, uae_u8 *mfmdata, int len, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize)
{
int i;
int i, outsecs;
for (i = 0; i < len / 2; i++)
amigamfmbuffer[i] = mfmdata[i * 2 + 1] | (mfmdata[i * 2 + 0] << 8);
i = drive_write_adf_pc (amigamfmbuffer, amigamfmbuffer + len / 2, writebuffer, writebuffer_ok, track, outsize);
i = drive_write_adf_pc (amigamfmbuffer, amigamfmbuffer + len / 2, writebuffer, writebuffer_ok, track, &outsecs);
*outsize = outsecs * 512;
if (*outsize < 9 * 512)
*outsize = 9 * 512;
return i ? -1 : 0;

View File

@ -324,7 +324,7 @@ void notice_screen_contents_lost (void)
bool isnativevidbuf (void)
{
return true;
return true;
}
extern int plffirstline_total, plflastline_total;
@ -2415,11 +2415,13 @@ static void init_drawing_frame (void)
if (frame_res_cnt == 0) {
int m = frame_res * 2 + frame_res_lace;
struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_size_fs : &changed_prefs.gfx_size_win;
while (m < 6) {
while (m < 3 * 2) {
struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m];
if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gfx_filter > 0)) {
int nr = m >> 1;
int nl = (m & 1) == 0 ? 0 : 1;
int nr_o = nr;
int nl_o = nl;
if (currprefs.gfx_autoresolution_minh < 0) {
if (nr < nl)
@ -2442,7 +2444,9 @@ static void init_drawing_frame (void)
if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) {
changed_prefs.gfx_resolution = nr;
changed_prefs.gfx_vresolution = nl;
write_log (_T("RES -> %d LINE -> %d\n"), nr, nl);
write_log (_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o,
currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv,
gfxvidinfo.gfx_resolution_reserved, gfxvidinfo.gfx_vresolution_reserved);
config_changed = 1;
//activate_debugger ();
}
@ -3054,7 +3058,6 @@ void drawing_init (void)
uae_sem_init (&gui_sem, 0, 1);
#ifdef PICASSO96
if (!isrestore ()) {
InitPicasso96 ();
picasso_on = 0;
picasso_requested_on = 0;
gfx_set_picasso_state (0);

View File

@ -1271,6 +1271,20 @@ int filesys_eject (int nr)
return 1;
}
// This uses filesystem process to reduce resource usage
void setsystime (void)
{
if (!currprefs.tod_hack)
return;
Unit *u;
for (u = units; u; u = u->next) {
if (is_virtual (u->unit)) {
put_byte (u->volume + 173 - 32, 1);
uae_Signal (get_long (u->volume + 176 - 32), 1 << 13);
break;
}
}
}
int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags)
{
@ -3852,6 +3866,7 @@ static uae_u32 exall_helpder(TrapContext *context)
static uae_u32 REGPARAM2 fsmisc_helper (TrapContext *context)
{
int mode = m68k_dreg (regs, 0);
uae_u32 t;
switch (mode)
{
@ -3861,11 +3876,14 @@ static uae_u32 REGPARAM2 fsmisc_helper (TrapContext *context)
return filesys_media_change_reply (context, 0);
case 2:
return filesys_media_change_reply (context, 1);
case 3:
t = getlocaltime ();
uae_u32 secs = (uae_u32)t - (8 * 365 + 2) * 24 * 60 * 60;
return secs;
}
return 0;
}
static void action_examine_object (Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;

File diff suppressed because it is too large Load Diff

View File

@ -201,7 +201,7 @@ static int pcmcia_card;
static int pcmcia_readonly;
static int pcmcia_type;
static uae_u8 pcmcia_configuration[20];
static bool pcmcia_configured;
static int pcmcia_configured;
static int gayle_id_cnt;
static uae_u8 gayle_irq, gayle_int, gayle_cs, gayle_cs_mask, gayle_cfg;
@ -235,14 +235,14 @@ static void ps (int offset, const TCHAR *src, int max)
static void pcmcia_reset (void)
{
memset (pcmcia_configuration, 0, sizeof pcmcia_configuration);
pcmcia_configured = false;
pcmcia_configured = -1;
if (PCMCIA_LOG > 0)
write_log (_T("PCMCIA reset\n"));
}
static uae_u8 checkpcmciaideirq (void)
{
if (!idedrive || pcmcia_type != PCMCIA_IDE || !pcmcia_configured)
if (!idedrive || pcmcia_type != PCMCIA_IDE || pcmcia_configured < 0)
return 0;
if (ideregs[PCMCIA_IDE_ID].ide_devcon & 2)
return 0;
@ -1564,10 +1564,12 @@ static int pcmcia_common_mask;
static uae_u8 *pcmcia_common;
static uae_u8 *pcmcia_attrs;
static int pcmcia_write_min, pcmcia_write_max;
static int pcmcia_oddevenflip;
static uae_u16 pcmcia_idedata;
static int get_pcmcmia_ide_reg (uaecptr addr)
static int get_pcmcmia_ide_reg (uaecptr addr, int width)
{
int reg;
int reg = -1;
addr &= 0x80000 - 1;
if (addr < 0x20000)
@ -1575,10 +1577,17 @@ static int get_pcmcmia_ide_reg (uaecptr addr)
if (addr >= 0x40000)
return -1;
addr -= 0x20000;
reg = addr & 15;
// 8BITODD
if (addr >= 0x10000) {
addr &= ~0x10000;
addr |= 1;
}
ide = idedrive[PCMCIA_IDE_ID * 2];
if (ide->regs->ide_drv)
ide = idedrive[PCMCIA_IDE_ID * 2 + 1];
if (pcmcia_configured == 1) {
// IO mapped linear
reg = addr & 15;
if (reg < 8)
return reg;
if (reg == 8)
@ -1593,6 +1602,18 @@ static int get_pcmcmia_ide_reg (uaecptr addr)
reg = IDE_DRVADDR;
else
reg = -1;
} else if (pcmcia_configured == 2) {
// primary io mapped (PC)
if (addr >= 0x1f0 && addr <= 0x1f7) {
reg = addr - 0x1f0;
} else if (addr == 0x3f6) {
reg = IDE_DEVCON;
} else if (addr == 0x3f7) {
reg = IDE_DRVADDR;
} else {
reg = -1;
}
}
return reg;
}
@ -1615,16 +1636,16 @@ static uae_u32 gayle_attr_read (uaecptr addr)
int offset = (addr - 0x200) / 2;
return pcmcia_configuration[offset];
}
if (pcmcia_configured) {
int reg = get_pcmcmia_ide_reg (addr);
if (pcmcia_configured >= 0) {
int reg = get_pcmcmia_ide_reg (addr, 1);
if (reg >= 0) {
if (reg == 0) {
static uae_u16 data;
if (addr < 0x30000)
data = ide_get_data ();
else
return data & 0xff;
return (data >> 8) & 0xff;
if (addr >= 0x30000) {
return pcmcia_idedata & 0xff;
} else {
pcmcia_idedata = ide_get_data ();
return (pcmcia_idedata >> 8) & 0xff;
}
} else {
return ide_read_reg (reg);
}
@ -1653,23 +1674,26 @@ static void gayle_attr_write (uaecptr addr, uae_u32 v)
if (v & 0x80) {
pcmcia_reset ();
} else {
int index = v & 0x3f;
if (index != 1 && index != 2) {
write_log (_T("WARNING: Only config index 1 and 2 emulated, attempted to select %d!\n"), index);
} else {
pcmcia_configured = index;
write_log (_T("PCMCIA IO configured = %02x\n"), v);
if ((v & 0x3f) != 1)
write_log (_T("WARNING: Only config index 1 is emulated!\n"));
pcmcia_configured = true;
}
}
}
if (pcmcia_configured) {
int reg = get_pcmcmia_ide_reg (addr);
}
if (pcmcia_configured >= 0) {
int reg = get_pcmcmia_ide_reg (addr, 1);
if (reg >= 0) {
if (reg == 0) {
static uae_u16 data;
if (addr >= 0x30000) {
data = (v & 0xff) << 8;
pcmcia_idedata = (v & 0xff) << 8;
} else {
data |= v & 0xff;
ide_put_data (data);
pcmcia_idedata &= 0xff00;
pcmcia_idedata |= v & 0xff;
ide_put_data (pcmcia_idedata);
}
return;
}
@ -2067,11 +2091,12 @@ static uae_u32 REGPARAM2 gayle_attr_wget (uaecptr addr)
special_mem |= S_READ;
#endif
if (pcmcia_type == PCMCIA_IDE && pcmcia_configured) {
int reg = get_pcmcmia_ide_reg (addr);
if (pcmcia_type == PCMCIA_IDE && pcmcia_configured >= 0) {
int reg = get_pcmcmia_ide_reg (addr, 2);
if (reg == IDE_DATA) {
// 16-bit register
return ide_get_data ();
pcmcia_idedata = ide_get_data ();
return pcmcia_idedata;
}
}
@ -2100,11 +2125,12 @@ static void REGPARAM2 gayle_attr_wput (uaecptr addr, uae_u32 value)
special_mem |= S_WRITE;
#endif
if (pcmcia_type == PCMCIA_IDE && pcmcia_configured) {
int reg = get_pcmcmia_ide_reg (addr);
if (pcmcia_type == PCMCIA_IDE && pcmcia_configured >= 0) {
int reg = get_pcmcmia_ide_reg (addr, 2);
if (reg == IDE_DATA) {
// 16-bit register
ide_put_data (value);
pcmcia_idedata = value;
ide_put_data (pcmcia_idedata);
return;
}
}

View File

@ -8,6 +8,9 @@
#define RTAREA_DEFAULT 0xf00000
#define RTAREA_BACKUP 0xef0000
#define RTAREA_SIZE 0x10000
#define RTAREA_TRAPS 0x2000
#define RTAREA_RTG 0x3000
extern uae_u32 addr (int);
extern void db (uae_u8);

View File

@ -62,7 +62,6 @@ STATIC_INLINE int dmaen (unsigned int dmamask)
#define SPCFLAG_COPPER 4
#define SPCFLAG_INT 8
#define SPCFLAG_BRK 16
#define SPCFLAG_EXTRA_CYCLES 32
#define SPCFLAG_TRACE 64
#define SPCFLAG_DOTRACE 128
#define SPCFLAG_DOINT 256 /* arg, JIT fails without this.. */

View File

@ -174,7 +174,7 @@ extern uae_u8 handle_joystick_buttons (uae_u8, uae_u8);
extern int magicmouse_alive (void);
extern int is_tablet (void);
extern int inputdevice_is_tablet (void);
extern void input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset);
extern int input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset);
extern void input_mousehack_mouseoffset (uaecptr pointerprefs);
extern int mousehack_alive (void);
extern void setmouseactive (int);
@ -255,6 +255,7 @@ extern void inputdevice_tablet_strobe (void);
extern int input_getqualifiers (void);
extern void setsystime (void);
#define JSEM_MODE_DEFAULT 0
#define JSEM_MODE_MOUSE 1

View File

@ -397,6 +397,7 @@ extern void m68k_reset (int);
extern int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor);
extern void m68k_do_rte (void);
extern void protect_roms (bool);
extern void mmu_op (uae_u32, uae_u32);
extern void mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr);

View File

@ -429,6 +429,7 @@ struct uae_prefs {
uae_u32 mbresmem_low_size;
uae_u32 mbresmem_high_size;
uae_u32 rtgmem_size;
bool rtg_hardwareinterrupt;
int rtgmem_type;
uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS];
uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS];
@ -506,6 +507,7 @@ struct uae_prefs {
bool win32_norecyclebin;
int win32_guikey;
int win32_kbledmode;
bool win32_blankmonitors;
TCHAR win32_commandpathstart[MAX_DPATH];
TCHAR win32_commandpathend[MAX_DPATH];
TCHAR win32_parjoyport0[MAX_DPATH];

View File

@ -530,7 +530,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
}
}
static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf)
static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, struct uae_input_device *id, struct inputdevice_functions *idf)
{
TCHAR tmp1[MAX_DPATH];
int i;
@ -570,12 +570,12 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
cfgfile_dwrite_str (f, tmp, p->input_config_name[id]);
}
for (i = 0; i < MAX_INPUT_DEVICES; i++)
write_config2 (f, id, i, _T("joystick"), &p->joystick_settings[id][i], &idev[IDTYPE_JOYSTICK]);
write_config (f, id, i, _T("joystick"), &p->joystick_settings[id][i], &idev[IDTYPE_JOYSTICK]);
for (i = 0; i < MAX_INPUT_DEVICES; i++)
write_config2 (f, id, i, _T("mouse"), &p->mouse_settings[id][i], &idev[IDTYPE_MOUSE]);
write_config (f, id, i, _T("mouse"), &p->mouse_settings[id][i], &idev[IDTYPE_MOUSE]);
for (i = 0; i < MAX_INPUT_DEVICES; i++)
write_kbr_config (f, id, i, &p->keyboard_settings[id][i], &idev[IDTYPE_KEYBOARD]);
write_config2 (f, id, 0, _T("internal"), &p->internalevent_settings[id][0], &idev[IDTYPE_INTERNALEVENT]);
write_config (f, id, 0, _T("internal"), &p->internalevent_settings[id][0], &idev[IDTYPE_INTERNALEVENT]);
}
}
@ -1144,45 +1144,43 @@ int inputdevice_is_tablet (void)
return v ? 1 : 0;
}
static int getmhoffset (void)
{
if (!uae_boot_rom)
return 0;
return get_long (rtarea_base + bootrom_header + 7 * 4) + bootrom_header;
}
static uaecptr mousehack_address;
static bool mousehack_enabled;
static void mousehack_reset (void)
{
int off;
dimensioninfo_width = dimensioninfo_height = 0;
mouseoffset_x = mouseoffset_y = 0;
dimensioninfo_dbl = 0;
mousehack_alive_cnt = 0;
vp_xoffset = vp_yoffset = 0;
tablet_data = 0;
off = getmhoffset ();
if (off)
rtarea[off + MH_E] = 0;
if (mousehack_address)
put_byte (mousehack_address + MH_E, 0);
mousehack_address = 0;
mousehack_enabled = false;
}
static void mousehack_enable (void)
static bool mousehack_enable (void)
{
#ifdef FILESYS /* Internal mousehack depends on filesys boot-rom */
int off, mode;
int mode;
if (!uae_boot_rom || currprefs.input_tablet == TABLET_OFF)
return;
off = getmhoffset ();
if (rtarea[off + MH_E])
return;
return false;
if (mousehack_address && mousehack_enabled)
return true;
mode = 0x80;
if (currprefs.input_tablet == TABLET_MOUSEHACK)
mode |= 1;
if (inputdevice_is_tablet () > 0)
mode |= 2;
if (mousehack_address) {
write_log (_T("Mouse driver enabled (%s)\n"), ((mode & 3) == 3 ? _T("tablet+mousehack") : ((mode & 3) == 2) ? _T("tablet") : _T("mousehack")));
rtarea[off + MH_E] = 0x80;
put_byte (mousehack_address + MH_E, mode);
mousehack_enabled = true;
}
return true;
#endif
}
@ -1192,13 +1190,18 @@ void input_mousehack_mouseoffset (uaecptr pointerprefs)
mouseoffset_y = (uae_s16)get_word (pointerprefs + 30);
}
void input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset)
int input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset)
{
if (mode == 0) {
uae_u8 v = rtarea[getmhoffset ()];
if (mode == 4) {
return mousehack_enable () ? 1 : 0;
} else if (mode == 5) {
mousehack_address = m68k_dreg (regs, 0);
mousehack_enable ();
} else if (mode == 0) {
uae_u8 v = get_byte (mousehack_address + MH_E);
v |= 0x40;
rtarea[getmhoffset ()] = v;
write_log (_T("Tablet driver running (%02x)\n"), v);
put_byte (mousehack_address + MH_E, v);
write_log (_T("Tablet driver running (%08x,%02x)\n"), mousehack_address, v);
} else if (mode == 1) {
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
uae_u32 props = 0;
@ -1230,37 +1233,32 @@ void input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecpt
else if (mousehack_alive_cnt > 0)
mousehack_alive_cnt = 100;
}
return 1;
}
void get_custom_mouse_limits (int *w, int *h, int *dx, int *dy, int dbl);
void inputdevice_tablet_strobe (void)
{
uae_u8 *p;
uae_u32 off;
mousehack_enable ();
if (!uae_boot_rom)
return;
if (!tablet_data)
return;
off = getmhoffset ();
p = rtarea + off;
p[MH_CNT]++;
if (mousehack_address)
put_byte (mousehack_address + MH_CNT, get_byte (mousehack_address + MH_CNT) + 1);
}
void inputdevice_tablet (int x, int y, int z, int pressure, uae_u32 buttonbits, int inproximity, int ax, int ay, int az)
{
uae_u8 *p;
uae_u8 tmp[MH_END];
uae_u32 off;
mousehack_enable ();
if (inputdevice_is_tablet () <= 0)
return;
//write_log (_T("%d %d %d %d %08X %d %d %d %d\n"), x, y, z, pressure, buttonbits, inproximity, ax, ay, az);
off = getmhoffset ();
p = rtarea + off;
p = get_real_address (mousehack_address);
memcpy (tmp, p + MH_START, MH_END - MH_START);
#if 0
@ -1339,7 +1337,7 @@ void inputdevice_tablet (int x, int y, int z, int pressure, uae_u32 buttonbits,
if (!memcmp (tmp, p + MH_START, MH_END - MH_START))
return;
rtarea[off + MH_E] = 0xc0 | 2;
p[MH_E] = 0xc0 | 2;
p[MH_CNT]++;
}
@ -1349,7 +1347,7 @@ void inputdevice_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay
if (!uae_boot_rom)
return;
p = rtarea + getmhoffset ();
p = get_real_address (mousehack_address);
tablet_maxx = maxx;
tablet_maxy = maxy;
@ -1380,11 +1378,11 @@ static void inputdevice_mh_abs (int x, int y)
{
uae_u8 *p;
uae_u8 tmp[4];
uae_u32 off;
mousehack_enable ();
off = getmhoffset ();
p = rtarea + off;
if (!mousehack_address)
return;
p = get_real_address (mousehack_address);
memcpy (tmp, p + MH_ABSX, sizeof tmp);
@ -1398,7 +1396,7 @@ static void inputdevice_mh_abs (int x, int y)
if (!memcmp (tmp, p + MH_ABSX, sizeof tmp))
return;
rtarea[off + MH_E] = 0xc0 | 1;
p[MH_E] = 0xc0 | 1;
p[MH_CNT]++;
tablet_data = 1;
}
@ -2204,13 +2202,13 @@ void inputdevice_read (void)
//} while (handle_msgpump ());
}
static int handle_custom_event (TCHAR *custom)
static int handle_custom_event (const TCHAR *custom)
{
TCHAR *p, *buf, *nextp;
if (custom == NULL)
return 0;
//write_log (_T("%s\n"), custom);
write_log (_T("%s\n"), custom);
p = buf = my_strdup (custom);
while (p && *p) {
TCHAR *p2;
@ -2226,6 +2224,7 @@ static int handle_custom_event (TCHAR *custom)
while (*nextp == ' ')
nextp++;
}
//write_log (_T("-> '%s'\n"), p);
cfgfile_parse_line (&changed_prefs, p, 0);
p = nextp;
}
@ -2548,6 +2547,7 @@ void inputdevice_handle_inputcode (void)
{
case AKS_ENTERGUI:
gui_display (-1);
setsystime ();
break;
case AKS_SCREENSHOT_FILE:
screenshot (1, 1);
@ -2562,15 +2562,19 @@ void inputdevice_handle_inputcode (void)
#endif
case AKS_FLOPPY0:
gui_display (0);
setsystime ();
break;
case AKS_FLOPPY1:
gui_display (1);
setsystime ();
break;
case AKS_FLOPPY2:
gui_display (2);
setsystime ();
break;
case AKS_FLOPPY3:
gui_display (3);
setsystime ();
break;
case AKS_EFLOPPY0:
disk_eject (0);
@ -5774,27 +5778,48 @@ void inputdevice_swap_ports (struct uae_prefs *p, int devnum)
}
//memcpy (p->joystick_settings[dst], p->joystick_settings[src], sizeof (struct uae_input_device) * MAX_INPUT_DEVICES);
static void copydev (struct uae_input_device *dst, struct uae_input_device *src)
static void copydev (struct uae_input_device *dst, struct uae_input_device *src, int selectedwidget)
{
for (unsigned int i = 0; i < MAX_INPUT_DEVICES; i++) {
for (unsigned int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) {
for (unsigned int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) {
xfree (dst[i].custom[j][k]);
if (j == selectedwidget || selectedwidget < 0) {
for (unsigned int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) {
xfree (dst[i].custom[j][k]);
}
}
}
xfree (dst[i].configname);
xfree (dst[i].name);
if (selectedwidget < 0) {
xfree (dst[i].configname);
xfree (dst[i].name);
}
}
if (selectedwidget < 0) {
memcpy (dst, src, sizeof (struct uae_input_device) * MAX_INPUT_DEVICES);
} else {
int j = selectedwidget;
for (int i = 0; i < MAX_INPUT_DEVICES; i++) {
for (int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) {
dst[i].eventid[j][k] = src[i].eventid[j][k];
dst[i].custom[j][k] = src[i].custom[j][k];
dst[i].flags[j][k] = src[i].flags[j][k];
dst[i].port[j][k] = src[i].port[j][k];
}
dst[i].extra[j] = src[i].extra[j];
}
}
memcpy (dst, src, sizeof (struct uae_input_device) * MAX_INPUT_DEVICES);
for (unsigned int i = 0; i < MAX_INPUT_DEVICES; i++) {
for (unsigned int j = 0; j < MAX_INPUT_DEVICE_EVENTS; j++) {
for (unsigned int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) {
if (dst[i].custom)
dst[i].custom[j][k] = my_strdup (dst[i].custom[j][k]);
if (j == selectedwidget || selectedwidget < 0) {
for (unsigned int k = 0; k < MAX_INPUT_SUB_EVENT_ALL; k++) {
if (dst[i].custom)
dst[i].custom[j][k] = my_strdup (dst[i].custom[j][k]);
}
}
}
dst[i].configname = my_strdup (dst[i].configname);
dst[i].name = my_strdup (dst[i].name);
if (selectedwidget < 0) {
dst[i].configname = my_strdup (dst[i].configname);
dst[i].name = my_strdup (dst[i].name);
}
}
}
@ -5803,6 +5828,12 @@ static void copydev (struct uae_input_device *dst, struct uae_input_device *src)
// +2 = default (pc keyboard)
void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum, int selectedwidget)
{
if (selectedwidget >= 0) {
if (devnum < 0)
return;
if (gettype (devnum) != IDTYPE_KEYBOARD)
return;
}
if (src >= MAX_INPUT_SETTINGS) {
if (gettype (devnum) == IDTYPE_KEYBOARD) {
p->input_keyboard_type = src > MAX_INPUT_SETTINGS ? 1 : 0;
@ -5814,11 +5845,11 @@ void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int
return;
if (src < MAX_INPUT_SETTINGS) {
if (devnum < 0 || gettype (devnum) == IDTYPE_JOYSTICK)
copydev (p->joystick_settings[dst], p->joystick_settings[src]);
copydev (p->joystick_settings[dst], p->joystick_settings[src], selectedwidget);
if (devnum < 0 || gettype (devnum) == IDTYPE_MOUSE)
copydev (p->mouse_settings[dst], p->mouse_settings[src]);
copydev (p->mouse_settings[dst], p->mouse_settings[src], selectedwidget);
if (devnum < 0 || gettype (devnum) == IDTYPE_KEYBOARD)
copydev (p->keyboard_settings[dst], p->keyboard_settings[src]);
copydev (p->keyboard_settings[dst], p->keyboard_settings[src], selectedwidget);
}
}
@ -6182,6 +6213,7 @@ void warpmode (int mode)
#endif
changed_prefs.turbo_emulation = currprefs.turbo_emulation;
config_changed = 1;
setsystime ();
}
void pausemode (int mode)
@ -6191,6 +6223,7 @@ void pausemode (int mode)
else
pause_emulation = mode;
config_changed = 1;
setsystime ();
}
int jsem_isjoy (int port, const struct uae_prefs *p)

View File

@ -936,6 +936,7 @@ static void a1000_handle_kickstart (int mode)
{
if (!a1000_bootrom)
return;
protect_roms (false);
if (mode == 0) {
a1000_kickstart_mode = 0;
memcpy (kickmemory, kickmemory + 262144, 262144);
@ -1530,6 +1531,7 @@ void a3000_fakekick (int map)
{
static uae_u8 *kickstore;
protect_roms (false);
if (map) {
uae_u8 *fkickmemory = a3000lmemory + allocated_a3000lmem - fkickmem_size;
if (fkickmemory[2] == 0x4e && fkickmemory[3] == 0xf9 && fkickmemory[4] == 0x00) {
@ -1563,6 +1565,7 @@ void a3000_fakekick (int map)
xfree (kickstore);
kickstore = NULL;
}
protect_roms (true);
}
static uae_char *kickstring = "exec.library";
@ -1941,7 +1944,7 @@ err:
#ifndef NATMEM_OFFSET
uae_u8 *mapped_malloc (size_t s, TCHAR *file)
uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
{
return xmalloc (uae_u8, s);
}

View File

@ -1774,3 +1774,20 @@ void doflashscreen (void)
*/
}
// posix
uae_u32 getlocaltime (void)
{
/*
SYSTEMTIME st;
FILETIME ft;
ULARGE_INTEGER t;
GetLocalTime (&st);
SystemTimeToFileTime (&st, &ft);
t.LowPart = ft.dwLowDateTime;
t.HighPart = ft.dwHighDateTime;
t.QuadPart -= 11644473600000 * 10000;
return (uae_u32)(t.QuadPart / 10000000);
*/
}

View File

@ -1096,15 +1096,15 @@ static void build_cpufunctbl (void)
void fill_prefetch (void)
{
#ifdef MMU
if (currprefs.mmu_model)
if (currprefs.cpu_model >= 68020)
return;
#endif
regs.ir = x_get_word (m68k_getpc ());
regs.irc = x_get_word (m68k_getpc () + 2);
}
static void fill_prefetch_quick (void)
{
if (currprefs.cpu_model >= 68020)
return;
regs.ir = get_word (m68k_getpc ());
regs.irc = get_word (m68k_getpc () + 2);
}
@ -3395,7 +3395,7 @@ void doint (void)
}
#define sleep_resolution 1000 / 1
#define IDLETIME (currprefs.cpu_idle * sleep_resolution / 700)
#define IDLETIME (currprefs.cpu_idle * sleep_resolution / 1000)
STATIC_INLINE int do_specialties (int cycles)
{
@ -4395,7 +4395,9 @@ void m68k_go (int may_quit)
currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
}
protect_roms (true);
run_func ();
protect_roms (false);
}
in_m68k_go--;
}
@ -5128,7 +5130,7 @@ uae_u8 *restore_cpu_extra (uae_u8 *src)
currprefs.cpu_frequency = changed_prefs.cpu_frequency = restore_u32 ();
currprefs.cpu_clock_multiplier = changed_prefs.cpu_clock_multiplier = restore_u32 ();
#ifdef JIT
currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0;
//currprefs.cachesize = changed_prefs.cachesize = (flags & 8) ? 8192 : 0;
#endif
currprefs.m68k_speed = changed_prefs.m68k_speed = 0;

View File

@ -616,6 +616,24 @@ STATIC_INLINE key_t find_shmkey (key_t key)
return result;
}
void protect_roms (bool protect)
{
struct shmid_ds *shm;
if (!currprefs.cachesize || currprefs.comptrustbyte || currprefs.comptrustword || currprefs.comptrustlong)
return;
for (int i = 0; i < MAX_SHMID; i++) {
long old;
shm = &shmids[i];
/* if (shm->mode != PAGE_READONLY)
continue;
if (!VirtualProtect (shm->attached, shm->rosize, protect ? PAGE_READONLY : PAGE_READWRITE, &old)) {
write_log (_T("VirtualProtect %08X - %08X %x (%dk) failed %d\n"),
(uae_u8*)shm->attached - natmem_offset, (uae_u8*)shm->attached - natmem_offset + shm->size,
shm->size, shm->size >> 10, errno);
}*/
}
}
int my_shmdt (const void *shmaddr)
{

View File

@ -37,8 +37,6 @@
#include "sysconfig.h"
#include "sysdeps.h"
int p96hack_vpos, p96hack_vpos2, p96refresh_active;
#if defined(PICASSO96)
#define FALSE 0
#define TRUE 1
@ -57,8 +55,11 @@ int p96hack_vpos, p96hack_vpos2, p96refresh_active;
#include "traps.h"
#include "misc.h"
#define NOBLITTER 0
#define NOBLITTER_BLIT 0
int debug_rtg_blitter = 3;
#define NOBLITTER (0 || !(debug_rtg_blitter & 1))
#define NOBLITTER_BLIT (0 || !(debug_rtg_blitter & 2))
#define USE_HARDWARESPRITE 1
#define P96TRACING_ENABLED 0
#define P96SPRTRACING_ENABLED 0
@ -68,6 +69,7 @@ static int picasso96_BT = BT_uaegfx;
static int picasso96_GCT = GCT_Unknown;
static int picasso96_PCT = PCT_Unknown;
int p96refresh_active;
bool have_done_picasso = 1; /* For the JIT compiler */
static int p96syncrate;
int p96hsync_counter, full_refresh;
@ -102,9 +104,9 @@ static struct PicassoResolution *newmodes;
static int picasso_convert, host_mode;
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions()
* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
* data here. */
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */
/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
/* data here. */
static struct ScreenResolution planar = { 320, 240 };
static struct ScreenResolution chunky = { 640, 480 };
static struct ScreenResolution hicolour = { 640, 480 };
@ -616,7 +618,7 @@ static int doskip (void)
void picasso_trigger_vblank (void)
{
if (!ABI_interrupt || !uaegfx_base || !interrupt_enabled || currprefs.win32_rtgvblankrate < -1)
if (!ABI_interrupt || !uaegfx_base || !interrupt_enabled || !currprefs.rtg_hardwareinterrupt)
return;
put_long (uaegfx_base + CARD_IRQPTR, ABI_interrupt + PSSO_BoardInfo_SoftInterrupt);
put_byte (uaegfx_base + CARD_IRQFLAG, 1);
@ -1778,8 +1780,6 @@ static void picasso96_alloc2 (TrapContext *ctx)
{
int i, j, size, cnt;
int misscnt, depths;
struct MultiDisplay *md = getdisplay (&currprefs);
struct PicassoResolution *DisplayModes = md->DisplayModes;
xfree (newmodes);
newmodes = NULL;
@ -1918,7 +1918,7 @@ void picasso96_alloc (TrapContext *ctx)
picasso96_alloc2 (ctx);
}
static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI);
static void inituaegfxfuncs (uaecptr start, uaecptr ABI);
static void inituaegfx (uaecptr ABI)
{
uae_u32 flags;
@ -1968,15 +1968,15 @@ static void inituaegfx (uaecptr ABI)
hwsprite = 0;
write_log (_T("P96: Hardware sprite support disabled\n"));
}
if (currprefs.win32_rtgvblankrate >= -1 && !uaegfx_old)
if (currprefs.rtg_hardwareinterrupt && !uaegfx_old)
flags |= BIF_VBLANKINTERRUPT;
if (!(flags & BIF_INDISPLAYCHAIN)) {
write_log (_T("P96: BIF_INDISPLAYCHAIN force-enabled!\n"));
flags |= BIF_INDISPLAYCHAIN;
}
put_long (ABI + PSSO_BoardInfo_Flags, flags);
// if (debug_rtg_blitter != 3)
// write_log (_T("P96: Blitter mode = %x!\n"), debug_rtg_blitter);
if (debug_rtg_blitter != 3)
write_log (_T("P96: Blitter mode = %x!\n"), debug_rtg_blitter);
put_word (ABI + PSSO_BoardInfo_MaxHorResolution + 0, planar.width);
put_word (ABI + PSSO_BoardInfo_MaxHorResolution + 2, chunky.width);
@ -3669,11 +3669,7 @@ static void copyall (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight)
static bool flushpixels (void)
{
int i;
#ifdef JIT
uae_u8 *src = p96ram_start + natmem_offset;
#else
uae_u8 *src = p96ram_start;
#endif
int off = picasso96_state.XYOffset - gfxmem_start;
uae_u8 *src_start;
uae_u8 *src_end;
@ -3786,7 +3782,7 @@ static bool flushpixels (void)
break;
}
if (!currprefs.gfx_api && (currprefs.leds_on_screen & STATUSLINE_RTG)) {
if (currprefs.leds_on_screen & STATUSLINE_RTG) {
if (dst == NULL) {
dst = gfx_lock_picasso (false, false);
if (dst)
@ -4012,13 +4008,10 @@ static uae_u32 REGPARAM2 picasso_SetMemoryMode(TrapContext *ctx)
if (ABI) \
put_long (ABI + func, start);
static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI)
static void inituaegfxfuncs (uaecptr start, uaecptr ABI)
{
uaecptr old = here ();
uaecptr ptr;
if (uaegfx_old)
return 0;
return;
org (start);
dw (RTS);
@ -4172,11 +4165,8 @@ static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI)
write_log (_T("uaegfx.card magic code: %08X-%08X ABI=%08X\n"), start, here (), ABI);
if (ABI && currprefs.win32_rtgvblankrate >= -1)
if (ABI && currprefs.rtg_hardwareinterrupt)
initvblankABI (uaegfx_base, ABI);
ptr = here ();
org (old);
return ptr;
}
void picasso_reset (void)
@ -4187,13 +4177,14 @@ void picasso_reset (void)
interrupt_enabled = 0;
reserved_gfxmem = 0;
resetpalette();
InitPicasso96 ();
}
void uaegfx_install_code (void)
void uaegfx_install_code (uaecptr start)
{
uaecptr start = here ();
uaegfx_rom = start;
org (inituaegfxfuncs (start, 0));
org (start);
inituaegfxfuncs (start, 0);
}
#define UAEGFX_VERSION 3
@ -4279,7 +4270,7 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize)
put_long (uaegfx_base + CARD_RESLIST, uaegfx_base + CARD_SIZEOF);
put_long (uaegfx_base + CARD_RESLISTSIZE, extrasize);
if (currprefs.win32_rtgvblankrate >= -1)
if (currprefs.rtg_hardwareinterrupt)
initvblankirq (ctx, uaegfx_base);
write_log (_T("uaegfx.card %d.%d init @%08X\n"), UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);

View File

@ -417,6 +417,11 @@
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

View File

@ -179,11 +179,18 @@ void REGPARAM2 m68k_handle_trap (unsigned int trap_num)
* Implementation of extended traps
*/
struct TrapCPUContext
{
uae_u32 regs[16];
uae_u32 pc;
int intmask;
};
struct TrapContext
{
/* Trap's working copy of 68k state. This is what the trap handler should
* access to get arguments from 68k space. */
struct regstruct regs;
//struct regstruct regs;
/* Trap handler function that gets called on the trap context */
TrapHandler trap_handler;
@ -193,7 +200,8 @@ struct TrapContext
uae_u32 trap_retval;
/* Copy of 68k state at trap entry. */
struct regstruct saved_regs;
//struct regstruct saved_regs;
struct TrapCPUContext saved_regs;
/* Thread which effects the trap context. */
uae_thread_id thread;
@ -209,6 +217,19 @@ struct TrapContext
uae_u32 call68k_retval;
};
static void copytocpucontext(struct TrapCPUContext *cpu)
{
memcpy (cpu->regs, regs.regs, sizeof (regs.regs));
cpu->intmask = regs.intmask;
cpu->pc = m68k_getpc ();
}
static void copyfromcpucontext(struct TrapCPUContext *cpu, uae_u32 pc)
{
memcpy (regs.regs, cpu->regs, sizeof (regs.regs));
regs.intmask = cpu->intmask;
m68k_setpc (pc);
}
/* 68k addresses which invoke the corresponding traps. */
static uaecptr m68k_call_trapaddr;
@ -244,15 +265,16 @@ static void *trap_thread (void *arg)
/* Enter critical section - only one trap at a time, please! */
uae_sem_wait (&trap_mutex);
regs = context->saved_regs;
//regs = context->saved_regs;
/* Set PC to address of the exit handler, so that it will be called
* when the 68k context resumes. */
copyfromcpucontext (&context->saved_regs, exit_trap_trapaddr);
/* Don't allow an interrupt and thus potentially another
* trap to be invoked while we hold the above mutex.
* This is probably just being paranoid. */
regs.intmask = 7;
/* Set PC to address of the exit handler, so that it will be called
* when the 68k context resumes. */
m68k_setpc (exit_trap_trapaddr);
//m68k_setpc (exit_trap_trapaddr);
current_context = context;
/* Switch back to 68k context */
@ -278,7 +300,8 @@ static void trap_HandleExtendedTrap (TrapHandler handler_func, int has_retval)
context->trap_handler = handler_func;
context->trap_has_retval = has_retval;
context->saved_regs = regs; /* Copy of regs to be restored when trap is done */
//context->saved_regs = regs;
copytocpucontext (&context->saved_regs);
/* Start thread to handle new trap context. */
uae_start_thread ("Trap", trap_thread, (void *)context, &context->thread);
@ -336,7 +359,7 @@ static uae_u32 trap_Call68k (TrapContext *context, uaecptr func_addr)
/*
* Handles the emulator's side of a 68k call (from an extended trap)
*/
static uae_u32 REGPARAM3 m68k_call_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 m68k_call_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;
@ -374,7 +397,7 @@ static uae_u32 REGPARAM3 m68k_call_handler (TrapContext *dummy_ctx)
/*
* Handles the return from a 68k call at the emulator's side.
*/
static uae_u32 REGPARAM3 m68k_return_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 m68k_return_handler (TrapContext *dummy_ctx)
{
TrapContext *context;
uae_u32 sp;
@ -408,7 +431,7 @@ static uae_u32 REGPARAM3 m68k_return_handler (TrapContext *dummy_ctx)
* Handles completion of an extended trap and passes
* return value from trap function to 68k space.
*/
static uae_u32 REGPARAM3 exit_trap_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM2 exit_trap_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;
@ -416,7 +439,8 @@ static uae_u32 REGPARAM3 exit_trap_handler (TrapContext *dummy_ctx)
uae_wait_thread (context->thread);
/* Restore 68k state saved at trap entry. */
regs = context->saved_regs;
//regs = context->saved_regs;
copyfromcpucontext (&context->saved_regs, context->saved_regs.pc);
/* If trap is supposed to return a value, then store
* return value in D0. */