}
return;
}
- }
+ }
if (bitcounter >= 0) {
if (direction) {
/* Amiga -> NVRAM */
}
} else {
write_log ("read error\n");
- }
+ }
} else {
write_log ("Audio CD\n");
if (audiounit < 0)
return;
}
}
-
+
static void akiko_internal (void)
{
cdrom_run_command ();
save_u32 (akiko_buffer[i]);
save_u8 ((uae_u8)akiko_read_offset);
save_u8 ((uae_u8)akiko_write_offset);
-
+
save_u32 ((cdrom_playing ? 1 : 0) | (cdrom_paused ? 2 : 0));
if (cdrom_playing)
cd_qcode (0);
{
struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+");
if (!f) {
- f = zfile_fopen (currprefs.flashfile, "wb");
- if (!f) return;
- zfile_fwrite (cd32_nvram, NVRAM_SIZE, 1, f);
- zfile_fclose (f);
+ f = zfile_fopen (currprefs.flashfile, "wb");
+ if (!f) return;
+ zfile_fwrite (cd32_nvram, NVRAM_SIZE, 1, f);
+ zfile_fclose (f);
}
zfile_fseek (f, offset, SEEK_SET);
zfile_fwrite (cd32_nvram + offset, len, 1, f);
if (direction > 0) {
nvram_writetmp[nvram_writeaddr++] = nvram_byte;
nvram_writeaddr &= 15;
- bitcounter = 0;
+ bitcounter = 0;
} else {
bitcounter = -1;
}
for (i = 0; i < 8; i++) akiko_result[i] = 0;
/* FIXME: better c2p algoritm than this piece of crap.... */
for (i = 0; i < 8 * 32; i++) {
- if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31)))
- akiko_result[i & 7] |= 1 << (i >> 3);
+ if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31)))
+ akiko_result[i & 7] |= 1 << (i >> 3);
}
}
uae_u8 *buf, *s, as;
if (d)
- memset (d, 0, 11);
+ memset (d, 0, 11);
last_play_pos = 0;
buf = sys_command_qcode (DF_IOCTL, unitnum);
if (!buf)
/* Make sure end of disc position is passed.
*/
int lsn = msf2lsn ((s[5] << 16) | (s[6] << 8) | (s[7] << 0));
- int msf = lsn2msf (cdrom_leadout);
+ int msf = lsn2msf (cdrom_leadout);
if (lsn >= cdrom_leadout || cdrom_leadout - lsn < 10) {
d[8] = tobcd ((uae_u8)(msf >> 16));
d[9] = tobcd ((uae_u8)(msf >> 8));
if (!found) {
if (first >= 0) {
unitnum = first;
- sys_command_open (DF_IOCTL, unitnum);
+ sys_command_open (DF_IOCTL, unitnum);
} else {
unitnum = -1;
return 1;
memset (cdrom_result_buffer, 0, sizeof(cdrom_result_buffer));
switch (cdrom_command & 0x0f)
{
- case 2:
- len = cdrom_command_pause ();
- break;
- case 3:
- len = cdrom_command_unpause ();
- break;
- case 4:
- len = cdrom_command_multi ();
- break;
+ case 2:
+ len = cdrom_command_pause ();
+ break;
+ case 3:
+ len = cdrom_command_unpause ();
+ break;
+ case 4:
+ len = cdrom_command_multi ();
+ break;
case 5:
cdrom_dosomething = 1;
len = cdrom_command_something ();
break;
- case 6:
- len = cdrom_command_subq ();
- break;
- case 7:
- len = cdrom_command_door_status ();
- break;
- default:
- len = 0;
- break;
+ case 6:
+ len = cdrom_command_subq ();
+ break;
+ case 7:
+ len = cdrom_command_door_status ();
+ break;
+ default:
+ len = 0;
+ break;
}
if (len == 0)
- return;
+ return;
if (cdrom_checksum_error)
- cdrom_result_buffer[1] |= 0x80;
+ cdrom_result_buffer[1] |= 0x80;
cdrom_return_data (len);
}
for (j = 0; j < 16; j++) {
if (cdrom_readmask_w & (1 << j)) break;
}
- sector = cdrom_current_sector = cdrom_data_offset + cdrom_sector_counter;
- sec = sector - sector_buffer_sector_1;
- if (sector_buffer_sector_1 >= 0 && sec >= 0 && sec < SECTOR_BUFFER_SIZE) {
+ sector = cdrom_current_sector = cdrom_data_offset + cdrom_sector_counter;
+ sec = sector - sector_buffer_sector_1;
+ if (sector_buffer_sector_1 >= 0 && sec >= 0 && sec < SECTOR_BUFFER_SIZE) {
if (sector_buffer_info_1[sec] != 0xff && sector_buffer_info_1[sec] != 0) {
- memcpy (buf + 16, sector_buffer_1 + sec * 2048, 2048);
- encode_l2 (buf, sector + 150);
- buf[0] = 0;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = cdrom_sector_counter;
- for (i = 0; i < 2352; i++)
- put_byte (cdrom_address1 + j * 4096 + i, buf[i]);
- cdrom_readmask_r |= 1 << j;
+ memcpy (buf + 16, sector_buffer_1 + sec * 2048, 2048);
+ encode_l2 (buf, sector + 150);
+ buf[0] = 0;
+ buf[1] = 0;
+ buf[2] = 0;
+ buf[3] = cdrom_sector_counter;
+ for (i = 0; i < 2352; i++)
+ put_byte (cdrom_address1 + j * 4096 + i, buf[i]);
+ cdrom_readmask_r |= 1 << j;
}
if (sector_buffer_info_1[sec] != 0xff)
sector_buffer_info_1[sec]--;
} else
return;
#if AKIKO_DEBUG_IO_CMD
- write_log("read sector=%d, scnt=%d -> %d\n", cdrom_data_offset, cdrom_sector_counter, sector);
+ write_log("read sector=%d, scnt=%d -> %d\n", cdrom_data_offset, cdrom_sector_counter, sector);
#endif
cdrom_readmask_w &= ~(1 << j);
- cdrom_status1 |= CDSTATUS_DATASECTOR;
+ cdrom_status1 |= CDSTATUS_DATASECTOR;
}
cdrom_sector_counter++;
}
struct device_info di;
if (cdrom_result_complete > cdrom_result_last_pos && cdrom_result_complete - cdrom_result_last_pos < 100) {
- cdrom_status1 |= CDSTATUS_DATA_AVAILABLE;
+ cdrom_status1 |= CDSTATUS_DATA_AVAILABLE;
return;
}
if (cdrom_result_last_pos < cdrom_result_complete)
{
cdrom_run_command ();
if (cdrom_command_active > 0) {
- cdrom_command_active--;
- if (!cdrom_command_active)
+ cdrom_command_active--;
+ if (!cdrom_command_active)
cdrom_run_command_run ();
}
}
if (framecounter <= 0) {
cdrom_run_read ();
framecounter = 1000000 / (74 * 75 * cdrom_speed);
- cdrom_status1 |= CDSTATUS_FRAME;
+ cdrom_status1 |= CDSTATUS_FRAME;
}
akiko_internal ();
akiko_handler ();
int sector;
while(akiko_thread_running) {
- uae_sem_wait (&akiko_sem);
+ uae_sem_wait (&akiko_sem);
sector = cdrom_current_sector;
for (i = 0; i < SECTOR_BUFFER_SIZE; i++) {
if (sector_buffer_info_1[i] == 0xff) break;
sector_buffer_sector_1 = sector_buffer_sector_2;
sector_buffer_sector_2 = tmp3;
}
- uae_sem_post (&akiko_sem);
+ uae_sem_post (&akiko_sem);
Sleep (10);
}
akiko_thread_running = -1;
/* C2P */
case 0x38:
case 0x39:
- case 0x3a:
+ case 0x3a:
case 0x3b:
v = akiko_c2p_read (addr - 0x38);
break;
v |= akiko_bget2 (addr + 1, 0) << 16;
v |= akiko_bget2 (addr + 0, 0) << 24;
if (addr < 0x30 && (addr != 4 && addr != 8) && AKIKO_DEBUG_IO)
- write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", m68k_getpc(), addr, v);
+ write_log ("akiko_lget %08.8X: %08.8X %08.8X\n", m68k_getpc(), addr, v);
return v;
}
addr &= 0xffff;
v &= 0xff;
if(msg && addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", m68k_getpc(), addr, v & 0xff);
+ write_log ("akiko_bput %08.8X: %08.8X=%02.2X\n", m68k_getpc(), addr, v & 0xff);
uae_sem_wait (&akiko_sem);
switch (addr)
{
{
addr &= 0xffff;
if(addr < 0x30 && AKIKO_DEBUG_IO)
- write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v);
+ write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v);
akiko_bput2 (addr + 3, (v >> 0) & 0xff, 0);
akiko_bput2 (addr + 2, (v >> 8) & 0xff, 0);
akiko_bput2 (addr + 1, (v >> 16) & 0xff, 0);
}
}
if (!savestate_state) {
- cdrom_playing = cdrom_paused = 0;
+ cdrom_playing = cdrom_paused = 0;
cdrom_data_offset = -1;
uae_sem_init (&akiko_sem, 0, 1);
}
sys_command_play (DF_IOCTL, unitnum, last_play_pos, last_play_end, 0);
return src;
-}
\ No newline at end of file
+}
-/*
+/*
* UAE Action Replay 1/2/3 and HRTMon support
*
* (c) 2000-2002 Toni Wilen <twilen@arabuusimiehet.com>
* HRTMon support is tested with version 2.25 + patch.
* More information about HRTMon can be found from
* http://dumbo.cryogen.ch/hrtmon/
- *
+ *
* Action Replay 2/3:
*
* Tested with AR3 ROM version 3.09 (10/13/91) and AR2 2.12 (12/24/90)
* 3.17 12/17/91 mm/dd/yy
*
* This patch also makes AR3 compatible with KickStart's other than 1.3
- * (ROM checksum error is normal with KS != 1.3)
- * NOTE: AR has problems with 68020+ processors.
+ * (ROM checksum error is normal with KS != 1.3)
+ * NOTE: AR has problems with 68020+ processors
* For maximum compatibility select 68000/68010 and A500 speed from UAE
* options.
*
* 5. Copy the rom into the address the monitor allocated.
* 6. Exit the action replay.
* 7. Save the ram from the monitor to disk.
- *
+ *
* I DO NOT REPLY MAILS ASKING FOR ACTION REPLAY ROMS!
*
* AR2/3 hardware notes (not 100% correct..)
*
* cartridge hardware also snoops CPU accesses to custom chip
* registers (DFF000-DFF1FE). All CPU custom chip accesses are
- * saved to RAM at 0x44f000-0x44f1ff. Note that emulated AR3 also
+ * saved to RAM at 0x44f000-0x44f1ff. Note that emulated AR3 also
* saves copper's custom chip accesses. This fix stops programs
* that try to trick AR by using copper to update write-only
* custom registers.
* This command will not work using the current infrastructure,
* so don't use it 8).
*/
-
+
/* AR1 Breakpoint info.
* 1.15 If a breakpoint occurred. Its address is stored at 9fe048.
* The 5 breakpoint entries each consisting of 6 bytes are stored at 9fe23e.
/* How AR1 is entered on reset:
* In the kickstart (1.3) there is the following code:
* I have marked the important lines:
- *
- * fc00e6 lea f00000,a1 ; address where AR1 rom is located.
+ *
+ * fc00e6 lea f00000,a1 ; address where AR1 rom is located.
* fc00ec cmpa.l a1,a0
* fc00ee beq fc00fe.s
* fc00f0 lea C(pc), a5
- * fc00f4 cmpi.w #1111,(a1) ; The first word of the AR1 rom is set to 1111.
+ * fc00f4 cmpi.w #1111,(a1) ; The first word of the AR1 rom is set to 1111.
* fc00f8 bne fc00fe.s
- * fc00fa jmp 2(a1) ; This is the entry point of the rom.
+ * fc00fa jmp 2(a1) ; This is the entry point of the rom.
*/
-
+
/* Flag info:
- * AR3:'ARON'. This is unset initially. It is set the first time you enter the AR via a freeze.
- * It enables you to keep the keyboard buffer and such.
- * If this flag is unset, the keyboard buffer is cleared, the breakpoints are deleted and ... */
-
+ * AR3:'ARON'. This is unset initially. It is set the first time you enter the AR via a freeze.
+ * It enables you to keep the keyboard buffer and such.
+ * If this flag is unset, the keyboard buffer is cleared, the breakpoints are deleted and ... */
+
/* AR3:'PRIN'. This flag is unset initially. It is set at some point and when you switch to the 2nd screen
- * for the first time it displays all the familiar text. Then unsets 'PRIN'.
- */
-
-
+ * for the first time it displays all the familiar text. Then unsets 'PRIN'.
+ */
+
+
#include "sysconfig.h"
#include "sysdeps.h"
#include "ar.h"
#include "savestate.h"
-#define DEBUG
+#define DEBUG
#ifdef DEBUG
-#define write_log_debug write_log
+#define write_log_debug write_log
#else
-#define write_log_debug
+#define write_log_debug
#endif
-
-#define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed. */
-#define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */
-#define ARMODE_BREAKPOINT_ACTIVATED 1
-#define ARMODE_BREAKPOINT_AR3_RESET_AR2 3 /* AR2: The action replay is activated after a reset. */
+
+#define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed. */
+#define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */
+#define ARMODE_BREAKPOINT_ACTIVATED 1
+#define ARMODE_BREAKPOINT_AR3_RESET_AR2 3 /* AR2: The action replay is activated after a reset. */
/* AR3: The action replay is activated by a breakpoint. */
/* HRTMon baseaddress, can be freely changed */
-#define HRTMON_BASE 0x980000
+#define HRTMON_BASE 0x980000
uae_u8 ar_custom[2*256];
-int hrtmon_flag = ACTION_REPLAY_INACTIVE;
+int hrtmon_flag = ACTION_REPLAY_INACTIVE;
static uae_u8 *hrtmemory = 0;
static uae_u8 *armemory_rom = 0, *armemory_ram = 0;
static uae_u32 hrtmem_mask;
static uae_u8 *hrtmon_custom;
-uae_u32 hrtmem_start, hrtmem_size;
+uae_u32 hrtmem_start, hrtmem_size;
static uae_u32 hrtmem_lget (uaecptr) REGPARAM;
static uae_u32 hrtmem_wget (uaecptr) REGPARAM;
static void hrtmem_lput (uaecptr, uae_u32) REGPARAM;
static void hrtmem_wput (uaecptr, uae_u32) REGPARAM;
static void hrtmem_bput (uaecptr, uae_u32) REGPARAM;
-static int hrtmem_check (uaecptr addr, uae_u32 size) REGPARAM;
+static int hrtmem_check (uaecptr addr, uae_u32 size) REGPARAM;
static uae_u8 *hrtmem_xlate (uaecptr addr) REGPARAM;
static void hrtmon_unmap_banks(void);
return (addr + size) <= hrtmem_size;
}
-static uae_u8 REGPARAM2 *hrtmem_xlate (uaecptr addr)
+static uae_u8 REGPARAM2 *hrtmem_xlate (uaecptr addr)
{
addr -= hrtmem_start & hrtmem_mask;
addr &= hrtmem_mask;
src++;
}
}
-static void copytoamiga(uaecptr dst,uae_u8 *src,int len)
+static void copytoamiga(uaecptr dst,uae_u8 *src,int len)
{
while(len--) {
put_byte (dst, *src++);
int action_replay_flag = ACTION_REPLAY_INACTIVE;
static int ar_rom_file_size;
-/* Use this for relocating AR? */
+/* Use this for relocating AR? */
static int ar_rom_location;
/*static*/ int armodel;
-static uae_u8 artemp[4]; /* Space to store the 'real' level 7 interrupt */
+static uae_u8 artemp[4]; /* Space to store the 'real' level 7 interrupt */
static uae_u8 armode;
-static uae_u32 arrom_start, arrom_size, arrom_mask;
-static uae_u32 arram_start, arram_size, arram_mask;
+static uae_u32 arrom_start, arrom_size, arrom_mask;
+static uae_u32 arram_start, arram_size, arram_mask;
-static int ar_wait_pop = 0; /* bool used by AR1 when waiting for the program counter to exit it's ram. */
-uaecptr wait_for_pc = 0; /* The program counter that we wait for. */
+static int ar_wait_pop = 0; /* bool used by AR1 when waiting for the program counter to exit it's ram. */
+uaecptr wait_for_pc = 0; /* The program counter that we wait for. */
-/* returns true if the Program counter is currently in the AR rom. */
+/* returns true if the Program counter is currently in the AR rom. */
int is_ar_pc_in_rom()
{
uaecptr pc = m68k_getpc() & 0xFFFFFF;
return pc >= arrom_start && pc < arrom_start+arrom_size;
}
-/* returns true if the Program counter is currently in the AR RAM. */
+/* returns true if the Program counter is currently in the AR RAM. */
int is_ar_pc_in_ram()
{
uaecptr pc = m68k_getpc() & 0xFFFFFF;
}
-/* flag writing == 1 for writing memory, 0 for reading from memory. */
-STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing)
+/* flag writing == 1 for writing memory, 0 for reading from memory. */
+STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing)
{
uaecptr pc;
-/* if ( addr < 8 ) //|| writing ) */
+/* if ( addr < 8 ) //|| writing ) */
/* { */
/* if ( writing ) */
-/* write_log_debug("ARSTATUS armode:%d, Writing %d to address %p, PC=%p\n", armode, b, addr, m68k_getpc()); */
+/* write_log_debug("ARSTATUS armode:%d, Writing %d to address %p, PC=%p\n", armode, b, addr, m68k_getpc()); */
/* else */
-/* write_log_debug("ARSTATUS armode:%d, Reading %d from address %p, PC=%p\n", armode, armemory_rom[addr], addr, m68k_getpc()); */
+/* write_log_debug("ARSTATUS armode:%d, Reading %d from address %p, PC=%p\n", armode, armemory_rom[addr], addr, m68k_getpc()); */
/* } */
if (armodel == 1 ) /* With AR1. It is always a read. Actually, it is a strobe on exit of the AR.
- * but, it is also read during the checksum routine. */
+ * but, it is also read during the checksum routine. */
{
- if ( addr < 2)
+ if ( addr < 2)
{
if ( is_ar_pc_in_rom() )
{
if ( ar_wait_pop )
{
action_replay_flag = ACTION_REPLAY_WAIT_PC;
-/* write_log_debug("SP %p\n", m68k_areg(regs,7)); */
-/* write_log_debug("SP+2 %p\n", m68k_areg(regs,7)+2 ); */
+/* write_log_debug("SP %p\n", m68k_areg(regs,7)); */
+/* write_log_debug("SP+2 %p\n", m68k_areg(regs,7)+2 ); */
/* write_log_debug("(SP+2) %p\n", longget(m68k_areg(regs,7)+2)); */
- ar_wait_pop = 0;
+ ar_wait_pop = 0;
/* We get (SP+2) here, as the first word on the stack is the status register. */
/* We want the following long, which is the return program counter. */
wait_for_pc = longget(m68k_areg(regs,7)+2); /* Get (SP+2) */
set_special (SPCFLAG_ACTION_REPLAY);
-
+
pc = m68k_getpc();
/* write_log_debug("Action Replay marked as ACTION_REPLAY_WAIT_PC, PC=%p\n",pc);*/
}
if (action_replay_flag != ACTION_REPLAY_ACTIVE)
return 0;
#endif
-
+
if (!writing) /* reading */
{
if (addr == 1 || addr == 3) /* This is necessary because we don't update rom location 0 every time we change armode */
return armemory_rom[addr];
}
/* else, we are writing */
- else if (addr == 1) {
+ else if (addr == 1) {
armode = b;
- if(armode >= 2)
+ if(armode >= 2)
{
if ( armode == ARMODE_BREAKPOINT_AR2 )
{
{
write_log("AR3: exit waiting for breakpoint.\n"); /* Correct for AR3 (waiting for breakpoint)*/
}
- else
+ else
{
write_log("AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
- }
+ }
} else {
write_log("AR: exit with armode(%d)\n", armode);
}
static uae_u32 arram_lget (uaecptr) REGPARAM;
static uae_u32 arram_wget (uaecptr) REGPARAM;
static uae_u32 arram_bget (uaecptr) REGPARAM;
-static void arram_lput (uaecptr, uae_u32) REGPARAM;
-static void arram_wput (uaecptr, uae_u32) REGPARAM;
-static void arram_bput (uaecptr, uae_u32) REGPARAM;
-static int arram_check (uaecptr addr, uae_u32 size) REGPARAM;
+static void arram_lput (uaecptr, uae_u32) REGPARAM;
+static void arram_wput (uaecptr, uae_u32) REGPARAM;
+static void arram_bput (uaecptr, uae_u32) REGPARAM;
+static int arram_check (uaecptr addr, uae_u32 size) REGPARAM;
static uae_u8 *arram_xlate (uaecptr addr) REGPARAM;
static uae_u32 arrom_lget (uaecptr) REGPARAM;
static uae_u32 arrom_wget (uaecptr) REGPARAM;
static uae_u32 arrom_bget (uaecptr) REGPARAM;
-static void arrom_lput (uaecptr, uae_u32) REGPARAM;
-static void arrom_wput (uaecptr, uae_u32) REGPARAM;
-static void arrom_bput (uaecptr, uae_u32) REGPARAM;
-static int arrom_check (uaecptr addr, uae_u32 size) REGPARAM;
+static void arrom_lput (uaecptr, uae_u32) REGPARAM;
+static void arrom_wput (uaecptr, uae_u32) REGPARAM;
+static void arrom_bput (uaecptr, uae_u32) REGPARAM;
+static int arrom_check (uaecptr addr, uae_u32 size) REGPARAM;
static uae_u8 *arrom_xlate (uaecptr addr) REGPARAM;
static void action_replay_unmap_banks(void);
armemory_ram[addr] = b;
}
-static int REGPARAM2 arram_check (uaecptr addr, uae_u32 size)
+static int REGPARAM2 arram_check (uaecptr addr, uae_u32 size)
{
addr -= arram_start;
addr &= arram_mask;
return (addr + size) <= arram_size;
}
-static uae_u8 REGPARAM2 *arram_xlate (uaecptr addr)
+static uae_u8 REGPARAM2 *arram_xlate (uaecptr addr)
{
addr -= arram_start;
addr &= arram_mask;
return ar3a (addr, 0, 0);
}
-static void REGPARAM2 arrom_lput (uaecptr addr, uae_u32 l)
+static void REGPARAM2 arrom_lput (uaecptr addr, uae_u32 l)
{
#ifdef JIT
special_mem |= S_WRITE;
ar3a (addr + 3,(uae_u8)(l >> 0), 1);
}
-static void REGPARAM2 arrom_wput (uaecptr addr, uae_u32 w)
+static void REGPARAM2 arrom_wput (uaecptr addr, uae_u32 w)
{
#ifdef JIT
special_mem |= S_WRITE;
ar3a (addr + 1,(uae_u8)(w >> 0), 1);
}
-static void REGPARAM2 arrom_bput (uaecptr addr, uae_u32 b)
+static void REGPARAM2 arrom_bput (uaecptr addr, uae_u32 b)
{
#ifdef JIT
special_mem |= S_WRITE;
ar3a (addr, b, 1);
}
-static int REGPARAM2 arrom_check (uaecptr addr, uae_u32 size)
+static int REGPARAM2 arrom_check (uaecptr addr, uae_u32 size)
{
addr -= arrom_start;
addr &= arrom_mask;
return (addr + size) <= arrom_size;
}
-static uae_u8 REGPARAM2 *arrom_xlate (uaecptr addr)
+static uae_u8 REGPARAM2 *arrom_xlate (uaecptr addr)
{
addr -= arrom_start;
addr &= arrom_mask;
return armemory_rom + addr;
}
-static addrbank arrom_bank = {
+static addrbank arrom_bank = {
arrom_lget, arrom_wget, arrom_bget,
arrom_lput, arrom_wput, arrom_bput,
arrom_xlate, arrom_check, NULL
};
-static addrbank arram_bank = {
+static addrbank arram_bank = {
arram_lget, arram_wget, arram_bget,
arram_lput, arram_wput, arram_bput,
arram_xlate, arram_check, NULL
{
if(!armemory_rom)
return;
-
+
map_banks (&dummy_bank, arrom_start >> 16 , arrom_size >> 16, 0);
map_banks (&dummy_bank, arram_start >> 16 , arram_size >> 16, 0);
}
#endif
}
-/*extern void Interrupt (int nr);*/
+/*extern void Interrupt (int nr);*/
-/* Cartridge activates itself by overlaying its rom
+/* Cartridge activates itself by overlaying its rom
* over chip-ram and then issuing IRQ 7
*
* I just copy IRQ vector 7 from ROM to chip RAM
{
hide_cart (0);
action_replay_flag = ACTION_REPLAY_ACTIVE;
-
+
memcpy (armemory_ram + 0xf000, ar_custom, 2 * 256);
Interrupt (7);
}
}
else if (armode == ARMODE_FREEZE) {
write_log("AR2/3: activated (freeze)\n");
- }
- else if (armode >= 2)
+ }
+ else if (armode >= 2)
{
if ( armode == ARMODE_BREAKPOINT_AR2 )
{
{
write_log("AR3: activated (breakpoint)\n");
}
- else
+ else
{
write_log("AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
- }
+ }
armode = ARMODE_BREAKPOINT_ACTIVATED;
}
action_replay_go();
void check_prefs_changed_carts(int in_memory_reset)
{
- if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0)
+ if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0)
{
write_log("Cartridge ROM Prefs changed.\n");
if (action_replay_unload(in_memory_reset))
{
- memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile);
+ memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile);
#ifdef ACTION_REPLAY
action_replay_load();
- action_replay_init(1);
+ action_replay_init(1);
#endif
#ifdef ACTION_REPLAY_HRTMON
hrtmon_load(1);
#endif
}
}
-}
-
+}
+
void action_replay_reset(void)
{
if (action_replay_flag == ACTION_REPLAY_INACTIVE)
int action_replay_freeze(void)
{
- if(action_replay_flag == ACTION_REPLAY_IDLE)
+ if(action_replay_flag == ACTION_REPLAY_IDLE)
{
if (armodel == 1)
{
void action_replay_chipwrite(void)
{
- if (armodel > 1)
+ if (armodel > 1)
{
action_replay_flag = ACTION_REPLAY_DORESET;
set_special (SPCFLAG_ACTION_REPLAY);
copyfromamiga (artemp, regs.vbr + 0x60, 4);
copytoamiga (regs.vbr + 0x7c, artemp, 4);
ar_wait_pop = 1; /* Wait for stack to pop. */
-
+
action_replay_flag = ACTION_REPLAY_ACTIVATE;
set_special (SPCFLAG_ACTION_REPLAY);
}
}
-/* Disabling copperlist processing:
+/* Disabling copperlist processing:
* On: ar317 an rts at 41084c does it.
* On: ar214: an rts at 41068e does it.
*/
-/* Original AR3 only works with KS 1.3
+/* Original AR3 only works with KS 1.3
* this patch fixes that problem.
*/
if (armodel != 3 || !kickmem)
return;
if (!memcmp (kickmem, kickmem + 262144, 262144)) off1 = 262144; else off1 = 0;
- for (;;) {
+ for (;;) {
if (!memcmp (kickmem + off1, ar3patch1, sizeof (ar3patch1)) || off1 == 524288 - sizeof (ar3patch1)) break;
off1++;
}
write_log ("AR ROM patched for KS2.0+\n");
}
-/* Returns 0 if the checksum is OK.
+/* Returns 0 if the checksum is OK.
* Else, it returns the calculated checksum.
- * Note: Will be wrong if the checksum is zero, but i'll take my chances on that not happenning ;)
+ * Note: Will be wrong if the checksum is zero, but i'll take my chances on that not happenning ;)
*/
static uae_u32 action_replay_calculate_checksum()
{
* AR1: The checksum is the last non-zero long in the rom.
* AR2: The checksum starts at offset 4.
* AR2: The checksum is the last Long in the rom.
- * AR3: The checksum starts at offset 0x7c.
+ * AR3: The checksum starts at offset 0x7c.
* AR3: The checksum is the last Long in the rom.
*
* Checksums: (This is a good way to compare roms. I have two with different md5sums,
* but the same checksum, so the difference must be in the first four bytes.)
- * 3.17 0xf009bfc9
+ * 3.17 0xf009bfc9
* 3.09 0xd34d04a7
* 2.14 0xad839d36
* 2.14 0xad839d36
* 1.15 0xee12116
*/
-
+
if (!armemory_rom)
return 0; /* If there is no rom then i guess the checksum is ok */
/* Search for first non-zero Long starting from the end of the rom. */
/* Assume long alignment, (will always be true for AR2 and AR3 and the AR1 rom i've got). */
- /* If anyone finds an AR1 rom with a word-aligned checksum, then this code will have to be modified. */
+ /* If anyone finds an AR1 rom with a word-aligned checksum, then this code will have to be modified. */
while (! *(--checksum_end) );
-
+
if ( armodel == 1)
{
- uae_u16* rom_ptr_word;
- uae_s16 sign_extended_word;
-
+ uae_u16* rom_ptr_word;
+ uae_s16 sign_extended_word;
+
rom_ptr_word = (uae_u16*)checksum_start;
while ( rom_ptr_word != (uae_u16*)checksum_end )
{
sign_extended_word = (uae_s16)do_get_mem_word (rom_ptr_word);
/* When the word is cast on the following line, it will get sign-extended. */
- checksum += (uae_u32)sign_extended_word;
+ checksum += (uae_u32)sign_extended_word;
rom_ptr_word++;
}
}
else
- {
- uae_u32* rom_ptr_long;
+ {
+ uae_u32* rom_ptr_long;
rom_ptr_long = checksum_start;
while ( rom_ptr_long != checksum_end )
{
- checksum += do_get_mem_long (rom_ptr_long);
- rom_ptr_long++;
+ checksum += do_get_mem_long (rom_ptr_long);
+ rom_ptr_long++;
}
}
-
+
stored_checksum = do_get_mem_long(checksum_end);
return checksum == stored_checksum ? 0 : checksum;
}
-/* Returns 0 on error. */
+/* Returns 0 on error. */
static uae_u8* get_checksum_location()
{
uae_u32* checksum_end;
/* See action_replay_calculate_checksum() for checksum info. */
-
+
if (!armemory_rom)
return 0;
checksum_end = (uae_u32*)&armemory_rom[ar_rom_file_size];
- /* Search for first non-zero Long starting from the end of the rom. */
+ /* Search for first non-zero Long starting from the end of the rom. */
while (! *(--checksum_end) );
return (uae_u8*)checksum_end;
}
-/* Replaces the existing cart checksum with a correct one. */
-/* Useful if you want to patch the rom. */
+/* Replaces the existing cart checksum with a correct one. */
+/* Useful if you want to patch the rom.*/
static void action_replay_fixup_checksum(uae_u32 new_checksum)
{
uae_u32* checksum = (uae_u32*)get_checksum_location();
}
/* Longword search on word boundary
- * the search_value is assumed to already be in the local endian format
+ * the search_value is assumed to already be in the local endian format
* return 0 on failure
*/
-static uae_u8* find_absolute_long(uae_u8* start_addr, uae_u8* end_addr, uae_u32 search_value)
+static uae_u8* find_absolute_long(uae_u8* start_addr, uae_u8* end_addr, uae_u32 search_value)
{
uae_u8* addr;
-
+
for ( addr = start_addr; addr < end_addr; )
{
if ( do_get_mem_long((uae_u32*)addr) == search_value )
addr+=2;
}
return 0;
-}
+}
-/* word search on word boundary
- * the search_addr is assumed to already be in the local endian format
+/* word search on word boundary
+ * the search_addr is assumed to already be in the local endian format
* return 0 on failure
* Currently only tested where the address we are looking for is AFTER the instruction.
- * Not sure it works with negative offsets.
+ * Not sure it works with negative offsets.
*/
-static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 search_addr)
+static uae_u8* find_relative_word(uae_u8* start_addr, uae_u8* end_addr, uae_u16 search_addr)
{
uae_u8* addr;
-
+
for ( addr = start_addr; addr < end_addr; )
{
if ( do_get_mem_word((uae_u16*)addr) == (uae_u16)(search_addr - (uae_u16)(addr-start_addr)) )
{
-/* write_log_debug("Found %p at offset %p.\n", search_addr, addr - start_addr);*/
+/* write_log_debug("Found %p at offset %p.\n", search_addr, addr - start_addr);*/
return addr;
}
addr+=2;
return 0;
}
-/* Disable rom test */
-/* This routine replaces the rom-test routine with a 'rts'.
- * It does this in a 'safe' way, by searching for a reference to the checksum
- * and only disables it if the surounding bytes are what it expects.
+/* Disable rom test */
+/* This routine replaces the rom-test routine with a 'rts'.
+ * It does this in a 'safe' way, by searching for a reference to the checksum
+ * and only disables it if the surounding bytes are what it expects.
*/
static void disable_rom_test()
{
uae_u8* addr;
-
+
uae_u8* start_addr = armemory_rom;
uae_u8* end_addr = get_checksum_location();
* checksum test.
* AR1:
* F0D4D0 6100 ???? bsr.w calc_checksum ; calculate the checksum
- * F0D4D4 41FA 147A lea (0xf0e950,PC),a0 ; load the existing checksum.
+ * F0D4D4 41FA 147A lea (0xf0e950,PC),a0 ; load the existing checksum.
* ; do a comparison.
* AR2:
* 40EC92 6100 ???? bsr.w calc_checksum
{
uae_u16 search_value_rel = end_addr - start_addr;
addr = find_relative_word(start_addr, end_addr, search_value_rel);
-
+
if ( addr )
{
if ( do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */
- do_get_mem_word((uae_u16*)(addr-2)) == 0x41fa ) /* lea relative */
+ do_get_mem_word((uae_u16*)(addr-2)) == 0x41fa ) /* lea relative */
{
write_log("Patching to disable ROM TEST.\n");
do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */
if ( addr )
{
if ( do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */
- do_get_mem_word((uae_u16*)(addr-2)) == 0x41f9 ) /* lea absolute */
+ do_get_mem_word((uae_u16*)(addr-2)) == 0x41f9 ) /* lea absolute */
{
write_log("Patching to disable ROM TEST.\n");
do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */
}
}
}
-}
-
-/* After we have calculated the checksum, and verified the rom is ok,
+}
+
+/* After we have calculated the checksum, and verified the rom is ok,
* we can do two things.
* 1. (optionally)Patch it and then update the checksum.
* 2. Remove the checksum check and (optionally) patch it.
chipmem_bank.lput = chipmem_lput;
}
-/* param to allow us to unload the cart. Currently we know it is safe if we are doing a reset to unload it.*/
+/* param to allow us to unload the cart. Currently we know it is safe if we are doing a reset to unload it.*/
int action_replay_unload(int in_memory_reset)
-{
- char* state[] =
- {
+{
+ char* state[] =
+ {
"ACTION_REPLAY_WAIT_PC",
"ACTION_REPLAY_INACTIVE",
"ACTION_REPLAY_WAITRESET",
"ACTION_REPLAY_DORESET",
"ACTION_REPLAY_HIDE",
};
-
+
write_log_debug("Action Replay State:(%s) Hrtmon State:(%s)\n", state[action_replay_flag+3],state[hrtmon_flag+3] );
if ( armemory_rom && armodel == 1 )
action_replay_cleanup();
return 1;
}
-
+
int action_replay_load(void)
{
}
}
-/* This only deallocates memory, it is not suitable for unloading roms and continuing */
+/* This only deallocates memory, it is not suitable for unloading roms and continuing */
void action_replay_cleanup()
{
if (armemory_rom)
hrtmemory = 0;
}
-#ifndef FALSE
-#define FALSE 0
+#ifndef FALSE
+#define FALSE 0
#endif
-#ifndef TRUE
-#define TRUE 1
+#ifndef TRUE
+#define TRUE 1
#endif
-typedef struct {
+typedef struct {
char jmps[20];
unsigned int mon_size;
unsigned short col0, col1;
unsigned int error_pc;
unsigned short error_status;
char newid[6];
- unsigned short mon_version;
- unsigned short mon_revision;
- unsigned int whd_base;
- unsigned short whd_version;
- unsigned short whd_revision;
- unsigned int max_chip;
- unsigned int custom;
+ unsigned short mon_version;
+ unsigned short mon_revision;
+ unsigned int whd_base;
+ unsigned short whd_version;
+ unsigned short whd_revision;
+ unsigned int max_chip;
+ unsigned int custom;
} HRTCFG;
static void hrtmon_configure(HRTCFG *cfg)
cfg->key = FALSE;
cfg->ide = 0;
cfg->a1200 = 0;
-cfg->aga = (currprefs.chipset_mask & 4) ? 1 : 0;
+cfg->aga = (currprefs.chipset_mask & 4) ? 1 : 0;
cfg->insert = TRUE;
cfg->delay = 15;
cfg->lview = FALSE;
cfg->cd32 = 0;
-cfg->screenmode = 0;
+cfg->screenmode = 0;
cfg->vbr = TRUE;
cfg->hexmode = FALSE;
cfg->mon_size=0;
cfg->hexmode = TRUE;
do_put_mem_long(&cfg->max_chip,currprefs.chipmem_size);
-hrtmon_custom = do_get_mem_long ((uae_u32*)&cfg->custom)+hrtmemory;
+hrtmon_custom = do_get_mem_long ((uae_u32*)&cfg->custom)+hrtmemory;
}
static void hrtmon_reloc(uae_u32 *mem,uae_u32 *header)
}
}
-static uae_u8 hrt_header[] = {
+static uae_u8 hrt_header[] = {
0x0, 0x0, 0x3, 0xf3,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
- 0x0
+ 0x0
};
int hrtmon_load(int activate)
int size;
uae_u32 header[8];
uae_u32 id_string[2];
-
+
/* Don't load a rom if one is already loaded. Use action_replay_unload() first. */
if (armemory_rom)
return 0;
if (hrtmemory)
return 0;
-
+
armodel = 0;
if (strlen(currprefs.cartfile) == 0)
return 0;
zfile_fclose (f);
return 0;
}
- zfile_fread(header,sizeof(header),1,f);
+ zfile_fread(header,sizeof(header),1,f);
/* Check the header */
-/* uae_u8* ptr = (uae_u8*)&header; */
-/* for ( ; ptr < sizeof(header); ptr++) */
+/* uae_u8* ptr = (uae_u8*)&header; */
+/* for ( ; ptr < sizeof(header); ptr++) */
/* { */
-/* if ( *ptr != *header */
-
- zfile_fread(id_string,sizeof(id_string),1,f);
+/* if ( *ptr != *header */
+
+ zfile_fread(id_string,sizeof(id_string),1,f);
if (strncmp((char*)&id_string[1], "HRT!",4) != 0 )
{
write_log("Not a Hrtmon Rom\n");
return 0;
}
zfile_fseek(f,sizeof(header),SEEK_SET);
-
+
hrtmem_size = size;
hrtmem_size += 65535;
hrtmem_size &= ~65535;
-#define AR_VER_STR_OFFSET 0x4 /* offset in the rom where the version string begins. */
-#define AR_VER_STR_END 0x7c /* offset in the rom where the version string ends. */
-#define AR_VER_STR_LEN (AR_VER_STR_END - AR_VER_STR_OFFSET)
+#define AR_VER_STR_OFFSET 0x4 /* offset in the rom where the version string begins. */
+#define AR_VER_STR_END 0x7c /* offset in the rom where the version string ends. */
+#define AR_VER_STR_LEN (AR_VER_STR_END - AR_VER_STR_OFFSET)
char arVersionString[AR_VER_STR_LEN+1];
-/* This function extracts the version info for AR2 and AR3. */
+/* This function extracts the version info for AR2 and AR3. */
void action_replay_version()
{
if (!armemory_rom)
return;
-
+
if ( armodel == 1 )
return; /* no support yet. */
-
+
/* Extract Version string */
memcpy(arVersionString, armemory_rom+AR_VER_STR_OFFSET, AR_VER_STR_LEN);
arVersionString[AR_VER_STR_LEN]= '\0';
*tmp = '\0';
}
/* write_log_debug("Version string is : '%s'\n", arVersionString); */
-
+
tmp = strchr(arVersionString,')');
if ( tmp )
{
write_log("Version of cart is '%d.%.02d', date is '%s'\n", iArVersionMajor, iArVersionMinor, sArDate);
}
}
-
-/* This function doesn't reset the Cart memory, it is just called during a memory reset */
+
+/* This function doesn't reset the Cart memory, it is just called during a memory reset */
void action_replay_memory_reset(void)
{
#ifdef ACTION_REPLAY
}
#endif
#ifdef ACTION_REPLAY_HRTMON
- if ( hrtmemory )
+ if ( hrtmemory )
{
hrtmon_hide(); /* It is never really idle */
}
action_replay_checksum_info();
}
-uae_u8 *save_action_replay (int *len, uae_u8 *dstptr)
+uae_u8 *save_action_replay (int *len, uae_u8 *dstptr)
{
uae_u8 *dstbak,*dst;
uaecptr lc, pt;
int current_sample, last_sample;
int *voltbl;
- int state;
+ int state;
int per;
int vol;
int len, wlen;
static void namesplit (char *s)
{
int l;
-
+
l = strlen (s) - 1;
while (l >= 0) {
if (s[l] == '.')
data3 &= audio_channel[3].adk_mask;
data3p &= audio_channel[3].adk_mask;
- {
+ {
struct audio_channel_data *cdp;
unsigned long ratio, ratio1;
#define INTERVAL (scaled_sample_evtime * 3)
data1 &= audio_channel[1].adk_mask;
data2 &= audio_channel[2].adk_mask;
data3 &= audio_channel[3].adk_mask;
-
+
PUT_SOUND_WORD (data0 << 2);
PUT_SOUND_WORD (data1 << 2);
PUT_SOUND_WORD (data3 << 2);
PUT_SOUND_WORD (data2 << 2);
-
+
check_sound_buffers ();
}
data1 &= audio_channel[1].adk_mask;
data2 &= audio_channel[2].adk_mask;
data3 &= audio_channel[3].adk_mask;
-
+
data0 += data3;
{
uae_u32 data = SBASEVAL16(1) + data0;
data3 &= audio_channel[3].adk_mask;
data3p &= audio_channel[3].adk_mask;
- {
+ {
struct audio_channel_data *cdp;
unsigned long ratio, ratio1;
#define INTERVAL (scaled_sample_evtime * 3)
uae_u32 data = SBASEVAL16(1) + data1;
FINISH_DATA (data, 16, 1);
put_sound_word_right (data);
- }
+ }
check_sound_buffers ();
}
uae_u32 data = SBASEVAL16(1) + data1;
FINISH_DATA (data, 16, 1);
put_sound_word_right (data);
- }
+ }
check_sound_buffers ();
}
best = cdp->evtime;
eventtab[ev_audio].active = 1;
}
- }
+ }
}
eventtab[ev_audio].evtime = get_cycles () + best;
}
}
}
return;
-
+
case 3:
if (currprefs.produce_sound == 0)
cdp->per = PERIOD_MAX;
best_evtime = audio_channel[2].evtime;
if (audio_channel[3].evtime != MAX_EV && best_evtime > audio_channel[3].evtime)
best_evtime = audio_channel[3].evtime;
-
+
if (currprefs.produce_sound > 1 && best_evtime > next_sample_evtime)
best_evtime = next_sample_evtime;
void audio_hsync (int dmaaction)
{
int nr, handle;
-
+
if (currprefs.produce_sound == 0)
return;
#include "osdep/exectasks.h"
/* We'll need a lot of these. */
-#define MAX_TRAPS 4096
+#define MAX_TRAPS 4096
static TrapFunction traps[MAX_TRAPS];
static int trapmode[MAX_TRAPS];
static const char *trapstr[MAX_TRAPS];
/* Stack management */
-/* The mechanism for doing m68k calls from native code is as follows:
+/* The mechanism for doing m68k calls from native code is as follows:
*
* m68k code executes, stack is main
* calltrap to execute_fn_on_extra_stack. new stack is allocated
return;
}
#ifdef BLITTER_DEBUG
- if (!blitter_dontdo)
+ if (!blitter_dontdo)
actually_do_blit();
else
bltstate = BLT_done;
+ (blit_filltable[d >> 8][ifemode + fc1][0] << 8));
blitfc = blit_filltable[d >> 8][ifemode + fc1][1];
}
-
+
if (ddat)
blt_info.blitzero = 0;
{
int i;
- blitline = bltcon1 & 1;
+ blitline = bltcon1 & 1;
blitfill = bltcon1 & 0x18;
blitdesc = bltcon1 & 2;
blit_ch = (bltcon0 & 0x0f00) >> 8;
blit_last_hpos = hpos;
blit_cyclecounter = 0;
- reset_blit (1|2);
+ reset_blit (1|2);
if (blitline) {
blitsing = bltcon1 & 0x2;
{
static int oddfstrt, oddfstop, ototal, ofree;
static int slow;
-
+
if (!totalcycles || ddfstrt < 0 || ddfstop < 0)
return;
if (ddfstrt != oddfstrt || ddfstop != oddfstop || totalcycles != ototal || ofree != freecycles) {
{ // Task with same name already exists -> use same dtable
if (sb1->dtable[sd-1] != INVALID_SOCKET)
return sb1->dtable[sd-1];
- }
+ }
nsb = sb1->next;
}
sb->ownertask = gettask ();
m68k_dreg (regs, 0) = -1;
- sb->signal = CallLib (get_long (4), -0x14A);
+ sb->signal = CallLib (get_long (4), -0x14A); /* AllocSignal */
if (sb->signal == -1) {
write_log ("bsdsocket: ERROR: Couldn't allocate signal for task 0x%lx.\n", sb->ownertask);
struct socketbase *get_socketbase (void)
{
- /* @@@ make portable for sizeof(void *) != sizeof(uae_u32) */
- return (struct socketbase *) get_long (m68k_areg (regs, 6) + offsetof (struct UAEBSDBase, sb));
+ int i;
+ uae_u32 p[sizeof(void*) / 4];
+
+ for (i = 0; i < (sizeof p) / 4; i++)
+ p[i] = get_long (m68k_areg (regs, 6) + offsetof (struct UAEBSDBase, sb) + i * 4);
+ return *((struct socketbase**)p);
}
static void free_socketbase (void)
static uae_u32 bsdsocklib_Open (void)
{
uae_u32 result = 0;
- int opencount;
+ int opencount, i;
SB;
+ uae_u32 p[sizeof (void*) / 4];
locksigqueue ();
m68k_areg (regs, 2) = 0;
m68k_dreg (regs, 0) = sizeof (struct UAEBSDBase);
m68k_dreg (regs, 1) = 0;
- result = CallLib (get_long (4), -0x54);
+ result = CallLib (get_long (4), -0x54); /* MakeLibrary */
- /* @@@ make portable for sizeof(void *) != sizeof(uae_u32) */
- put_long (result + offsetof (struct UAEBSDBase, sb), (uae_u32) sb);
+ *((struct socketbase**)p) = sb;
+ for (i = 0; i < (sizeof p) / 4; i++)
+ put_long(result + offsetof (struct UAEBSDBase, sb) + i * 4, p[i]);
TRACE (("%0lx [%d]\n", result, opencount));
} else
return sb->resultval;
}
-/* recv(s, buf, len, flags)(d0/a0/d1/d2) */
+/* recv(s, buf, len, flags)(d0/a0/d1/d2) */
static uae_u32 bsdsocklib_recv (void)
{
SB = get_socketbase ();
uae_u32 strErrptr;
-#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
-#define TAG_IGNORE (1L) /* ignore this item, not end of array */
+#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
+#define TAG_IGNORE (1L) /* ignore this item, not end of array */
#define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems */
-#define TAG_SKIP (3L) /* skip this and the next ti_Data items */
+#define TAG_SKIP (3L) /* skip this and the next ti_Data items */
#define TAG_USER ((uae_u32)(1L<<31))
#define SBTF_VAL 0x0000
m68k_areg (regs, 0) = functable;
m68k_areg (regs, 1) = datatable;
m68k_areg (regs, 2) = 0;
- m68k_dreg (regs, 0) = LIBRARY_SIZEOF;
+ m68k_dreg (regs, 0) = sizeof (struct UAEBSDBase);
m68k_dreg (regs, 1) = 0;
- tmp1 = CallLib (m68k_areg (regs, 6), -0x54);
+ tmp1 = CallLib (m68k_areg (regs, 6), -0x54); /* MakeLibrary */
if (!tmp1) {
write_log ("bsdoscket: FATAL: Cannot create bsdsocket.library!\n");
return 0;
}
m68k_areg (regs, 1) = tmp1;
- CallLib (m68k_areg (regs, 6), -0x18c);
+ CallLib (m68k_areg (regs, 6), -0x18c); /* AddLibrary */
SockLibBase = tmp1;
-#if 0
- m68k_areg (regs, 1) = ds ("dos.library");
- m68k_dreg (regs, 0) = 0;
- dosbase = CallLib (m68k_areg (regs, 6), -552);
- printf ("%08lx\n", dosbase);
-#endif
/* Install error strings in Amiga memory */
- tmp1 = 0;
+ tmp1 = 0;
for (i = number_sys_error; i--;)
tmp1 += strlen (errortexts[i])+1;
m68k_dreg (regs, 0) = tmp1;
m68k_dreg (regs, 1) = 0;
- tmp1 = CallLib (get_long (4), -0xC6);
+ tmp1 = CallLib (get_long (4), -0xC6); /* AllocMem */
if (!tmp1) {
write_log ("bsdsocket: FATAL: Ran out of memory while creating bsdsocket.library!\n");
{
case 0x17: /* SCSI STATUS */
return 0x22;
-
+
default:
return dmacmemory[0x93];
}
va_end (parms);
}
+void cfgfile_target_write (struct zfile *f, char *format,...)
+{
+ va_list parms;
+ char tmp[CONFIG_BLEN];
+
+ va_start (parms, format);
+ vsprintf (tmp + strlen (TARGET_NAME) + 1, format, parms);
+ memcpy (tmp, TARGET_NAME, strlen (TARGET_NAME));
+ tmp[strlen (TARGET_NAME)] = '.';
+ zfile_fwrite (tmp, 1, strlen (tmp), f);
+ va_end (parms);
+}
+
static void save_options (struct zfile *f, struct uae_prefs *p, int type)
{
struct strlist *sl;
cfgfile_write (f, "config_version=%d.%d.%d\n", UAEMAJOR, UAEMINOR, UAESUBREV);
cfgfile_write (f, "config_hardware_path=%s\n", p->config_hardware_path);
cfgfile_write (f, "config_host_path=%s\n", p->config_host_path);
-
+
for (sl = p->all_lines; sl; sl = sl->next) {
if (sl->unknown)
cfgfile_write (f, "%s=%s\n", sl->option, sl->value);
cfgfile_write (f, "sound_channels=%s\n", stereomode[p->sound_stereo]);
cfgfile_write (f, "sound_stereo_separation=%d\n", p->sound_stereo_separation);
cfgfile_write (f, "sound_stereo_mixing_delay=%d\n", p->sound_mixed_stereo >= 0 ? p->sound_mixed_stereo : 0);
-
+
cfgfile_write (f, "sound_max_buff=%d\n", p->sound_maxbsiz);
cfgfile_write (f, "sound_frequency=%d\n", p->sound_freq);
cfgfile_write (f, "sound_interpol=%s\n", interpolmode[p->sound_interpol]);
cfgfile_write (f, "comp_nf=%s\n", p->compnf ? "true" : "false");
cfgfile_write (f, "comp_constjump=%s\n", p->comp_constjump ? "true" : "false");
cfgfile_write (f, "comp_oldsegv=%s\n", p->comp_oldsegv ? "true" : "false");
-
+
cfgfile_write (f, "comp_flushmode=%s\n", flushmode[p->comp_hardflush]);
cfgfile_write (f, "compforcesettings=%s\n", p->compforcesettings ? "true" : "false");
cfgfile_write (f, "compfpu=%s\n", p->compfpu ? "true" : "false");
#endif
cfgfile_write (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false");
- cfgfile_write (f, "fast_copper=%s\n", p->fast_copper ? "true" : "false");
cfgfile_write (f, "ntsc=%s\n", p->ntscmode ? "true" : "false");
cfgfile_write (f, "genlock=%s\n", p->genlock ? "true" : "false");
cfgfile_write (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false");
else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0
|| strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0)
*location = 0;
- else
+ else {
write_log ("Option `%s' requires a value of either `yes' or `no'.\n", option);
+ return -1;
+ }
return 1;
}
value += 2, base = 16;
*location = strtol (value, &endptr, base) * scale;
- if (*endptr != '\0' || *value == '\0')
+ if (*endptr != '\0' || *value == '\0') {
write_log ("Option `%s' requires a numeric argument.\n", option);
+ return -1;
+ }
return 1;
}
return 0;
write_log ("Unknown value for option `%s'.\n", option);
- return 1;
+ return -1;
}
*location = val;
return 1;
|| cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode1, 1)
|| cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode2, 0))
return 1;
-
+
#ifdef GFXFILTER
if (strcmp (option,"gfx_filter") == 0) {
char tmpbuf[CONFIG_BLEN];
if (cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits)
- || cfgfile_yesno (option, value, "fast_copper", &p->fast_copper)
|| cfgfile_yesno (option, value, "kickshifter", &p->kickshifter)
|| cfgfile_yesno (option, value, "ntsc", &p->ntscmode)
|| cfgfile_yesno (option, value, "genlock", &p->genlock)
char *dname, *aname, *root, *fs;
char *tmpp = strchr (value, ',');
char *str;
-
+
config_newfilesystem = 1;
if (tmpp == 0)
goto invalid_fs;
if (p->gfx_linedbl == 3) {
write_log ("You can't use both 'd' and 'D' modifiers in the display mode specification.\n");
}
-
+
free (x0);
return;
#ifdef __DOS__
{
char *tmp;
-
+
while ((tmp = strchr (s2, '\\')))
*tmp = '/';
}
write_log ("Usage: [-m | -M] VOLNAME:mount_point\n");
}
}
-
+
static void parse_hardfile_spec (char *spec)
{
char *x0 = my_strdup (spec);
write_log ("CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n");
return;
}
-
+
p->cpu_level = *spec++ - '0';
p->address_space_24 = p->cpu_level < 2;
p->cpu_compatible = 0;
cnt_ok++;
break;
}
- }
+ }
}
- }
+ }
p = nextp;
}
xfree (tmp);
static struct zfile *configstore;
static char *configsearch;
static int configsearchfound;
-
+
err = 0;
argv = 0;
p = 0;
}
goto end;
}
-
+
if (size > 10000)
return 10;
p = xmalloc (size + 1);
char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
char *path = 0;
int i;
-
+
tmp2[0] = 0;
i = 0;
while (rom[i] >= 0) {
for (i = 0;i < 10; i++)
p->optcount[i] = -1;
p->optcount[0] = 4; /* How often a block has to be executed before it
- is translated */
- p->optcount[1] = 0; /* How often to use the naive translation */
- p->optcount[2] = 0;
+ * is translated */
+ p->optcount[1] = 0; /* How often to use the naive translation */
+ p->optcount[2] = 0;
p->optcount[3] = 0;
p->optcount[4] = 0;
p->optcount[5] = 0;
p->leds_on_screen = 0;
p->keyboard_leds_in_use = 0;
p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0;
- p->fast_copper = 1;
p->scsi = 0;
p->cpu_idle = 0;
p->catweasel = 0;
p->chipset_mask = CSMASK_ECS_AGNUS;
p->immediate_blits = 0;
p->collision_level = 2;
- p->fast_copper = 1;
p->produce_sound = 3;
p->scsi = 0;
p->cpu_idle = 0;
{
case 0:
p->cpu_cycle_exact = p->blitter_cycle_exact = 1;
- p->fast_copper = 0;
break;
case 1:
- p->fast_copper = 0;
break;
case 2:
p->cpu_compatible = 0;
set_68000_compa (p, compa);
p->dfxtype[1] = -1;
return configure_rom (p, roms, romcheck);
-}
+}
static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[4];
-
+
roms[0] = 6;
roms[1] = 32;
roms[2] = -1;
static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck)
{
int roms[2];
-
+
buildin_default_prefs_68020 (p);
roms[0] = 18;
roms[1] = -1;
#endif
ciaadra = val; bfe001_change (); break;
case 3:
- ciaadrb = val;
+ ciaadrb = val;
#ifdef DONGLE_DEBUG
if (notinrom ())
write_log ("BFE301 W %02.2X %s\n", val, debuginfo(0));
if (! ersatzkickfile)
map_overlay (0);
#ifdef SERIAL_PORT
- if (currprefs.use_serial && !savestate_state)
+ if (currprefs.use_serial && !savestate_state)
serial_dtr_off (); /* Drop DTR at reset */
#endif
if (savestate_state) {
{
struct zfile *f;
int offset = addr & CDTV_NVRAM_MASK;
- if (offset >= CDTV_NVRAM_SIZE) return;
- if (cdtv_battram[offset] == v) return;
+ if (offset >= CDTV_NVRAM_SIZE)
+ return;
+ if (cdtv_battram[offset] == v)
+ return;
cdtv_battram[offset] = v;
f = zfile_fopen (currprefs.flashfile,"rb+");
if (!f)
uae_u8 v;
int offset;
offset = addr & CDTV_NVRAM_MASK;
- if (offset >= CDTV_NVRAM_SIZE) return 0;
- v = cdtv_battram[offset];
+ if (offset >= CDTV_NVRAM_SIZE)
+ return 0;
+ v = cdtv_battram[offset];
return v;
}
#endif
b = restore_u8 (); /* F CRB */
if (num) ciabcrb = b; else ciaacrb = b;
-/* CIA internal data */
+ /* CIA internal data */
b = restore_u8 (); /* ICR MASK */
if (num) ciabimask = b; else ciaaimask = b;
b = num ? ciabprb : ciaaprb; /* 1 PRB */
save_u8 (b);
b = num ? ciabdra : ciaadra; /* 2 DDRA */
- save_u8 (b);
+ save_u8 (b);
b = num ? ciabdrb : ciaadrb; /* 3 DDRB */
save_u8 (b);
t = (num ? ciabta - ciabta_passed : ciaata - ciaata_passed);/* 4 TA */
#define CLOBBER_SHRL clobber_flags()
#define CLOBBER_SHRA clobber_flags()
#define CLOBBER_TEST clobber_flags()
-#define CLOBBER_CL16
-#define CLOBBER_CL8
+#define CLOBBER_CL16
+#define CLOBBER_CL8
#define CLOBBER_SE16
#define CLOBBER_SE8
#define CLOBBER_ZE16
* Actual encoding of the instructions on the target CPU *
*************************************************************************/
-static int have_cmov=0; /* We need to generate different code if
- we don't have cmov */
-
#include "compemu_optimizer_x86.c"
static uae_u16 swap16(uae_u16 x)
}
else { /* replacement using branch and mov */
int uncc=(cc^1);
- emit_byte(0x70+uncc);
+ emit_byte(0x70+uncc);
emit_byte(2); /* skip next 2 bytes if not cc=true */
emit_byte(0x89);
emit_byte(0xc0+8*s+d);
{
int isebp=(baser==5)?0x40:0;
int fi;
-
+
switch(factor) {
case 1: fi=0; break;
case 2: fi=1; break;
{
int fi;
int isebp;
-
+
switch(factor) {
case 1: fi=0; break;
case 2: fi=1; break;
default: abort();
}
isebp=(baser==5)?0x40:0;
-
+
emit_byte(0x66);
emit_byte(0x8b);
emit_byte(0x04+8*d+isebp);
default: abort();
}
-
+
isebp=(baser==5)?0x40:0;
emit_byte(0x89);
case 2: fi=1; break;
case 4: fi=2; break;
case 8: fi=3; break;
- default:
+ default:
fprintf(stderr,"Bad factor %d in mov_l_rm_indexed!\n",factor);
abort();
}
case 2: fi=1; break;
case 4: fi=2; break;
case 8: fi=3; break;
- default:
+ default:
fprintf(stderr,"Bad factor %d in mov_l_rm_indexed!\n",factor);
abort();
}
}
else { /* replacement using branch and mov */
int uncc=(cond^1);
- emit_byte(0x70+uncc);
+ emit_byte(0x70+uncc);
emit_byte(7); /* skip next 7 bytes if not cc=true */
emit_byte(0x8b);
emit_byte(0x04+8*d);
}
else { /* replacement using branch and mov */
int uncc=(cond^1);
- emit_byte(0x70+uncc);
+ emit_byte(0x70+uncc);
emit_byte(6); /* skip next 6 bytes if not cc=true */
emit_byte(0x8b);
emit_byte(0x05+8*d);
LOWFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
{
int fi;
-
+
switch(factor) {
case 1: fi=0; break;
case 2: fi=1; break;
{
int isebp=(s==5)?0x40:0;
int fi;
-
+
switch(factor) {
case 1: fi=0; break;
case 2: fi=1; break;
}
LENDFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
-LOWFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
{
emit_byte(0x81);
emit_byte(0x05);
emit_long(d);
emit_long(s);
}
-LENDFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
+LENDFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
-LOWFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
{
emit_byte(0x66);
emit_byte(0x81);
emit_long(d);
emit_word(s);
}
-LENDFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
+LENDFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
-LOWFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
+LOWFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
{
emit_byte(0x80);
emit_byte(0x05);
emit_long(d);
emit_byte(s);
}
-LENDFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
+LENDFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
LOWFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
{
LOWFUNC(WRITE,READ,4,raw_cmp_l_rm_indexed,(R4 d, IMM offset, R4 index, IMM factor))
{
int fi;
-
+
switch(factor) {
case 1: fi=0; break;
case 2: fi=1; break;
static __inline__ void raw_jnz_l_oponly(void)
{
lopt_emit_all();
- emit_byte(0x0f);
- emit_byte(0x85);
+ emit_byte(0x0f);
+ emit_byte(0x85);
}
static __inline__ void raw_jcc_l_oponly(int cc)
{
lopt_emit_all();
- emit_byte(0x0f);
- emit_byte(0x80+cc);
+ emit_byte(0x0f);
+ emit_byte(0x80+cc);
}
static __inline__ void raw_jnz_b_oponly(void)
{
lopt_emit_all();
- emit_byte(0x75);
+ emit_byte(0x75);
}
static __inline__ void raw_jz_b_oponly(void)
{
lopt_emit_all();
- emit_byte(0x74);
+ emit_byte(0x74);
}
static __inline__ void raw_jmp_l_oponly(void)
{
lopt_emit_all();
- emit_byte(0xe9);
+ emit_byte(0xe9);
}
static __inline__ void raw_jmp_b_oponly(void)
{
lopt_emit_all();
- emit_byte(0xeb);
+ emit_byte(0xeb);
}
static __inline__ void raw_ret(void)
{
lopt_emit_all();
- emit_byte(0xc3);
+ emit_byte(0xc3);
}
static __inline__ void raw_nop(void)
{
raw_lahf(0); /* Most flags in AH */
//raw_setcc(r,0); /* V flag in AL */
- raw_setcc_m((uae_u32)live.state[FLAGTMP].mem,0);
-
+ raw_setcc_m((uae_u32)live.state[FLAGTMP].mem,0);
+
#if 1 /* Let's avoid those nasty partial register stalls */
//raw_mov_b_mr((uae_u32)live.state[FLAGTMP].mem,r);
raw_mov_b_mr(((uae_u32)live.state[FLAGTMP].mem)+1,r+4);
static uae_u8 *veccode;
#ifdef _WIN32
+
+#if defined(CPU_64_BIT)
+#define ctxPC (pContext->Rip)
+#else
+#define ctxPC (pContext->Eip)
+#endif
+
int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
{
PEXCEPTION_RECORD pExceptRecord = NULL;
int j;
if( n_except != STATUS_ACCESS_VIOLATION || !canbang)
- return EXCEPTION_CONTINUE_SEARCH;
+ return EXCEPTION_CONTINUE_SEARCH;
pExceptRecord = blah->ExceptionRecord;
pContext = blah->ContextRecord;
if( pContext )
{
- i = (uae_u8 *)(pContext->Eip);
+ i = (uae_u8 *)ctxPC;
}
if( pExceptRecord )
{
#ifdef JIT_DEBUG
write_log("JIT: fault address is 0x%x at 0x%x\n",addr,i);
#endif
- if (!canbang || !currprefs.cachesize)
+ if (!canbang || !currprefs.cachesize)
{
#ifdef JIT_DEBUG
write_log("JIT: Not happy! Canbang or cachesize is 0 in SIGSEGV handler!\n");
return EXCEPTION_CONTINUE_SEARCH;
}
- if (in_handler)
+ if (in_handler)
write_log("JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
-
+
if (canbang && i>=compiled_code && i<=current_compile_p) {
if (*i==0x66) {
i++;
size=2;
len++;
}
-
+
switch(i[0]) {
case 0x8a:
if ((i[1]&0xc0)==0x80) {
dir=SIG_READ;
len+=2;
break;
- default:
+ default:
break;
}
break;
break;
}
break;
- }
+ }
}
-
- if (r!=-1) {
+
+ if (r!=-1) {
void* pr=NULL;
#ifdef JIT_DEBUG
write_log("register was %d, direction was %d, size was %d\n",r,dir,size);
#endif
switch(r) {
+#if defined(CPU_64_BIT)
+ case 0: pr=&(pContext->Rax); break;
+ case 1: pr=&(pContext->Rcx); break;
+ case 2: pr=&(pContext->Rdx); break;
+ case 3: pr=&(pContext->Rbx); break;
+ case 4: pr=(size>1)?NULL:(((uae_u8*)&(pContext->Rax))+1); break;
+ case 5: pr=(size>1)?
+ (void*)(&(pContext->Rbp)):
+ (void*)(((uae_u8*)&(pContext->Rcx))+1); break;
+ case 6: pr=(size>1)?
+ (void*)(&(pContext->Rsi)):
+ (void*)(((uae_u8*)&(pContext->Rdx))+1); break;
+ case 7: pr=(size>1)?
+ (void*)(&(pContext->Rdi)):
+ (void*)(((uae_u8*)&(pContext->Rbx))+1); break;
+#else
case 0: pr=&(pContext->Eax); break;
case 1: pr=&(pContext->Ecx); break;
case 2: pr=&(pContext->Edx); break;
case 7: pr=(size>1)?
(void*)(&(pContext->Edi)):
(void*)(((uae_u8*)&(pContext->Ebx))+1); break;
+#endif
default: abort();
}
if (pr) {
blockinfo* bi;
-
+
if (currprefs.comp_oldsegv) {
addr-=(uae_u32)NATMEM_OFFSET;
-
+
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log("Suspicious address 0x%x in SEGV handler.\n",addr);
- }
+ }
#endif
if (dir==SIG_READ) {
switch(size) {
#endif
fflush(stdout);
segvcount++;
- pContext->Eip+=len;
+ ctxPC+=len;
}
else {
void* tmp=target;
int i;
uae_u8 vecbuf[5];
-
+
addr-=(uae_u32)NATMEM_OFFSET;
-
+
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log("Suspicious address 0x%x in SEGV handler.\n",addr);
- }
+ }
#endif
-
- target=(uae_u8*)pContext->Eip;
+
+ target=(uae_u8*)ctxPC;
for (i=0;i<5;i++)
vecbuf[i]=target[i];
emit_byte(0xe9);
write_log("Handled one access!\n");
#endif
segvcount++;
-
+
target=veccode;
-
+
if (dir==SIG_READ) {
switch(size) {
case 1: raw_mov_b_ri(r,get_byte(addr)); break;
}
}
for (i=0;i<5;i++)
- raw_mov_b_mi(pContext->Eip+i,vecbuf[i]);
+ raw_mov_b_mi(ctxPC+i,vecbuf[i]);
raw_mov_l_mi((uae_u32)&in_handler,0);
emit_byte(0xe9);
- emit_long(pContext->Eip+len-(uae_u32)target-4);
+ emit_long(ctxPC+len-(uae_u32)target-4);
in_handler=1;
target=tmp;
}
bi=active;
while (bi) {
- if (bi->handler &&
+ if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
#ifdef JIT_DEBUG
is in the dormant list */
bi=dormant;
while (bi) {
- if (bi->handler &&
+ if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
#ifdef JIT_DEBUG
int dir=-1;
int len=0;
int j;
-
+
write_log("fault address is %08x at %08x\n",sc.cr2,sc.eip);
- if (!canbang)
+ if (!canbang)
write_log("Not happy! Canbang is 0 in SIGSEGV handler!\n");
- if (in_handler)
+ if (in_handler)
write_log("Argh --- Am already in a handler. Shouldn't happen!\n");
if (canbang && i>=compiled_code && i<=current_compile_p) {
size=2;
len++;
}
-
+
switch(i[0]) {
case 0x8a:
if ((i[1]&0xc0)==0x80) {
dir=SIG_READ;
len+=2;
break;
- default:
+ default:
break;
}
break;
-
+
case 0x89:
switch(i[1]&0xc0) {
case 0x80:
break;
}
break;
- }
+ }
}
- if (r!=-1) {
+ if (r!=-1) {
void* pr=NULL;
write_log("register was %d, direction was %d, size was %d\n",r,dir,size);
-
+
switch(r) {
case 0: pr=&(sc.eax); break;
case 1: pr=&(sc.ecx); break;
if (currprefs.comp_oldsegv) {
addr-=NATMEM_OFFSET;
-
+
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log("Suspicious address in %x SEGV handler.\n",addr);
void* tmp=target;
int i;
uae_u8 vecbuf[5];
-
+
addr-=NATMEM_OFFSET;
-
+
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log("Suspicious address 0x%x in SEGV handler.\n",addr);
}
-
+
target=(uae_u8*)sc.eip;
for (i=0;i<5;i++)
vecbuf[i]=target[i];
write_log("Handled one access!\n");
fflush(stdout);
segvcount++;
-
+
target=veccode;
if (dir==SIG_READ) {
}
bi=active;
while (bi) {
- if (bi->handler &&
+ if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
write_log("deleted trigger (%p<%p<%p) %p\n",
is in the dormant list */
bi=dormant;
while (bi) {
- if (bi->handler &&
+ if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
write_log("deleted trigger (%p<%p<%p) %p\n",
#endif
#endif
+/*************************************************************************
+ * Checking for CPU features *
+ *************************************************************************/
+
+struct cpuinfo_x86 {
+ uae_u8 x86; // CPU family
+ uae_u8 x86_vendor; // CPU vendor
+ uae_u8 x86_processor; // CPU canonical processor type
+ uae_u8 x86_brand_id; // CPU BrandID if supported, yield 0 otherwise
+ uae_u32 x86_hwcap;
+ uae_u8 x86_model;
+ uae_u8 x86_mask;
+ int cpuid_level; // Maximum supported CPUID level, -1=no CPUID
+ char x86_vendor_id[16];
+};
+struct cpuinfo_x86 cpuinfo;
+
+enum {
+ X86_VENDOR_INTEL = 0,
+ X86_VENDOR_CYRIX = 1,
+ X86_VENDOR_AMD = 2,
+ X86_VENDOR_UMC = 3,
+ X86_VENDOR_NEXGEN = 4,
+ X86_VENDOR_CENTAUR = 5,
+ X86_VENDOR_RISE = 6,
+ X86_VENDOR_TRANSMETA = 7,
+ X86_VENDOR_NSC = 8,
+ X86_VENDOR_UNKNOWN = 0xff
+};
+
+enum {
+ X86_PROCESSOR_I386, /* 80386 */
+ X86_PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
+ X86_PROCESSOR_PENTIUM,
+ X86_PROCESSOR_PENTIUMPRO,
+ X86_PROCESSOR_K6,
+ X86_PROCESSOR_ATHLON,
+ X86_PROCESSOR_PENTIUM4,
+ X86_PROCESSOR_K8,
+ X86_PROCESSOR_max
+};
+
+static const char * x86_processor_string_table[X86_PROCESSOR_max] = {
+ "80386",
+ "80486",
+ "Pentium",
+ "PentiumPro",
+ "K6",
+ "Athlon",
+ "Pentium4",
+ "K8"
+};
+
+static struct ptt {
+ const int align_loop;
+ const int align_loop_max_skip;
+ const int align_jump;
+ const int align_jump_max_skip;
+ const int align_func;
+}
+x86_alignments[X86_PROCESSOR_max] = {
+ { 4, 3, 4, 3, 4 },
+ { 16, 15, 16, 15, 16 },
+ { 16, 7, 16, 7, 16 },
+ { 16, 15, 16, 7, 16 },
+ { 32, 7, 32, 7, 32 },
+ { 16, 7, 16, 7, 16 },
+ { 0, 0, 0, 0, 0 },
+ { 16, 7, 16, 7, 16 }
+};
+
+static void
+x86_get_cpu_vendor(struct cpuinfo_x86 *c)
+{
+ char *v = c->x86_vendor_id;
+
+ if (!strcmp(v, "GenuineIntel"))
+ c->x86_vendor = X86_VENDOR_INTEL;
+ else if (!strcmp(v, "AuthenticAMD"))
+ c->x86_vendor = X86_VENDOR_AMD;
+ else if (!strcmp(v, "CyrixInstead"))
+ c->x86_vendor = X86_VENDOR_CYRIX;
+ else if (!strcmp(v, "Geode by NSC"))
+ c->x86_vendor = X86_VENDOR_NSC;
+ else if (!strcmp(v, "UMC UMC UMC "))
+ c->x86_vendor = X86_VENDOR_UMC;
+ else if (!strcmp(v, "CentaurHauls"))
+ c->x86_vendor = X86_VENDOR_CENTAUR;
+ else if (!strcmp(v, "NexGenDriven"))
+ c->x86_vendor = X86_VENDOR_NEXGEN;
+ else if (!strcmp(v, "RiseRiseRise"))
+ c->x86_vendor = X86_VENDOR_RISE;
+ else if (!strcmp(v, "GenuineTMx86") ||
+ !strcmp(v, "TransmetaCPU"))
+ c->x86_vendor = X86_VENDOR_TRANSMETA;
+ else
+ c->x86_vendor = X86_VENDOR_UNKNOWN;
+}
+
+static void cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
+{
+ const int CPUID_SPACE = 4096;
+ uae_u8* cpuid_space = cache_alloc(CPUID_SPACE);
+ static uae_u32 s_op, s_eax, s_ebx, s_ecx, s_edx;
+ uae_u8* tmp=get_target();
+
+ s_op = op;
+ set_target(cpuid_space);
+ raw_push_l_r(0); /* eax */
+ raw_push_l_r(1); /* ecx */
+ raw_push_l_r(2); /* edx */
+ raw_push_l_r(3); /* ebx */
+ raw_mov_l_rm(0,(uintptr)&s_op);
+ raw_cpuid(0);
+ raw_mov_l_mr((uintptr)&s_eax,0);
+ raw_mov_l_mr((uintptr)&s_ebx,3);
+ raw_mov_l_mr((uintptr)&s_ecx,1);
+ raw_mov_l_mr((uintptr)&s_edx,2);
+ raw_pop_l_r(3);
+ raw_pop_l_r(2);
+ raw_pop_l_r(1);
+ raw_pop_l_r(0);
+ raw_ret();
+ set_target(tmp);
+
+ ((cpuop_func*)cpuid_space)(0);
+ if (eax != NULL) *eax = s_eax;
+ if (ebx != NULL) *ebx = s_ebx;
+ if (ecx != NULL) *ecx = s_ecx;
+ if (edx != NULL) *edx = s_edx;
+
+ cache_free (cpuid_space);
+}
+
+static void raw_init_cpu(void)
+{
+ struct cpuinfo_x86 *c = &cpuinfo;
+ uae_u32 xlvl;
+
+ /* Defaults */
+ c->x86_processor = X86_PROCESSOR_max;
+ c->x86_vendor = X86_VENDOR_UNKNOWN;
+ c->cpuid_level = -1; /* CPUID not detected */
+ c->x86_model = c->x86_mask = 0; /* So far unknown... */
+ c->x86_vendor_id[0] = '\0'; /* Unset */
+ c->x86_hwcap = 0;
+
+ /* Get vendor name */
+ c->x86_vendor_id[12] = '\0';
+ cpuid(0x00000000,
+ (uae_u32 *)&c->cpuid_level,
+ (uae_u32 *)&c->x86_vendor_id[0],
+ (uae_u32 *)&c->x86_vendor_id[8],
+ (uae_u32 *)&c->x86_vendor_id[4]);
+ x86_get_cpu_vendor(c);
+
+ /* Intel-defined flags: level 0x00000001 */
+ c->x86_brand_id = 0;
+ if ( c->cpuid_level >= 0x00000001 ) {
+ uae_u32 tfms, brand_id;
+ cpuid(0x00000001, &tfms, &brand_id, NULL, &c->x86_hwcap);
+ c->x86 = (tfms >> 8) & 15;
+ c->x86_model = (tfms >> 4) & 15;
+ c->x86_brand_id = brand_id & 0xff;
+ if ( (c->x86_vendor == X86_VENDOR_AMD) &&
+ (c->x86 == 0xf)) {
+ /* AMD Extended Family and Model Values */
+ c->x86 += (tfms >> 20) & 0xff;
+ c->x86_model += (tfms >> 12) & 0xf0;
+ }
+ c->x86_mask = tfms & 15;
+ } else {
+ /* Have CPUID level 0 only - unheard of */
+ c->x86 = 4;
+ }
+
+ /* AMD-defined flags: level 0x80000001 */
+ cpuid(0x80000000, &xlvl, NULL, NULL, NULL);
+ if ( (xlvl & 0xffff0000) == 0x80000000 ) {
+ if ( xlvl >= 0x80000001 ) {
+ uae_u32 features;
+ cpuid(0x80000001, NULL, NULL, NULL, &features);
+ if (features & (1 << 29)) {
+ /* Assume x86-64 if long mode is supported */
+ c->x86_processor = X86_PROCESSOR_K8;
+ }
+ }
+ }
+
+ /* Canonicalize processor ID */
+ switch (c->x86) {
+ case 3:
+ c->x86_processor = X86_PROCESSOR_I386;
+ break;
+ case 4:
+ c->x86_processor = X86_PROCESSOR_I486;
+ break;
+ case 5:
+ if (c->x86_vendor == X86_VENDOR_AMD)
+ c->x86_processor = X86_PROCESSOR_K6;
+ else
+ c->x86_processor = X86_PROCESSOR_PENTIUM;
+ break;
+ case 6:
+ if (c->x86_vendor == X86_VENDOR_AMD)
+ c->x86_processor = X86_PROCESSOR_ATHLON;
+ else
+ c->x86_processor = X86_PROCESSOR_PENTIUMPRO;
+ break;
+ case 15:
+ if (c->x86_vendor == X86_VENDOR_INTEL) {
+ /* Assume any BrandID >= 8 and family == 15 yields a Pentium 4 */
+ if (c->x86_brand_id >= 8)
+ c->x86_processor = X86_PROCESSOR_PENTIUM4;
+ }
+ if (c->x86_vendor == X86_VENDOR_AMD) {
+ /* Assume an Athlon processor if family == 15 and it was not
+ detected as an x86-64 so far */
+ if (c->x86_processor == X86_PROCESSOR_max)
+ c->x86_processor = X86_PROCESSOR_ATHLON;
+ }
+ break;
+ }
+ if (c->x86_processor == X86_PROCESSOR_max) {
+ write_log ("Error: unknown processor type\n");
+ write_log ("..Family : %d\n", c->x86);
+ write_log ("..Model : %d\n", c->x86_model);
+ write_log ("..Mask : %d\n", c->x86_mask);
+ write_log (" Vendor : %s [%d]\n", c->x86_vendor_id, c->x86_vendor);
+ if (c->x86_brand_id)
+ write_log(" BrandID : %02x\n", c->x86_brand_id);
+ abort();
+ }
+
+ /* Have CMOV support? */
+ have_cmov = c->x86_hwcap & (1 << 15);
+
+ /* Can the host CPU suffer from partial register stalls? */
+ have_rat_stall = (c->x86_vendor == X86_VENDOR_INTEL);
+#if 1
+ /* It appears that partial register writes are a bad idea even on
+ AMD K7 cores, even though they are not supposed to have the
+ dreaded rat stall. Why? Anyway, that's why we lie about it ;-) */
+ if (c->x86_processor == X86_PROCESSOR_ATHLON)
+ have_rat_stall = 1;
+#endif
+
+ /* Alignments */
+ if (tune_alignment) {
+ align_loops = x86_alignments[c->x86_processor].align_loop;
+ align_jumps = x86_alignments[c->x86_processor].align_jump;
+ }
+
+ write_log("Max CPUID level=%d Processor is %s [%s]\n",
+ c->cpuid_level, c->x86_vendor_id,
+ x86_processor_string_table[c->x86_processor]);
+}
+
+#if 0
+static int target_check_bsf(void)
+{
+ int mismatch = 0;
+ for (int g_ZF = 0; g_ZF <= 1; g_ZF++) {
+ for (int g_CF = 0; g_CF <= 1; g_CF++) {
+ for (int g_OF = 0; g_OF <= 1; g_OF++) {
+ for (int g_SF = 0; g_SF <= 1; g_SF++) {
+ for (int value = -1; value <= 1; value++) {
+ unsigned long flags = (g_SF << 7) | (g_OF << 11) | (g_ZF << 6) | g_CF;
+ unsigned long tmp = value;
+ __asm__ __volatile__ ("push %0; popf; bsf %1,%1; pushf; pop %0"
+ : "+r" (flags), "+r" (tmp) : : "cc");
+ int OF = (flags >> 11) & 1;
+ int SF = (flags >> 7) & 1;
+ int ZF = (flags >> 6) & 1;
+ int CF = flags & 1;
+ tmp = (value == 0);
+ if (ZF != tmp || SF != g_SF || OF != g_OF || CF != g_CF)
+ mismatch = true;
+ }
+ }}}}
+ if (mismatch)
+ write_log("Target CPU defines all flags on BSF instruction\n");
+ return !mismatch;
+}
+#endif
+
+#if 0
+
/*************************************************************************
* Checking for CPU features *
*************************************************************************/
{
x86_regs x;
uae_u32 maxlev;
-
+
x=cpuid(0);
maxlev=x.eax;
write_log("Max CPUID level=%d Processor is %c%c%c%c%c%c%c%c%c%c%c%c\n",
if (maxlev>=1) {
x=cpuid(1);
- if (x.edx&(1<<15))
+ if (x.edx&(1<<15))
have_cmov=1;
}
have_rat_stall=1;
have_rat_stall=1;
#endif
}
+#endif
/*************************************************************************
* FPU stuff *
static __inline__ void raw_fp_init(void)
{
int i;
-
+
for (i=0;i<N_FREGS;i++)
live.spos[i]=-2;
live.tos=-1; /* Stack is empty */
emit_byte(0xd8+(live.tos+1)-live.spos[r]);
/* store top of stack in reg and pop it*/
}
-
-
+
+
LOWFUNC(NONE,WRITE,2,raw_fmov_mr,(MEMW m, FR r))
{
make_tos(r);
{
int rs;
- /* Stupid x87 can't write a long double to mem without popping the
+ /* Stupid x87 can't write a long double to mem without popping the
stack! */
usereg(r);
rs=stackpos(r);
make_tos(d);
emit_byte(0xd9);
emit_byte(0xfa); /* fsqrt y=sqrt(x) */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_fsqrt_rr,(FW d, FR s))
make_tos(d);
emit_byte(0xd9);
emit_byte(0xe1); /* fabs y=abs(x) */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_fabs_rr,(FW d, FR s))
make_tos(d);
emit_byte(0xd9);
emit_byte(0xfc); /* frndint y=int(x) */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_frndint_rr,(FW d, FR s))
ds=stackpos(s);
emit_byte(0xd9);
emit_byte(0xc0+ds); /* fld x */
- emit_byte(0xd9);
- emit_byte(0xf4); /* fxtract exp push man */
- emit_byte(0xdd);
- emit_byte(0xd8); /* fstp just pop man */
+ emit_byte(0xd9);
+ emit_byte(0xf4); /* fxtract exp push man */
+ emit_byte(0xdd);
+ emit_byte(0xd8); /* fstp just pop man */
tos_make(d); /* store exp to destination */
}
else {
make_tos(d); /* tos=x=y */
- emit_byte(0xd9);
- emit_byte(0xf4); /* fxtract exp push man */
- emit_byte(0xdd);
- emit_byte(0xd8); /* fstp just pop man */
- }
+ emit_byte(0xd9);
+ emit_byte(0xf4); /* fxtract exp push man */
+ emit_byte(0xdd);
+ emit_byte(0xd8); /* fstp just pop man */
+ }
}
LENDFUNC(NONE,NONE,2,raw_fgetexp_rr,(FW d, FR s))
ds=stackpos(s);
emit_byte(0xd9);
emit_byte(0xc0+ds); /* fld x */
- emit_byte(0xd9);
- emit_byte(0xf4); /* fxtract exp push man */
- emit_byte(0xdd);
- emit_byte(0xd9); /* fstp copy man up & pop */
+ emit_byte(0xd9);
+ emit_byte(0xf4); /* fxtract exp push man */
+ emit_byte(0xdd);
+ emit_byte(0xd9); /* fstp copy man up & pop */
tos_make(d); /* store man to destination */
}
else {
make_tos(d); /* tos=x=y */
- emit_byte(0xd9);
- emit_byte(0xf4); /* fxtract exp push man */
- emit_byte(0xdd);
- emit_byte(0xd9); /* fstp copy man up & pop */
- }
+ emit_byte(0xd9);
+ emit_byte(0xf4); /* fxtract exp push man */
+ emit_byte(0xdd);
+ emit_byte(0xd9); /* fstp copy man up & pop */
+ }
}
LENDFUNC(NONE,NONE,2,raw_fgetman_rr,(FW d, FR s))
make_tos(d);
emit_byte(0xd9);
emit_byte(0xfe); /* fsin y=sin(x) */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_fsin_rr,(FW d, FR s))
make_tos(d);
emit_byte(0xd9);
emit_byte(0xff); /* fcos y=cos(x) */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_fcos_rr,(FW d, FR s))
ds=stackpos(s);
emit_byte(0xd9);
emit_byte(0xc0+ds); /* fld x */
- emit_byte(0xd9);
- emit_byte(0xf2); /* fptan tan(x)=y/1.0 */
- emit_byte(0xdd);
- emit_byte(0xd8); /* fstp pop 1.0 */
+ emit_byte(0xd9);
+ emit_byte(0xf2); /* fptan tan(x)=y/1.0 */
+ emit_byte(0xdd);
+ emit_byte(0xd8); /* fstp pop 1.0 */
tos_make(d); /* store to destination */
}
else {
make_tos(d);
- emit_byte(0xd9);
- emit_byte(0xf2); /* fptan tan(x)=y/1.0 */
- emit_byte(0xdd);
- emit_byte(0xd8); /* fstp pop 1.0 */
- }
+ emit_byte(0xd9);
+ emit_byte(0xf2); /* fptan tan(x)=y/1.0 */
+ emit_byte(0xdd);
+ emit_byte(0xd8); /* fstp pop 1.0 */
+ }
}
LENDFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
return; /* occupy both regs directly */
}
if (live.spos[c]<0) {
- emit_byte(0xd9);
- emit_byte(0xc9); /* fxch swap cos(x) with sin(x) */
- emit_byte(0xdd); /* store sin(x) to d & pop */
- emit_byte(0xd8+(live.tos+2)-live.spos[d]);
+ emit_byte(0xd9);
+ emit_byte(0xc9); /* fxch swap cos(x) with sin(x) */
+ emit_byte(0xdd); /* store sin(x) to d & pop */
+ emit_byte(0xd8+(live.tos+2)-live.spos[d]);
live.tos++; /* occupy a reg for cos(x) here */
live.spos[c]=live.tos;
live.onstack[live.tos]=c;
}
else {
- emit_byte(0xdd); /* store cos(x) to c & pop */
- emit_byte(0xd8+(live.tos+2)-live.spos[c]);
- tos_make(d); /* store sin(x) to destination */
+ emit_byte(0xdd); /* store cos(x) to c & pop */
+ emit_byte(0xd8+(live.tos+2)-live.spos[c]);
+ tos_make(d); /* store sin(x) to destination */
}
}
LENDFUNC(NONE,NONE,3,raw_fsincos_rr,(FW d, FW c, FR s))
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("fscale found x in TOS-1 and y in TOS\n");
- emit_byte(0xd9);
- emit_byte(0xfd); /* fscale y*(2^x) */
+ //write_log ("fscale found x in TOS-1 and y in TOS\n");
+ emit_byte(0xd9);
+ emit_byte(0xfd); /* fscale y*(2^x) */
}
else {
- make_tos(s); /* tos=x */
- ds=stackpos(d);
- emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld y */
- emit_byte(0xd9);
- emit_byte(0xfd); /* fscale y*(2^x) */
- tos_make(d); /* store y=y*(2^x) */
+ make_tos(s); /* tos=x */
+ ds=stackpos(d);
+ emit_byte(0xd9);
+ emit_byte(0xc0+ds); /* fld y */
+ emit_byte(0xd9);
+ emit_byte(0xfd); /* fscale y*(2^x) */
+ tos_make(d); /* store y=y*(2^x) */
}
}
LENDFUNC(NONE,NONE,2,raw_fscale_rr,(FRW d, FR s))
tos_make(d); /* store y=10^x */
}
LENDFUNC(NONE,NONE,2,raw_ftentox_rr,(FW d, FR s))
-
+
LOWFUNC(NONE,NONE,2,raw_flog2_rr,(FW d, FR s))
{
int ds;
tos_make(d); /* store y=acos(x) */
}
LENDFUNC(NONE,NONE,2,raw_facos_rr,(FW d, FR s))
-
+
LOWFUNC(NONE,NONE,2,raw_fatan_rr,(FW d, FR s))
{
int ds;
tos_make(d); /* store y=atanh(x) */
}
LENDFUNC(NONE,NONE,2,raw_fatanh_rr,(FW d, FR s))
-
+
LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
{
int ds,tr;
emit_byte(0xdd);
emit_byte(0xd1); /* fst copy x*log2(e) */
if (tr>=0) {
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap with temp-reg */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0xf4); /* add -12 to esp */
- emit_byte(0xdb);
- emit_byte(0x3c);
- emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap with temp-reg */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0xf4); /* add -12 to esp */
+ emit_byte(0xdb);
+ emit_byte(0x3c);
+ emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
}
emit_byte(0xd9);
emit_byte(0xe0); /* fchs -x*log2(e) */
emit_byte(0xdd);
emit_byte(0xd9); /* fstp copy e^x & pop */
if (tr>=0) {
- emit_byte(0xdb);
- emit_byte(0x2c);
- emit_byte(0x24); /* fld load temp-reg from [esp] */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0x0c); /* add +12 to esp */
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
- emit_byte(0xde);
- emit_byte(0xe9); /* fsubp (e^x)-(e^-x) */
+ emit_byte(0xdb);
+ emit_byte(0x2c);
+ emit_byte(0x24); /* fld load temp-reg from [esp] */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0x0c); /* add +12 to esp */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
+ emit_byte(0xde);
+ emit_byte(0xe9); /* fsubp (e^x)-(e^-x) */
}
else {
- emit_byte(0xde);
- emit_byte(0xe1); /* fsubrp (e^x)-(e^-x) */
+ emit_byte(0xde);
+ emit_byte(0xe1); /* fsubrp (e^x)-(e^-x) */
}
emit_byte(0xd9);
emit_byte(0xe8); /* fld 1.0 */
tos_make(d); /* store y=sinh(x) */
}
LENDFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
-
+
LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
{
int ds,tr;
emit_byte(0xdd);
emit_byte(0xd1); /* fst copy x*log2(e) */
if (tr>=0) {
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap with temp-reg */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0xf4); /* add -12 to esp */
- emit_byte(0xdb);
- emit_byte(0x3c);
- emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap with temp-reg */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0xf4); /* add -12 to esp */
+ emit_byte(0xdb);
+ emit_byte(0x3c);
+ emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
}
emit_byte(0xd9);
emit_byte(0xe0); /* fchs -x*log2(e) */
emit_byte(0xdd);
emit_byte(0xd9); /* fstp copy e^x & pop */
if (tr>=0) {
- emit_byte(0xdb);
- emit_byte(0x2c);
- emit_byte(0x24); /* fld load temp-reg from [esp] */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0x0c); /* add +12 to esp */
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
+ emit_byte(0xdb);
+ emit_byte(0x2c);
+ emit_byte(0x24); /* fld load temp-reg from [esp] */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0x0c); /* add +12 to esp */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
}
emit_byte(0xde);
emit_byte(0xc1); /* faddp (e^x)+(e^-x) */
tos_make(d); /* store y=cosh(x) */
}
LENDFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
-
+
LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
{
int ds,tr;
emit_byte(0xdd);
emit_byte(0xd1); /* fst copy x*log2(e) */
if (tr>=0) {
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap with temp-reg */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0xf4); /* add -12 to esp */
- emit_byte(0xdb);
- emit_byte(0x3c);
- emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap with temp-reg */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0xf4); /* add -12 to esp */
+ emit_byte(0xdb);
+ emit_byte(0x3c);
+ emit_byte(0x24); /* fstp store temp-reg to [esp] & pop */
}
emit_byte(0xd9);
emit_byte(0xe0); /* fchs -x*log2(e) */
emit_byte(0xde);
emit_byte(0xe9); /* fsubp (e^x)-(e^-x) */
if (tr>=0) {
- emit_byte(0xdb);
- emit_byte(0x2c);
- emit_byte(0x24); /* fld load temp-reg from [esp] */
- emit_byte(0x83);
- emit_byte(0xc4);
- emit_byte(0x0c); /* add +12 to esp */
- emit_byte(0xd9);
- emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
- emit_byte(0xde);
- emit_byte(0xf9); /* fdivp ((e^x)-(e^-x))/((e^x)+(e^-x)) */
+ emit_byte(0xdb);
+ emit_byte(0x2c);
+ emit_byte(0x24); /* fld load temp-reg from [esp] */
+ emit_byte(0x83);
+ emit_byte(0xc4);
+ emit_byte(0x0c); /* add +12 to esp */
+ emit_byte(0xd9);
+ emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
+ emit_byte(0xde);
+ emit_byte(0xf9); /* fdivp ((e^x)-(e^-x))/((e^x)+(e^-x)) */
}
else {
- emit_byte(0xde);
- emit_byte(0xf1); /* fdivrp ((e^x)-(e^-x))/((e^x)+(e^-x)) */
+ emit_byte(0xde);
+ emit_byte(0xf1); /* fdivrp ((e^x)-(e^-x))/((e^x)+(e^-x)) */
}
tos_make(d); /* store y=tanh(x) */
}
make_tos(d);
emit_byte(0xd9);
emit_byte(0xe0); /* take fchs */
- }
+ }
}
LENDFUNC(NONE,NONE,2,raw_fneg_rr,(FW d, FR s))
else {
make_tos(d);
ds=stackpos(s);
-
+
emit_byte(0xd8);
emit_byte(0xc0+ds); /* add source to dest*/
}
LOWFUNC(NONE,NONE,2,raw_fsub_rr,(FRW d, FR s))
{
int ds;
-
+
if (live.spos[s]==live.tos) {
/* Source is on top of stack */
ds=stackpos(d);
else {
make_tos(d);
ds=stackpos(s);
-
+
emit_byte(0xd8);
emit_byte(0xe0+ds); /* sub src from dest */
}
LOWFUNC(NONE,NONE,2,raw_fcmp_rr,(FR d, FR s))
{
int ds;
-
+
make_tos(d);
ds=stackpos(s);
LOWFUNC(NONE,NONE,2,raw_fmul_rr,(FRW d, FR s))
{
int ds;
-
+
if (live.spos[s]==live.tos) {
/* Source is on top of stack */
ds=stackpos(d);
else {
make_tos(d);
ds=stackpos(s);
-
+
emit_byte(0xd8);
emit_byte(0xc8+ds); /* mul dest by source*/
}
LOWFUNC(NONE,NONE,2,raw_fdiv_rr,(FRW d, FR s))
{
int ds;
-
+
if (live.spos[s]==live.tos) {
/* Source is on top of stack */
ds=stackpos(d);
else {
make_tos(d);
ds=stackpos(s);
-
+
emit_byte(0xd8);
emit_byte(0xf0+ds); /* div dest by source*/
}
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("frem found x in TOS-1 and y in TOS\n");
- emit_byte(0xd9);
- emit_byte(0xf8); /* fprem rem(y/x) */
+ //write_log ("frem found x in TOS-1 and y in TOS\n");
+ emit_byte(0xd9);
+ emit_byte(0xf8); /* fprem rem(y/x) */
}
else {
- make_tos(s); /* tos=x */
- ds=stackpos(d);
- emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld y */
- emit_byte(0xd9);
- emit_byte(0xf8); /* fprem rem(y/x) */
- tos_make(d); /* store y=rem(y/x) */
+ make_tos(s); /* tos=x */
+ ds=stackpos(d);
+ emit_byte(0xd9);
+ emit_byte(0xc0+ds); /* fld y */
+ emit_byte(0xd9);
+ emit_byte(0xf8); /* fprem rem(y/x) */
+ tos_make(d); /* store y=rem(y/x) */
}
}
LENDFUNC(NONE,NONE,2,raw_frem_rr,(FRW d, FR s))
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("frem1 found x in TOS-1 and y in TOS\n");
- emit_byte(0xd9);
- emit_byte(0xf5); /* fprem1 rem1(y/x) */
+ //write_log ("frem1 found x in TOS-1 and y in TOS\n");
+ emit_byte(0xd9);
+ emit_byte(0xf5); /* fprem1 rem1(y/x) */
}
else {
- make_tos(s); /* tos=x */
- ds=stackpos(d);
- emit_byte(0xd9);
- emit_byte(0xc0+ds); /* fld y */
- emit_byte(0xd9);
- emit_byte(0xf5); /* fprem1 rem1(y/x) */
- tos_make(d); /* store y=rem(y/x) */
+ make_tos(s); /* tos=x */
+ ds=stackpos(d);
+ emit_byte(0xd9);
+ emit_byte(0xc0+ds); /* fld y */
+ emit_byte(0xd9);
+ emit_byte(0xf5); /* fprem1 rem1(y/x) */
+ tos_make(d); /* store y=rem(y/x) */
}
}
LENDFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s))
emit_byte(0xd9);
emit_byte(0xc9+p); /* swap top two around */
if (have_cmov) {
- // gb-- fucomi is for P6 cores only, not K6-2 then...
+ // gb-- fucomi is for P6 cores only, not K6-2 then...
emit_byte(0xdb);
emit_byte(0xe9+p); /* fucomi them */
}
else {
- emit_byte(0xdd);
- emit_byte(0xe1+p); /* fucom them */
- emit_byte(0x9b);
- emit_byte(0xdf);
- emit_byte(0xe0); /* fstsw ax */
- raw_sahf(0); /* sahf */
+ emit_byte(0xdd);
+ emit_byte(0xe1+p); /* fucom them */
+ emit_byte(0x9b);
+ emit_byte(0xdf);
+ emit_byte(0xe0); /* fstsw ax */
+ raw_sahf(0); /* sahf */
}
emit_byte(0xdd);
emit_byte(0xd9+p); /* store value back, and get rid of 0 */
#define readmem_special readmem
#define USE_MATCHSTATE 0
-#define setzflg_uses_bsf 0
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
static uae_u8* max_compile_start;
uae_u8* compiled_code=NULL;
static uae_s32 reg_alloc_run;
-static int have_rat_stall=0;
+
+static int lazy_flush = 1; // Flag: lazy translation cache invalidation
+static int avoid_fpu = 1; // Flag: compile FPU instructions ?
+static int have_cmov = 0; // target has CMOV instructions ?
+static int have_rat_stall = 1; // target has partial register stalls ?
+const int tune_alignment = 1; // Tune code alignments for running CPU ?
+const int tune_nop_fillers = 1; // Tune no-op fillers for architecture
+
+static int setzflg_uses_bsf = 0; // setzflg virtual instruction can use native BSF instruction correctly?
+static int align_loops = 32; // Align the start of loops
+static int align_jumps = 32; // Align the start of jumps
void* pushall_call_handler=NULL;
static void* popall_do_nothing=NULL;
/* Some arithmetic ooperations can be optimized away if the operands
are known to be constant. But that's only a good idea when the
side effects they would have on the flags are not important. This
- variable indicates whether we need the side effects or not
+ variable indicates whether we need the side effects or not
*/
uae_u32 needflags=0;
Then again, sometimes we do x86 instructions that clobber the x86
flags, but don't represent a corresponding m68k instruction. In that
- case, we have to save them.
+ case, we have to save them.
We used to save them to the stack, but now store them back directly
into the regflags.cznv of the traditional emulation. Thus some odd
track of the respective states.
To make things worse, we might or might not be interested in the flags.
- by default, we are, but a call to dont_care_flags can change that
+ by default, we are, but a call to dont_care_flags can change that
until the next call to live_flags. If we are not, pretty much whatever
is in the register and/or the native flags is seen as valid.
*/
return NULL;
}
-
+
/*******************************************************************
* All sorts of list related functions for all of the lists *
*******************************************************************/
{
uae_u32 cl=cacheline(bi->pc_p);
- if (bi->prev_same_cl_p)
+ if (bi->prev_same_cl_p)
*(bi->prev_same_cl_p)=bi->next_same_cl;
if (bi->next_same_cl)
bi->next_same_cl->prev_same_cl_p=bi->prev_same_cl_p;
- if (cache_tags[cl+1].bi)
+ if (cache_tags[cl+1].bi)
cache_tags[cl].handler=cache_tags[cl+1].bi->handler_to_use;
- else
+ else
cache_tags[cl].handler=popall_execute_normal;
}
static __inline__ void remove_from_list(blockinfo* bi)
{
- if (bi->prev_p)
+ if (bi->prev_p)
*(bi->prev_p)=bi->next;
if (bi->next)
bi->next->prev_p=bi->prev_p;
static __inline__ void add_to_cl_list(blockinfo* bi)
{
uae_u32 cl=cacheline(bi->pc_p);
-
+
if (cache_tags[cl+1].bi)
cache_tags[cl+1].bi->prev_same_cl_p=&(bi->next_same_cl);
bi->next_same_cl=cache_tags[cl+1].bi;
static __inline__ void add_to_active(blockinfo* bi)
{
- if (active)
+ if (active)
active->prev_p=&(bi->next);
bi->next=active;
static __inline__ void add_to_dormant(blockinfo* bi)
{
- if (dormant)
+ if (dormant)
dormant->prev_p=&(bi->next);
bi->next=dormant;
static __inline__ void remove_dep(dependency* d)
{
- if (d->prev_p)
+ if (d->prev_p)
*(d->prev_p)=d->next;
if (d->next)
d->next->prev_p=d->prev_p;
//printf("x is %p\n",x);
//printf("x->next is %p\n",x->next);
//printf("x->prev_p is %p\n",x->prev_p);
-
+
if (x->jmp_off) {
adjust_jmpdep(x,dh);
}
static __inline__ void create_jmpdep(blockinfo* bi, int i, uae_u32* jmpaddr, uae_u32 target)
{
blockinfo* tbi=get_blockinfo_addr((void*)target);
-
+
Dif(!tbi) {
printf("Could not create jmpdep!\n");
abort();
bi->dep[i].jmp_off=jmpaddr;
bi->dep[i].target=tbi;
bi->dep[i].next=tbi->deplist;
- if (bi->dep[i].next)
+ if (bi->dep[i].next)
bi->dep[i].next->prev_p=&(bi->dep[i].next);
bi->dep[i].prev_p=&(tbi->deplist);
tbi->deplist=&(bi->dep[i]);
}
}
printf("count=%d\n",count);
- for (i=0;i<N_REGS;i++) { // FIXME --- don't do dirty yet
+ for (i=0;i<N_REGS;i++) { // FIXME --- don't do dirty yet
s->nat[i].dirtysize=0;
- }
+ }
}
static __inline__ void attached_state(blockinfo* bi)
int i;
#if USE_OPTIMIZER
- if (reg_alloc_run)
+ if (reg_alloc_run)
return NULL;
#endif
if (!bi) {
for (i=0;i<MAX_HOLD_BI && !bi;i++) {
if (hold_bi[i]) {
uae_u32 cl=cacheline(addr);
-
+
bi=hold_bi[i];
hold_bi[i]=NULL;
bi->pc_p=addr;
invalidate_block(bi);
add_to_active(bi);
add_to_cl_list(bi);
-
+
}
}
}
static void prepare_block(blockinfo* bi);
-static __inline__ void alloc_blockinfos(void)
+static __inline__ void alloc_blockinfos(void)
{
int i;
blockinfo* bi;
return;
bi=hold_bi[i]=(blockinfo*)current_compile_p;
current_compile_p+=sizeof(blockinfo);
-
+
prepare_block(bi);
}
}
currprefs.comp_midopt=changed_prefs.comp_midopt;
currprefs.comp_lowopt=changed_prefs.comp_lowopt;
- if ( ( !canbang || !currprefs.cachesize ) &&
+ if ( ( !canbang || !currprefs.cachesize ) &&
currprefs.comptrustbyte != 1 )
{
// Set all of these to indirect when canbang == 0
if (!currprefs.compforcesettings && !have_done_picasso) {
int stop=0;
- if (currprefs.comptrustbyte!=0 && currprefs.comptrustbyte!=3)
+ if (currprefs.comptrustbyte!=0 && currprefs.comptrustbyte!=3)
stop = 1, write_log("<JIT compiler> : comptrustbyte is not 'direct' or 'afterpic'\n");
- if (currprefs.comptrustword!=0 && currprefs.comptrustword!=3)
+ if (currprefs.comptrustword!=0 && currprefs.comptrustword!=3)
stop = 1, write_log("<JIT compiler> : comptrustword is not 'direct' or 'afterpic'\n");
- if (currprefs.comptrustlong!=0 && currprefs.comptrustlong!=3)
+ if (currprefs.comptrustlong!=0 && currprefs.comptrustlong!=3)
stop = 1, write_log("<JIT compiler> : comptrustlong is not 'direct' or 'afterpic'\n");
- if (currprefs.comptrustnaddr!=0 && currprefs.comptrustnaddr!=3)
+ if (currprefs.comptrustnaddr!=0 && currprefs.comptrustnaddr!=3)
stop = 1, write_log("<JIT compiler> : comptrustnaddr is not 'direct' or 'afterpic'\n");
- if (currprefs.compnf!=1)
+ if (currprefs.compnf!=1)
stop = 1, write_log("<JIT compiler> : compnf is not 'yes'\n");
- if (currprefs.cachesize<1024)
+ if (currprefs.cachesize<1024)
stop = 1, write_log("<JIT compiler> : cachesize is less than 1024\n");
- if (currprefs.comp_hardflush)
+ if (currprefs.comp_hardflush)
stop = 1, write_log("<JIT compiler> : comp_flushmode is 'hard'\n");
- if (!canbang)
+ if (!canbang)
stop = 1, write_log("<JIT compiler> : Cannot use most direct memory access,\n"
" and unable to recover from failed guess!\n");
#if 0
((oldv<<8)&0xff0000) | ((oldv<<24)&0xff000000);
}
-
+
void set_target(uae_u8* t)
{
lopt_emit_all();
static __inline__ void log_dump(void)
{
int i;
-
+
return;
write_log("----------------------\n");
live.nat[rr].nholds==1 &&
!live.nat[rr].locked) {
// printf("RemovingA offset %x from reg %d (%d) at %p\n",
- // live.state[r].val,r,rr,target);
+ // live.state[r].val,r,rr,target);
adjust_nreg(rr,live.state[r].val);
live.state[r].val=0;
live.state[r].dirtysize=4;
badness=live.nat[i].touched;
if (live.nat[i].nholds==0)
badness=0;
- if (i==hint)
+ if (i==hint)
badness-=200000000;
if (!live.nat[i].locked && badness<when) {
if ((size==1 && live.nat[i].canbyte) ||
if (s==d)
return;
- if (nd>0)
+ if (nd>0)
free_nreg(d);
raw_mov_l_rr(d,s);
return;
for (i=0;i<live.nat[rr].nholds;i++) {
int vr=live.nat[rr].holds[i];
- if (vr!=r &&
+ if (vr!=r &&
(live.state[vr].status==DIRTY || live.state[vr].val))
ndirt++;
}
- if (!ndirt && size<live.state[r].validsize && !live.nat[rr].locked) {
+ if (!ndirt && size<live.state[r].validsize && !live.nat[rr].locked) {
/* Everything else is clean, so let's keep this register */
for (i=0;i<live.nat[rr].nholds;i++) {
int vr=live.nat[rr].holds[i];
else
raw_mov_l_rr(nr,rr); /* Make another copy */
}
- unlock(rr);
+ unlock(rr);
}
static __inline__ void add_offset(int r, uae_u32 off)
return;
if (live.state[r].val==0)
return;
- if (isinreg(r) && live.state[r].validsize<4)
+ if (isinreg(r) && live.state[r].validsize<4)
evict(r);
- if (!isinreg(r))
+ if (!isinreg(r))
alloc_reg_hinted(r,4,0,spec);
Dif (live.state[r].validsize!=4) {
/* make_exclusive might have done the job already */
if (live.state[r].val==0)
return;
-
+
rr=live.state[r].realreg;
if (live.nat[rr].nholds==1) {
//printf("RemovingB offset %x from reg %d (%d) at %p\n",
- // live.state[r].val,r,rr,target);
+ // live.state[r].val,r,rr,target);
adjust_nreg(rr,live.state[r].val);
live.state[r].dirtysize=4;
live.state[r].val=0;
{
int n;
int answer=-1;
-
+
if (live.state[r].status==UNDEF) {
printf("WARNING: Unexpected read of undefined register %d\n",r);
}
if (!can_offset)
remove_offset(r,spec);
-
+
if (isinreg(r) && live.state[r].validsize>=size) {
n=live.state[r].realreg;
switch(size) {
- case 1:
- if (live.nat[n].canbyte || spec>=0) {
- answer=n;
+ case 1:
+ if (live.nat[n].canbyte || spec>=0) {
+ answer=n;
}
break;
- case 2:
- if (live.nat[n].canword || spec>=0) {
- answer=n;
+ case 2:
+ if (live.nat[n].canword || spec>=0) {
+ answer=n;
}
break;
- case 4:
- answer=n;
+ case 4:
+ answer=n;
break;
default: abort();
}
if (answer<0)
evict(r);
}
- /* either the value was in memory to start with, or it was evicted and
+ /* either the value was in memory to start with, or it was evicted and
is in memory now */
if (answer<0) {
answer=alloc_reg_hinted(r,spec>=0?4:size,0,spec);
Dif (live.nat[n].nholds!=1)
abort();
switch(size) {
- case 1:
- if (live.nat[n].canbyte || spec>=0) {
+ case 1:
+ if (live.nat[n].canbyte || spec>=0) {
live.state[r].dirtysize=ndsize;
live.state[r].validsize=nvsize;
answer=n;
}
break;
- case 2:
- if (live.nat[n].canword || spec>=0) {
+ case 2:
+ if (live.nat[n].canword || spec>=0) {
live.state[r].dirtysize=ndsize;
live.state[r].validsize=nvsize;
answer=n;
}
break;
- case 4:
+ case 4:
live.state[r].dirtysize=ndsize;
live.state[r].validsize=nvsize;
answer=n;
if (answer<0)
evict(r);
}
- /* either the value was in memory to start with, or it was evicted and
+ /* either the value was in memory to start with, or it was evicted and
is in memory now */
if (answer<0) {
answer=alloc_reg_hinted(r,size,1,spec);
live.state[r].validsize=4;
live.state[r].dirtysize=size>live.state[r].dirtysize?size:live.state[r].dirtysize;
live.state[r].validsize=size>live.state[r].validsize?size:live.state[r].validsize;
-
+
live.nat[answer].locked++;
live.nat[answer].touched=touchcnt++;
if (size==4) {
{
int n;
int answer=-1;
-
+
if (live.state[r].status==UNDEF) {
printf("WARNING: Unexpected read of undefined register %d\n",r);
}
abort();
switch(rsize) {
- case 1:
- if (live.nat[n].canbyte || spec>=0) {
- answer=n;
+ case 1:
+ if (live.nat[n].canbyte || spec>=0) {
+ answer=n;
}
break;
- case 2:
- if (live.nat[n].canword || spec>=0) {
- answer=n;
+ case 2:
+ if (live.nat[n].canword || spec>=0) {
+ answer=n;
}
break;
- case 4:
- answer=n;
+ case 4:
+ answer=n;
break;
default: abort();
}
if (answer<0)
evict(r);
}
- /* either the value was in memory to start with, or it was evicted and
+ /* either the value was in memory to start with, or it was evicted and
is in memory now */
if (answer<0) {
answer=alloc_reg_hinted(r,spec>=0?4:rsize,0,spec);
return answer;
}
-static int rmw(int r, int wsize, int rsize)
+static int rmw(int r, int wsize, int rsize)
{
return rmw_general(r,wsize,rsize,-1);
}
-static int rmw_specific(int r, int wsize, int rsize, int spec)
+static int rmw_specific(int r, int wsize, int rsize, int spec)
{
return rmw_general(r,wsize,rsize,spec);
}
{
if (live.fate[r].status==DIRTY) {
#if USE_LONG_DOUBLE
- raw_fmov_ext_mr((uae_u32)live.fate[r].mem,live.fate[r].realreg);
+ raw_fmov_ext_mr((uae_u32)live.fate[r].mem,live.fate[r].realreg);
#else
- raw_fmov_mr((uae_u32)live.fate[r].mem,live.fate[r].realreg);
+ raw_fmov_mr((uae_u32)live.fate[r].mem,live.fate[r].realreg);
#endif
live.fate[r].status=CLEAN;
}
{
if (live.fate[r].status==DIRTY) {
#if USE_LONG_DOUBLE
- raw_fmov_ext_mr_drop((uae_u32)live.fate[r].mem,live.fate[r].realreg);
+ raw_fmov_ext_mr_drop((uae_u32)live.fate[r].mem,live.fate[r].realreg);
#else
- raw_fmov_mr_drop((uae_u32)live.fate[r].mem,live.fate[r].realreg);
+ raw_fmov_mr_drop((uae_u32)live.fate[r].mem,live.fate[r].realreg);
#endif
live.fate[r].status=INMEM;
}
}
live.fate[r].status=CLEAN;
}
- else {
+ else {
live.fate[r].status=DIRTY;
}
live.fate[r].realreg=bestreg;
if (f_isinreg(r)) {
n=live.fate[r].realreg;
- answer=n;
+ answer=n;
}
- /* either the value was in memory to start with, or it was evicted and
+ /* either the value was in memory to start with, or it was evicted and
is in memory now */
- if (answer<0)
+ if (answer<0)
answer=f_alloc_reg(r,0);
live.fat[answer].locked++;
if (vr!=r && live.fate[vr].status==DIRTY)
ndirt++;
}
- if (!ndirt && !live.fat[rr].locked) {
+ if (!ndirt && !live.fat[rr].locked) {
/* Everything else is clean, so let's keep this register */
for (i=0;i<live.fat[rr].nholds;i++) {
int vr=live.fat[rr].holds[i];
live.fate[r]=oldstate; /* Keep all the old state info */
live.fate[r].realreg=nr;
live.fate[r].realind=nind;
- f_unlock(rr);
+ f_unlock(rr);
}
if (f_isinreg(r)) {
n=live.fate[r].realreg;
}
- else
+ else
n=f_alloc_reg(r,0);
live.fate[r].status=DIRTY;
live.fat[n].locked++;
* CPU functions exposed to gencomp. Both CREATE and EMIT time *
********************************************************************/
-/*
+/*
* RULES FOR HANDLING REGISTERS:
*
- * * In the function headers, order the parameters
+ * * In the function headers, order the parameters
* - 1st registers written to
* - 2nd read/modify/write registers
* - 3rd registers read from
MIDFUNC(2,bt_l_ri,(R4 r, IMM i)) /* This is defined as only affecting C */
-{
+{
int size=4;
if (i<16)
size=2;
}
MENDFUNC(2,bt_l_rr,(R4 r, R4 b)) /* This is defined as only affecting C */
-MIDFUNC(2,btc_l_ri,(RW4 r, IMM i))
-{
+MIDFUNC(2,btc_l_ri,(RW4 r, IMM i))
+{
int size=4;
if (i<16)
size=2;
raw_btc_l_ri(r,i);
unlock(r);
}
-MENDFUNC(2,btc_l_ri,(RW4 r, IMM i))
+MENDFUNC(2,btc_l_ri,(RW4 r, IMM i))
-MIDFUNC(2,btc_l_rr,(RW4 r, R4 b))
+MIDFUNC(2,btc_l_rr,(RW4 r, R4 b))
{
CLOBBER_BT;
b=readreg(b,4);
unlock(r);
unlock(b);
}
-MENDFUNC(2,btc_l_rr,(RW4 r, R4 b))
+MENDFUNC(2,btc_l_rr,(RW4 r, R4 b))
-MIDFUNC(2,btr_l_ri,(RW4 r, IMM i))
-{
+MIDFUNC(2,btr_l_ri,(RW4 r, IMM i))
+{
int size=4;
if (i<16)
size=2;
raw_btr_l_ri(r,i);
unlock(r);
}
-MENDFUNC(2,btr_l_ri,(RW4 r, IMM i))
+MENDFUNC(2,btr_l_ri,(RW4 r, IMM i))
-MIDFUNC(2,btr_l_rr,(RW4 r, R4 b))
+MIDFUNC(2,btr_l_rr,(RW4 r, R4 b))
{
CLOBBER_BT;
b=readreg(b,4);
unlock(r);
unlock(b);
}
-MENDFUNC(2,btr_l_rr,(RW4 r, R4 b))
+MENDFUNC(2,btr_l_rr,(RW4 r, R4 b))
-MIDFUNC(2,bts_l_ri,(RW4 r, IMM i))
-{
+MIDFUNC(2,bts_l_ri,(RW4 r, IMM i))
+{
int size=4;
if (i<16)
size=2;
raw_bts_l_ri(r,i);
unlock(r);
}
-MENDFUNC(2,bts_l_ri,(RW4 r, IMM i))
+MENDFUNC(2,bts_l_ri,(RW4 r, IMM i))
-MIDFUNC(2,bts_l_rr,(RW4 r, R4 b))
+MIDFUNC(2,bts_l_rr,(RW4 r, R4 b))
{
CLOBBER_BT;
b=readreg(b,4);
unlock(r);
unlock(b);
}
-MENDFUNC(2,bts_l_rr,(RW4 r, R4 b))
+MENDFUNC(2,bts_l_rr,(RW4 r, R4 b))
MIDFUNC(2,mov_l_rm,(W4 d, IMM s))
{
}
MENDFUNC(1,call_r,(R4 r)) /* Clobbering is implicit */
-MIDFUNC(2,sub_l_mi,(IMM d, IMM s))
+MIDFUNC(2,sub_l_mi,(IMM d, IMM s))
{
CLOBBER_SUB;
raw_sub_l_mi(d,s) ;
}
-MENDFUNC(2,sub_l_mi,(IMM d, IMM s))
+MENDFUNC(2,sub_l_mi,(IMM d, IMM s))
-MIDFUNC(2,mov_l_mi,(IMM d, IMM s))
+MIDFUNC(2,mov_l_mi,(IMM d, IMM s))
{
CLOBBER_MOV;
raw_mov_l_mi(d,s) ;
}
-MENDFUNC(2,mov_l_mi,(IMM d, IMM s))
+MENDFUNC(2,mov_l_mi,(IMM d, IMM s))
-MIDFUNC(2,mov_w_mi,(IMM d, IMM s))
+MIDFUNC(2,mov_w_mi,(IMM d, IMM s))
{
CLOBBER_MOV;
raw_mov_w_mi(d,s) ;
}
-MENDFUNC(2,mov_w_mi,(IMM d, IMM s))
+MENDFUNC(2,mov_w_mi,(IMM d, IMM s))
-MIDFUNC(2,mov_b_mi,(IMM d, IMM s))
+MIDFUNC(2,mov_b_mi,(IMM d, IMM s))
{
CLOBBER_MOV;
raw_mov_b_mi(d,s) ;
}
-MENDFUNC(2,mov_b_mi,(IMM d, IMM s))
+MENDFUNC(2,mov_b_mi,(IMM d, IMM s))
MIDFUNC(2,rol_b_ri,(RW1 r, IMM i))
{
}
MENDFUNC(2,rol_l_ri,(RW4 r, IMM i))
-MIDFUNC(2,rol_l_rr,(RW4 d, R1 r))
-{
+MIDFUNC(2,rol_l_rr,(RW4 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(rol_l_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,rol_l_rr,(RW4 d, R1 r))
+MENDFUNC(2,rol_l_rr,(RW4 d, R1 r))
-MIDFUNC(2,rol_w_rr,(RW2 d, R1 r))
+MIDFUNC(2,rol_w_rr,(RW2 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(rol_w_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,rol_w_rr,(RW2 d, R1 r))
+MENDFUNC(2,rol_w_rr,(RW2 d, R1 r))
-MIDFUNC(2,rol_b_rr,(RW1 d, R1 r))
+MIDFUNC(2,rol_b_rr,(RW1 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(rol_b_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,rol_b_rr,(RW1 d, R1 r))
+MENDFUNC(2,rol_b_rr,(RW1 d, R1 r))
-MIDFUNC(2,shll_l_rr,(RW4 d, R1 r))
-{
+MIDFUNC(2,shll_l_rr,(RW4 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(shll_l_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shll_l_rr,(RW4 d, R1 r))
+MENDFUNC(2,shll_l_rr,(RW4 d, R1 r))
-MIDFUNC(2,shll_w_rr,(RW2 d, R1 r))
+MIDFUNC(2,shll_w_rr,(RW2 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shll_w_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shll_w_rr,(RW2 d, R1 r))
+MENDFUNC(2,shll_w_rr,(RW2 d, R1 r))
-MIDFUNC(2,shll_b_rr,(RW1 d, R1 r))
+MIDFUNC(2,shll_b_rr,(RW1 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shll_b_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shll_b_rr,(RW1 d, R1 r))
+MENDFUNC(2,shll_b_rr,(RW1 d, R1 r))
MIDFUNC(2,ror_b_ri,(R1 r, IMM i))
}
MENDFUNC(2,ror_l_ri,(R4 r, IMM i))
-MIDFUNC(2,ror_l_rr,(R4 d, R1 r))
-{
+MIDFUNC(2,ror_l_rr,(R4 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(ror_l_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,ror_l_rr,(R4 d, R1 r))
+MENDFUNC(2,ror_l_rr,(R4 d, R1 r))
-MIDFUNC(2,ror_w_rr,(R2 d, R1 r))
-{
+MIDFUNC(2,ror_w_rr,(R2 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(ror_w_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,ror_w_rr,(R2 d, R1 r))
+MENDFUNC(2,ror_w_rr,(R2 d, R1 r))
-MIDFUNC(2,ror_b_rr,(R1 d, R1 r))
-{
+MIDFUNC(2,ror_b_rr,(R1 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(ror_b_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,ror_b_rr,(R1 d, R1 r))
+MENDFUNC(2,ror_b_rr,(R1 d, R1 r))
-MIDFUNC(2,shrl_l_rr,(RW4 d, R1 r))
-{
+MIDFUNC(2,shrl_l_rr,(RW4 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(shrl_l_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shrl_l_rr,(RW4 d, R1 r))
+MENDFUNC(2,shrl_l_rr,(RW4 d, R1 r))
-MIDFUNC(2,shrl_w_rr,(RW2 d, R1 r))
+MIDFUNC(2,shrl_w_rr,(RW2 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shrl_w_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shrl_w_rr,(RW2 d, R1 r))
+MENDFUNC(2,shrl_w_rr,(RW2 d, R1 r))
-MIDFUNC(2,shrl_b_rr,(RW1 d, R1 r))
+MIDFUNC(2,shrl_b_rr,(RW1 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shrl_b_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shrl_b_rr,(RW1 d, R1 r))
+MENDFUNC(2,shrl_b_rr,(RW1 d, R1 r))
}
MENDFUNC(2,shra_b_ri,(RW1 r, IMM i))
-MIDFUNC(2,shra_l_rr,(RW4 d, R1 r))
-{
+MIDFUNC(2,shra_l_rr,(RW4 d, R1 r))
+{
if (isconst(r)) {
COMPCALL(shra_l_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shra_l_rr,(RW4 d, R1 r))
+MENDFUNC(2,shra_l_rr,(RW4 d, R1 r))
-MIDFUNC(2,shra_w_rr,(RW2 d, R1 r))
+MIDFUNC(2,shra_w_rr,(RW2 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shra_w_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shra_w_rr,(RW2 d, R1 r))
+MENDFUNC(2,shra_w_rr,(RW2 d, R1 r))
-MIDFUNC(2,shra_b_rr,(RW1 d, R1 r))
+MIDFUNC(2,shra_b_rr,(RW1 d, R1 r))
{ /* Can only do this with r==1, i.e. cl */
-
+
if (isconst(r)) {
COMPCALL(shra_b_ri)(d,(uae_u8)live.state[r].val);
return;
unlock(r);
unlock(d);
}
-MENDFUNC(2,shra_b_rr,(RW1 d, R1 r))
+MENDFUNC(2,shra_b_rr,(RW1 d, R1 r))
MIDFUNC(2,setcc,(W1 d, IMM cc))
are int trouble! */
s=d=rmw(s,4,1);
}
-
+
raw_sign_extend_8_rr(d,s);
if (!isrmw) {
are int trouble! */
s=d=rmw(s,4,1);
}
-
+
raw_zero_extend_8_rr(d,s);
if (!isrmw) {
index=readreg(index,4);
s=readreg(s,4);
- Dif (baser==s || index==s)
+ Dif (baser==s || index==s)
abort();
baser=readreg_offset(baser,4);
index=readreg_offset(index,4);
base+=get_offset(basereg);
- base+=factor*get_offset(indexreg);
+ base+=factor*get_offset(indexreg);
d=writereg(d,4);
raw_mov_l_brrm_indexed(d,base,baser,index,factor);
unlock(d);
baser=readreg_offset(baser,4);
index=readreg_offset(index,4);
base+=get_offset(basereg);
- base+=factor*get_offset(indexreg);
+ base+=factor*get_offset(indexreg);
d=writereg(d,2);
raw_mov_w_brrm_indexed(d,base,baser,index,factor);
unlock(d);
baser=readreg_offset(baser,4);
index=readreg_offset(index,4);
base+=get_offset(basereg);
- base+=factor*get_offset(indexreg);
+ base+=factor*get_offset(indexreg);
d=writereg(d,1);
raw_mov_b_brrm_indexed(d,base,baser,index,factor);
unlock(d);
s=readreg_offset(s,4);
offset+=get_offset(sreg);
d=writereg(d,4);
-
+
raw_mov_l_brR(d,s,offset);
unlock(d);
unlock(s);
live.state[r].val=reverse32(oldv);
return;
}
-
+
CLOBBER_SW32;
- r=rmw(r,4,4);
+ r=rmw(r,4,4);
raw_bswap_32(r);
unlock(r);
}
CLOBBER_SW16;
r=rmw(r,2,2);
-
+
raw_bswap_16(r);
unlock(r);
}
live.nat[s].holds[live.nat[s].nholds]=d;
live.nat[s].nholds++;
log_clobberreg(d);
-
+
/* printf("Added %d to nreg %d(%d), now holds %d regs\n",
d,s,live.state[d].realind,live.nat[s].nholds); */
unlock(s);
MENDFUNC(2,mov_b_ri,(W1 d, IMM s))
-MIDFUNC(2,add_l_mi,(IMM d, IMM s))
+MIDFUNC(2,add_l_mi,(IMM d, IMM s))
{
CLOBBER_ADD;
raw_add_l_mi(d,s) ;
}
-MENDFUNC(2,add_l_mi,(IMM d, IMM s))
+MENDFUNC(2,add_l_mi,(IMM d, IMM s))
-MIDFUNC(2,add_w_mi,(IMM d, IMM s))
+MIDFUNC(2,add_w_mi,(IMM d, IMM s))
{
CLOBBER_ADD;
raw_add_w_mi(d,s) ;
}
-MENDFUNC(2,add_w_mi,(IMM d, IMM s))
+MENDFUNC(2,add_w_mi,(IMM d, IMM s))
-MIDFUNC(2,add_b_mi,(IMM d, IMM s))
+MIDFUNC(2,add_b_mi,(IMM d, IMM s))
{
CLOBBER_ADD;
raw_add_b_mi(d,s) ;
}
-MENDFUNC(2,add_b_mi,(IMM d, IMM s))
+MENDFUNC(2,add_b_mi,(IMM d, IMM s))
MIDFUNC(2,test_l_ri,(R4 d, IMM i))
live.state[d].val-=i;
return;
}
-#if USE_OFFSET
+#if USE_OFFSET
if (!needflags) {
add_offset(d,-(signed)i);
return;
live.state[d].val+=i;
return;
}
-#if USE_OFFSET
+#if USE_OFFSET
if (!needflags) {
add_offset(d,i);
return;
int kill_rodent(int r)
{
- return KILLTHERAT &&
- have_rat_stall &&
- (live.state[r].status==INMEM ||
- live.state[r].status==CLEAN ||
- live.state[r].status==ISCONST ||
+ return KILLTHERAT &&
+ have_rat_stall &&
+ (live.state[r].status==INMEM ||
+ live.state[r].status==CLEAN ||
+ live.state[r].status==ISCONST ||
live.state[r].dirtysize==4);
}
uae_u32 get_const(int r)
{
#if USE_OPTIMIZER
- if (!reg_alloc_run)
+ if (!reg_alloc_run)
#endif
Dif (!isconst(r)) {
printf("Register %d should be constant, but isn't\n",r);
m68k_pc_offset=0;
}
}
-
+
/********************************************************************
* Support functions exposed to newcpu *
********************************************************************/
live.state[FLAGX].mem=&(regflags.x);
live.state[FLAGX].needflush=NF_TOMEM;
set_status(FLAGX,INMEM);
-
+
live.state[FLAGTMP].mem=&(regflags.cznv);
live.state[FLAGTMP].needflush=NF_TOMEM;
set_status(FLAGTMP,INMEM);
live.fat[i].nholds=0;
live.fat[i].locked=0;
}
-
+
touchcnt=1;
m68k_pc_offset=0;
live.flags_in_flags=TRASH;
abort();
}
n=vton[i];
- Dif (live.nat[n].nholds>1)
+ Dif (live.nat[n].nholds>1)
abort();
if (live.nat[n].nholds && depth<N_REGS) {
vinton(live.nat[n].holds[0],vton,depth+1);
int i;
int again=0;
- for (i=0;i<VREGS;i++)
+ for (i=0;i<VREGS;i++)
vton[i]=-1;
- for (i=0;i<N_REGS;i++)
- if (s->nat[i].validsize)
+ for (i=0;i<N_REGS;i++)
+ if (s->nat[i].validsize)
vton[s->nat[i].holds]=i;
flush_flags(); /* low level */
sync_m68k_pc(); /* mid level */
-
+
/* We don't do FREGS yet, so this is raw flush() code */
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_SCRATCH ||
+ if (live.fate[i].needflush==NF_SCRATCH ||
live.fate[i].status==CLEAN) {
f_disassociate(i);
}
}
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_TOMEM &&
+ if (live.fate[i].needflush==NF_TOMEM &&
live.fate[i].status==DIRTY) {
f_evict(i);
}
for (i=0;i<VREGS;i++) {
if (isinreg(i)) {
int n=live.state[i].realreg;
-
+
if (live.nat[n].nholds!=1) {
printf("Register %d isn't alone in nreg %d\n",
i,n);
if (isinreg(i) && vton[i]!=live.state[i].realreg)
vinton(i,vton,0);
}
-
+
/* And now we may need to load some registers from memory */
for (i=0;i<VREGS;i++) {
int n=vton[i];
void flush(int save_regs)
{
int fi,i;
-
+
log_flush();
flush_flags(); /* low level */
sync_m68k_pc(); /* mid level */
if (save_regs) {
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_SCRATCH ||
+ if (live.fate[i].needflush==NF_SCRATCH ||
live.fate[i].status==CLEAN) {
f_disassociate(i);
}
for (i=0;i<VREGS;i++) {
if (live.state[i].needflush==NF_TOMEM) {
switch(live.state[i].status) {
- case INMEM:
+ case INMEM:
if (live.state[i].val) {
raw_add_l_mi((uae_u32)live.state[i].mem,live.state[i].val);
live.state[i].val=0;
}
break;
- case CLEAN:
- case DIRTY:
+ case CLEAN:
+ case DIRTY:
remove_offset(i,-1); tomem(i); break;
- case ISCONST:
- if (i!=PC_P)
- writeback_const(i);
+ case ISCONST:
+ if (i!=PC_P)
+ writeback_const(i);
break;
default: break;
}
}
}
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_TOMEM &&
+ if (live.fate[i].needflush==NF_TOMEM &&
live.fate[i].status==DIRTY) {
f_evict(i);
}
static void flush_keepflags(void)
{
int fi,i;
-
+
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_SCRATCH ||
+ if (live.fate[i].needflush==NF_SCRATCH ||
live.fate[i].status==CLEAN) {
f_disassociate(i);
}
for (i=0;i<VREGS;i++) {
if (live.state[i].needflush==NF_TOMEM) {
switch(live.state[i].status) {
- case INMEM:
+ case INMEM:
/* Can't adjust the offset here --- that needs "add" */
break;
- case CLEAN:
- case DIRTY:
+ case CLEAN:
+ case DIRTY:
remove_offset(i,-1); tomem(i); break;
- case ISCONST:
- if (i!=PC_P)
- writeback_const(i);
+ case ISCONST:
+ if (i!=PC_P)
+ writeback_const(i);
break;
default: break;
}
}
}
for (i=0;i<VFREGS;i++) {
- if (live.fate[i].needflush==NF_TOMEM &&
+ if (live.fate[i].needflush==NF_TOMEM &&
live.fate[i].status==DIRTY) {
f_evict(i);
}
{
lopt_emit_all();
/* Fill with NOPs --- makes debugging with gdb easier */
- while ((uae_u32)target&(a-1))
+ while ((uae_u32)target&(a-1))
*target++=0x90;
}
}
}
for (i=0;i<VFREGS;i++)
- if (f_isinreg(i))
+ if (f_isinreg(i))
f_evict(i);
raw_fp_cleanup_drop();
}
static void prepare_for_call_2(void)
{
int i;
- for (i=0;i<N_REGS;i++)
+ for (i=0;i<N_REGS;i++)
if (!call_saved[i] && live.nat[i].nholds>0)
free_nreg(i);
- for (i=0;i<N_FREGS;i++)
+ for (i=0;i<N_FREGS;i++)
if (live.fat[i].nholds>0)
f_free_nreg(i);
if (clobber)
f=source;
switch(size) {
- case 1: mov_b_bRr(address,source,NATMEM_OFFSETX); break;
+ case 1: mov_b_bRr(address,source,NATMEM_OFFSETX); break;
case 2: mov_w_rr(f,source); bswap_16(f); mov_w_bRr(address,f,NATMEM_OFFSETX); break;
case 4: mov_l_rr(f,source); bswap_32(f); mov_l_bRr(address,f,NATMEM_OFFSETX); break;
}
writeword_general(address,source,tmp,0);
}
-static __inline__ void writelong_general(int address, int source, int tmp,
+static __inline__ void writelong_general(int address, int source, int tmp,
int clobber)
{
int distrust;
static void readmem_real(int address, int dest, int offset, int size, int tmp)
{
- int f=tmp;
+ int f=tmp;
if (size==4 && address!=dest)
f=dest;
#ifdef NATMEM_OFFSET
if (canbang) { /* Woohoo! go directly at the memory! */
switch(size) {
- case 1: mov_b_brR(dest,address,NATMEM_OFFSETX); break;
+ case 1: mov_b_brR(dest,address,NATMEM_OFFSETX); break;
case 2: mov_w_brR(dest,address,NATMEM_OFFSETX); bswap_16(dest); break;
case 4: mov_l_brR(dest,address,NATMEM_OFFSETX); bswap_32(dest); break;
}
shrl_l_ri(f,16); /* The index into the baseaddr table */
mov_l_rm_indexed(f,(uae_u32)baseaddr,f,4);
/* f now holds the offset */
-
+
switch(size) {
case 1: mov_b_rrm_indexed(dest,address,f,1); break;
case 2: mov_w_rrm_indexed(dest,address,f,1); bswap_16(dest); break;
}
-/* base is a register, but dp is an actual value.
+/* base is a register, but dp is an actual value.
target is a register, as is tmp */
void calc_disp_ea_020(int base, uae_u32 dp, int target, int tmp)
{
int ignorereg=(dp&0x40);
int addbase=0;
int outer=0;
-
+
if ((dp & 0x30) == 0x20) addbase = (uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2);
if ((dp & 0x30) == 0x30) addbase = comp_get_ilong((m68k_pc_offset+=4)-4);
if ((dp & 0x4) == 0) { /* add regd *before* the get_long */
if (!ignorereg) {
- if ((dp & 0x800) == 0)
+ if ((dp & 0x800) == 0)
sign_extend_16_rr(target,reg);
else
mov_l_rr(target,reg);
if (dp&0x03) readlong(target,target,tmp);
if (!ignorereg) {
- if ((dp & 0x800) == 0)
+ if ((dp & 0x800) == 0)
sign_extend_16_rr(tmp,reg);
else
mov_l_rr(tmp,reg);
tmp&=(~3);
pos=(uae_u32*)tmp;
- if (len<0 || len>MAX_CHECKSUM_LEN) {
+ if (len<0 || len>MAX_CHECKSUM_LEN) {
*c1=0;
*c2=0;
}
int check_for_cache_miss(void)
{
blockinfo* bi=get_blockinfo_addr(regs.pc_p);
-
+
if (bi) {
int cl=cacheline(regs.pc_p);
if (bi!=cache_tags[cl+1].bi) {
return 0;
}
-
+
static void recompile_block(void)
{
/* An existing block's countdown code has expired. We need to make
perceived cache miss... */
blockinfo* bi=get_blockinfo_addr(regs.pc_p);
- Dif (!bi)
+ Dif (!bi)
abort();
raise_in_cl_list(bi);
execute_normal();
return;
}
-static void check_checksum(void)
+static void check_checksum(void)
{
blockinfo* bi=get_blockinfo_addr(regs.pc_p);
uae_u32 cl=cacheline(regs.pc_p);
blockinfo* bi2=get_blockinfo(cl);
uae_u32 c1,c2;
-
+
checksum_count++;
/* These are not the droids you are looking for... */
if (!bi) {
else {
c1=c2=1; /* Make sure it doesn't match */
}
- if (c1==bi->c1 && c2==bi->c2) {
+ if (c1==bi->c1 && c2==bi->c2) {
/* This block is still OK. So we reactivate. Of course, that
means we have to move it into the needs-to-be-flushed list */
bi->handler_to_use=bi->handler;
}
raw_jmp((uae_u32)do_nothing);
align_target(32);
-
+
popall_execute_normal=get_target();
for (i=0;i<N_REGS;i++) {
if (need_to_preserve[i])
}
raw_jmp((uae_u32)recompile_block);
align_target(32);
-
+
popall_exec_nostats=get_target();
for (i=0;i<N_REGS;i++) {
if (need_to_preserve[i])
}
raw_jmp((uae_u32)exec_nostats);
align_target(32);
-
+
popall_check_checksum=get_target();
for (i=0;i<N_REGS;i++) {
if (need_to_preserve[i])
}
raw_jmp((uae_u32)check_checksum);
align_target(32);
-
+
current_compile_p=get_target();
#else
popall_exec_nostats=exec_nostats;
static __inline__ void reset_lists(void)
{
int i;
-
+
for (i=0;i<MAX_HOLD_BI;i++)
hold_bi[i]=NULL;
active=NULL;
set_cache_state(0);
}
-void build_comp(void)
+void build_comp(void)
{
int i;
int jumpcount=0;
/* Unconditional jumps don't evaluate condition codes, so they
don't actually use any flags themselves */
if (prop[opcode].is_const_jump)
- prop[opcode].use_flags=0;
+ prop[opcode].use_flags=0;
}
#ifdef NOFLAGS_SUPPORT
for (i = 0; nfctbl[i].handler != NULL; i++) {
cache_tags[i+1].bi=NULL;
}
compemu_reset();
-
+
for (i=0;i<N_REGS;i++) {
empty_ss.nat[i].holds=-1;
empty_ss.nat[i].validsize=0;
empty_ss.nat[i].dirtysize=0;
}
default_ss=empty_ss;
-#if 0
+#if 0
default_ss.nat[6].holds=11;
default_ss.nat[6].validsize=4;
default_ss.nat[5].holds=12;
#endif
}
-
+
static void flush_icache_hard(int n)
{
uae_u32 i;
/* "Soft flushing" --- instead of actually throwing everything away,
- we simply mark everything as "needs to be checked".
+ we simply mark everything as "needs to be checked".
*/
void flush_icache(int n)
bi=active;
while (bi) {
uae_u32 cl=cacheline(bi->pc_p);
- if (!bi->handler) {
+ if (!bi->handler) {
/* invalidated block */
- if (bi==cache_tags[cl+1].bi)
+ if (bi==cache_tags[cl+1].bi)
cache_tags[cl].handler=popall_execute_normal;
bi->handler_to_use=popall_execute_normal;
set_dhtu(bi,bi->direct_pen);
}
else {
- if (bi==cache_tags[cl+1].bi)
+ if (bi==cache_tags[cl+1].bi)
cache_tags[cl].handler=popall_check_checksum;
bi->handler_to_use=popall_check_checksum;
set_dhtu(bi,bi->direct_pcc);
bi2->next=dormant;
if (dormant)
dormant->prev_p=&(bi2->next);
-
+
dormant=active;
active->prev_p=&dormant;
active=NULL;
optlev=bi->optlevel;
if (bi->handler) {
- Dif (bi!=bi2) {
- /* I don't think it can happen anymore. Shouldn't, in
+ Dif (bi!=bi2) {
+ /* I don't think it can happen anymore. Shouldn't, in
any case. So let's make sure... */
printf("WOOOWOO count=%d, ol=%d %p %p\n",
bi->count,bi->optlevel,bi->handler_to_use,
/* What the heck? We are not supposed to be here! */
abort();
}
- }
+ }
if (bi->count==-1) {
optlev++;
while (!currprefs.optcount[optlev])
bi->count=currprefs.optcount[optlev]-1;
}
current_block_pc_p=(uae_u32)pc_hist[0].location;
-
+
remove_deps(bi); /* We are about to create new code */
bi->optlevel=optlev;
bi->pc_p=(uae_u8*)pc_hist[0].location;
-
+
liveflags[blocklen]=0x1f; /* All flags needed afterwards */
i=blocklen;
while (i--) {
if (optlev==0) { /* No need to actually translate */
/* Execute normally without keeping stats */
raw_mov_l_mi((uae_u32)®s.pc_p,(uae_u32)pc_hist[0].location);
- raw_jmp((uae_u32)popall_exec_nostats);
+ raw_jmp((uae_u32)popall_exec_nostats);
}
else {
reg_alloc_run=0;
cpuop_func **cputbl;
cpuop_func **comptbl;
uae_u16 opcode;
-
+
opcode=cft_map((uae_u16)*pc_hist[i].location);
special_mem=pc_hist[i].specmem;
needed_flags=(liveflags[i+1] & prop[opcode].set_flags);
cputbl=cpufunctbl;
comptbl=compfunctbl;
}
-
- if (comptbl[opcode] && optlev>1) {
+
+ if (comptbl[opcode] && optlev>1) {
failure=0;
if (!was_comp) {
comp_pc_p=(uae_u8*)pc_hist[i].location;
comptbl[opcode](opcode);
freescratch();
- if (!(liveflags[i+1] & FLAG_CZNV)) {
+ if (!(liveflags[i+1] & FLAG_CZNV)) {
/* We can forget about flags */
dont_care_flags();
}
-#if INDIVIDUAL_INST
+#if INDIVIDUAL_INST
flush(1);
nop();
flush(1);
was_comp=0;
#endif
}
- else
+ else
failure=1;
if (failure) {
if (was_comp) {
else {
//raw_mov_l_mi((uae_u32)&foink3,(uae_u32)opcode);
}
-
+
if (i<blocklen-1) {
uae_s8* branchadd;
-
+
raw_mov_l_rm(0,(uae_u32)specflags);
raw_test_l_rr(0,0);
raw_jz_b_oponly();
blockinfo* bi1=get_blockinfo_addr_new((void*)next_pc_p,0);
blockinfo* bi2=get_blockinfo_addr_new((void*)taken_pc_p,0);
uae_u8 x=bi1->needed_flags;
-
+
if (x==0xff || 1) { /* To be on the safe side */
uae_u16* next=(uae_u16*)next_pc_p;
uae_u16 op=cft_map(*next);
x&=(~prop[op].set_flags);
x|=prop[op].use_flags;
}
-
+
x|=bi2->needed_flags;
- if (!(x & FLAG_CZNV)) {
+ if (!(x & FLAG_CZNV)) {
/* We can forget about flags */
dont_care_flags();
extra_len+=2; /* The next instruction now is part of this
block */
}
-
+
}
#endif
uae_u32 t1=next_pc_p;
uae_u32 t2=taken_pc_p;
int cc=branch_cc;
-
+
uae_u32* branchadd;
uae_u32* tba;
bigstate tmp;
raw_mov_l_mi((uae_u32)®s.pc_p,t2);
raw_jmp((uae_u32)popall_do_nothing);
create_jmpdep(bi,1,tba,t2);
- }
- else
+ }
+ else
{
if (was_comp) {
flush(1);
}
-
+
/* Let's find out where next_handler is... */
- if (was_comp && isinreg(PC_P)) {
+ if (was_comp && isinreg(PC_P)) {
int r2;
r=live.state[PC_P].realreg;
-
+
if (r==0)
r2=1;
- else
+ else
r2=0;
-
+
raw_and_l_ri(r,TAGMASK);
raw_mov_l_ri(r2,(uae_u32)popall_do_nothing);
raw_sub_l_mi((uae_u32)&countdown,scaled_cycles(totcycles));
raw_mov_l_mi((uae_u32)®s.pc_p,v);
raw_jmp((uae_u32)popall_do_nothing);
create_jmpdep(bi,0,tba,v);
- }
+ }
else {
int r2;
raw_mov_l_rm(r,(uae_u32)®s.pc_p);
if (r==0)
r2=1;
- else
+ else
r2=0;
-
+
raw_and_l_ri(r,TAGMASK);
raw_mov_l_ri(r2,(uae_u32)popall_do_nothing);
raw_sub_l_mi((uae_u32)&countdown,scaled_cycles(totcycles));
}
}
- if (next_pc_p+extra_len>=max_pcp &&
- next_pc_p+extra_len<max_pcp+LONGEST_68K_INST)
+ if (next_pc_p+extra_len>=max_pcp &&
+ next_pc_p+extra_len<max_pcp+LONGEST_68K_INST)
max_pcp=next_pc_p+extra_len; /* extra_len covers flags magic */
else
max_pcp+=LONGEST_68K_INST;
bi->len=max_pcp-min_pcp;
bi->min_pcp=min_pcp;
-
+
remove_from_list(bi);
- if (isinrom(min_pcp) && isinrom(max_pcp))
+ if (isinrom(min_pcp) && isinrom(max_pcp))
add_to_dormant(bi); /* No need to checksum it on cache flush.
Please don't start changing ROMs in
flight! */
align_target(32);
current_compile_p=get_target();
- raise_in_cl_list(bi);
- bi->nexthandler=current_compile_p;
+ raise_in_cl_list(bi);
+ bi->nexthandler=current_compile_p;
- /* We will flush soon, anyway, so let's do it now */
- if (current_compile_p>=max_compile_start)
- flush_icache_hard(7);
+ /* We will flush soon, anyway, so let's do it now */
+ if (current_compile_p>=max_compile_start)
+ flush_icache_hard(7);
- do_extra_cycles(totcycles); /* for the compilation time */
+ do_extra_cycles(totcycles); /* for the compilation time */
}
}
STATIC_INLINE void sync_copper (int hpos);
/* Events */
-
+
unsigned long int event_cycles, nextevent, is_lastline, currcycle;
long cycles_to_next_event;
long max_cycles_to_next_event;
uae_u16 adkcon; /* used by audio code */
static uae_u32 cop1lc,cop2lc,copcon;
-
+
int maxhpos = MAXHPOS_PAL;
int maxvpos = MAXVPOS_PAL;
int minfirstline = VBLANK_ENDLINE_PAL;
#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
/* sam: Those arrays uses around 7Mb of BSS... That seems */
/* too much for AmigaDOS (uae crashes as soon as one loads */
-/* it. So I use a different strategy here (realloc the */
+/* it. So I use a different strategy here (realloc the */
/* arrays when needed. That strategy might be usefull for */
-/* computer with low memory. */
+/* computer with low memory. */
struct sprite_entry *sprite_entries[2];
struct color_change *color_changes[2];
static int max_sprite_entry = 400;
return planes[fetchmode * 4 + res];
}
-/* Disable bitplane DMA if planes > maxplanes. This is needed e.g. by the
+/* Disable bitplane DMA if planes > maxplanes. This is needed e.g. by the
Sanity WOC demo (at the "Party Effect"). */
STATIC_INLINE int GET_PLANES_LIMIT (uae_u16 v)
{
}
/* The HRM says 0xD8, but that can't work... */
-#define HARD_DDF_STOP 0xd4
-#define HARD_DDF_START 0x18
+#define HARD_DDF_STOP 0xd4
+#define HARD_DDF_START 0x18
static void add_modulos (void)
{
/* The corresponding values, by fetchmode and display resolution. */
static int fetchunits[] = { 8,8,8,0, 16,8,8,0, 32,16,8,0 };
static int fetchstarts[] = { 3,2,1,0, 4,3,2,0, 5,4,3,0 };
-static int fm_maxplanes[] = { 3,2,1,0, 3,3,2,0, 3,3,3,0 };
+static int fm_maxplanes[] = { 3,2,1,0, 3,3,2,0, 3,3,3,0 };
static uae_u8 cycle_diagram_table[3][3][9][32];
static uae_u8 cycle_diagram_free_cycles[3][3][9];
if (v==0) aa='-'; else if(v>0) aa='1'; else aa='X';
write_log("%c",aa);
}
- write_log(" %d:%d\n",
+ write_log(" %d:%d\n",
cycle_diagram_free_cycles[fm][res][planes], cycle_diagram_total_cycles[fm][res][planes]);
}
write_log("\n");
}
-/* Used by the copper. */
+/* Used by the copper. */
static int estimated_last_fetch_cycle;
static int cycle_diagram_shift;
#endif
/* Expansions from bplcon0/bplcon1. */
-static int toscr_res, toscr_res_first, toscr_nr_planes, fetchwidth;
+static int toscr_res, toscr_res_first, toscr_nr_planes, fetchwidth;
static int toscr_delay1x, toscr_delay2x, toscr_delay1, toscr_delay2;
-/* The number of bits left from the last fetched words.
+/* The number of bits left from the last fetched words.
This is an optimization - conceptually, we have to make sure the result is
the same as if toscr is called in each clock cycle. However, to speed this
- up, we accumulate display data; this variable keeps track of how much.
+ up, we accumulate display data; this variable keeps track of how much.
Thus, once we do call toscr_nbits (which happens at least every 16 bits),
we can do more work at once. */
static int toscr_nbits;
curr_color_changes[next_color_change++].value = value;
}
-typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t;
+typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t;
/* handle very rarely needed playfield collision (CLXDAT bit 0) */
static void do_playfield_collisions (void)
}
STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int dbl,
- unsigned int mask, int do_collisions, uae_u32 collision_mask)
+ unsigned int mask, int do_collisions, uae_u32 collision_mask)
{
int j = 0;
while (datab) {
{
int nrs[MAX_SPRITES], posns[MAX_SPRITES];
int count, i;
- /* apparantly writes to custom registers happen in the 3/4th of cycle
+ /* apparantly writes to custom registers happen in the 3/4th of cycle
* and sprite xpos comparator sees it immediately */
int point = hpos * 2 - 4;
int width = sprite_width;
if (dip->nr_sprites != dip_old->nr_sprites)
return 1;
-
+
if (dip->nr_sprites == 0)
return 0;
{
if (dip->nr_color_changes != dip_old->nr_color_changes)
return 1;
-
+
if (dip->nr_color_changes == 0)
return 0;
if (memcmp (curr_color_changes + dip->first_color_change,
if (was_active)
events_schedule ();
+ unset_special (SPCFLAG_COPPER);
cop_state.ignore_next = 0;
cop_state.state = COP_read1;
cop_state.vpos = vpos;
} else if (oldstrobe != num) {
/* dma disabled and accessing both COPxJMPs -> copper stops! */
cop_state.state = COP_stop;
- copper_enabled_thisline = 0;
- unset_special (SPCFLAG_COPPER);
}
}
if (dmaen (DMA_BITPLANE))
maybe_start_bpl_dma (hpos);
}
-
+
events_schedule();
}
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 27 0x40 - 0x74 */
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, /* 21 */
- 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0, /* 32 0xa0 - 0xde
+ 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0, /* 32 0xa0 - 0xde */
/* BPLxPTH/BPLxPTL */
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */
/* BPLCON0-3,BPLMOD1-2 */
static void dump_copper (char *error, int until_hpos)
{
+ static int warned = 10;
+
+ if (warned < 0)
+ return;
+ warned--;
write_log("%s: vpos=%d until_hpos=%d\n",
error, vpos, until_hpos);
write_log("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04.4X ci2=%04.4X\n",
static void update_copper (int until_hpos)
{
- int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
+ int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
int c_hpos = cop_state.hpos;
if (eventtab[ev_copper].active) {
- static int warned;
- if (!warned) {
- dump_copper ("error1",until_hpos);
- warned = 1;
- }
+ dump_copper ("error1",until_hpos);
eventtab[ev_copper].active = 0;
return;
- uae_abort ("update_copper1");
}
if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
- static int warned;
- if (!warned) {
- dump_copper ("error2",until_hpos);
- warned = 1;
- }
+ dump_copper ("error2",until_hpos);
+ eventtab[ev_copper].active = 0;
copper_enabled_thisline = 0;
return;
- uae_abort ("update_copper2");
}
-
+
until_hpos &= ~1;
if (until_hpos > (maxhpos & ~1))
/* So we know about the fetch state. */
decide_line (c_hpos);
-
+
switch (cop_state.state) {
case COP_read1_in2:
cop_state.state = COP_read1;
cop_state.hcmp = (cop_state.saved_i1 & cop_state.saved_i2 & 0xFE);
vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
-
+
if (cop_state.saved_i1 == 0xFFFF && cop_state.saved_i2 == 0xFFFE) {
cop_state.state = COP_stop;
copper_enabled_thisline = 0;
}
if (s->dmastate && !posctl) {
uae_u16 data;
-
+
data = sprite_fetch (s, dma, hpos, cycle, 1);
#if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
}
break;
case 32:
- {
+ {
uae_u16 data32 = sprite_fetch (s, dma, hpos, cycle, 1);
if (dma) {
if (cycle == 0)
}
return v;
}
-
+
static void framewait (void)
{
frame_time_t curr_time;
static void fpscounter (void)
{
int now, last;
-
+
now = read_processor_time ();
last = now - lastframetime;
lastframetime = now;
if (picasso_on)
picasso_handle_vsync ();
#endif
-
+
vsync_handle_redraw (lof, lof_changed);
if (quit_program > 0) {
dumpcustom ();
for (i = 0; i < 8; i++)
nr_armed += spr[i].armed != 0;
+ if (! currprefs.produce_sound) {
+ eventtab[ev_audio].active = 0;
+ events_schedule ();
+ }
}
expand_sprres ();
void dumpcustom (void)
{
write_log ("DMACON: %x INTENA: %x INTREQ: %x VPOS: %x HPOS: %x\n", DMACONR(),
- (unsigned int)intena, (unsigned int)intreq, (unsigned int)vpos, (unsigned int)current_hpos());
+ (unsigned int)intena, (unsigned int)intreq, (unsigned int)vpos, (unsigned int)current_hpos());
write_log ("COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n", (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip);
write_log ("DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n",
- (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop);
+ (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop);
write_log ("BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4);
if (timeframes) {
write_log ("Average frame time: %f ms [frames: %d time: %d]\n",
- (double)frametime / timeframes, timeframes, frametime);
+ (double)frametime / timeframes, timeframes, frametime);
if (total_skipped)
write_log ("Skipped frames: %d\n", total_skipped);
}
int num;
for (num = 0; num < 2; num++) {
- sprite_entries[num] = xmalloc (max_sprite_entry * sizeof (struct sprite_entry));
- color_changes[num] = xmalloc (max_color_change * sizeof (struct color_change));
+ sprite_entries[num] = xmalloc (max_sprite_entry * sizeof (struct sprite_entry));
+ color_changes[num] = xmalloc (max_color_change * sizeof (struct color_change));
}
#endif
}
return custom_wget2 (addr);
}
-
+
uae_u32 REGPARAM2 custom_bget (uaecptr addr)
{
#ifdef JIT
}
}
-static uae_u32 debug_lget (uaecptr addr)
+static uae_u32 REGPARAM debug_lget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
memwatch_func (addr, 0, 4, v);
return v;
}
-static uae_u32 debug_wget (uaecptr addr)
+static uae_u32 REGPARAM2 debug_wget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
memwatch_func (addr, 0, 2, v);
return v;
}
-static uae_u32 debug_bget (uaecptr addr)
+static uae_u32 REGPARAM2 debug_bget (uaecptr addr)
{
int off = debug_mem_off (addr);
uae_u32 v;
memwatch_func (addr, 0, 1, v);
return v;
}
-static void debug_lput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 debug_lput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
memwatch_func (addr, 1, 4, v);
debug_mem_banks[off]->lput(addr, v);
}
-static void debug_wput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 debug_wput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
memwatch_func (addr, 1, 2, v);
debug_mem_banks[off]->wput(addr, v);
}
-static void debug_bput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 debug_bput (uaecptr addr, uae_u32 v)
{
int off = debug_mem_off (addr);
memwatch_func (addr, 1, 1, v);
debug_mem_banks[off]->bput(addr, v);
}
-static int debug_check (uaecptr addr, uae_u32 size)
+static int REGPARAM2 debug_check (uaecptr addr, uae_u32 size)
{
return debug_mem_banks[munge24 (addr) >> 16]->check (addr, size);
}
-static uae_u8 *debug_xlate (uaecptr addr)
+static uae_u8 *REGPARAM2 debug_xlate (uaecptr addr)
{
return debug_mem_banks[munge24 (addr) >> 16]->xlateaddr (addr);
}
}
p[0] = days >> 24; p[1] = days >> 16; p[2] = days >> 8; p[3] = days >> 0;
p[4] = minutes >> 24; p[5] = minutes >> 16; p[6] = minutes >> 8; p[7] = minutes >> 0;
- p[8] = ticks >> 24; p[9] = ticks >> 16; p[10] = ticks >> 8; p[11] = ticks >> 0;
+ p[8] = ticks >> 24; p[9] = ticks >> 16; p[10] = ticks >> 8; p[11] = ticks >> 0;
}
static void createbootblock (uae_u8 *sector, int bootable)
pl (sector1, 24 + dirhash (dirname1) * 4, dblock1);
disk_checksum(sector1, sector1 + 20);
writeimageblock (dst, sector1, 880 * FS_FLOPPY_BLOCKSIZE);
-
+
createbitmapblock (sector1, bitmap);
writeimageblock (dst, sector1, 881 * FS_FLOPPY_BLOCKSIZE);
case DRIVE_ID_525SD: return "5.25SD";
case DRIVE_ID_35DD : return "3.5DD";
}
- return "UNKNOWN";
+ return "UNKNOWN";
}
-/* Simulate exact behaviour of an A3000T 3.5 HD disk drive.
+/* Simulate exact behaviour of an A3000T 3.5 HD disk drive.
* The drive reports to be a 3.5 DD drive whenever there is no
* disk or a 3.5 DD disk is inserted. Only 3.5 HD drive id is reported
* when a real 3.5 HD disk is inserted. -Adil
char name2[MAX_DPATH];
char path[MAX_DPATH];
int i;
-
+
strcpy (name2, name);
i = strlen (name2) - 1;
while (i > 0) {
struct zfile *zf1, *zf2;
int wrprot1 = 0, wrprot2 = 1;
unsigned char buffer[25];
-
+
*needwritefile = 0;
*drvtype = DRV_35_DD;
zf1 = DISK_validate_filename (fname, 1, &wrprot1, NULL);
tid->offs = i * 512 * drv->num_secs;
}
drv->useturbo = 1;
-
+
} else {
int i;
drive_fill_bigbuf (drv, 1);
drv->mfmpos = (rand () | (rand () << 16)) % drv->tracklen;
drv->prevtracklen = 0;
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_insert (drv - floppy, 0);
#endif
return 1;
if (direction) {
if (drv->cyl) {
drv->cyl--;
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_click (drv - floppy, drv->cyl);
#endif
}
}
if (drv->cyl >= maxtrack)
write_dlog ("program tried to step over track %d\n", maxtrack);
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_click (drv - floppy, drv->cyl);
#endif
}
if (drv->motoroff && !off) {
drv->dskready_time = DSKREADY_TIME;
rand_shifter (drv);
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_motor (drv - floppy, drv->dskready_down_time == 0 ? 2 : 1);
#endif
#ifdef DISK_DEBUG2
if (!drv->motoroff && off) {
drv->drive_id_scnt = 0; /* Reset id shift reg counter */
drv->dskready_down_time = DSKREADY_DOWN_TIME;
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_motor (drv - floppy, 0);
#endif
#ifdef DEBUG_DRIVE_ID
track_reset (drv);
return;
}
-#endif
+#endif
} else if (drv->filetype == ADF_IPF) {
#ifdef CAPS
dstmfmbuf[dstmfmoffset % len] = mfmbuf[i];
dstmfmoffset++;
}
-
+
}
#ifdef DISK_DEBUG
static void drive_eject (drive * drv)
{
-#ifdef DRIVESOUND
+#ifdef DRIVESOUND
driveclick_insert (drv - floppy, 1);
#endif
drive_image_free (drv);
{
struct stat st;
int mode, oldmode;
-
+
if (stat (name, &st))
return;
oldmode = mode = st.st_mode;
int wrprot1, wrprot2, i;
char *name2;
drive_type drvtype;
-
+
oldprotect = diskfile_iswriteprotect (name, &needwritefile, &drvtype);
zf1 = DISK_validate_filename (name, 1, &wrprot1, NULL);
if (!zf1) return 0;
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = floppy + dr;
/* motor on/off workings tested with small assembler code on real Amiga 1200. */
- /* motor/id flipflop is set only when drive select goes from high to low */
+ /* motor/id flipflop is set only when drive select goes from high to low */
if (!(selected & (1 << dr)) && (lastselected & (1 << dr)) ) {
drv->drive_id_scnt++;
drv->drive_id_scnt &= 31;
} else if (drv->dskchange && currprefs.dfxtype[dr] != DRV_525_SD) {
st &= ~4;
}
- }
+ }
}
return st;
}
write_log ("\n");
}
#endif
-}
+}
static void fetchnextrevolution (drive *drv)
{
{
int dr;
int drives[4];
-
+
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv2 = &floppy[dr];
drives[dr] = 0;
static void disk_dma_debugmsg(void)
{
- write_dlog ("LEN=%04.4X (%d) SYNC=%04.4X PT=%08.8X ADKCON=%04.4X PC=%08.8X\n",
+ write_dlog ("LEN=%04.4X (%d) SYNC=%04.4X PT=%08.8X ADKCON=%04.4X PC=%08.8X\n",
dsklength, dsklength, (adkcon & 0x400) ? dsksync : 0xffff, dskpt, adkcon, m68k_getpc());
}
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
-
+
if (drv->motoroff)
continue;
drv->floppybitcounter += cycles;
linecounter = 2;
dskdmaen = 0;
return;
- }
+ }
}
}
drive_image_free (drv);
return ret;
}
-
+
/* Disk save/restore code */
} pixdata;
uae_u16 spixels[2 * MAX_SPR_PIXELS];
-/* Eight bits for every pixel. */
+/* Eight bits for every pixel. */
union sps_union spixstate;
static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE * 2];
playfield_start = linetoscr_diw_start;
playfield_end = linetoscr_diw_end;
-
+
if (playfield_start < visible_left_border)
playfield_start = visible_left_border;
if (playfield_start > visible_right_border)
playfield_end = max;
if (playfield_end > visible_right_border)
playfield_end = visible_right_border;
- }
+ }
#endif
/* Now, compute some offsets. */
#if SPRITE_DEBUG > 0
v |= 1 | 4;
#endif
-
+
if (has_attach && (stbuf[pos] & (3 << offs))) {
col = v;
if (aga)
window_pos += 1 << doubling;
}
}
-
-/* See comments above. Do not touch if you don't know what's going on.
+
+/* See comments above. Do not touch if you don't know what's going on.
* (We do _not_ want the following to be inlined themselves). */
/* lores bitplane, lores sprites */
static void NOINLINE draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0, 0); }
static void weird_bitplane_fix (void)
{
int i, shift = lores_shift - bplres;
-
+
if (shift < 0) {
shift = -shift;
for (i = playfield_start << lores_shift; i < playfield_end << lores_shift; i++) {
}
}
-/* See above for comments on inlining. These functions should _not_
+/* See above for comments on inlining. These functions should _not_
be inlined themselves. */
static void NOINLINE pfield_doline_n1 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 1); }
static void NOINLINE pfield_doline_n2 (uae_u32 *data, int count) { pfield_doline_1 (data, count, 2); }
if (currprefs.gfx_correct_aspect)
native_lines_per_amiga_line = ((double)gfxvidinfo.height
- * (currprefs.gfx_lores ? 320 : 640)
- / (currprefs.gfx_linedbl ? 512 : 256)
- / gfxvidinfo.width);
+ * (currprefs.gfx_lores ? 320 : 640)
+ / (currprefs.gfx_linedbl ? 512 : 256)
+ / gfxvidinfo.width);
else
native_lines_per_amiga_line = 1;
#define NUMBERS_NUM 14
-static char *numbers = { /* ugly */
+#define TD_BORDER 0x333
+
+static char *numbers = { /* ugly 0123456789CHD% */
"+++++++--++++-+++++++++++++++++-++++++++++++++++++++++++++++++++++++++++++++-++++++-++++----++---+"
"+xxxxx+--+xx+-+xxxxx++xxxxx++x+-+x++xxxxx++xxxxx++xxxxx++xxxxx++xxxxx++xxxx+-+x++x+-+xxx++-+xx+-+x"
"+x+++x+--++x+-+++++x++++++x++x+++x++x++++++x++++++++++x++x+++x++x+++x++x++++-+x++x+-+x++x+--+x++x+"
{
int j;
uae_u8 *numptr;
-
+
numptr = numbers + num * TD_NUM_WIDTH + NUMBERS_NUM * TD_NUM_WIDTH * y;
for (j = 0; j < TD_NUM_WIDTH; j++) {
if (*numptr == 'x')
static void draw_status_line (int line)
{
int x_start, y, j, led;
-
+
if (td_pos & TD_RIGHT)
x_start = gfxvidinfo.width - TD_PADX - NUM_LEDS * TD_WIDTH;
else
if (xlinebuffer == 0)
xlinebuffer = row_map[line];
- memset (xlinebuffer, 0, gfxvidinfo.width * gfxvidinfo.pixbytes);
-
for (led = 0; led < NUM_LEDS; led++) {
- int side, pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1, x, off_rgb, on_rgb, c, on = 0;
+ int side, pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1;
+ int x, off_rgb, on_rgb, c, on = 0, am = 2;
if (led >= 1 && led <= 4) {
int pled = led - 1;
int track = gui_data.drive_track[pled];
num1 = fps / 100;
num2 = (fps - num1 * 100) / 10;
num3 = fps % 10;
+ am = 3;
+ if (num1 == 0)
+ am = 2;
} else if (led == 8) {
int idle = (gui_data.idle + 5) / 10;
pos = 0;
num2 = (idle - num1 * 100) / 10;
num3 = idle % 10;
num4 = 13;
+ am = 4;
+ if (num1 == 0)
+ am = 3;
}
c = xcolors[on ? on_rgb : off_rgb];
+ if (y == 0 || y == TD_TOTAL_HEIGHT - 1)
+ c = xcolors[TD_BORDER];
x = x_start + pos * TD_WIDTH;
- for (j = 0; j < TD_LED_WIDTH; j++)
+ putpixel (x - 1, xcolors[TD_BORDER]);
+ for (j = 0; j < TD_LED_WIDTH; j++)
putpixel (x + j, c);
+ putpixel (x + j, xcolors[TD_BORDER]);
if (y >= TD_PADY && y - TD_PADY < TD_NUM_HEIGHT) {
if (num3 >= 0) {
- int tn = num1 > 0 ? 3 : 2;
- int offs = (TD_LED_WIDTH - tn * TD_NUM_WIDTH) / 2;
+ x += (TD_LED_WIDTH - am * TD_NUM_WIDTH) / 2;
if (num1 > 0) {
- write_tdnumber (x + offs, y - TD_PADY, num1);
- offs += TD_NUM_WIDTH;
+ write_tdnumber (x, y - TD_PADY, num1);
+ x += TD_NUM_WIDTH;
}
- write_tdnumber (x + offs, y - TD_PADY, num2);
- write_tdnumber (x + offs + TD_NUM_WIDTH, y - TD_PADY, num3);
+ write_tdnumber (x, y - TD_PADY, num2);
+ x += TD_NUM_WIDTH;
+ write_tdnumber (x, y - TD_PADY, num3);
+ x += TD_NUM_WIDTH;
if (num4 > 0)
- write_tdnumber (x + offs + 2 * TD_NUM_WIDTH, y - TD_PADY, num4);
+ write_tdnumber (x, y - TD_PADY, num4);
}
}
}
break;
where = amiga2aspect_line_map[i1];
- if (where >= gfxvidinfo.height - (currprefs.leds_on_screen ? TD_TOTAL_HEIGHT : 0))
+ if (where >= gfxvidinfo.height)
break;
if (where == -1)
continue;
} else {
for(n = nClick; n < CLICK_TRACKS; n++) {
ds->indexes[n] = ds->indexes[nClick-1];
- ds->lengths[n] = ds->lengths[nClick-1];
+ ds->lengths[n] = ds->lengths[nClick-1];
}
}
}
static void mix (void)
{
int total = ((uae_u8*)sndbufpt - (uae_u8*)sndbuffer) / (currprefs.sound_stereo ? 4 : 2);
-
+
if (currprefs.dfxclickvolume > 0) {
while (clickcnt < total) {
clickbuffer[clickcnt++] = getsample() * (100 - currprefs.dfxclickvolume) / 100;
addr -= chipmem_start & chipmem_mask;
addr &= chipmem_mask;
m = (uae_u32 *)(chipmemory + addr);
-
+
if (ISILLEGAL(addr))
{
enforcer_display_hit("LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode==1)
{
set_special (SPCFLAG_TRAP);
- }
+ }
}
return do_get_mem_long (m);
}
m = (uae_u16 *)(chipmemory + addr);
if (ISILLEGAL(addr))
- {
+ {
enforcer_display_hit("WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode==1)
{
set_special (SPCFLAG_TRAP);
- }
+ }
}
return do_get_mem_word (m);
}
#include "ersatz.h"
#include "gui.h"
-#define EOP_INIT 0
+#define EOP_INIT 0
#define EOP_NIMP 1
#define EOP_SERVEINT 2
#define EOP_DOIO 3
- /*
+ /*
* UAE - The Un*x Amiga Emulator
*
* AutoConfig (tm) Expansions (ZorroII/III)
/* Please note: ZorroIII implementation seems to work different
* than described in the HRM. This claims that ZorroIII config
* address is 0xff000000 while the ZorroII config space starts
- * at 0x00e80000. In reality, both, Z2 and Z3 cards are
+ * at 0x00e80000. In reality, both, Z2 and Z3 cards are
* configured in the ZorroII config space. Kickstart 3.1 doesn't
* even do a single read or write access to the ZorroIII space.
* The original Amiga include files tell the same as the HRM.
* to a ZorroIII card on a real Amiga. This is not implemented
* yet.
* -- Stefan
- *
+ *
* Surprising that 0xFF000000 isn't used. Maybe it depends on the
* ROM. Anyway, the HRM says that Z3 cards may appear in Z2 config
* space, so what we are doing here is correct.
case 0x44:
if (expamem_type() == zorroIII) {
// +Bernd Roesch
- value = value - 0x3000; // maps to 0x10000000
+ value = value - 0x3000; // maps to 0x10000000
chipmem_wput (regs.regs[11] + 0x20, value);
chipmem_wput (regs.regs[11] + 0x28, value);
// -Bernd Roesch
static void expamem_map_catweasel (void)
{
catweasel_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
- map_banks (&catweasel_bank, catweasel_start >> 16, 1, 0);
+ map_banks (&catweasel_bank, catweasel_start >> 16, 1, 0);
write_log ("Catweasel MK%d: mapped @$%lx\n", cwc.type, catweasel_start);
}
#endif
-/*
+/*
* Filesystem device
*/
#ifdef ARCADIA
if (arcadia_rom) {
arcadiaboot = mapped_malloc (0x10000, "arcadia");
- arcadia_bank.baseaddr = arcadiaboot;
+ arcadia_bank.baseaddr = arcadiaboot;
card_init[cardno] = expamem_init_arcadia;
card_map[cardno++] = expamem_map_arcadia;
}
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
+ more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
return;
}
fdi->track_dst[BIT_BYTEOFFSET] &= ~(1 << BIT_BITOFFSET);
- if (bit)
+ if (bit)
fdi->track_dst[BIT_BYTEOFFSET] |= (1 << BIT_BITOFFSET);
fdi->out++;
if (fdi->out >= MAX_DST_BUFFER * 8) {
static void s20(FDI *fdi)
{
bit_drop_next (fdi);
- debuglog ("s20:header=%s,data=%s", datalog(fdi->track_src, 4), datalog(fdi->track_src + 4, 16));
+ debuglog ("s20:header=%s,data=%s", datalog(fdi->track_src, 4), datalog(fdi->track_src + 4, 16));
amiga_sector_header (fdi, fdi->track_src, fdi->track_src + 4, 0, 0);
fdi->track_src += 4 + 16;
}
typedef void (*decode_normal_track_func)(FDI*);
static decode_normal_track_func decode_normal_track[] =
-{
+{
track_empty, /* 0 */
track_amiga_dd, track_amiga_hd, /* 1-2 */
track_atari_st_9, track_atari_st_10, /* 3-4 */
fwrite (stream, 1, len * 4, f);
fclose (f);
#endif
-}
+}
static int bitoffset;
static void init_array(unsigned long standard_MFM_2_bit_cell_size, int nb_of_bits)
{
int i;
-
+
for (i = 0; i < FDI_MAX_ARRAY; i++) {
psarray[i].size = standard_MFM_2_bit_cell_size; // That is (total track length / 50000) for Amiga double density
total += psarray[i].size;
for (j = 0; j < real_size; j++)
*pt++ = (uae_u16)(pulse / real_size);
}
-
+
/* prepares for the next pulse */
adjust = ((real_size * avg_size)/8) - pulse;
total -= psarray[array_index].size;
}
if (outstep == 1 && indexoffset == i)
*indexoffsetp = bitoffset;
- }
+ }
/* gets the size in bits from the pulse width, considering the current average bitrate */
adjusted_pulse = pulse;
for (j = 0; j < real_size; j++)
*pt++ = (uae_u16)(pulse / real_size);
}
-
+
/* prepares for the next pulse */
adjust = ((real_size * avg_size) / (4 << mfm)) - pulse;
total -= psarray[array_index].size;
{
while ((i != j) && (p1[idx_off1] > p1[idx_off2])) { /* falling edge, replace with "<" for rising edge */
i++;
- p1 += idx_off3;
+ p1 += idx_off3;
if (i >= pulses) {
i = 0;
p1 = idxp;
fdi->track_src_buffer = fdi_malloc (MAX_SRC_BUFFER);
fdi->track_dst_buffer = fdi_malloc (MAX_DST_BUFFER);
fdi->track_dst_buffer_timing = fdi_malloc (MAX_TIMING_BUFFER);
-
+
fdi->last_track = ((fdi->header[142] << 8) + fdi->header[143]) + 1;
fdi->last_track *= fdi->header[144] + 1;
if (fdi->last_track > MAX_TRACKS)
zxx (fdi);
outlen = -1;
-
+
} else if (fdi->track_type < 0x10) {
decode_normal_track[fdi->track_type](fdi);
int bootpri; /* boot priority */
int devno;
int automounted; /* don't save to config if set */
-
+
struct hardfiledata hf;
/* Threading stuff */
if (nr >= mountinfo->num_units)
return "No slot allocated for this unit";
-
+
*volname = uip->volname ? my_strdup (uip->volname) : 0;
if (uip->devname == 0 || strlen(uip->devname) == 0) {
*devname = xmalloc (10);
unsigned long nr_cache_lookups;
struct notify *notifyhash[NOTIFY_HASH_SIZE];
-
+
int volflags;
} Unit;
return u;
}
-
+
static void prepare_for_open (char *name)
{
#if 0
char *name_start;
char *new_name;
char dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
-
+
a->parent = parent;
name_start = strrchr (a->nname, FSDB_DIR_SEPARATOR);
if (name_start == 0) {
aino_test (base);
*modified_rel = 0;
-
+
/* If we have a mapping of some other aname to "rel", we must pretend
* it does not exist.
* This can happen for example if an Amiga program creates a
aino_test (base);
/* We are trying to create a file called REL. */
-
+
/* If the name is used otherwise in the directory (or globally), we
* need a new unique nname. */
if (fsdb_name_invalid (rel) || fsdb_used_as_nname (base, rel)) {
do_info (Unit *unit, dpacket packet, uaecptr info)
{
struct fs_usage fsu;
-
+
if (get_fs_usage (unit->ui.rootdir, 0, &fsu) != 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, dos_errno ());
get_fileinfo (unit, packet, info, ek->curr_file);
ek->curr_file = ek->curr_file->sibling;
TRACE (("curr_file set to %p %s\n", ek->curr_file,
- ek->curr_file ? ek->curr_file->aname : "NULL"));
+ ek->curr_file ? ek->curr_file->aname : "NULL"));
return;
no_more_entries:
/* will be CHANGE_FH or CHANGE_LOCK value */
long type = GET_PCK_ARG1 (packet);
/* either a file-handle or lock */
- uaecptr object = GET_PCK_ARG2 (packet) << 2;
+ uaecptr object = GET_PCK_ARG2 (packet) << 2;
/* will be EXCLUSIVE_LOCK/SHARED_LOCK if CHANGE_LOCK,
* or MODE_OLDFILE/MODE_NEWFILE/MODE_READWRITE if CHANGE_FH */
long mode = GET_PCK_ARG3 (packet);
put_long (info, 0);
}
-/* For a nice example of just how contradictory documentation can be, see the
+/* For a nice example of just how contradictory documentation can be, see the
* Autodoc for DOS:SetFileSize and the Packets.txt description of this packet...
* This implementation tries to mimic the behaviour of the Kick 3.1 ramdisk
* (which seems to match the Autodoc description). */
}
static void
-action_set_date (Unit *unit, dpacket packet)
+action_set_date (Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG2 (packet) << 2;
uaecptr name = GET_PCK_ARG3 (packet) << 2;
}
ut.actime = ut.modtime = put_time(get_long (date), get_long (date + 4),
- get_long (date + 8));
+ get_long (date + 8));
a = find_aino (unit, lock, bstr (unit, name), &err);
if (err == 0 && utime (a->nname, &ut) == -1)
err = dos_errno ();
}
resaddr += 0x1A;
tmp = resaddr;
-
+
/* The good thing about this function is that it always gets called
* when we boot. So we could put all sorts of stuff that wants to be done
* here.
err = -1;
goto error;
}
-
+
if (hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->size)
write_log("WARNING: end of partition > size of disk!\n");
{
Unit *u = startup_create_unit (ui);
int cnt;
-
+
u->a_uniq = restore_u64 ();
u->key_uniq = restore_u64 ();
u->dosbase = restore_u32 ();
#define FFLAG_Z 0x4000
#define FFLAG_N 0x0100
-#define FFLAG_NAN 0x0400
+#define FFLAG_NAN 0x0400
#define MAKE_FPSR(r) regs.fp_result=(r)
case 2: /* down */ iround=1; break;
case 3: /* up */ iround=2; break;
}
-
+
x=0x107f + (iprec<<8) + (iround<<10);
#if defined(X86_MSVC_ASSEMBLY)
__asm {
reg = opcode & 7;
size = (extra >> 10) & 7;
ad = -1;
-
+
switch (mode) {
case 0:
switch (size) {
#if 0
return NotANumber || (Z && N); /* This is wrong, compare 0x0c */
#else
- return NotANumber || (N && !Z);
+ return NotANumber || (N && !Z);
#endif
case 0x1d:
return NotANumber || Z || N;
case 0x00: /* FMOVE */
case 0x40: /* Explicit rounding. This is just a quick fix. Same
* for all other cases that have three choices */
- case 0x44:
+ case 0x44:
regs.fp[reg] = src;
/* Brian King was here. <ea> to register needs FPSR updated.
* See page 3-73 in Motorola 68K programmers reference manual.
MAKE_FPSR (regs.fp[reg]);
break;
case 0x0d: /* FATANH */
-#if 1 /* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */
+#if 1 /* The BeBox doesn't have atanh, and it isn't in the HPUX libm either */
regs.fp[reg] = log ((1 + src) / (1 - src)) / 2;
#else
regs.fp[reg] = atanh (src);
m68k_pc_offset += 4;
if (using_ce) {
- printf ("\t%s %s;\n", type, name);
+ printf ("\t%s %s;\n", type, name);
/* we must do this because execution order of (something | something2) is not defined */
if (norefill) {
printf ("\t%s = get_word_ce_prefetch (%d) << 16;\n", name, r + 2);
printf ("\t%s |= get_word_ce_prefetch (%d);\n", name, r + 4);
}
} else {
- if (using_prefetch) {
+ if (using_prefetch) {
if (norefill) {
- printf ("\t%s %s;\n", type, name);
+ printf ("\t%s %s;\n", type, name);
printf ("\t%s = get_word_prefetch (%d) << 16;\n", name, r + 2);
printf ("\t%s |= regs.irc;\n", name);
insn_n_cycles += 4;
}
} else {
sprintf (buffer, "get_iword (%d)", r);
- insn_n_cycles += 4;
+ insn_n_cycles += 4;
}
}
return buffer;
else
sprintf (buffer, "(uae_u8)get_word_ce_prefetch (%d)", r + 2);
} else {
- insn_n_cycles += 4;
+ insn_n_cycles += 4;
if (using_prefetch) {
if (norefill) {
sprintf (buffer, "(uae_u8)regs.irc", r);
} else {
sprintf (buffer, "(uae_u8)get_word_prefetch (%d)", r + 2);
- insn_n_cycles += 4;
+ insn_n_cycles += 4;
}
} else {
sprintf (buffer, "get_ibyte (%d)", r);
- insn_n_cycles += 4;
+ insn_n_cycles += 4;
}
}
return buffer;
if (!using_prefetch)
return;
if (using_ce) {
- printf ("\tget_word_ce_prefetch (%d);\n", o);
+ printf ("\tget_word_ce_prefetch (%d);\n", o);
} else {
printf ("\tget_word_prefetch (%d);\n", o);
}
printf ("\tget_word_prefetch (0);\n");
did_prefetch = 1;
insn_n_cycles += 4;
-}
+}
static void fill_prefetch_next_1 (void)
{
irc2ir ();
fill_prefetch_1 (m68k_pc_offset + 2);
-}
+}
static void fill_prefetch_next (void)
{
{
char namea[100];
int m68k_pc_offset_last = m68k_pc_offset;
-
+
sprintf (namea, "%sa", name);
start_brace ();
/* We get here for all non-reg non-immediate addressing modes to
* actually fetch the value. */
- if ((using_prefetch || using_ce) && using_exception_3 && getv != 0 && size != sz_byte) {
+ if ((using_prefetch || using_ce) && using_exception_3 && getv != 0 && size != sz_byte) {
printf ("\tif (%sa & 1) {\n", name);
- printf ("\t\texception3 (opcode, m68k_getpc() + %d, %sa);\n",
- m68k_pc_offset_last + e3fudge, name);
+ printf ("\t\texception3 (opcode, m68k_getpc() + %d, %sa);\n",
+ m68k_pc_offset_last + e3fudge, name);
printf ("\t\tgoto %s;\n", endlabelstr);
printf ("\t}\n");
need_endlabel = 1;
printf ("\tuae_u32 v;\n");
genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA);
if (table68k[opcode].dmode == Ad8r || table68k[opcode].dmode == PC8r)
- addcycles (2);
+ addcycles (2);
start_brace ();
if (table68k[opcode].size == sz_long) {
printf ("\twhile (dmask) { v = get_word_ce(srca) << 16; v |= get_word_ce(srca + 2); m68k_dreg(regs, movem_index1[dmask]) = v; srca += %d; dmask = movem_next[dmask]; }\n",
genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1, GF_AA);
if (table68k[opcode].dmode == Ad8r || table68k[opcode].dmode == PC8r)
- addcycles (2);
+ addcycles (2);
start_brace ();
if (table68k[opcode].size == sz_long) {
if (table68k[opcode].dmode == Apdi) {
case sz_long: printf ("\toptflag_cmpl ((uae_s32)(%s), (uae_s32)(%s));\n", src, dst); break;
}
return;
-
+
default:
break;
}
static void shift_ce (amodes dmode, int size)
{
if (using_ce && isreg (dmode)) {
- printf ("\t{\n");
+ printf ("\t{\n");
printf ("\t\tint cycles = %d * %d;\n", size == sz_long ? 8 : 6, CYCLE_UNIT / 2);
printf ("\t\tcycles += 2 * %d * ccnt;\n", CYCLE_UNIT / 2);
- addcycles3 ("\t\t");
- printf ("\t}\n");
+ addcycles3 ("\t\t");
+ printf ("\t}\n");
}
}
if (curi->size == sz_byte) {
printf ("\tsrc &= 0xFF;\n");
}
- fill_prefetch_next_delay (4);
+ fill_prefetch_next_delay (4);
printf ("\tregs.sr %c= src;\n", curi->mnemo == i_EORSR ? '^' : '|');
printf ("\tMakeFromSR();\n");
break;
if (curi->size == sz_byte) {
printf ("\tsrc |= 0xFF00;\n");
}
- fill_prefetch_next_delay (4);
+ fill_prefetch_next_delay (4);
printf ("\tregs.sr &= src;\n");
printf ("\tMakeFromSR();\n");
break;
if (curi->dmode == Dreg && curi->size == sz_long)
tmpc += (curi->smode == imm || curi->smode == immi) ? 4 : 2;
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
genflags (flag_sub, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
if ((isreg (curi->smode) && curi->size == sz_long) || !isreg (curi->smode))
tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u32 newv = dst - src - (GET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "dst");
case i_SBCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u16 newv_lo = (dst & 0xF) - (src & 0xF) - (GET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = (dst & 0xF0) - (src & 0xF0);\n");
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) {
if (curi->dmode == Dreg && curi->size == sz_long)
- tmpc += (curi->smode == imm || curi->smode == immi) ? 4 : 2;
+ tmpc += (curi->smode == imm || curi->smode == immi) ? 4 : 2;
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
genflags (flag_add, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
if (curi->size == sz_long)
tmpc += (isreg (curi->smode) || curi->smode == imm) ? 2 : 0;
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u32 newv = dst + src;\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
if ((isreg (curi->smode) && curi->size == sz_long) || !isreg (curi->smode))
tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u32 newv = dst + src + (GET_XFLG ? 1 : 0);\n");
genflags (flag_addx, curi->size, "newv", "src", "dst");
case i_ABCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u16 newv_lo = (src & 0xF) + (dst & 0xF) + (GET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = (src & 0xF0) + (dst & 0xF0);\n");
case i_NEG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
genflags (flag_sub, curi->size, "dst", "src", "0");
genastore_rev ("dst", curi->smode, "srcreg", curi->size, "src");
case i_NEGX:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u32 newv = 0 - src - (GET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "0");
case i_NBCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
if (isreg (curi->smode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u16 newv_lo = - (src & 0xF) - (GET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = - (src & 0xF0);\n");
case i_CLR:
genamode (curi->smode, "srcreg", curi->size, "src", cpu_level == 0 ? 1 : 2, 0, 0);
if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
genflags (flag_logical, curi->size, "0", "", "");
genastore_rev ("0", curi->smode, "srcreg", curi->size, "src");
break;
case i_NOT:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
if (isreg (curi->smode) && curi->size == sz_long) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
printf ("\tuae_u32 dst = ~src;\n");
genflags (flag_logical, curi->size, "dst", "", "");
break;
case i_TST:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
genflags (flag_logical, curi->size, "src", "", "");
break;
case i_BTST:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
if (isreg (curi->dmode)) tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
case i_CMPM:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, GF_AA);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
genflags (flag_cmp, curi->size, "newv", "src", "dst");
break;
if (curi->dmode == Areg || (curi->dmode == Dreg && curi->size == sz_long))
tmpc += 2;
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
genflags (flag_cmp, curi->size, "newv", "src", "dst");
break;
if (curi->dmode == Areg || (curi->dmode == Dreg && curi->size == sz_long))
tmpc += 2;
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
start_brace ();
genflags (flag_cmp, sz_long, "newv", "src", "dst");
break;
case i_MVPRM:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
printf ("\tuaecptr memp = m68k_areg(regs, dstreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword (0));
- fill_prefetch_next ();
+ fill_prefetch_next ();
if (using_ce) {
if (curi->size == sz_word) {
printf ("\tput_byte_ce (memp, src >> 8); put_byte_ce (memp + 2, src);\n");
printf (" + (get_byte (memp + 4) << 8) + get_byte (memp + 6);\n");
}
}
- fill_prefetch_next ();
+ fill_prefetch_next ();
genastore ("val", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_MOVE:
} else {
printf ("\tuae_u32 val = src;\n");
}
- fill_prefetch_next ();
+ fill_prefetch_next ();
genastore ("val", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_MVSR2:
genamode (curi->smode, "srcreg", sz_word, "src", 2, 0, 0);
if (isreg (curi->smode)) tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
printf ("\tMakeSR();\n");
if (curi->size == sz_byte)
genastore ("regs.sr & 0xff", curi->smode, "srcreg", sz_word, "src");
tmpc += 4;
printf ("\tregs.sr = src;\n");
}
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
printf ("\tMakeFromSR();\n");
break;
case i_SWAP:
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
printf ("\tuae_u32 dst = ((src >> 16)&0xFFFF) | ((src&0xFFFF)<<16);\n");
genflags (flag_logical, sz_long, "dst", "", "");
case i_EXG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- fill_prefetch_next_delay (2);
+ fill_prefetch_next_delay (2);
genastore ("dst", curi->smode, "srcreg", curi->size, "src");
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_EXT:
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 dst = (uae_s32)(uae_s8)src;\n"); break;
genmovemel_ce (opcode);
else
genmovemel (opcode);
- fill_prefetch_next ();
+ fill_prefetch_next ();
break;
case i_MVMLE:
if (using_ce)
genmovemle_ce (opcode);
else
genmovemle (opcode);
- fill_prefetch_next ();
+ fill_prefetch_next ();
break;
case i_TRAP:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
printf ("\tcpureset();\n");
break;
case i_NOP:
- fill_prefetch_next ();
+ fill_prefetch_next ();
break;
case i_STOP:
/* real stop do not prefetch anything, later... */
genamode (Aipi, "7", sz_long, "pc", 1, 0, 0);
genamode (curi->smode, "srcreg", curi->size, "offs", 1, 0, 0);
printf ("\tm68k_areg(regs, 7) += offs;\n");
- printf ("\tif (pc & 1)\n");
- printf ("\t\texception3 (0x%04.4X, m68k_getpc(), pc);\n", opcode);
- printf ("\telse\n");
+ printf ("\tif (pc & 1)\n");
+ printf ("\t\texception3 (0x%04.4X, m68k_getpc(), pc);\n", opcode);
+ printf ("\telse\n");
printf ("\t\tm68k_setpc_rte(pc);\n");
/* PC is set and prefetch filled. */
m68k_pc_offset = 0;
genastore ("m68k_areg(regs, 7)", curi->smode, "srcreg", sz_long, "src");
genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0, 0);
printf ("\tm68k_areg(regs, 7) += offs;\n");
- fill_prefetch_next ();
+ fill_prefetch_next ();
break;
case i_UNLK:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
printf ("\tm68k_areg(regs, 7) = src;\n");
genamode (Aipi, "7", sz_long, "old", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
genastore ("old", curi->smode, "srcreg", curi->size, "src");
break;
case i_RTS:
else
printf ("\tm68k_do_rts();\n");
m68k_pc_offset = 0;
- fill_prefetch_full ();
+ fill_prefetch_full ();
break;
case i_TRAPV:
sync_m68k_pc ();
printf ("\t\tException (7, m68k_getpc ());\n");
printf ("\t\tgoto %s;\n", endlabelstr);
printf ("\t}\n");
- fill_prefetch_next ();
+ fill_prefetch_next ();
need_endlabel = 1;
break;
case i_RTR:
printf ("\tregs.sr |= sr; m68k_setpc(pc);\n");
printf ("\tMakeFromSR();\n");
m68k_pc_offset = 0;
- fill_prefetch_full ();
+ fill_prefetch_full ();
break;
case i_JSR:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA|GF_NOREFILL);
printf ("\t}\n");
need_endlabel = 1;
}
- printf ("\tm68k_setpc (srca);\n");
+ printf ("\tm68k_setpc (srca);\n");
m68k_pc_offset = 0;
fill_prefetch_1 (0);
- printf("\tm68k_areg (regs, 7) -= 4;\n");
+ printf("\tm68k_areg (regs, 7) -= 4;\n");
if (using_ce) {
printf("\tput_word_ce (m68k_areg (regs, 7), oldpc >> 16);\n");
printf("\tput_word_ce (m68k_areg (regs, 7) + 2, oldpc);\n");
} else {
printf("\tput_long (m68k_areg (regs, 7), oldpc);\n");
}
- fill_prefetch_next ();
+ fill_prefetch_next ();
break;
case i_JMP:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA|GF_NOREFILL);
addcycles (2);
printf ("\tm68k_setpc(srca);\n");
m68k_pc_offset = 0;
- fill_prefetch_full ();
+ fill_prefetch_full ();
break;
case i_BSR:
printf ("\tuae_s32 s;\n");
else
printf ("\tm68k_do_bsr (m68k_getpc() + %d, s);\n", m68k_pc_offset);
m68k_pc_offset = 0;
- fill_prefetch_full ();
+ fill_prefetch_full ();
break;
case i_Bcc:
if (curi->size == sz_long) {
printf ("\t\tgoto %s;\n", endlabelstr);
printf ("\t}\n");
sync_m68k_pc ();
- irc2ir ();
+ irc2ir ();
fill_prefetch_2 ();
printf ("\tgoto %s;\n", endlabelstr);
need_endlabel = 1;
next_cpu_level = 1;
}
}
- genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA | GF_NOREFILL);
+ genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA | GF_NOREFILL);
addcycles (2);
printf ("\tif (!cctrue(%d)) goto didnt_jump;\n", curi->cc);
if (using_exception_3) {
fill_prefetch_2 ();
} else
fill_prefetch_full ();
- insn_n_cycles = curi->size == sz_byte ? 8 : 12;
+ insn_n_cycles = curi->size == sz_byte ? 8 : 12;
break;
case i_LEA:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0, GF_AA);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, GF_AA);
if (curi->smode == Ad8r || curi->smode == PC8r)
tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
genastore ("srca", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_PEA:
genamode (Apdi, "7", sz_long, "dst", 2, 0, GF_AA);
if (curi->smode == Ad8r || curi->smode == PC8r)
tmpc += 4;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
genastore ("srca", Apdi, "7", sz_long, "dst");
break;
case i_DBcc:
printf ("\tm68k_setpc (oldpc + %d);\n", m68k_pc_offset);
m68k_pc_offset = 0;
fill_prefetch_full ();
- insn_n_cycles = 12;
+ insn_n_cycles = 12;
need_endlabel = 1;
break;
case i_Scc:
genamode (curi->smode, "srcreg", curi->size, "src", cpu_level == 0 ? 1 : 2, 0, 0);
start_brace ();
- fill_prefetch_next();
+ fill_prefetch_next();
start_brace ();
printf ("\tint val = cctrue(%d) ? 0xff : 0;\n", curi->cc);
if (using_ce) {
*/
printf("\t\tSET_VFLG (1);\n");
printf("\t\tif (dst < 0) SET_NFLG (1);\n");
- }
+ }
printf ("\t\tException (5, oldpc);\n");
printf ("\t\tgoto %s;\n", endlabelstr);
printf ("\t} else {\n");
printf ("\t\t\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
printf ("\t\t"); genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
printf ("\t\t}\n");
- fill_prefetch_next ();
+ fill_prefetch_next ();
sync_m68k_pc ();
printf ("\t}\n");
insn_n_cycles += 136 - (136 - 76) / 2; /* average */
printf ("\t\t\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
printf ("\t\t"); genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
printf ("\t\t}\n");
- fill_prefetch_next ();
+ fill_prefetch_next ();
sync_m68k_pc ();
printf ("\t}\n");
insn_n_cycles += 156 - (156 - 120) / 2; /* average */
case i_MULU:
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0, 0);
- fill_prefetch_next();
+ fill_prefetch_next();
start_brace ();
printf ("\tuae_u32 newv = (uae_u32)(uae_u16)dst * (uae_u32)(uae_u16)src;\n");
if (using_ce)
}
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
sync_m68k_pc ();
- insn_n_cycles += (70 - 38) / 2 + 38; /* average */
+ insn_n_cycles += (70 - 38) / 2 + 38; /* average */
break;
case i_MULS:
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0, 0);
- fill_prefetch_next();
+ fill_prefetch_next();
start_brace ();
printf ("\tuae_u32 newv = (uae_s32)(uae_s16)dst * (uae_s32)(uae_s16)src;\n");
if (using_ce)
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
sync_m68k_pc ();
- fill_prefetch_next_delay (6);
+ fill_prefetch_next_delay (6);
printf ("\tif ((uae_s32)dst < 0) {\n");
printf ("\t\tSET_NFLG (1);\n");
printf ("\t\tException (6, oldpc);\n");
printf ("\tuaecptr oldpc = m68k_getpc();\n");
genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0, 0);
- fill_prefetch_0 ();
+ fill_prefetch_0 ();
printf ("\t{uae_s32 upper,lower,reg = regs.regs[(extra >> 12) & 15];\n");
switch (curi->size) {
case sz_byte:
default: abort ();
}
printf ("\tuae_u32 sign = (%s & val) >> %d;\n", cmask (curi->size), bit_size (curi->size) - 1);
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
- printf ("\tint ccnt = cnt & 63;\n");
+ printf ("\tint ccnt = cnt & 63;\n");
printf ("\tcnt &= 63;\n");
printf ("\tCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
break;
case i_ASRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
break;
case i_ASLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
break;
case i_LSRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
break;
case i_LSLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
break;
case i_ROLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
break;
case i_RORW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
break;
case i_ROXLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
break;
case i_ROXRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
break;
case i_MOVEC2:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
printf ("\tint regno = (src >> 12) & 15;\n");
printf ("\tuae_u32 *regp = regs.regs + regno;\n");
break;
case i_MOVE2C:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
- fill_prefetch_next ();
+ fill_prefetch_next ();
start_brace ();
printf ("\tint regno = (src >> 12) & 15;\n");
printf ("\tuae_u32 *regp = regs.regs + regno;\n");
int old_brace_level;
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
- fill_prefetch_0 ();
+ fill_prefetch_0 ();
start_brace ();
printf ("\tint ru = (src >> 6) & 7;\n");
printf ("\tint rc = src & 7;\n");
case i_TRAPcc:
if (curi->smode != am_unknown && curi->smode != am_illg)
genamode (curi->smode, "srcreg", curi->size, "dummy", 1, 0, 0);
- fill_prefetch_0 ();
+ fill_prefetch_0 ();
printf ("\tif (cctrue(%d)) { Exception(7,m68k_getpc()); goto %s; }\n", curi->cc, endlabelstr);
need_endlabel = 1;
break;
genflags (flag_logical, curi->size, "src", "", "");
if (!isreg (curi->smode))
tmpc += 2;
- fill_prefetch_next_delay (tmpc);
+ fill_prefetch_next_delay (tmpc);
printf ("\tsrc |= 0x80;\n");
genastore ("src", curi->smode, "srcreg", curi->size, "src");
break;
case i_CINVL:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(31);\n");
+ "\t\tflush_icache(31);\n");
break;
case i_CINVP:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(32);\n");
+ "\t\tflush_icache(32);\n");
break;
case i_CINVA:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(33);\n");
+ "\t\tflush_icache(33);\n");
break;
case i_CPUSHL:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(41);\n");
+ "\t\tflush_icache(41);\n");
break;
case i_CPUSHP:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(42);\n");
+ "\t\tflush_icache(42);\n");
break;
case i_CPUSHA:
printf ("\tif (opcode&0x80)\n"
- "\t\tflush_icache(43);\n");
+ "\t\tflush_icache(43);\n");
break;
case i_MOVE16:
if ((opcode & 0xfff8) == 0xf620) {
printf ("\tput_long(memda+8, get_long(memsa+8));\n");
printf ("\tput_long(memda+12, get_long(memsa+12));\n");
if ((opcode & 0xfff8) == 0xf600)
- printf ("\tm68k_areg(regs, srcreg) += 16;\n");
+ printf ("\tm68k_areg(regs, srcreg) += 16;\n");
else if ((opcode & 0xfff8) == 0xf608)
printf ("\tm68k_areg(regs, dstreg) += 16;\n");
}
fprintf (f, "#include \"newcpu.h\"\n");
fprintf (f, "#include \"cpu_prefetch.h\"\n");
fprintf (f, "#include \"cputbl.h\"\n");
-
+
fprintf (f, "#define CPUFUNC(x) x##_ff\n"
"#define SET_CFLG_ALWAYS(x) SET_CFLG(x)\n"
"#define SET_NFLG_ALWAYS(x) SET_NFLG(x)\n"
}
break;
case imm0:
- strcpy (buffer,"#<data>.B");
- break;
+ strcpy (buffer,"#<data>.B");
+ break;
case imm1:
- strcpy (buffer,"#<data>.W");
- break;
+ strcpy (buffer,"#<data>.W");
+ break;
case imm2:
- strcpy (buffer,"#<data>.L");
- break;
+ strcpy (buffer,"#<data>.L");
+ break;
case immi:
- strcpy (buffer,"#<data>");
- break;
+ strcpy (buffer,"#<data>");
+ break;
default:
break;
/* sam: this is for people with low memory (eg. me :)) */
printf ("\n"
- "#if !defined(PART_1) && !defined(PART_2) && "
- "!defined(PART_3) && !defined(PART_4) && "
+ "#if !defined(PART_1) && !defined(PART_2) && "
+ "!defined(PART_3) && !defined(PART_4) && "
"!defined(PART_5) && !defined(PART_6) && "
"!defined(PART_7) && !defined(PART_8)"
"\n"
- "#define PART_1 1\n"
- "#define PART_2 1\n"
- "#define PART_3 1\n"
- "#define PART_4 1\n"
- "#define PART_5 1\n"
- "#define PART_6 1\n"
- "#define PART_7 1\n"
- "#define PART_8 1\n"
- "#endif\n\n");
-
+ "#define PART_1 1\n"
+ "#define PART_2 1\n"
+ "#define PART_3 1\n"
+ "#define PART_4 1\n"
+ "#define PART_5 1\n"
+ "#define PART_6 1\n"
+ "#define PART_7 1\n"
+ "#define PART_8 1\n"
+ "#endif\n\n");
+
rp = 0;
for(j = 1; j <= 8; ++j) {
int k = (j * nr_cpuop_funcs) / 8;
fprintf (stblfile, "#ifdef CPUEMU_%d\n", postfix);
postfix2 = postfix;
sprintf (fname, "cpuemu_%d.c", postfix);
- freopen (fname, "wb", stdout);
+ freopen (fname, "wb", stdout);
generate_includes (stdout);
}
cpu_level = 4 - i;
}
if (i > 0 && i < 4)
fprintf (stblfile, "#ifndef CPUEMU_68000_ONLY\n");
- fprintf (stblfile, "struct cputbl CPUFUNC(op_smalltbl_%d)[] = {\n", postfix);
+ fprintf (stblfile, "struct cputbl CPUFUNC(op_smalltbl_%d)[] = {\n", postfix);
generate_func ();
if (i > 0 && i < 4)
fprintf (stblfile, "#endif /* CPUEMU_68000_ONLY */\n");
*
* Copyright 1997, 1998 Bernd Schmidt
* Copyright 1998 Michael Krause
- *
+ *
* The Tk GUI doesn't work.
* The X Forms Library isn't available as source, and there aren't any
* binaries compiled against glibc
&volname, &rootdir, &readonly,
&secspertrack, &surfaces, &reserved,
&cylinders, &size, &blocksize);
-
+
if (is_hardfile (currprefs.mountinfo, i)) {
sprintf (texts[0], "DH%d", i );
sprintf (texts[3], "%d", surfaces);
{
if (quit_gui)
return;
-
+
write_comm_pipe_int (&from_gui_pipe, 2, 1);
}
{
if (quit_gui)
return;
-
+
write_comm_pipe_int (&from_gui_pipe, 3, 1);
}
{
if (quit_gui)
return;
-
+
write_comm_pipe_int (&from_gui_pipe, 4, 1);
}
{
if (quit_gui)
return;
-
+
write_comm_pipe_int (&from_gui_pipe, 0, 0);
write_comm_pipe_int (&from_gui_pipe, (int)data, 1);
}
if (quit_gui)
return;
- write_comm_pipe_int (&from_gui_pipe, GTK_TOGGLE_BUTTON (widget)->active ? 5 : 6, 1);
+ write_comm_pipe_int (&from_gui_pipe, GTK_TOGGLE_BUTTON (widget)->active ? 5 : 6, 1);
}
static void end_pause_uae (void)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pause_uae_widget), FALSE);
}
-
+
static int filesel_active = -1;
static GtkWidget *disk_selector;
thing = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_box_pack_start (GTK_BOX (the_led), thing, TRUE, TRUE, 0);
gtk_widget_show (thing);
-
+
return the_led;
}
/* Frame with an hbox and the "DFx:" title */
sprintf (buf, "DF%d:", i);
buttonbox = make_file_container (buf, vbox);
-
+
/* LED */
subthing = make_led (i + 1);
gtk_box_pack_start (GTK_BOX (buttonbox), subthing, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), newbox, FALSE, FALSE, 0);
add_empty_vbox (hbox);
- gtk_widget_show (hbox);
+ gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
frame = gtk_frame_new ("CPU flags");
gtk_signal_connect (GTK_OBJECT (ccpu_widget), "clicked",
(GtkSignalFunc) cputype_changed, NULL);
gtk_signal_connect (GTK_OBJECT (a24m_widget), "clicked",
- (GtkSignalFunc) cputype_changed, NULL);
+ (GtkSignalFunc) cputype_changed, NULL);
}
static void make_gfx_widgets (GtkWidget *vbox)
"Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
NULL
},*complabels2[] = {
- "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
+ "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
NULL
},*complabels3[] = {
- "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
+ "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
NULL
},*complabels3a[] = {
- "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
+ "Direct", "Indirect", "Indirect for KS", "Direct after Picasso",
NULL
}, *complabels4[] = {
"Always generate", "Only generate when needed",
"Soft", "Hard",
NULL
}, *complabels9[] = {
- "Disable", "Enable",
+ "Disable", "Enable",
NULL
};
GtkWidget *thing;
gtk_box_pack_start (GTK_BOX (hbox), label1, FALSE, TRUE, 10);
gtk_widget_show (label1);
thing = gtk_entry_new_with_max_length (255);
- gtk_box_pack_start (GTK_BOX (hbox), thing, TRUE, TRUE, 10);
+ gtk_box_pack_start (GTK_BOX (hbox), thing, TRUE, TRUE, 10);
gtk_widget_show (thing);
path_entry = thing;
gtk_box_pack_start (GTK_BOX (hbox), thing, FALSE, TRUE, 10);
gtk_widget_show (thing);
thing = gtk_entry_new_with_max_length (255);
- gtk_box_pack_start (GTK_BOX (hbox), thing, TRUE, TRUE, 10);
+ gtk_box_pack_start (GTK_BOX (hbox), thing, TRUE, TRUE, 10);
gtk_widget_show (thing);
gtk_widget_set_usize (thing, 200, -1);
volname_entry = thing;
hd_change_mode = 1;
if (is_hardfile (currprefs.mountinfo, selected_hd_row)) {
} else {
- create_dirdlg ("Change a mounted directory");
+ create_dirdlg ("Change a mounted directory");
gtk_entry_set_text (GTK_ENTRY (volname_entry), volname);
gtk_entry_set_text (GTK_ENTRY (path_entry), rootdir);
}
{ "Graphics", make_gfx_widgets },
{ "Chipset", make_chipset_widgets },
{ "Sound", make_sound_widgets },
- { "JIT", make_comp_widgets },
+ { "JIT", make_comp_widgets },
{ "Game ports", make_joy_widgets },
{ "Harddisks", make_hd_widgets },
{ "About", make_about_widgets }
void gui_changesettings(void)
{
-
+
}
void gui_fps (int x)
void gui_handle_events (void)
{
int pause_uae = FALSE;
-
+
if (no_gui)
return;
do {
- while (pause_uae || comm_pipe_has_data (&from_gui_pipe)) {
- int cmd = read_comm_pipe_int_blocking (&from_gui_pipe);
- int n;
- switch (cmd) {
+ while (pause_uae || comm_pipe_has_data (&from_gui_pipe)) {
+ int cmd = read_comm_pipe_int_blocking (&from_gui_pipe);
+ int n;
+ switch (cmd) {
case 0:
n = read_comm_pipe_int_blocking (&from_gui_pipe);
changed_prefs.df[n][0] = '\0';
free (gui_keyname);
uae_sem_post (&gui_sem);
break;
- }
- }
+ }
+ }
} while (pause_uae);
}
uae_thread_id tid;
gui_active = 0;
-
+
init_comm_pipe (&to_gui_pipe, 20, 1);
init_comm_pipe (&from_gui_pipe, 20, 1);
uae_sem_init (&gui_sem, 0, 1);
case CMD_REMCHANGEINT:
release_async_request (hfpd, request);
break;
-
+
case HD_SCSICMD: /* SCSI */
if (hfd->nrcyls == 0)
error = handle_scsi (request, hfd);
hf_log2 ("hf: unit=%d, request=%p, cmd=%d offset=%u len=%d, actual=%d error%=%d\n", unit, request,
get_word(request + 28), get_long (request + 44), get_long (request + 36), actual, error);
-
+
return async;
}
if (hfpd->opencount > 0) {
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
uaecptr request;
- if (request = hfpd->d_request[i])
+ if (request = hfpd->d_request[i])
abort_async (hfpd, request, 0, 0);
}
}
int bytespersector;
int bus, target, lun;
int id;
- char label[60];
+ char *label;
};
typedef int (*open_bus_func)(int flags);
struct UAEBSDBase {
char dummy[LIBRARY_SIZEOF];
- struct socketbase *sb;
+ uae_u32 sb[sizeof (void*) / 4];
char scratchbuf[SCRATCHBUFSIZE];
};
int catweasel_track0(catweasel_drive *d);
-#endif
\ No newline at end of file
+#endif
+#ifdef CPU_64_BIT
+typedef uae_u64 uintptr;
+#else
+typedef uae_u32 uintptr;
+#endif
+
#define USE_OPTIMIZER 0
#define USE_LOW_OPTIMIZER 0
#define USE_ALIAS 1
AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG,
AKS_DECREASEREFRESHRATE,
AKS_INCREASEREFRESHRATE,
- AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2
+ AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2,
+ AKS_TOGGLEMOUSEGRAB, AKS_SWITCHINTERPOL
};
int win32_no_overlay; /* If this is set, we won't try and use any RGB overlays */
int win32_ctrl_F11_is_quit;
int win32_automount_drives;
+ int win32_automount_netdrives;
int win32_midioutdev;
int win32_midiindev;
int win32_aspi;
int win32_soundcard;
int win32_norecyclebin;
+ int win32_specialkey;
+ int win32_kbledmode;
int curses_reverse_video;
extern char optionsfile[];
extern void save_options (struct zfile *, struct uae_prefs *, int);
extern void cfgfile_write (struct zfile *, char *format,...);
+extern void cfgfile_target_write (struct zfile *, char *format,...);
extern void cfgfile_backup (const char *path);
extern void default_prefs (struct uae_prefs *, int);
extern void closeprinter (void);
extern void openprinter (void);
extern int isprinteropen (void);
-
-
#elif _MSC_VER
#define STATIC_INLINE static __forceinline
#define NOINLINE __declspec(noinline)
-#define NORETURN __declspec(noreturn)
+#define NORETURN __declspec(noreturn)
#else
#define STATIC_INLINE static __inline__
#define NOINLINE
typedef int (ZEXPORT *DEFLATE)(z_streamp strm, int flush);
typedef uLong (ZEXPORT *CRC32)(uLong crc, const Bytef *buf, uInt len);
-extern INFLATEINIT2 pinflateInit2;
-extern INFLATEINIT pinflateInit;
-extern INFLATEEND pinflateEnd;
-extern INFLATE pinflate;
-extern CRC32 pcrc32;
-
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
extern void handle_events (void);
extern void setup_brkhandler (void);
extern int isfullscreen (void);
+extern void toggle_fullscreen (void);
+extern void toggle_mousegrab (void);
extern void flush_line (int);
extern void flush_block (int, int);
*/
struct zfile;
-extern int is_zlib;
typedef int (*zfile_callback)(struct zfile*, void*);
int inputdevice_uaelib (char *s, char *parm)
{
int i;
-
+
for (i = 1; events[i].name; i++) {
if (!strcmp (s, events[i].confname)) {
handle_input_event (i, atol (parm), 1, 0);
option += 6; /* "input." */
p = getstring (&option);
- if (!strcasecmp (p, "config"))
+ if (!strcasecmp (p, "config"))
pr->input_selected_setting = atol (value);
- if (!strcasecmp (p, "joymouse_speed_analog"))
+ if (!strcasecmp (p, "joymouse_speed_analog"))
pr->input_joymouse_multiplier = atol (value);
- if (!strcasecmp (p, "joymouse_speed_digital"))
+ if (!strcasecmp (p, "joymouse_speed_digital"))
pr->input_joymouse_speed = atol (value);
- if (!strcasecmp (p, "joystick_deadzone"))
+ if (!strcasecmp (p, "joystick_deadzone"))
pr->input_joystick_deadzone = atol (value);
- if (!strcasecmp (p, "joymouse_deadzone"))
+ if (!strcasecmp (p, "joymouse_deadzone"))
pr->input_joymouse_deadzone = atol (value);
- if (!strcasecmp (p, "mouse_speed"))
+ if (!strcasecmp (p, "mouse_speed"))
pr->input_mouse_speed = atol (value);
- if (!strcasecmp (p, "autofire"))
+ if (!strcasecmp (p, "autofire"))
pr->input_autofire_framecnt = atol (value);
idnum = atol (p);
if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS)
num = getnum (&p);
}
p = value;
-
+
custom = NULL;
for (subnum = 0; subnum < MAX_INPUT_SUB_EVENT; subnum++) {
xfree (custom);
mouse_frame_x[i] = mouse_x[i];
mouse_frame_y[i] = mouse_y[i];
}
-
+
}
}
{
uae_u8 but = 0;
int i;
-
+
for (i = 0; i < 2; i++) {
if (cd32_pad_enabled[i]) {
uae_u16 p5dir = 0x0200 << (i * 4);
void handle_cd32_joystick_cia (uae_u8 pra, uae_u8 dra)
{
static int oldstate[2];
- int i;
-
+ int i;
+
for (i = 0; i < 2; i++) {
uae_u8 but = 0x40 << i;
uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
static uae_u8 keybuf[256];
static int inputcode_pending, inputcode_pending_state;
+ void inputdevice_release_all_keys (void)
+ {
+ int i;
+
+ for (i = 0; i < 0x80; i++) {
+ if (keybuf[i] != 0) {
+ keybuf[i] = 0;
+ record_key (i << 1|1);
+ }
+ }
+ }
+
+
void inputdevice_add_inputcode (int code, int state)
{
inputcode_pending = code;
#ifdef ARCADIA
switch (code)
{
- case AKS_ARCADIADIAGNOSTICS:
+ case AKS_ARCADIADIAGNOSTICS:
arcadia_flag &= ~1;
arcadia_flag |= state ? 1 : 0;
break;
- case AKS_ARCADIAPLY1:
+ case AKS_ARCADIAPLY1:
arcadia_flag &= ~4;
arcadia_flag |= state ? 4 : 0;
break;
- case AKS_ARCADIAPLY2:
+ case AKS_ARCADIAPLY2:
arcadia_flag &= ~2;
arcadia_flag |= state ? 2 : 0;
break;
- case AKS_ARCADIACOIN1:
+ case AKS_ARCADIACOIN1:
if (state)
arcadia_coin[0]++;
break;
- case AKS_ARCADIACOIN2:
+ case AKS_ARCADIACOIN2:
if (state)
arcadia_coin[1]++;
break;
return;
switch (code)
{
- case AKS_ENTERGUI:
+ case AKS_ENTERGUI:
gui_display (-1);
break;
- case AKS_SCREENSHOT:
+ case AKS_SCREENSHOT:
screenshot(1, 1);
break;
#ifdef ACTION_REPLAY
- case AKS_FREEZEBUTTON:
+ case AKS_FREEZEBUTTON:
action_replay_freeze ();
break;
#endif
- case AKS_FLOPPY0:
+ case AKS_FLOPPY0:
gui_display (0);
break;
- case AKS_FLOPPY1:
+ case AKS_FLOPPY1:
gui_display (1);
break;
- case AKS_FLOPPY2:
+ case AKS_FLOPPY2:
gui_display (2);
break;
- case AKS_FLOPPY3:
+ case AKS_FLOPPY3:
gui_display (3);
break;
- case AKS_EFLOPPY0:
+ case AKS_EFLOPPY0:
disk_eject (0);
break;
- case AKS_EFLOPPY1:
+ case AKS_EFLOPPY1:
disk_eject (1);
break;
- case AKS_EFLOPPY2:
+ case AKS_EFLOPPY2:
disk_eject (2);
break;
- case AKS_EFLOPPY3:
+ case AKS_EFLOPPY3:
disk_eject (3);
break;
- case AKS_IRQ7:
+ case AKS_IRQ7:
Interrupt (7);
break;
- case AKS_PAUSE:
+ case AKS_PAUSE:
pausemode (-1);
break;
- case AKS_WARP:
+ case AKS_WARP:
warpmode (-1);
break;
- case AKS_INHIBITSCREEN:
+ case AKS_INHIBITSCREEN:
toggle_inhibit_frame (IHF_SCROLLLOCK);
break;
- case AKS_STATEREWIND:
+ case AKS_STATEREWIND:
savestate_dorewind(1);
break;
- case AKS_VOLDOWN:
+ case AKS_VOLDOWN:
sound_volume (-1);
break;
- case AKS_VOLUP:
+ case AKS_VOLUP:
sound_volume (1);
break;
- case AKS_VOLMUTE:
+ case AKS_VOLMUTE:
sound_volume (0);
break;
- case AKS_QUIT:
+ case AKS_QUIT:
uae_quit ();
break;
- case AKS_SOFTRESET:
+ case AKS_SOFTRESET:
uae_reset (0);
break;
- case AKS_HARDRESET:
+ case AKS_HARDRESET:
uae_reset (1);
break;
- case AKS_STATESAVEQUICK:
- case AKS_STATESAVEQUICK1:
- case AKS_STATESAVEQUICK2:
- case AKS_STATESAVEQUICK3:
- case AKS_STATESAVEQUICK4:
- case AKS_STATESAVEQUICK5:
- case AKS_STATESAVEQUICK6:
- case AKS_STATESAVEQUICK7:
- case AKS_STATESAVEQUICK8:
- case AKS_STATESAVEQUICK9:
+ case AKS_STATESAVEQUICK:
+ case AKS_STATESAVEQUICK1:
+ case AKS_STATESAVEQUICK2:
+ case AKS_STATESAVEQUICK3:
+ case AKS_STATESAVEQUICK4:
+ case AKS_STATESAVEQUICK5:
+ case AKS_STATESAVEQUICK6:
+ case AKS_STATESAVEQUICK7:
+ case AKS_STATESAVEQUICK8:
+ case AKS_STATESAVEQUICK9:
savestate_quick ((code - AKS_STATESAVEQUICK) / 2, 1);
break;
- case AKS_STATERESTOREQUICK:
- case AKS_STATERESTOREQUICK1:
- case AKS_STATERESTOREQUICK2:
- case AKS_STATERESTOREQUICK3:
- case AKS_STATERESTOREQUICK4:
- case AKS_STATERESTOREQUICK5:
- case AKS_STATERESTOREQUICK6:
- case AKS_STATERESTOREQUICK7:
- case AKS_STATERESTOREQUICK8:
- case AKS_STATERESTOREQUICK9:
+ case AKS_STATERESTOREQUICK:
+ case AKS_STATERESTOREQUICK1:
+ case AKS_STATERESTOREQUICK2:
+ case AKS_STATERESTOREQUICK3:
+ case AKS_STATERESTOREQUICK4:
+ case AKS_STATERESTOREQUICK5:
+ case AKS_STATERESTOREQUICK6:
+ case AKS_STATERESTOREQUICK7:
+ case AKS_STATERESTOREQUICK8:
+ case AKS_STATERESTOREQUICK9:
savestate_quick ((code - AKS_STATERESTOREQUICK) / 2, 0);
break;
- case AKS_TOGGLEFULLSCREEN:
- fullscreentoggle ();
+ case AKS_TOGGLEFULLSCREEN:
+ toggle_fullscreen ();
break;
- case AKS_ENTERDEBUGGER:
+ case AKS_TOGGLEMOUSEGRAB:
+ toggle_mousegrab ();
+ break;
+ case AKS_ENTERDEBUGGER:
activate_debugger ();
break;
- case AKS_STATESAVEDIALOG:
+ case AKS_STATESAVEDIALOG:
gui_display (5);
- break;
+ break;
case AKS_STATERESTOREDIALOG:
gui_display (4);
break;
- case AKS_DECREASEREFRESHRATE:
- case AKS_INCREASEREFRESHRATE:
- {
- int dir = code == AKS_INCREASEREFRESHRATE ? 5 : -5;
- if (currprefs.chipset_refreshrate == 0)
- currprefs.chipset_refreshrate = currprefs.ntscmode ? 60 : 50;
- changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate + dir;
- if (changed_prefs.chipset_refreshrate < 10)
- changed_prefs.chipset_refreshrate = 10;
- if (changed_prefs.chipset_refreshrate > 900)
- changed_prefs.chipset_refreshrate = 900;
- }
- break;
+ case AKS_DECREASEREFRESHRATE:
+ case AKS_INCREASEREFRESHRATE:
+ {
+ int dir = code == AKS_INCREASEREFRESHRATE ? 5 : -5;
+ if (currprefs.chipset_refreshrate == 0)
+ currprefs.chipset_refreshrate = currprefs.ntscmode ? 60 : 50;
+ changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate + dir;
+ if (changed_prefs.chipset_refreshrate < 10)
+ changed_prefs.chipset_refreshrate = 10;
+ if (changed_prefs.chipset_refreshrate > 900)
+ changed_prefs.chipset_refreshrate = 900;
+ }
+ break;
}
}
{
struct inputevent *ie;
int joy;
-
+
if (nr <= 0)
return 0;
ie = &events[nr];
uae_u32 omask = id2->buttonmask & mask;
uae_u32 nmask = (state ? 1 : 0) << button;
char *custom;
-
+
if (button >= ID_BUTTON_TOTAL)
return;
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
id2->buttonmask |= mask;
else
id2->buttonmask &= ~mask;
- }
+ }
}
mouse_delta[i][2] = 0;
}
memset (keybuf, 0, sizeof (keybuf));
-
+
for (i = 0; i < INPUT_QUEUE_SIZE; i++)
input_queue[i].framecnt = input_queue[i].nextframecnt = -1;
keyboard_default = trans;
}
-int inputdevice_translatekeycode (int keyboard, int scancode, int state)
+static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int state)
{
struct uae_input_device *na = &keyboards[keyboard];
int j, k;
return handled;
}
+#define IECODE_UP_PREFIX 0x80
+#define RAW_STEALTH 0x68
+#define STEALTHF_E0KEY 0x08
+#define STEALTHF_UPSTROKE 0x04
+#define STEALTHF_SPECIAL 0x02
+#define STEALTHF_E1KEY 0x01
+
+static void sendmmcodes(int code, int newstate)
+{
+ uae_u8 b;
+
+ b = RAW_STEALTH | IECODE_UP_PREFIX;
+ record_key(((b << 1) | (b >> 7)) & 0xff);
+ b = IECODE_UP_PREFIX;
+ if ((code >> 8) == 0x01)
+ b |= STEALTHF_E0KEY;
+ if ((code >> 8) == 0x02)
+ b |= STEALTHF_E1KEY;
+ if (!newstate)
+ b |= STEALTHF_UPSTROKE;
+ record_key(((b << 1) | (b >> 7)) & 0xff);
+ b = ((code >> 4) & 0x0f) | IECODE_UP_PREFIX;
+ record_key(((b << 1) | (b >> 7)) & 0xff);
+ b = (code & 0x0f) | IECODE_UP_PREFIX;
+ record_key(((b << 1) | (b >> 7)) & 0xff);
+}
+
+int inputdevice_translatekeycode (int keyboard, int scancode, int state)
+{
+ if (inputdevice_translatekeycode_2 (keyboard, scancode, state))
+ return 1;
+ if (currprefs.mmkeyboard)
+ sendmmcodes(scancode, state);
+ return 0;
+}
+
static struct inputdevice_functions idev[3];
void inputdevice_init (void)
memcpy (&dst->keyboard_settings[i][j], &src->keyboard_settings[i][j], sizeof (struct uae_input_device));
}
}
-
+
inputdevice_updateconfig (dst);
}
k++;
}
}
- }
+ }
}
void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum)
fract2[mouse][axis] += v;
diff = fract2[mouse][axis] - fract1[mouse][axis];
if (diff > 1 || diff < -1) {
- v -= (int)diff;
+ v -= (int)diff;
fract2[mouse][axis] -= diff;
}
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++)
DEFEVENT(SPC_QUIT,"Quit emulator",AM_K,0,0,AKS_QUIT)
DEFEVENT(SPC_SOFTRESET,"Reset emulation",AM_K,0,0,AKS_SOFTRESET)
DEFEVENT(SPC_HARDRESET,"Hard reset emulation",AM_K,0,0,AKS_HARDRESET)
+DEFEVENT(SPC_ENTERDEBUGGER,"Activate the built-in debugger",AM_K,0,0,AKS_ENTERDEBUGGER)
DEFEVENT(SPC_STATESAVE,"Quick save state",AM_K,0,0,AKS_STATESAVEQUICK)
DEFEVENT(SPC_STATERESTORE,"Quick restore state",AM_K,0,0,AKS_STATERESTOREQUICK)
DEFEVENT(SPC_STATESAVEDIALOG,"Save state",AM_K,0,0,AKS_STATESAVEDIALOG)
DEFEVENT(SPC_STATERESTOREDIALOG,"Restore state",AM_K,0,0,AKS_STATERESTOREDIALOG)
DEFEVENT(SPC_TOGGLEFULLSCREEN,"Toggle windowed/fullscreen",AM_K,0,0,AKS_TOGGLEFULLSCREEN)
+DEFEVENT(SPC_TOGGLEMOUSEGRAB,"Toggle between mouse grabbed and un-grabbed",AM_K,0,0,AKS_TOGGLEMOUSEGRAB)
DEFEVENT(SPC_DECREASE_REFRESHRATE,"Decrease emulation speed",AM_K,0,0,AKS_DECREASEREFRESHRATE)
DEFEVENT(SPC_INCREASE_REFRESHRATE,"Increase emulation speed",AM_K,0,0,AKS_INCREASEREFRESHRATE)
+DEFEVENT(SPC_SWITCHINTERPOL,"Switch between audio interpolation methods",AM_K,0,0,AKS_SWITCHINTERPOL)
DEFEVENT(SPC_ARCADIA_DIAGNOSTICS,"Arcadia diagnostics dip switch",AM_K,0,0,AKS_ARCADIADIAGNOSTICS)
DEFEVENT(SPC_ARCADIA_PLAYER1,"Arcadia player 1",AM_K,0,0,AKS_ARCADIAPLY1)
char *romlist_get (struct romdata *rd)
{
int i;
-
+
if (!rd)
return 0;
for (i = 0; i < romlist_cnt; i++) {
{ "Space Ranger\0ar_sprg", 0, 0, 0, 0, 43, 0, 0, ROMTYPE_ARCADIA },
{ "Xenon\0ar_xeon", 0, 0, 0, 0, 44, 0, 0, ROMTYPE_ARCADIA },
- { 0 }
+ { NULL, 0, 0, 0, 0, 0, 0, 0, 0 }
+
};
struct romdata *getarcadiarombyname (char *name)
uae_u8 *keybuf = 0;
int keysize = 0;
char tmp[MAX_PATH], *d;
-
+
tmp[0] = 0;
if (path)
strcpy (tmp, path);
f = zfile_fopen(tmp, "rb");
}
}
-
+
}
}
memset (p, 0, size);
zfile_fseek (f, 0, SEEK_SET);
zfile_fread (p, 1, size, f);
- zfile_fseek (f, pos, SEEK_SET);
+ zfile_fseek (f, pos, SEEK_SET);
rd = getromdatabydata (p, size);
xfree (p);
return rd;
{
#ifdef JIT
special_mem |= S_WRITE;
-#endif
+#endif
if (currprefs.illegal_mem) {
if (illegal_count < MAX_ILG) {
illegal_count++;
} else {
cr = 1;
}
-
+
if (cloanto_rom)
*cloanto_rom = cr;
{
uae_u32 cksum = 0, prevck = 0;
int i, ch = size == 524288 ? 0x7ffe8 : 0x3e;
-
+
mem[ch] = 0;
mem[ch + 1] = 0;
mem[ch + 2] = 0;
uae_u8 kickshift1[] = { 0x41, 0xf8, 0x04, 0x00 };
uae_u8 kickshift2[] = { 0x41, 0xf8, 0x10, 0x00 };
uae_u8 kickshift3[] = { 0x43, 0xf8, 0x04, 0x00 };
-
+
for (i = 0x200; i < 0x300; i++) {
if (!memcmp (kickmemory + i, kickshift1, sizeof (kickshift1)) ||
!memcmp (kickmemory + i, kickshift2, sizeof (kickshift2)) ||
if( f == NULL ) { /* still no luck */
#if defined(AMIGA)||defined(__POS__)
#define USE_UAE_ERSATZ "USE_UAE_ERSATZ"
- if( !getenv(USE_UAE_ERSATZ))
+ if( !getenv(USE_UAE_ERSATZ))
{
write_log ("Using current ROM. (create ENV:%s to "
"use uae's ROM replacement)\n",USE_UAE_ERSATZ);
}
}
}
-
+
static void add_shmmaps (uae_u32 start, addrbank *what)
{
shmpiece *x = shm_start;
#ifdef ARCADIA
if (!arcadia_rom) {
#endif
- action_replay_memory_reset();
+ action_replay_memory_reset();
#ifdef ACTION_REPLAY_HRTMON
hrtmon_map_banks();
#endif
#ifndef ACTION_REPLAY_HIDE_CARTRIDGES
#ifdef ACTION_REPLAY
- action_replay_map_banks();
+ action_replay_map_banks();
#endif
#endif
#ifdef ARCADIA
ersatzkickfile = 1;
#endif
-#ifdef ACTION_REPLAY
+#ifdef ACTION_REPLAY
action_replay_load();
action_replay_init(1);
-
+
#ifdef ACTION_REPLAY_HRTM
hrtmon_load(1);
#endif
xfree (a1000_bootrom);
if (chipmemory)
mapped_free (chipmemory);
-
+
bogomemory = 0;
kickmemory = 0;
a1000_bootrom = 0;
{
uae_u32 crc32;
int i;
-
+
restore_u32 ();
restore_u32 ();
restore_u32 ();
* Call Amiga Exec functions outside the main UAE thread.
*
* Copyright 1999 Patrick Ohly
- *
+ *
* Uses the EXTER interrupt that is setup in filesys.c
* and needs thread support.
*/
write_log (" 24-bit addressing");
}
write_log ("\n");
-
+
read_table68k ();
do_merges ();
#ifdef DEBUGGER
if (!exception_debugging)
return;
- console_out ("Exception %d, PC=%08.8X\n", nr, m68k_getpc());
+ console_out ("Exception %d, PC=%08.8X\n", nr, m68k_getpc());
#endif
}
switch (regno) {
case 0: regs.sfc = *regp & 7; break;
case 1: regs.dfc = *regp & 7; break;
- case 2:
+ case 2:
cacr = *regp & (currprefs.cpu_level < 4 ? 0x3 : (currprefs.cpu_level == 4 ? 0x80008000 : 0xf8800e00));
#ifdef JIT
if (currprefs.cpu_level < 4) {
if(!(regs.spcflags & ~SPCFLAG_ACTION_REPLAY)) return 0;
}
#endif
- if ((regs.spcflags & SPCFLAG_ACTION_REPLAY) && action_replay_flag != ACTION_REPLAY_INACTIVE )
+ if ((regs.spcflags & SPCFLAG_ACTION_REPLAY) && action_replay_flag != ACTION_REPLAY_INACTIVE )
{
/*if(action_replay_flag == ACTION_REPLAY_ACTIVE && !is_ar_pc_in_rom())*/
/* write_log("PC:%p\n",m68k_getpc());*/
-
- if(action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET)
+
+ if(action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET)
action_replay_enter();
- if(action_replay_flag == ACTION_REPLAY_HIDE && !is_ar_pc_in_rom())
+ if(action_replay_flag == ACTION_REPLAY_HIDE && !is_ar_pc_in_rom())
{
action_replay_hide();
unset_special(SPCFLAG_ACTION_REPLAY);
{
int new_cycles;
- for (;;)
- {
+ for (;;)
+ {
uae_u16 opcode = get_iword(0);
#if defined X86_ASSEMBLY
__asm__ __volatile__("\tpush %%ebp\n\tcall *%%ebx\n\tpop %%ebp" /* FIXME */
- : "=&a" (new_cycles)
+ : "=&a" (new_cycles)
: "b" (cpufunctbl[opcode]), "0" (opcode)
- : "%edx", "%ecx", "%esi", "%edi",
+ : "%edx", "%ecx", "%esi", "%edi",
"%ebp", "memory", "cc");
#else
new_cycles = (*cpufunctbl[opcode])(opcode);
new_cycles &= cycles_mask;
new_cycles |= cycles_val;
do_cycles (new_cycles);
-
+
if (end_block(opcode) ||
regs.spcflags) {
return; /* We will deal with the spcflags in the caller */
return;
total_cycles = 0;
blocklen = 0;
- start_pc_p = regs.pc_oldp;
- start_pc = regs.pc;
- for (;;)
+ start_pc_p = regs.pc_oldp;
+ start_pc = regs.pc;
+ for (;;)
{ /* Take note: This is the do-it-normal loop */
uae_u16 opcode = get_iword (0);
pc_hist[blocklen].location = (uae_u16*)regs.pc_p;
#if defined X86_ASSEMBLY
__asm__ __volatile__("\tpush %%ebp\n\tcall *%%ebx\n\tpop %%ebp" /* FIXME */
- : "=&a" (new_cycles)
+ : "=&a" (new_cycles)
: "b" (cpufunctbl[opcode]), "0" (opcode)
- : "%edx", "%ecx", "%esi", "%edi",
+ : "%edx", "%ecx", "%esi", "%edi",
"%ebp", "memory", "cc");
#else
new_cycles = (*cpufunctbl[opcode])(opcode);
static void m68k_run_2a (void)
{
- for (;;) {
-#if defined X86_ASSEMBLY
+ for (;;) {
+#if defined X86_ASSEMBLY
__asm__ __volatile__(
"\tpush %%ebp\n\tcall *%0\n\tpop %%ebp" /* FIXME */
- :: "m" (cache_tags[cacheline(regs.pc_p)].handler)
+ :: "m" (cache_tags[cacheline(regs.pc_p)].handler)
: "%edx", "%ecx", "%eax",
"%esi", "%ebx", "%edi", "%ebp", "memory", "cc");
#else
currprefs.cpu_level == 0 && currprefs.cpu_compatible ? m68k_run_1 :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2);
#else
- m68k_run1 (currprefs.cpu_cycle_exact && currprefs.cpu_level == 0 ? m68k_run_1_ce :
- currprefs.cpu_compatible > 0 && currprefs.cpu_level == 0 ? m68k_run_1 :
+ m68k_run1 (currprefs.cpu_cycle_exact && currprefs.cpu_level == 0 ? m68k_run_1_ce :
+ currprefs.cpu_compatible > 0 && currprefs.cpu_level == 0 ? m68k_run_1 :
currprefs.cpu_level >= 2 && currprefs.cachesize ? m68k_run_2a :
currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2);
#endif
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname);
}
-
+
for (i = 0; i < (m68kpc_offset - oldpc) / 2; i++) {
f_out (f, "%04x ", get_iword_1 (oldpc + i * 2));
}
newpc = m68k_getpc () + m68kpc_offset;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname);
}
-
+
if (instrcode)
{
int i;
{
exception3f (opcode, addr, fault, 0, 0);
}
+
void exception3i (uae_u32 opcode, uaecptr addr, uaecptr fault)
{
exception3f (opcode, addr, fault, 0, 1);
Best case without signed overflow: 122 cycles.
Best case with signed overflow: 120 cycles
-
+
*/
static LPVOID dwData1,dwData2;
int ahi_pollrate = 40;
-int sound_freq_ahi;
+int sound_freq_ahi, sound_channels_ahi, sound_bits_ahi;
static int vin,devicenum;
static int amigablksize;
//memset( lpData, 0x80,4 );
}
/*
- {
+{
long dwEvt=1;
dwEvt = MsgWaitForMultipleObjects(
if (dwEvt>1 ){calcsound=0;return;}
- }
+}
*/
hr = IDirectSoundBuffer_GetCurrentPosition(lpDSB2, &i, 0);
enumerate_sound_devices (0);
wavfmt.wFormatTag = WAVE_FORMAT_PCM;
- wavfmt.nChannels = 2;
+ wavfmt.nChannels = sound_channels_ahi;
wavfmt.nSamplesPerSec = sound_freq_ahi;
- wavfmt.wBitsPerSample = 16;
- wavfmt.nBlockAlign = 16 / 8 * 2;
+ wavfmt.wBitsPerSample = sound_bits_ahi;
+ wavfmt.nBlockAlign = wavfmt.wBitsPerSample / 8 * wavfmt.nChannels;
wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * sound_freq_ahi;
wavfmt.cbSize = 0;
if (!ahisndbuffer)
return 0;
hr = DirectSoundCreate( &sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL );
- if (FAILED(hr))
+ if (FAILED(hr))
{
write_log( "DirectSoundCreate() failure: %s\n", DXError(hr));
return 0;
if FAILED(IDirectSound_SetCooperativeLevel(lpDS2,dsound_tmpw, DSSCL_PRIORITY))
return 0;
hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSBprimary2, NULL);
- if(FAILED(hr))
+ if(FAILED(hr))
{
write_log("CreateSoundBuffer() failure: %s\n", DXError(hr));
return 0;
}
hr = IDirectSoundBuffer_SetFormat(lpDSBprimary2, &wavfmt);
- if(FAILED(hr))
+ if(FAILED(hr))
{
write_log( "SetFormat() failure: %s\n", DXError(hr));
return 0;
sound_buffer.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME /*| DSBCAPS_CTRLPOSITIONNOTIFY */
| DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_GLOBALFOCUS |DSBCAPS_STATIC ;
hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSB2, NULL);
- if (FAILED(hr))
+ if (FAILED(hr))
{
write_log("CreateSoundBuffer() failure: %s\n", DXError(hr));
return 0;
*/
hr = IDirectSoundBuffer_SetVolume (lpDSB2, 0);
- if (FAILED(hr))
+ if (FAILED(hr))
{
write_log("SetVolume() 2 failure: %s\n", DXError(hr));
return 0;
}
hr = IDirectSoundBuffer_GetFormat(lpDSBprimary2,&wavfmt,500,0);
- if(FAILED(hr))
+ if(FAILED(hr))
{
write_log("GetFormat() failure: %s\n", DXError(hr));
return 0;
}
// Record begin
hr = DirectSoundCaptureCreate( NULL, &lpDS2r, NULL );
- if (FAILED(hr))
+ if (FAILED(hr))
{
write_log( "DirectSoundCaptureCreate() failure: %s\n", DXError(hr));
norec = 1;
norec = 1;
}
}
-
+
if(ahisndbuffer==0)
return 0;
ahisndbufpt =(int*) ahisndbuffer;
sndptrmax = ahisndbuffer + ahisndbufsize;
samplecount = 0;
memset(ahisndbuffer, soundneutral, amigablksize*8);
- write_log("Init AHI Sound Rate %d Buffsize %d\n",sound_freq_ahi,amigablksize);
+ write_log("Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
+ sound_freq_ahi, sound_channels_ahi, sound_bits_ahi, amigablksize);
if (!norec)
write_log("Init AHI Audio Recording \n");
ahi_on = 1;
}
-static char *addr;
static void *bswap_buffer = NULL;
static uae_u32 bswap_buffer_size = 0;
{
//use the extern int (6 #13)
// d0 0=opensound d1=unit d2=samplerate d3=blksize ret: sound frequency
+// d0 6=opensound_new d1=unit d2=samplerate d3=blksize ret d4=channels d5=bits d6=zero: sound frequency
// d0 1=closesound d1=unit
// d0 2=writesamples d1=unit a0=addr write blksize samples to card
// d0 3=readsamples d1=unit a0=addr read samples from card ret: d0=samples read
// d0 4=writeinterrupt d1=unit d0=0 no interrupt happen for this unit
// d0=-2 no playing open
//note units for now not support use only unit 0
-// d0=10 get clipboard size d0=size in bytes
+// d0 5=?
+ // d0=10 get clipboard size d0=size in bytes
// d0=11 get clipboard data a0=clipboarddata
//Note: a get clipboard size must do before
// d0=12 write clipboard data a0=clipboarddata
// d0=103 close dll
// d0=104 screenlost
// d0=105 mem offset
-// d0=106 16Bit byteswap
+// d0=106 16Bit byteswap
// d0=107 32Bit byteswap
// d0=108 free swap array
// d0=200 ahitweak d1=offset for dsound position pointer
int cur_pos;
case 0:
- cap_pos=0;
- sound_freq_ahi=m68k_dreg (regs, 2);
- amigablksize=m68k_dreg (regs, 3);
- sound_freq_ahi=ahi_open_sound();
+ cap_pos = 0;
+ sound_freq_ahi = m68k_dreg (regs, 2);
+ amigablksize = m68k_dreg (regs, 3);
+ sound_freq_ahi = ahi_open_sound();
+ uaevar.changenum--;
+ return sound_freq_ahi;
+ case 6: /* new open function */
+ cap_pos = 0;
+ sound_freq_ahi = m68k_dreg (regs, 2);
+ amigablksize = m68k_dreg (regs, 3);
+ sound_channels_ahi = m68k_dreg (regs, 4);
+ sound_bits_ahi = m68k_dreg (regs, 5);
+ sound_freq_ahi = ahi_open_sound();
uaevar.changenum--;
return sound_freq_ahi;
return 0;
case 2:
- addr=(char *)m68k_areg (regs, 0);
- for (i=0;i<(amigablksize*4);i+=4)
- {
- ahisndbufpt[0] = get_long((unsigned int)addr+i);
- ahisndbufpt+=1;
- /*ahisndbufpt[0]=chipmem_bget((unsigned int)addr+i+2);
- ahisndbufpt+=1;
- ahisndbufpt[0]=chipmem_bget((unsigned int)addr+i+1);
- ahisndbufpt+=1;
- ahisndbufpt[0]=chipmem_bget((unsigned int)addr+i);
- ahisndbufpt+=1;*/
- }
+ {
+ uaecptr addr = m68k_areg (regs, 0);
+ for (i = 0; i < amigablksize * 4; i += 4)
+ *ahisndbufpt++ = get_long(addr + i);
ahi_finish_sound_buffer();
+ }
return amigablksize;
case 3:
- if (norec)return -1;
- if (!ahi_on)return -2;
- i = IDirectSoundCaptureBuffer_GetCurrentPosition(lpDSB2r,&t,&cur_pos);
- t = amigablksize*4;
+ {
+ uaecptr addr;
+ HRESULT hr;
+ if (norec)
+ return -1;
+ if (!ahi_on)
+ return -2;
+ hr = IDirectSoundCaptureBuffer_GetCurrentPosition(lpDSB2r,&t,&cur_pos);
+ if (FAILED(hr))
+ return -1;
+ t = amigablksize * 4;
- if (cap_pos<=cur_pos)
- todo=cur_pos-cap_pos;
+ if (cap_pos <= cur_pos)
+ todo = cur_pos - cap_pos;
else
- todo=cur_pos+(RECORDBUFFER*t)-cap_pos;
- if (todo<t)
- { //if no complete buffer ready exit
+ todo = cur_pos + (RECORDBUFFER * t) - cap_pos;
+ if (todo < t) { //if no complete buffer ready exit
return -1;
}
- i = IDirectSoundCaptureBuffer_Lock(lpDSB2r,cap_pos,t,&pos1,&byte1,&pos2,&byte2,0);
-
- if ((cap_pos+t)< (t*RECORDBUFFER))
- {
- cap_pos=cap_pos+t;
- }
- else
- {
+ hr = IDirectSoundCaptureBuffer_Lock(lpDSB2r,cap_pos,t,&pos1,&byte1,&pos2,&byte2,0);
+ if (FAILED(hr))
+ return -1;
+ if ((cap_pos + t) < (t * RECORDBUFFER)) {
+ cap_pos = cap_pos + t;
+ } else {
cap_pos = 0;
}
- addr=(char *)m68k_areg (regs, 0);
- sndbufrecpt=(unsigned int*)pos1;
+ addr = m68k_areg (regs, 0);
+ sndbufrecpt = (unsigned int*)pos1;
t=t/4;
- for (i=0;i<t;i++)
- {
- put_long((uae_u32)addr,sndbufrecpt[0]);
- addr+=4;
- sndbufrecpt+=1;
+ for (i = 0; i < t; i++) {
+ put_long(addr, *sndbufrecpt++);
+ addr += 4;
}
- t=t*4;
- i=IDirectSoundCaptureBuffer_Unlock(lpDSB2r,pos1,byte1,pos2,byte2);
- return (todo-t)/t;
+ t *= 4;
+ IDirectSoundCaptureBuffer_Unlock(lpDSB2r,pos1,byte1,pos2,byte2);
+ }
+ return (todo - t) / t;
case 4:
if (!ahi_on)
return -2;
- i=intcount;
- intcount=0;
+ i = intcount;
+ intcount = 0;
return i;
case 5:
- if ( !ahi_on )
+ if (!ahi_on)
return 0;
ahi_updatesound ( 1 );
- return 1;
+ return 1;
- case 10:
- i=OpenClipboard(0);
- clipdat=GetClipboardData(CF_TEXT);
- if (clipdat)
- {
- clipsize=strlen(clipdat);
- clipsize++;
- return clipsize;
+ case 10:
+ if (OpenClipboard(0)) {
+ clipdat=GetClipboardData(CF_TEXT);
+ if (clipdat) {
+ clipsize=strlen(clipdat);
+ clipsize++;
+ return clipsize;
+ }
}
return 0;
case 11:
- addr=(char *)m68k_areg (regs, 0);
- for (i=0;i<clipsize;i++)
- {
- put_byte((uae_u32)addr,clipdat[0]);
- addr++;
- clipdat++;
- }
+ for (i = 0; i < clipsize; i++)
+ put_byte(m68k_areg (regs, 0) + i,clipdat[i]);
CloseClipboard();
return 0;
- case 12:
- addr = (char *)m68k_areg (regs, 0);
- addr = (char *)get_real_address ((uae_u32)addr);
- i = OpenClipboard (0);
- EmptyClipboard();
- slen = strlen(addr);
- p = GlobalAlloc (GMEM_DDESHARE,slen+2);
- p2 = GlobalLock (p);
- memcpy (p2,addr,slen);
- p2[slen]=0;
- GlobalUnlock (p);
- i = (int)SetClipboardData (CF_TEXT,p2);
- CloseClipboard ();
- GlobalFree (p);
+ case 12:
+ {
+ uae_u8 *addr = get_real_address (m68k_areg (regs, 0));
+ if (OpenClipboard (0)) {
+ EmptyClipboard();
+ slen = strlen(addr);
+ p = GlobalAlloc (GMEM_DDESHARE,slen+2);
+ if (p) {
+ p2 = GlobalLock (p);
+ if (p2) {
+ memcpy (p2, addr, slen);
+ p2[slen] = 0;
+ GlobalUnlock (p);
+ SetClipboardData (CF_TEXT,p2);
+ }
+ GlobalFree (p);
+ }
+ CloseClipboard ();
+ }
+ }
return 0;
case 13: /* HACK */
#if defined(X86_MSVC_ASSEMBLY)
case 100: // open dll
- {
+ {
char *dllname;
uae_u32 result;
dllname = ( char *) m68k_areg (regs, 0);
//returns address of new array
src = m68k_areg(regs, 0);
num_vars = m68k_dreg(regs, 1);
-
+
if (bswap_buffer_size < num_vars * 2) {
bswap_buffer_size = (num_vars + 1024) * 2;
free(bswap_buffer);
mov esi, dword ptr [src]
mov edi, dword ptr [bswap_buffer]
mov ecx, num_vars
-
+
mov ebx, ecx
and ecx, 3
je BSWAP_WORD_4X
-
+
BSWAP_WORD_LOOP:
mov ax, [esi]
mov dl, al
mov [edi+6], ax
add esi, 8
add edi, 8
- loopne BSWAP_WORD_4X_LOOP
+ loopne BSWAP_WORD_4X_LOOP
BSWAP_WORD_END:
}
return (uae_u32) bswap_buffer;
default:
return 0x12345678; // Code for not supportet function
}
-}
+}
#endif
di->bus = si[unitnum].scsibus;
di->target = si[unitnum].target;
di->lun = si[unitnum].lun;
- di->media_inserted = mediacheck (unitnum); //si[unitnum].mediainserted;
+ di->media_inserted = mediacheck (unitnum);
di->write_protected = 1;
di->bytespersector = 2048;
di->cylinders = 1;
di->type = si[unitnum].type;
di->id = unitnum + 1;
- strcpy (di->label, si[unitnum].label);
+ di->label = my_strdup (si[unitnum].label);
return di;
}
{
int i, now;
- for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
- now = mediacheck (i);
- if (now != si[i].mediainserted) {
- write_log ("ASPI: media change %c %d\n", driveletter, insert);
- si[i].mediainserted = now;
- scsi_do_disk_change (i + 1, insert);
+ for (i = 0; i < unitcnt; i++) {
+ if (si[i].type == INQ_ROMD) {
+ now = mediacheck (i);
+ if (now != si[i].mediainserted) {
+ write_log ("ASPI: media change %c %d\n", driveletter, insert);
+ si[i].mediainserted = now;
+ scsi_do_disk_change (i + 1, insert);
+ }
}
}
}
di->write_protected = 1;
di->type = ciw32[unitnum].type == DRIVE_CDROM ? INQ_ROMD : INQ_DASD;
di->id = ciw32[unitnum].drvletter;
+ di->label = xmalloc(16);
sprintf (di->label, "Drive %c:", ciw32[unitnum].drvletter);
return di;
}
#include <stddef.h>
#include <windows.h>
-#include <devioctl.h>
+#include <initguid.h> // Guid definition
+#include <devguid.h> // Device guids
+#include <setupapi.h> // for SetupDiXxx functions.
+#include <cfgmgr32.h> // for SetupDiXxx functions.
+#include <devioctl.h>
#include <ntddscsi.h>
+
typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER {
SCSI_PASS_THROUGH_DIRECT spt;
ULONG Filler;
static int unitcnt = 0;
struct dev_info_spti {
- char drvletter;
- char drvpath[10];
+ char *drvpath;
int mediainserted;
HANDLE handle;
int isatapi;
+ int type;
};
static uae_sem_t scgp_sem;
return scsibuf;
}
-static int adddrive (int unitnum, char drive)
+static int total_devices;
+
+static int adddrive (char *drvpath, int type)
{
- if (unitcnt >= MAX_TOTAL_DEVICES)
+ int cnt = total_devices, i;
+ if (cnt >= MAX_TOTAL_DEVICES)
return 0;
- sprintf (dev_info[unitcnt].drvpath, "\\\\.\\%c:", drive);
- dev_info[unitcnt].drvletter = drive;
- write_log ("SPTI: selected drive %c: (uaescsi.device:%d)\n", drive, unitnum);
- unitcnt++;
+ for (i = 0; i < total_devices; i++) {
+ if (!strcmp(drvpath, dev_info[i].drvpath))
+ return 0;
+ }
+ dev_info[cnt].drvpath = my_strdup(drvpath);
+ dev_info[cnt].type = type;
+ write_log ("SPTI: uaescsi.device:%d ('%s')\n", cnt, drvpath);
+ total_devices++;
return 1;
}
-static int total_devices;
+int rescan(void);
+static int open_scsi_bus (int flags)
+{
+ int i;
+ total_devices = 0;
+ uae_sem_init (&scgp_sem, 0, 1);
+ for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
+ memset (&dev_info[i], 0, sizeof (struct dev_info_spti));
+ dev_info[i].handle = INVALID_HANDLE_VALUE;
+ }
+ if (!scsibuf)
+ scsibuf = VirtualAlloc (NULL, DEVICE_SCSI_BUFSIZE, MEM_COMMIT, PAGE_READWRITE);
+ rescan();
+ return total_devices;
+}
+
+#if 0
static int open_scsi_bus (int flags)
{
int dwDriveMask;
}
return total_devices;
}
+#endif
static void close_scsi_bus (void)
{
char *dev;
dev = dev_info[unitnum].drvpath;
- if (!dev[0])
+ if (!dev)
return 0;
h = CreateFile(dev,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
dev_info[unitnum].handle = h;
if (h == INVALID_HANDLE_VALUE) {
- write_log ("failed to open cd unit %d (%s)\n", unitnum, dev);
+ write_log ("failed to open cd unit %d err=%d ('%s')\n", unitnum, GetLastError(), dev);
} else {
- dev_info[unitnum].mediainserted = mediacheck (unitnum);
- dev_info[unitnum].isatapi = isatapi (unitnum);
- write_log ("cd unit %d %s opened (%s), %s\n", unitnum,
- dev_info[unitnum].isatapi ? "[ATAPI]" : "[SCSI]", dev,
- dev_info[unitnum].mediainserted ? "CD inserted" : "Drive empty");
+ if (dev_info[unitnum].type == INQ_ROMD) {
+ dev_info[unitnum].mediainserted = mediacheck (unitnum);
+ dev_info[unitnum].isatapi = isatapi (unitnum);
+ write_log ("scsi cd unit %d opened (%s), %s ('%s')\n", unitnum,
+ dev_info[unitnum].isatapi ? "[ATAPI]" : "[SCSI]",
+ dev_info[unitnum].mediainserted ? "CD inserted" : "Drive empty", dev);
+ } else {
+ write_log ("scsi unit %d, type %d opened ('%s')\n",
+ unitnum, dev_info[unitnum].type, dev);
+ }
return 1;
}
return 0;
{
if (unitnum >= MAX_TOTAL_DEVICES || dev_info[unitnum].handle == INVALID_HANDLE_VALUE)
return 0;
- sprintf(di->label,"Drive %c", dev_info[unitnum].drvletter);
+ di->label = my_strdup(dev_info[unitnum].drvpath);
di->bus = 0;
di->target = unitnum;
di->lun = 0;
di->write_protected = 1;
di->bytespersector = 2048;
di->cylinders = 1;
- di->type = INQ_ROMD;
- di->id = dev_info[unitnum].drvletter;
+ di->type = dev_info[unitnum].type;
+ di->id = unitnum + 1;
return di;
}
void win32_spti_media_change (char driveletter, int insert)
{
+#if 1
+ int i, now;
+
+ for (i = 0; i < total_devices; i++) {
+ if (dev_info[i].type == INQ_ROMD) {
+ now = mediacheck (i);
+ if (now != dev_info[i].mediainserted) {
+ write_log ("SPTI: media change %c %d\n", driveletter, insert);
+ dev_info[i].mediainserted = now;
+ scsi_do_disk_change (i + 1, insert);
+ }
+ }
+ }
+#else
int i;
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
scsi_do_disk_change (driveletter, insert);
}
}
+#endif
}
static int check_isatapi (int unitnum)
0, 0, 0, 0, 0, 0, 0, check_isatapi
};
-#endif
\ No newline at end of file
+static int getCDROMProperty(int idx, HDEVINFO DevInfo, const GUID *guid)
+{
+ SP_DEVICE_INTERFACE_DATA interfaceData;
+ PSP_DEVICE_INTERFACE_DETAIL_DATA interfaceDetailData = NULL;
+ DWORD interfaceDetailDataSize, reqSize;
+ DWORD status, errorCode;
+
+ interfaceData.cbSize = sizeof (SP_INTERFACE_DEVICE_DATA);
+ status = SetupDiEnumDeviceInterfaces (
+ DevInfo, // Interface Device Info handle
+ 0, // Device Info data
+ guid, // Interface registered by driver
+ idx, // Member
+ &interfaceData // Device Interface Data
+ );
+ if (status == FALSE)
+ return FALSE;
+
+ status = SetupDiGetDeviceInterfaceDetail (
+ DevInfo, // Interface Device info handle
+ &interfaceData, // Interface data for the event class
+ NULL, // Checking for buffer size
+ 0, // Checking for buffer size
+ &reqSize, // Buffer size required to get the detail data
+ NULL // Checking for buffer size
+ );
+
+ if (status == FALSE) {
+ errorCode = GetLastError();
+ if (errorCode != ERROR_INSUFFICIENT_BUFFER)
+ return FALSE;
+ }
+
+ interfaceDetailDataSize = reqSize;
+ interfaceDetailData = malloc (interfaceDetailDataSize);
+ if (interfaceDetailData == NULL)
+ return FALSE;
+ interfaceDetailData->cbSize = sizeof (SP_INTERFACE_DEVICE_DETAIL_DATA);
+
+ status = SetupDiGetDeviceInterfaceDetail (
+ DevInfo, // Interface Device info handle
+ &interfaceData, // Interface data for the event class
+ interfaceDetailData, // Interface detail data
+ interfaceDetailDataSize,// Interface detail data size
+ &reqSize, // Buffer size required to get the detail data
+ NULL); // Interface device info
+
+ if (status == FALSE)
+ return FALSE;
+
+ adddrive (interfaceDetailData->DevicePath, INQ_ROMD);
+
+ free (interfaceDetailData);
+
+ return TRUE;
+}
+
+static const GUID *guids[] = {
+ &GUID_DEVINTERFACE_CDROM,
+ &GUID_DEVINTERFACE_TAPE,
+ &GUID_DEVINTERFACE_WRITEONCEDISK,
+ &GUID_DEVINTERFACE_MEDIUMCHANGER,
+ &GUID_DEVINTERFACE_CDCHANGER,
+ &GUID_DEVINTERFACE_STORAGEPORT,
+ NULL};
+
+static int rescan(void)
+{
+ HDEVINFO hDevInfo;
+ int idx, idx2;
+
+ write_log("Scan starts..\n");
+ for (idx2 = 0; guids[idx2]; idx2++) {
+ hDevInfo = SetupDiGetClassDevs(
+ guids[idx2],
+ NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
+ if (hDevInfo != INVALID_HANDLE_VALUE) {
+ write_log("%d:\n", idx2);
+ for (idx = 0; ; idx++) {
+ if (!getCDROMProperty(idx, hDevInfo, guids[idx2]))
+ break;
+ }
+ SetupDiDestroyDeviceInfoList(hDevInfo);
+ }
+ }
+ write_log("finished.\n");
+ return 1;
+}
+
+#endif
#include "keyboard.h"
#include "custom.h"
#include "dxwrap.h"
+#include "akiko.h"
#ifdef WINDDK
#include <winioctl.h>
static int dd_inited, mouse_inited, keyboard_inited, joystick_inited;
static int stopoutput;
static HANDLE kbhandle = INVALID_HANDLE_VALUE;
-static int oldleds, oldusedleds, newleds, usbledmode, oldusbleds;
+static int oldleds, oldusedleds, newleds, oldusbleds;
static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode;
static int normalkb, superkb, rawkb;
if (ledkeystate[VK_SCROLL] & 1)
led |= KBLED_SCROLLLOCK;
- if (usbledmode && os_winnt) {
+ if (currprefs.win32_kbledmode && os_winnt) {
oldusbleds = led;
- } else if (!usbledmode && os_winnt && kbhandle != INVALID_HANDLE_VALUE) {
+ } else if (!currprefs.win32_kbledmode && os_winnt && kbhandle != INVALID_HANDLE_VALUE) {
#ifdef WINDDK
KEYBOARD_INDICATOR_PARAMETERS InputBuffer;
KEYBOARD_INDICATOR_PARAMETERS OutputBuffer;
static void set_leds (uae_u32 led)
{
- if (os_winnt && usbledmode) {
+ if (os_winnt && currprefs.win32_kbledmode) {
if((oldusbleds & KBLED_NUMLOCK) != (led & KBLED_NUMLOCK)) {
keybd_event (VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event (VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
hr = IDirectInputDevice8_GetDeviceState (lpdi, sizeof (kc), kc);
if (hr == DI_OK) {
for (i = 0; i < sizeof (kc); i++) {
+ if (i == 0x80) /* USB KB led causes this, better ignore it */
+ continue;
if (kc[i] & 0x80) kc[i] = 1; else kc[i] = 0;
if (kc[i] != di_keycodes[num][i]) {
write_log ("%02.2X -> %d\n", i, kc[i]);
}
-static int keyhack (int scancode,int pressed, int num)
+static int keyhack (int scancode,int pressed, int num)
{
static byte backslashstate,apostrophstate;
{
inputdevice_translatekeycode (num, DIK_LALT, 1);
inputdevice_translatekeycode (num, DIK_LSHIFT,1);
- return 4; // the german # key
+ return 4; // the german # key
}
else
{
inputdevice_translatekeycode (num, DIK_LALT, 0);
inputdevice_translatekeycode (num, DIK_LSHIFT, 0);
// Here is the same not nice but do the job
- return 4; // the german # key
+ return 4; // the german # key
}
}
{
backslashstate=1;
inputdevice_translatekeycode (num, DIK_RALT, 0);
- return DIK_BACKSLASH;
+ return DIK_BACKSLASH;
}
else
{
unacquire (lpdi, "keyboard");
if (currprefs.keyboard_leds_in_use) {
#ifdef WINDDK
- if (os_winnt && !usbledmode) {
+ if (os_winnt && !currprefs.win32_kbledmode) {
if (DefineDosDevice (DDD_RAW_TARGET_PATH, "Kbd","\\Device\\KeyboardClass0")) {
kbhandle = CreateFile("\\\\.\\Kbd", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (kbhandle == INVALID_HANDLE_VALUE) {
write_log ("kbled: CreateFile failed, error %d\n", GetLastError());
- usbledmode = 1;
+ currprefs.win32_kbledmode = 1;
}
} else {
- usbledmode = 1;
+ currprefs.win32_kbledmode = 1;
write_log ("kbled: DefineDosDevice failed, error %d\n", GetLastError());
}
}
#else
- usbledmode = 1;
+ currprefs.kbledmode = 1;
#endif
oldleds = get_leds ();
if (oldusedleds < 0)
if (currprefs.keyboard_leds_in_use) {
if (oldusedleds >= 0) {
- if (!usbledmode)
+ if (!currprefs.win32_kbledmode)
set_leds (oldleds);
oldusedleds = oldleds;
}
{
int i, port;
- for (i = 0; i < num_mouse; i++) {
+ for (i = 0; i < num_joystick; i++) {
port = i & 1;
uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;
uid[i].eventid[ID_AXIS_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT;
uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON;
uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON;
uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON;
+ if (cd32_enabled) {
+ uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED;
+ uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE;
+ uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW;
+ uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN;
+ uid[i].eventid[ID_BUTTON_OFFSET + 4][0] = port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW;
+ uid[i].eventid[ID_BUTTON_OFFSET + 5][0] = port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD;
+ uid[i].eventid[ID_BUTTON_OFFSET + 6][0] = port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY;
+ }
}
uid[0].enabled = 1;
}
IDirectDrawSurface7_Restore( DirectDrawState.primary.surface );
}
- while (FAILED(ddrval = IDirectDrawSurface7_Lock(surface, NULL, surfacedesc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,
- NULL)))
+ while (FAILED(ddrval = IDirectDrawSurface7_Lock(surface, NULL, surfacedesc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL)))
{
if (ddrval == DDERR_SURFACELOST) {
ddrval = restoresurface (surface);
if (FAILED(ddrval))
- {
- result = 0;
break;
- }
}
else if (ddrval != DDERR_SURFACEBUSY)
{
write_log ("lpDDS->Lock() failed - %s\n", DXError (ddrval));
- result = 0;
break;
}
}
- if(SUCCEEDED(ddrval))
- result = 1;
-
- if(result)
+ if(SUCCEEDED(ddrval)) {
+ static int warned = 10;
+ DWORD_PTR pixels = (DWORD_PTR)(surfacedesc->lpSurface);
+ if (warned > 0 && (pixels & 7)) {
+ write_log("bogus surface pointer %x!\n", pixels);
+ warned--;
+ }
lockcnt++;
-
+ result = 1;
+ }
return result;
}
extern int ispressed (int key);
-static int endpressed (void)
+static int specialkeycode (void)
{
- return ispressed(DIK_END);
+ return currprefs.win32_specialkey;
+}
+static int specialpressed (void)
+{
+ return ispressed(specialkeycode());
}
static int shiftpressed (void)
DIK_NUMPAD3, 3, DIK_NUMPAD4, 4, DIK_NUMPAD5, 5, DIK_NUMPAD6, 6, DIK_NUMPAD7, 7,
DIK_NUMPAD8, 8, DIK_NUMPAD9, 9, -1 };
-#define IECODE_UP_PREFIX 0x80
-#define RAW_STEALTH 0x68
-#define STEALTHF_E0KEY 0x08
-#define STEALTHF_UPSTROKE 0x04
-#define STEALTHF_SPECIAL 0x02
-#define STEALTHF_E1KEY 0x01
-
-static void sendmmcodes(int code, int newstate)
-{
- uae_u8 b;
-
- b = RAW_STEALTH | IECODE_UP_PREFIX;
- record_key(((b << 1) | (b >> 7)) & 0xff);
- b = IECODE_UP_PREFIX;
- if ((code >> 8) == 0x01)
- b |= STEALTHF_E0KEY;
- if ((code >> 8) == 0x02)
- b |= STEALTHF_E1KEY;
- if (!newstate)
- b |= STEALTHF_UPSTROKE;
- record_key(((b << 1) | (b >> 7)) & 0xff);
- b = ((code >> 4) & 0x0f) | IECODE_UP_PREFIX;
- record_key(((b << 1) | (b >> 7)) & 0xff);
- b = (code & 0x0f) | IECODE_UP_PREFIX;
- record_key(((b << 1) | (b >> 7)) & 0xff);
-}
-
void my_kbd_handler (int keyboard, int scancode, int newstate)
{
int code = 0;
case DIK_F12:
if (ctrlpressed ()) {
code = AKS_TOGGLEFULLSCREEN;
- } else if (shiftpressed () || endpressed ()) {
+ } else if (shiftpressed () || specialpressed ()) {
disablecapture ();
code = AKS_ENTERDEBUGGER;
} else {
case DIK_F2:
case DIK_F3:
case DIK_F4:
- if (endpressed ()) {
+ if (specialpressed ()) {
if (shiftpressed ())
code = AKS_EFLOPPY0 + (scancode - DIK_F1);
else
}
break;
case DIK_F5:
- if (endpressed ()) {
+ if (specialpressed ()) {
if (shiftpressed ())
code = AKS_STATESAVEDIALOG;
else
case DIK_8:
case DIK_9:
case DIK_0:
- if (endpressed ()) {
+ if (specialpressed ()) {
int num = scancode - DIK_1;
if (shiftpressed ())
num += 10;
case DIK_NUMPAD8:
case DIK_NUMPAD9:
case DIK_NUMPADPERIOD:
- if (endpressed ()) {
+ if (specialpressed ()) {
int i = 0, v = -1;
while (np[i] >= 0) {
v = np[i + 1];
}
break;
case DIK_SYSRQ:
- screenshot (endpressed() ? 1 : 0, 1);
+ screenshot (specialpressed() ? 1 : 0, 1);
break;
case DIK_PAUSE:
- if (endpressed ())
+ if (specialpressed ())
code = AKS_WARP;
else
code = AKS_PAUSE;
case DIK_NEXT:
break;
case DIK_NUMPADMINUS:
- if (endpressed ()) {
+ if (specialpressed ()) {
if (shiftpressed ())
code = AKS_DECREASEREFRESHRATE;
else
}
break;
case DIK_NUMPADPLUS:
- if (endpressed ()) {
+ if (specialpressed ()) {
if (shiftpressed ())
code = AKS_INCREASEREFRESHRATE;
else
}
break;
case DIK_NUMPADSTAR:
- if (endpressed ())
+ if (specialpressed ())
code = AKS_VOLMUTE;
break;
case DIK_NUMPADSLASH:
- if (endpressed ())
+ if (specialpressed ())
code = AKS_STATEREWIND;
break;
}
inputdevice_add_inputcode (code, 1);
return;
}
- if (endpressed ())
+ if (scancode == specialkeycode())
return;
if (scancode == DIK_CAPITAL) {
return;
#endif
}
- if (inputdevice_translatekeycode (keyboard, scancode, newstate))
- return;
-
- if (currprefs.mmkeyboard)
- sendmmcodes(scancode, newstate);
+ inputdevice_translatekeycode (keyboard, scancode, newstate);
}
void keyboard_settrans (void)
#define IDC_THEROOTS 1076
#define IDC_CAPS 1077
#define IDC_ABIME 1078
+#define IDC_AMIGASYS 1079
#define IDC_RICHEDIT1 1091
#define IDC_RICHEDIT2 1092
#define IDC_CONTRIBUTORS 1124
#define IDC_CYCLEEXACT 1219
#define IDC_CS_CPU_TEXT2 1219
#define IDC_CPUIDLE 1220
-#define IDC_CYCLEEXACT2 1220
#define IDC_GENLOCK 1220
#define IDC_SOUNDSETTINGS 1229
#define IDC_8BIT 1230
#define IDC_TEST16BIT 1506
#define IDC_MAPDRIVES 1507
#define IDC_CPUTEXT 1508
+#define IDC_MAPDRIVES_NET 1508
#define IDC_SWAP 1509
#define IDC_CACHETEXT 1509
#define IDC_SELECTRESTEXT 1510
#define IDC_D0 1532
#define IDC_STATE_CAPTURE 1532
#define IDC_D1 1533
+#define IDC_STATE_CAPTURE2 1533
+#define IDC_KBLED_USB 1533
#define IDC_D2 1534
#define IDC_D3 1535
#define IDC_D4 1536
// Microsoft Visual C++ generated Help ID include file.
// Used by winuae.rc
//
-#define HIDC_CREATELOGFILE 0x808d0402 // IDD_MISC1 [English (U.S.)]
-#define HIDC_EDITDESCRIPTION 0x8087057e // IDD_LOADSAVE [English (U.S.)]
-#define HIDC_EDITNAME 0x8087057d // IDD_LOADSAVE [English (U.S.)]
-#define HIDC_EDITPATH 0x80870582 // IDD_LOADSAVE [English (U.S.)]
-#define HIDC_LORES 0x806c0498 // IDD_DISPLAY [English (U.S.)]
-#define HIDC_MAPDRIVES 0x807105e3 // IDD_HARDDISK [English (U.S.)]
-#define HIDC_PFULLSCREEN 0x806c04a8 // IDD_DISPLAY [English (U.S.)]
-#define HIDC_TEST16BIT 0x806c05e2 // IDD_DISPLAY [English (U.S.)]
+#define HIDC_CREATELOGFILE 0x808d0402 // IDD_MISC1 [English (United States)]
+#define HIDC_EDITDESCRIPTION 0x8087057e // IDD_LOADSAVE [English (United States)]
+#define HIDC_EDITNAME 0x8087057d // IDD_LOADSAVE [English (United States)]
+#define HIDC_EDITPATH 0x80870582 // IDD_LOADSAVE [English (United States)]
+#define HIDC_LORES 0x806c0498 // IDD_DISPLAY [English (United States)]
+#define HIDC_MAPDRIVES 0x807105e3 // IDD_HARDDISK [English (United States)]
+#define HIDC_MAPDRIVES_NET 0x807105e4 // IDD_HARDDISK [English (United States)]
+#define HIDC_PFULLSCREEN 0x806c04a8 // IDD_DISPLAY [English (United States)]
+#define HIDC_TEST16BIT 0x806c05e2 // IDD_DISPLAY [English (United States)]
PUSHBUTTON "Delete Saveimage",IDC_SAVEIMAGE3,43,110,70,15,NOT WS_VISIBLE
END
-IDD_HARDDISK DIALOGEX 0, 0, 300, 242
+IDD_HARDDISK DIALOGEX 0, 0, 300, 231
STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
EXSTYLE WS_EX_CONTEXTHELP
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- CONTROL "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,5,290,185
- PUSHBUTTON "Add &Directory...",IDC_NEW_FS,5,196,60,15
- PUSHBUTTON "Add &Hardfile...",IDC_NEW_HF,70,196,60,15
- PUSHBUTTON "Add Ha&rddrive...",IDC_NEW_HD,135,196,60,15
- PUSHBUTTON "Remove",IDC_REMOVE,235,196,60,15
- PUSHBUTTON "&Properties",IDC_EDIT,235,217,60,15
- CONTROL "Add PC Drives at Startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,216,105,10,0,HIDC_MAPDRIVES
- CONTROL "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,229,115,10
- CONTROL "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,216,115,10
+ CONTROL "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,0,290,182
+ PUSHBUTTON "Add &Directory...",IDC_NEW_FS,5,186,60,15
+ PUSHBUTTON "Add &Hardfile...",IDC_NEW_HF,70,186,60,15
+ PUSHBUTTON "Add Ha&rddrive...",IDC_NEW_HD,135,186,60,15
+ PUSHBUTTON "Remove",IDC_REMOVE,235,186,60,15
+ PUSHBUTTON "&Properties",IDC_EDIT,235,207,60,15
+ CONTROL "Add PC Drives at Startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,205,100,10,0,HIDC_MAPDRIVES
+ CONTROL "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,205,115,10
+ CONTROL "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,216,115,10
+ CONTROL "Add Network Drives...",IDC_MAPDRIVES_NET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,216,101,10,0,HIDC_MAPDRIVES_NET
END
IDD_SOUND DIALOGEX 0, 0, 300, 244
CONTROL "",IDC_CONTRIBUTORS,"RICHEDIT",TCS_HOTTRACK | TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_OWNERDRAWFIXED | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,4,5,404,206
END
-IDD_ABOUT DIALOGEX 0, 0, 300, 175
+IDD_ABOUT DIALOGEX 0, 0, 300, 191
STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
PUSHBUTTON "Contributors",IDC_CONTRIBUTORS,110,55,80,15
CONTROL "",IDC_UAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,20,120,80,15
CONTROL "",IDC_PICASSOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,200,90,80,20
- CONTROL "",IDC_AMIGAHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,109,74,80,15
+ CONTROL "",IDC_AMIGAHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,109,90,80,20
CONTROL "",IDC_WINUAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,200,120,80,15
CONTROL "",IDC_AIABHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,110,120,80,15
CONTROL "",IDC_THEROOTS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,20,145,80,15
CONTROL "",IDC_CAPS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,200,145,80,15
CONTROL "",IDC_ABIME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,110,145,80,15
CONTROL "",IDC_CLOANTOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,20,90,80,20
+ CONTROL "",IDC_AMIGASYS,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,110,169,80,15
END
IDD_MISC1 DIALOGEX 0, 0, 300, 219
CONTROL "Don't use RGB overlays",IDC_NOOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,49,120,10
CONTROL "Use ASPI SCSI layer",IDC_ASPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,64,115,10
CONTROL "Syncronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,78,115,10
- GROUPBOX "Keyboard LEDs:",IDC_STATIC,7,110,85,73
+ GROUPBOX "Keyboard LEDs:",IDC_STATIC,7,110,85,104
COMBOBOX IDC_KBLED1,22,123,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_KBLED2,22,142,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_KBLED3,22,162,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_STATE_BUFFERSIZE,248,191,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,92,117,10
CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,92,115,10
+ CONTROL "USB-mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,185,64,10
END
IDD_HARDFILE DIALOGEX 0, 0, 299, 212
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
- IDD_HARDDISK, DIALOG
- BEGIN
- BOTTOMMARGIN, 241
- END
-
IDD_SOUND, DIALOG
BEGIN
BOTTOMMARGIN, 243
#endif
#ifdef WIN64
-#undef JIT
#undef X86_MSVC_ASSEMBLY
#define X64_MSVC_ASSEMBLY
#define CPU_64_BIT
sleep_resolution = 1;
if (clkdiv >= 0.90 && clkdiv <= 1.10 && rpt_available) {
limit = 2.5;
- if ((ratea2 / ratecnt) < limit * clockrate1000) { /* regular Sleep() is ok */
- timermode = 1;
- sleep_resolution = (int)(ratea2 * clockrate1000 / (ratecnt * 1000000));
- write_log ("Using Sleep() (resolution < %.1fms)\n", limit);
- } else if (mm_timerres && (ratea1 / ratecnt) < limit * clockrate1000) { /* MM-timer is ok */
+ if (mm_timerres && (ratea1 / ratecnt) < limit * clockrate1000) { /* MM-timer is ok */
timermode = 0;
sleep_resolution = (int)(ratea1 * clockrate1000 / (ratecnt * 1000000));
timebegin ();
write_log ("Using MultiMedia timers (resolution < %.1fms)\n", limit);
+ } else if ((ratea2 / ratecnt) < limit * clockrate1000) { /* regular Sleep() is ok */
+ timermode = 1;
+ sleep_resolution = (int)(ratea2 * clockrate1000 / (ratecnt * 1000000));
+ write_log ("Using Sleep() (resolution < %.1fms)\n", limit);
} else {
timermode = -1; /* both timers are bad, fall back to busy-wait */
write_log ("falling back to busy-loop waiting (timer resolution > %.1fms)\n", limit);
{
PAINTSTRUCT ps;
HDC hDC;
- LPMINMAXINFO lpmmi;
- RECT rect;
int mx, my, v;
static int mm;
static int minimized;
WIN32GFX_WindowMove();
return TRUE;
+#if 0
case WM_GETMINMAXINFO:
- rect.left=0;
- rect.top=0;
- lpmmi=(LPMINMAXINFO)lParam;
- rect.right=320;
- rect.bottom=256;
+ {
+ LPMINMAXINFO lpmmi;
+ RECT rect;
+ rect.left = 0;
+ rect.top = 0;
+ lpmmi = (LPMINMAXINFO)lParam;
+ rect.right = 320;
+ rect.bottom = 256;
//AdjustWindowRectEx(&rect,WSTYLE,0,0);
- lpmmi->ptMinTrackSize.x=rect.right-rect.left;
- lpmmi->ptMinTrackSize.y=rect.bottom-rect.top;
+ lpmmi->ptMinTrackSize.x = rect.right-rect.left;
+ lpmmi->ptMinTrackSize.y = rect.bottom-rect.top;
+ }
return 0;
+#endif
#ifdef FILESYS
case WM_DEVICECHANGE:
return dinput_winmouse () > 0 && dinput_winmousemode ();
}
+void toggle_mousegrab (void)
+{
+}
+
void logging_init( void )
{
static int started;
p->win32_iconified_priority = 3;
p->win32_notaskbarbutton = 0;
p->win32_alwaysontop = 0;
+ p->win32_specialkey = 0xcf; // DIK_END
+ p->win32_automount_drives = 0;
+ p->win32_automount_netdrives = 0;
+ p->win32_kbledmode = 0;
}
if (type == 1 || type == 0) {
p->win32_midioutdev = -2;
void target_save_options (struct zfile *f, struct uae_prefs *p)
{
- cfgfile_write (f, "win32.middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false");
- cfgfile_write (f, "win32.logfile=%s\n", p->win32_logfile ? "true" : "false");
- cfgfile_write (f, "win32.map_drives=%s\n", p->win32_automount_drives ? "true" : "false" );
- cfgfile_write (f, "win32.serial_port=%s\n", p->use_serial ? p->sername : "none" );
- cfgfile_write (f, "win32.parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" );
-
- cfgfile_write (f, "win32.active_priority=%d\n", priorities[p->win32_active_priority].value);
- cfgfile_write (f, "win32.inactive_priority=%d\n", priorities[p->win32_inactive_priority].value);
- cfgfile_write (f, "win32.inactive_nosound=%s\n", p->win32_inactive_nosound ? "true" : "false");
- cfgfile_write (f, "win32.inactive_pause=%s\n", p->win32_inactive_pause ? "true" : "false");
- cfgfile_write (f, "win32.iconified_priority=%d\n", priorities[p->win32_iconified_priority].value);
- cfgfile_write (f, "win32.iconified_nosound=%s\n", p->win32_iconified_nosound ? "true" : "false");
- cfgfile_write (f, "win32.iconified_pause=%s\n", p->win32_iconified_pause ? "true" : "false");
-
- cfgfile_write (f, "win32.ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? "true" : "false");
- cfgfile_write (f, "win32.midiout_device=%d\n", p->win32_midioutdev );
- cfgfile_write (f, "win32.midiin_device=%d\n", p->win32_midiindev );
- cfgfile_write (f, "win32.no_overlay=%s\n", p->win32_no_overlay ? "true" : "false" );
- cfgfile_write (f, "win32.aspi=%s\n", p->win32_aspi ? "true" : "false" );
- cfgfile_write (f, "win32.soundcard=%d\n", p->win32_soundcard );
- cfgfile_write (f, "win32.cpu_idle=%d\n", p->cpu_idle);
- cfgfile_write (f, "win32.notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false");
- cfgfile_write (f, "win32.always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false");
- cfgfile_write (f, "win32.no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false");
-}
+ cfgfile_target_write (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false");
+ cfgfile_target_write (f, "logfile=%s\n", p->win32_logfile ? "true" : "false");
+ cfgfile_target_write (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false");
+ cfgfile_target_write (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false");
+ cfgfile_target_write (f, "serial_port=%s\n", p->use_serial ? p->sername : "none" );
+ cfgfile_target_write (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" );
+
+ cfgfile_target_write (f, "active_priority=%d\n", priorities[p->win32_active_priority].value);
+ cfgfile_target_write (f, "inactive_priority=%d\n", priorities[p->win32_inactive_priority].value);
+ cfgfile_target_write (f, "inactive_nosound=%s\n", p->win32_inactive_nosound ? "true" : "false");
+ cfgfile_target_write (f, "inactive_pause=%s\n", p->win32_inactive_pause ? "true" : "false");
+ cfgfile_target_write (f, "iconified_priority=%d\n", priorities[p->win32_iconified_priority].value);
+ cfgfile_target_write (f, "iconified_nosound=%s\n", p->win32_iconified_nosound ? "true" : "false");
+ cfgfile_target_write (f, "iconified_pause=%s\n", p->win32_iconified_pause ? "true" : "false");
+
+ cfgfile_target_write (f, "ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? "true" : "false");
+ cfgfile_target_write (f, "midiout_device=%d\n", p->win32_midioutdev );
+ cfgfile_target_write (f, "midiin_device=%d\n", p->win32_midiindev );
+ cfgfile_target_write (f, "no_overlay=%s\n", p->win32_no_overlay ? "true" : "false" );
+ cfgfile_target_write (f, "aspi=%s\n", p->win32_aspi ? "true" : "false" );
+ cfgfile_target_write (f, "soundcard=%d\n", p->win32_soundcard );
+ cfgfile_target_write (f, "cpu_idle=%d\n", p->cpu_idle);
+ cfgfile_target_write (f, "notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false");
+ cfgfile_target_write (f, "always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false");
+ cfgfile_target_write (f, "no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false");
+ cfgfile_target_write (f, "specialkey=0x%x\n", p->win32_specialkey);
+ cfgfile_target_write (f, "kbledmode=%d\n", p->win32_kbledmode);}
static int fetchpri (int pri, int defpri)
{
{
int i, v;
int result = (cfgfile_yesno (option, value, "middle_mouse", &p->win32_middle_mouse)
+ || cfgfile_yesno (option, value, "map_drives", &p->win32_automount_drives)
+ || cfgfile_yesno (option, value, "map_net_drives", &p->win32_automount_netdrives)
|| cfgfile_yesno (option, value, "logfile", &p->win32_logfile)
- || cfgfile_yesno (option, value, "networking", &p->socket_emu)
+ || cfgfile_yesno (option, value, "networking", &p->socket_emu)
|| cfgfile_yesno (option, value, "no_overlay", &p->win32_no_overlay)
|| cfgfile_yesno (option, value, "aspi", &p->win32_aspi)
- || cfgfile_yesno (option, value, "map_drives", &p->win32_automount_drives)
|| cfgfile_yesno (option, value, "inactive_pause", &p->win32_inactive_pause)
|| cfgfile_yesno (option, value, "inactive_nosound", &p->win32_inactive_nosound)
|| cfgfile_yesno (option, value, "iconified_pause", &p->win32_iconified_pause)
|| cfgfile_yesno (option, value, "iconified_nosound", &p->win32_iconified_nosound)
- || cfgfile_yesno (option, value, "ctrl_f11_is_quit", &p->win32_ctrl_F11_is_quit)
- || cfgfile_yesno (option, value, "no_recyclebin", &p->win32_norecyclebin)
+ || cfgfile_yesno (option, value, "ctrl_f11_is_quit", &p->win32_ctrl_F11_is_quit)
+ || cfgfile_yesno (option, value, "no_recyclebin", &p->win32_norecyclebin)
|| cfgfile_intval (option, value, "midi_device", &p->win32_midioutdev, 1)
|| cfgfile_intval (option, value, "midiout_device", &p->win32_midioutdev, 1)
|| cfgfile_intval (option, value, "midiin_device", &p->win32_midiindev, 1)
|| cfgfile_intval (option, value, "soundcard", &p->win32_soundcard, 1)
|| cfgfile_string (option, value, "serial_port", &p->sername[0], 256)
|| cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)
- || cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
- || cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
- || cfgfile_intval (option, value, "cpu_idle", &p->cpu_idle, 1));
+ || cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
+ || cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
+ || cfgfile_intval (option, value, "specialkey", &p->win32_specialkey, 1)
+ || cfgfile_intval (option, value, "kbledmode", &p->win32_kbledmode, 1)
+ || cfgfile_intval (option, value, "cpu_idle", &p->cpu_idle, 1));
if (cfgfile_intval (option, value, "active_priority", &v, 1)) {
p->win32_active_priority = fetchpri (v, 1);
if (m)
goto end;
LLError(newname);
-#ifndef CPU_64_BIT
+#ifndef CPU_64_BIT
break;
#endif
}
extern int mouseactive, focus;
extern int ignore_messages_all;
#define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 1"
+#define WINUAEBETASTR " Beta 2"
extern char start_path_exe[MAX_DPATH];
extern char start_path_data[MAX_DPATH];
sprintf( filename, "%s.", DriveName );
dwHold = GetFileAttributes( filename );
if( dwHold != 0xFFFFFFFF )
- result = TRUE;
+ result = TRUE;
return result;
}
int i, result = 1, illegal_count = sizeof( illegal_volumenames ) / sizeof( char *);
for( i = 0; i < illegal_count; i++ )
{
- if( strcmp( volumename, illegal_volumenames[i] ) == 0 )
- {
- result = 0;
- break;
- }
+ if( strcmp( volumename, illegal_volumenames[i] ) == 0 )
+ {
+ result = 0;
+ break;
+ }
}
/* if result is still good, we've passed the illegal names check, and must check for duplicates now */
if( result && fullcheck)
{
- for( i = 0; i < mountinfo->num_units; i++ )
- {
- if( mountinfo->ui[i].volname && ( strcmp( mountinfo->ui[i].volname, volumename ) == 0 ) )
- {
- result = 0;
- break;
- }
- }
+ for( i = 0; i < mountinfo->num_units; i++ )
+ {
+ if( mountinfo->ui[i].volname && ( strcmp( mountinfo->ui[i].volname, volumename ) == 0 ) )
+ {
+ result = 0;
+ break;
+ }
+ }
}
return result;
}
if( result == 2 )
{
- switch( drivetype )
- {
- case DRIVE_FIXED:
- sprintf( volumename, "WinDH_%c", volumepath[0] );
- break;
- case DRIVE_CDROM:
- sprintf( volumename, "WinCD_%c", volumepath[0] );
- break;
- case DRIVE_REMOVABLE:
- sprintf( volumename, "WinRMV_%c", volumepath[0] );
- break;
- case DRIVE_REMOTE:
- sprintf( volumename, "WinNET_%c", volumepath[0] );
- break;
- case DRIVE_RAMDISK:
- sprintf( volumename, "WinRAM_%c", volumepath[0] );
- break;
- case DRIVE_UNKNOWN:
- case DRIVE_NO_ROOT_DIR:
- default:
- result = 0;
- break;
- }
+ switch( drivetype )
+ {
+ case DRIVE_FIXED:
+ sprintf( volumename, "WinDH_%c", volumepath[0] );
+ break;
+ case DRIVE_CDROM:
+ sprintf( volumename, "WinCD_%c", volumepath[0] );
+ break;
+ case DRIVE_REMOVABLE:
+ sprintf( volumename, "WinRMV_%c", volumepath[0] );
+ break;
+ case DRIVE_REMOTE:
+ sprintf( volumename, "WinNET_%c", volumepath[0] );
+ break;
+ case DRIVE_RAMDISK:
+ sprintf( volumename, "WinRAM_%c", volumepath[0] );
+ break;
+ case DRIVE_UNKNOWN:
+ case DRIVE_NO_ROOT_DIR:
+ default:
+ result = 0;
+ break;
+ }
}
return result;
DWORD dwDriveMask;
char *result = NULL;
- if( currprefs.win32_automount_drives )
+ if( currprefs.win32_automount_drives || currprefs.win32_automount_netdrives )
{
- dwDriveMask = GetLogicalDrives();
- dwDriveMask >>= 2; // Skip A and B drives...
+ dwDriveMask = GetLogicalDrives();
+ dwDriveMask >>= 2; // Skip A and B drives...
- for( drive = 'C'; drive <= 'Z'; ++drive )
- {
+ for( drive = 'C'; drive <= 'Z'; ++drive ) {
sprintf( volumepath, "%c:\\", drive );
/* Is this drive-letter valid (it used to check for media in drive) */
- if( ( dwDriveMask & 1 ) /* && CheckRM( volumepath ) */ )
- {
+ if( dwDriveMask & 1 ) {
BOOL inserted = CheckRM(volumepath); /* Is there a disk inserted? */
- drivetype = GetDriveType(volumepath);
- if (drivetype != DRIVE_CDROM) {
-
- get_volume_name( currprefs.mountinfo, volumepath, volumename, MAX_DPATH, inserted, drivetype, 1 );
- if (drivetype == DRIVE_REMOTE)
- strcat( volumepath, "." );
- else
- strcat( volumepath, ".." );
-
- result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0, FILESYS_FLAG_DONOTSAVE);
- if( result )
- write_log ("%s\n", result);
- }
- } /* if drivemask */
- dwDriveMask >>= 1;
- }
+ drivetype = GetDriveType(volumepath);
+ if (!inserted)
+ continue;
+ if (drivetype == DRIVE_CDROM)
+ continue;
+ if (drivetype == DRIVE_REMOTE && !currprefs.win32_automount_netdrives)
+ continue;
+ if ((drivetype == DRIVE_FIXED || drivetype == DRIVE_REMOVABLE) && !currprefs.win32_automount_drives)
+ continue;
+ get_volume_name( currprefs.mountinfo, volumepath, volumename, MAX_DPATH, inserted, drivetype, 1 );
+ if (drivetype == DRIVE_REMOTE)
+ strcat( volumepath, "." );
+ else
+ strcat( volumepath, ".." );
+ result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0, FILESYS_FLAG_DONOTSAVE);
+ if( result )
+ write_log ("%s\n", result);
+ } /* if drivemask */
+ dwDriveMask >>= 1;
+ }
}
SetErrorMode( errormode );
}
#define SM_WINDOW_OVERLAY 1
#define SM_FULLSCREEN_DX 2
#define SM_OPENGL_WINDOW 3
-//#define SM_OPENGL_FULLSCREEN_W 4
#define SM_OPENGL_FULLSCREEN_DX 4
#define SM_D3D_WINDOW 5
#define SM_D3D_FULLSCREEN_DX 6
DM_OPENGL | DM_DX_FULLSCREEN | DM_DC,
0
},
-#if 0
- {
- 3, "DirectDraw Fullscreen OpenGL",
- DM_OPENGL | DM_DX_FULLSCREEN | DM_DC,
- 0
- },
-#endif
{
0, "Windowed Direct3D",
DM_D3D,
int num_parts = 10;
double scaleX, scaleY;
-
hStatusWnd = CreateWindowEx(
0, STATUSCLASSNAME, (LPCTSTR) NULL, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, hMainWnd, (HMENU) 1, hInst, NULL);
rc.top = stored_y;
rc.right = rc.left + 2 + currentmode->current_width + 2;
- rc.bottom = rc.top + 2 + currentmode->current_height + 2 + GetSystemMetrics (SM_CYMENU);
+ rc.bottom = rc.top + 2 + currentmode->current_height + 2 + GetSystemMetrics (SM_CYMENU) - 1;
oldx = rc.left;
oldy = rc.top;
}
hMainWnd = CreateWindowEx (WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
- "PCsuxRox", "WinUAE",
- NORMAL_WINDOW_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
- rc.left, rc.top,
- rc.right - rc.left + 1, rc.bottom - rc.top + 1,
- hhWnd, NULL, 0, NULL);
+ "PCsuxRox", "WinUAE",
+ NORMAL_WINDOW_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ rc.left, rc.top,
+ rc.right - rc.left + 1, rc.bottom - rc.top + 1,
+ hhWnd, NULL, 0, NULL);
if (! hMainWnd) {
write_log ("main window creation failed\n");
return 0;
}
-
+
createstatuswindow ();
}
hMainWnd ? 2 : CW_USEDEFAULT, hMainWnd ? 2 : CW_USEDEFAULT,
currentmode->current_width, currentmode->current_height,
hMainWnd ? hMainWnd : hhWnd, NULL, 0, NULL);
-
+
if (! hAmigaWnd) {
write_log ("creation of amiga window failed\n");
close_hwnds();
}
} else if (!(currentmode->flags & DM_SWSCALE)) {
int size = currentmode->amiga_width * currentmode->amiga_height * gfxvidinfo.pixbytes;
- gfxvidinfo.realbufmem = malloc (size);
+ gfxvidinfo.realbufmem = xmalloc (size);
gfxvidinfo.bufmem = gfxvidinfo.realbufmem;
gfxvidinfo.rowbytes = currentmode->amiga_width * gfxvidinfo.pixbytes;
} else if (!(currentmode->flags & DM_D3D)) {
int size = (currentmode->amiga_width * 2) * (currentmode->amiga_height * 3) * gfxvidinfo.pixbytes;
- gfxvidinfo.realbufmem = malloc (size);
+ gfxvidinfo.realbufmem = xmalloc (size);
memset (gfxvidinfo.realbufmem, 0, size);
gfxvidinfo.bufmem = gfxvidinfo.realbufmem + (currentmode->amiga_width + (currentmode->amiga_width * 2) * currentmode->amiga_height) * gfxvidinfo.pixbytes;
gfxvidinfo.rowbytes = currentmode->amiga_width * 2 * gfxvidinfo.pixbytes;
displayGUID = &Displays[p->gfx_display].guid;
}
-void fullscreentoggle (void)
+void toggle_fullscreen (void)
{
if(picasso_on)
changed_prefs.gfx_pfullscreen = !changed_prefs.gfx_pfullscreen;
}
#endif
DirectDraw_ReleaseDC(hdc, DirectDraw_GetLockableType());
-}
\ No newline at end of file
+}
SetDlgItemText (hDlg, IDC_CONTRIBUTORS, szContributors );
SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
- CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
+ CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
strcpy (CharFormat.szFaceName, "Times New Roman");
SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
{IDC_THEROOTS, FALSE, "Back To The Roots", "http://www.back2roots.org/"},
{IDC_ABIME, FALSE, "abime.net", "http://www.abime.net/"},
{IDC_CAPS, FALSE, "CAPS", "http://caps-project.org/"},
+ {IDC_AMIGASYS, FALSE, "AmigaSYS", "http://amigasys.fw.hu/"},
{ -1, FALSE, NULL, NULL }
};
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hDlg;
ti.hinst = hInst;
- ti.uId = (UINT)GetDlgItem (hDlg, IDC_QUICKSTART_CONFIGURATION);
+ ti.uId = (UINT_PTR)GetDlgItem (hDlg, IDC_QUICKSTART_CONFIGURATION);
ti.lpszText = tt;
SendMessage (ToolTipHWND, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
if (!tt)
case IDC_ALWAYSONTOP:
workprefs.win32_alwaysontop = IsDlgButtonChecked (hDlg, IDC_ALWAYSONTOP);
break;
+ case IDC_KBLED_USB:
+ workprefs.win32_kbledmode = IsDlgButtonChecked (hDlg, IDC_KBLED_USB) ? 1 : 0;
+ break;
}
return TRUE;
}
result = add_filesys_unit (currprefs.mountinfo, current_hfdlg.devicename, 0,
current_hfdlg.filename, ! current_hfdlg.rw,
current_hfdlg.sectors, current_hfdlg.surfaces,
- current_hfdlg.reserved, current_hfdlg.blocksize,
- current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
+ current_hfdlg.reserved, current_hfdlg.blocksize,
+ current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
if (result)
MessageBox (hDlg, result, "Bad hardfile",
MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
result = add_filesys_unit (currprefs.mountinfo, 0, 0,
current_hfdlg.filename, ! current_hfdlg.rw, 0, 0,
- 0, current_hfdlg.blocksize, 0, 0, 0);
+ 0, current_hfdlg.blocksize, 0, 0, 0);
if (result)
MessageBox (hDlg, result, "Bad harddrive",
MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
{
const char *result;
result = set_filesys_unit (currprefs.mountinfo, entry, current_hfdlg.devicename, 0, current_hfdlg.filename,
- ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces,
- current_hfdlg.reserved, current_hfdlg.blocksize, current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
+ ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces,
+ current_hfdlg.reserved, current_hfdlg.blocksize, current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
if (result)
MessageBox (hDlg, result, "Bad hardfile",
MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
{
const char *result;
result = set_filesys_unit (currprefs.mountinfo, entry, 0, 0, current_hfdlg.filename,
- ! current_hfdlg.rw, 0, 0,
- 0, current_hfdlg.blocksize, current_hfdlg.bootpri, 0, 0);
+ ! current_hfdlg.rw, 0, 0,
+ 0, current_hfdlg.blocksize, current_hfdlg.bootpri, 0, 0);
if (result)
MessageBox (hDlg, result, "Bad harddrive",
MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_FILESYS), hDlg, VolumeSettingsProc)) {
const char *result;
result = set_filesys_unit (currprefs.mountinfo, entry, current_fsvdlg.device, current_fsvdlg.volume,
- current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0);
+ current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0);
if (result)
MessageBox (hDlg, result, "Bad hardfile",
MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
harddisk_move (hDlg, 0);
clicked_entry++;
break;
-
- case IDC_MAPDRIVES:
- workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, button);
+
+ case IDC_MAPDRIVES:
+ workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES);
+ break;
+
+ case IDC_MAPDRIVES_NET:
+ workprefs.win32_automount_netdrives = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES_NET);
break;
case IDC_NOUAEFSDB:
case WM_USER:
CheckDlgButton (hDlg, IDC_MAPDRIVES, workprefs.win32_automount_drives);
+ CheckDlgButton (hDlg, IDC_MAPDRIVES_NET, workprefs.win32_automount_netdrives);
CheckDlgButton (hDlg, IDC_NOUAEFSDB, workprefs.filesys_no_uaefsdb);
CheckDlgButton (hDlg, IDC_NORECYCLEBIN, workprefs.win32_norecyclebin);
InitializeListView (hDlg);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hDlg;
ti.hinst = hInst;
- ti.uId = (UINT)GetDlgItem (hDlg, id);
+ ti.uId = (UINT_PTR)GetDlgItem (hDlg, id);
SendMessage (ToolTipHWND, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
if (crc32 == 0)
return;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = GetParent (hwnd);
ti.hinst = hInst;
- ti.uId = (UINT)hwnd;
+ ti.uId = (UINT_PTR)hwnd;
ti.lpszText = p;
if (imageid > 0) {
int idx, i;
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,_WIN32_IE 0x0500,UNIX"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
+ Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings="4996"
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib1.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
OutputFile="d:\amiga\winuae.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,UNIX"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE 0x0500,UNIX"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
/>
<Tool
Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlib.lib"
OutputFile="d:\amiga\winuae.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
EnableCOMDATFolding="2"
OptimizeForWindows98="0"
LinkTimeCodeGeneration="0"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,ZLIB_DLL,_WIN32_IE 0x0500,UNIX;WIN64"
+ PreprocessorDefinitions="WINVER=0x0500,WIN32,NDEBUG,_WINDOWS,_WIN32_IE 0x0500,UNIX;WIN64"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlib.lib"
OutputFile="d:\amiga\winuae64.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,OPENGL_SUPPORT,_WIN32_IE 0x0500,UNIX,WIN64"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32,_WINDOWS,_WIN32_IE 0x0500,UNIX,WIN64"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib1.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
+ AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib zlib.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib"
OutputFile="d:\amiga\winuae64.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
* the pen values if we're doing 8-bit display-emulation on a 16-bit or higher screen. */
if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) {
# ifndef WORDS_BIGENDIAN
- if (Bpp > 1)
- pen = (pen & 0x000000FF) << 24
+ if (Bpp > 1)
+ pen = (pen & 0x000000FF) << 24
| (pen & 0x0000FF00) << 8
| (pen & 0x00FF0000) >> 8
| (pen & 0xFF000000) >> 24;
# endif
- if (DX_Fill (x, y, width, height, pen, rgbtype))
- return;
+ if (DX_Fill (x, y, width, height, pen, rgbtype))
+ return;
} else {
if (DX_Fill (x, y, width, height, picasso_vidinfo.clut[src[0]], rgbtype))
- return;
+ return;
}
P96TRACE ("P96_WARNING: do_fillrect() using fall-back routine!\n");
int yoff = picasso96_state.YOffset;
uae_u8 *srcp, *dstp;
-// write_log ("do_blit (sx:%d sy:%d op:%d cando:%d)\n", srcx, srcy, opcode, can_do_blit);
/* Clipping. */
dstx -= xoff;
dsty -= yoff;
* Call OS blitting function that can do it in video memory.
* Should return if it was successful
*/
- if (DX_Blit (srcx, srcy, dstx, dsty, width, height, opcode))
+ if (DX_Blit (srcx, srcy, dstx, dsty, width, height, opcode))
return;
}
goto out;
dstp += dsty * picasso_vidinfo.rowbytes + dstx * picasso_vidinfo.pixbytes;
P96TRACE(("do_blit with srcp 0x%x, dstp 0x%x, dst_rowbytes %d, srcx %d, srcy %d, dstx %d, dsty %d, w %d, h %d, dst_pixbytes %d\n",
- srcp, dstp, picasso_vidinfo.rowbytes, srcx, srcy, dstx, dsty, width, height, picasso_vidinfo.pixbytes));
+ srcp, dstp, picasso_vidinfo.rowbytes, srcx, srcy, dstx, dsty, width, height, picasso_vidinfo.pixbytes));
P96TRACE(("gfxmem is at 0x%x\n",gfxmemory));
srcp = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow;
DX_Invalidate (dsty, dsty + height - 1);
-
+
if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) {
width *= Bpp;
while (height-- > 0) {
ri.BytesPerRow = picasso96_state.BytesPerRow;
ri.RGBFormat = picasso96_state.RGBFormat;
- if (set_panning_called) {
+ if (set_panning_called) {
width = picasso96_state.VirtualWidth;
height = picasso96_state.VirtualHeight;
} else {
dst += dstri->BytesPerRow;
} /* for height */
}
- return;
+ return;
}
// (mask != 0xFF && Bpp <= 1)
tmp3 = tmp2 = tmp = xmalloc (linewidth * height); /* allocate enough memory for the src-rect */
do_invertrect (&ri, Bpp, X, Y, Width, Height);
else
do_blit( &ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0);
- }
- result = 1;
+ }
+ result = 1;
}
return result;
}
int i;
uaecptr addr;
if (renderinfo_is_current_screen (&ri)) {
- uae_u32 diff = gfxmem_start - (uae_u32)gfxmemory;
- addr = ri.Memory + X * Bpp + Y * ri.BytesPerRow + diff;
+ uae_u32 diff = gfxmem_start - (uae_u32)gfxmemory;
+ addr = ri.Memory + X * Bpp + Y * ri.BytesPerRow + diff;
if (Width == 1) {
for (i = 0; i < Height; i++) {
do_blit( &ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0);
result = 1;
}
- }
+ }
}
return result;
}
int can_do_visible_blit = 0;
if (opcode == BLIT_DST) {
- write_log( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
- return 1;
+ write_log( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
+ return 1;
}
/*
* and we need to put the results on the screen from the frame-buffer.
*/
if (dstri == NULL) {
- if (mask != 0xFF && Bpp > 1) {
- mask = 0xFF;
- }
- dstri = ri;
- can_do_visible_blit = 1;
+ if (mask != 0xFF && Bpp > 1) {
+ mask = 0xFF;
+ }
+ dstri = ri;
+ can_do_visible_blit = 1;
}
/* Do our virtual frame-buffer memory first */
P96TRACE(("Did do_blit 1 in BlitRect()\n"));
} else {
- P96TRACE(("Did not do_blit 1 in BlitRect()\n"));
+ P96TRACE(("Did not do_blit 1 in BlitRect()\n"));
}
return 1;
}
STATIC_INLINE int BlitRect (uaecptr ri, uaecptr dstri,
- unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty,
- unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode )
+ unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty,
+ unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode )
{
/* Set up the params */
CopyRenderInfoStructureA2U( ri, &blitrectdata.ri_struct );
wgfx_flushline ();
P96TRACE(("BlitRectNoMaskComplete() op 0x%2x, xy(%4d,%4d) --> xy(%4d,%4d), wh(%4d,%4d)\n",
- OpCode, srcx, srcy, dstx, dsty, width, height));
+ OpCode, srcx, srcy, dstx, dsty, width, height));
result = BlitRect (srcri, dstri, srcx, srcy, dstx, dsty, width, height, 0xFF, OpCode);
} /* switch (Bpp) */
}
break;
- } /* switch (pattern.DrawMode) */
- } /* for (bits) */
- } /* for (cols) */
- } /* for (rows) */
+ } /* switch (pattern.DrawMode) */
+ } /* for (bits) */
+ } /* for (cols) */
+ } /* for (rows) */
/* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */
- if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri))
+ if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri))
do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0);
result = 1;
- }
+ }
}
return result;
}
# endif
return 0;
} else
- result = 1;
- } else
- result = 1;
+ result = 1;
+ } else
+ result = 1;
#if 1
- if (tmp.DrawMode == COMP) {
- /* workaround, let native blitter handle COMP mode */
+ if (tmp.DrawMode == COMP) {
+ /* workaround, let native blitter handle COMP mode */
# ifdef _WIN32
flushpixels();
# endif
unsigned long rows, bitoffset = srcx & 7;
long eol_offset;
- /* if (mask != 0xFF)
+ /* if (mask != 0xFF)
write_log ("P2C - pixel-width = %d, bit-offset = %d\n", width, bitoffset); */
/* Set up our bm->Planes[] pointers to the right horizontal offset */
wgfx_flushline ();
if (minterm != 0x0C) {
- write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm);
+ write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm);
} else if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) {
Mask = 0xFF;
CopyColorIndexMappingA2U (cim, &local_cim);
static void REGPARAM2 gfxmem_wput (uaecptr addr, uae_u32 w)
{
uae_u16 *m;
-#ifdef JIT
- special_mem|=picasso_is_special;
-#endif
+#ifdef JIT
+ special_mem|=picasso_is_special;
+#endif
addr -= gfxmem_start & gfxmem_mask;
addr &= gfxmem_mask;
m = (uae_u16 *) (gfxmemory + addr);
static void REGPARAM2 gfxmem_bput (uaecptr addr, uae_u32 b)
{
-#ifdef JIT
- special_mem|=picasso_is_special;
-#endif
+#ifdef JIT
+ special_mem|=picasso_is_special;
+#endif
addr -= gfxmem_start & gfxmem_mask;
addr &= gfxmem_mask;
gfxmemory[addr] = b;
{
int i;
for (i = 0; i < mode_count; i++) {
- if (DisplayModes[i].res.width == x
+ if (DisplayModes[i].res.width == x
&& DisplayModes[i].res.height == y
&& DisplayModes[i].depth == d)
- break;
+ break;
}
if (i == mode_count)
- i = -1;
+ i = -1;
return i;
}
table68k[opc].stype = srctype;
table68k[opc].plev = id.plevel;
table68k[opc].clev = specialcase(opc, id.cpulevel);
-
+
#if 0
for (i = 0; i < 5; i++) {
table68k[opc].flaginfo[i].flagset = id.flaginfo[i].flagset;
*
* - blitter state is not saved, blitter is forced to finish immediately if it
* was active
- * - disk DMA state is completely saved
+ * - disk DMA state is completely saved
* - does not ask for statefile name and description. Currently uses DF0's disk
* image name (".adf" is replaced with ".asf")
* - only Amiga state is restored, harddisk support, autoconfig, expansion boards etc..
/* Usage :
*
* save:
- *
+ *
* set savestate_state = STATE_DOSAVE, savestate_filename = "..."
*
* restore:
- *
+ *
* set savestate_state = STATE_DORESTORE, savestate_filename = "..."
*
*/
uae_u64 restore_u64_func (uae_u8 **dstp)
{
uae_u64 v;
-
+
v = restore_u32_func (dstp);
v <<= 32;
v |= restore_u32_func (dstp);
*top++ = v;
} while(v);
*dstp = dst;
- return to;
+ return to;
}
/* read and write IFF-style hunks */
&& strcmp (name, "PRAM") != 0)
{
/* without zeros at the end old state files may not work */
- mem = calloc (1, len2 + 32);
+ mem = calloc (1, len2 + 32);
zfile_fread (mem, 1, len2, f);
} else {
mem = 0;
uae_u8 *src = tmp;
int size, fullsize;
uae_u32 flags;
-
+
zfile_fseek (savestate_file, filepos, SEEK_SET);
zfile_fread (tmp, 1, sizeof(tmp), savestate_file);
size = restore_u32();
for (i = 0; i < len2; i++)
tmp[i] += 0x80;
write_wavheader(f, len, 22050);
- zfile_fwrite(tmp, len2, 1, f);
+ zfile_fwrite(tmp, len2, 1, f);
xfree(tmp);
}
zfile_fclose (f);
hunk name (4 ascii-characters)
hunk size (including header)
- hunk flags
+ hunk flags
bit 0 = chunk contents are compressed with zlib (maybe RAM chunks only?)
HEADER
"ASF " (AmigaStateFile)
-
+
statefile version
emulator name ("uae", "fellow" etc..)
emulator version string (example: "0.8.15")
MMUSR 4
TC 2
-
+
CUSTOM CHIPS
"CHIP"
DSKLENGTH status 0=off,1=written once,2=written twice
unused 2
-RAM SPACE
+RAM SPACE
"xRAM" (CRAM = chip, BRAM = bogo, FRAM = fast, ZFRAM = Z3)
void scsi_do_disk_change (int device_id, int insert)
{
int i, j;
-
+
uae_sem_wait (&change_sem);
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
if (devst[i].di.id == device_id) {
if (dev->opencnt > 0) {
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
uaecptr request;
- if (request = dev->d_request[i])
+ if (request = dev->d_request[i])
abort_async (dev, request, 0, 0);
}
dev->opencnt = 1;
}
write_log ("%s = %s:%d\n", dev->di.label, UAEDEV_SCSI, dev->aunit);
}
+ xfree(dev->di.label);
+ dev->di.label = NULL;
}
}
/* initcode */
initcode = here ();
calltrap (deftrap (diskdev_init)); dw (RTS);
-
+
/* Open */
openfunc = here ();
calltrap (deftrap (diskdev_open)); dw (RTS);
/* initcode */
initcode = here ();
calltrap (deftrap (dev_init)); dw (RTS);
-
+
/* Open */
openfunc = here ();
calltrap (deftrap (dev_open)); dw (RTS);
- /*
+ /*
* UAE - The Un*x Amiga Emulator
- *
+ *
* SDL Joystick code
- *
+ *
* Copyright 1997 Bernd Schmidt
* Copyright 1998 Krister Walfridsson
*/
num = SDL_JoystickNumButtons (joy);
for (i = 0; i < num; i++) {
int bs = SDL_JoystickGetButton (joy, i) ? 1 : 0;
- setjoybuttonstate (nr, i, bs);
+ setjoybuttonstate (nr, i, bs);
}
}
char *s;
if(!first) return NULL;
- s = first->cmd;
+ s = first->cmd;
cmd = first; first = first->next;
if(!first) last = NULL;
free(cmd);
-/* unzip.c -- IO on .zip files using zlib
+/* unzip.c -- IO on .zip files using zlib
Version 0.15 beta, Mar 19th, 1998,
Read unzip.h for more info
# include <errno.h>
#endif
-
#ifndef local
# define local static
#endif
/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets
+ Reads a long in LSB order from the given gz_stream. Sets
*/
local int unzlocal_getShort (fin,pX)
struct zfile* fin;
err = unzlocal_getByte(fin,&i);
x = (uLong)i;
-
+
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8;
-
+
if (err==UNZ_OK)
*pX = x;
else
err = unzlocal_getByte(fin,&i);
x = (uLong)i;
-
+
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8;
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<24;
-
+
if (err==UNZ_OK)
*pX = x;
else
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif
-/*
+/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
-}
+}
#define BUFREADCOMMENT (0x400)
uLong uBackRead;
uLong uMaxBack=0xffff; /* maximum size of global comment */
uLong uPosFound=0;
-
+
if (zfile_fseek(fin,0,SEEK_END) != 0)
return 0;
uSizeFile = zfile_ftell( fin );
-
+
if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile;
{
uLong uReadSize,uReadPos ;
int i;
- if (uBackRead+BUFREADCOMMENT>uMaxBack)
+ if (uBackRead+BUFREADCOMMENT>uMaxBack)
uBackRead = uMaxBack;
else
uBackRead+=BUFREADCOMMENT;
uReadPos = uSizeFile-uBackRead ;
-
- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+
+ uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
if (zfile_fseek(fin,uReadPos,SEEK_SET)!=0)
break;
break;
for (i=(int)uReadSize-3; (i--)>0;)
- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+ if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
uPosFound = uReadPos+i;
unz_s *s;
uLong central_pos,uL;
- uLong number_disk; /* number of the current dist, used for
+ uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/
uLong number_entry_CD; /* total number of entries in
- the central dir
+ the central dir
(same than number_entry on nospan) */
int err=UNZ_OK;
if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
err=UNZ_ERRNO;
- /* offset of start of central directory with respect to the
+ /* offset of start of central directory with respect to the
starting disk number */
if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
err=UNZ_ERRNO;
if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
err=UNZ_ERRNO;
- if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
+ if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
(err==UNZ_OK))
err=UNZ_BADZIPFILE;
(us.offset_central_dir+us.size_central_dir);
us.central_pos = central_pos;
us.pfile_in_zip_read = NULL;
-
+
s=(unz_s*)ALLOC(sizeof(unz_s));
*s=us;
- unzGoToFirstFile((unzFile)s);
- return (unzFile)s;
+ unzGoToFirstFile((unzFile)s);
+ return (unzFile)s;
}
*/
local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
unz_file_info *pfile_info,
- unz_file_info_internal
+ unz_file_info_internal
*pfile_info_internal,
char *szFileName,
uLong fileNameBufferSize,
lSeek -= uSizeRead;
}
-
+
if ((err==UNZ_OK) && (extraField!=NULL))
{
uLong uSizeRead ;
lSeek += file_info.size_file_extra - uSizeRead;
}
else
- lSeek+=file_info.size_file_extra;
+ lSeek+=file_info.size_file_extra;
+
-
if ((err==UNZ_OK) && (szComment!=NULL))
{
uLong uSizeRead ;
extern int ZEXPORT unzGoToNextFile (file)
unzFile file;
{
- unz_s* s;
+ unz_s* s;
int err;
if (file==NULL)
const char *szFileName;
int iCaseSensitivity;
{
- unz_s* s;
+ unz_s* s;
int err;
-
+
uLong num_fileSaved;
uLong pos_in_central_dirSaved;
*/
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
err=UNZ_ERRNO;
-/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
+/* else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
((uFlags & 8)==0))
err=UNZ_BADZIPFILE;
*/
return err;
}
-
+
/*
Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK.
}
pfile_in_zip_read_info->stream_initialised=0;
-
+
if ((s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE;
{
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
- pfile_in_zip_read_info->stream.opaque = (voidpf)0;
-
- err=pinflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream));
+ pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+
+ err=inflateInit2_(&pfile_in_zip_read_info->stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream));
if (err == Z_OK)
pfile_in_zip_read_info->stream_initialised=1;
/* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and
- * return Z_STREAM_END.
- * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+ * return Z_STREAM_END.
+ * In unzip, i don't wait absolutely Z_STREAM_END because I known the
* size of both compressed and uncompressed data
*/
}
- pfile_in_zip_read_info->rest_read_compressed =
+ pfile_in_zip_read_info->rest_read_compressed =
s->cur_file_info.compressed_size ;
- pfile_in_zip_read_info->rest_read_uncompressed =
+ pfile_in_zip_read_info->rest_read_uncompressed =
s->cur_file_info.uncompressed_size ;
-
- pfile_in_zip_read_info->pos_in_zipfile =
- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+
+ pfile_in_zip_read_info->pos_in_zipfile =
+ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
iSizeVar;
-
+
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len;
-
+
if (len>pfile_in_zip_read_info->rest_read_uncompressed)
- pfile_in_zip_read_info->stream.avail_out =
+ pfile_in_zip_read_info->stream.avail_out =
(uInt)pfile_in_zip_read_info->rest_read_uncompressed;
while (pfile_in_zip_read_info->stream.avail_out>0)
if (uReadThis == 0)
return UNZ_EOF;
if (zfile_fseek(pfile_in_zip_read_info->file,
- pfile_in_zip_read_info->pos_in_zipfile +
+ pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
return UNZ_ERRNO;
if (zfile_fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
-
- pfile_in_zip_read_info->stream.next_in =
+
+ pfile_in_zip_read_info->stream.next_in =
(Bytef*)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
}
if (pfile_in_zip_read_info->compression_method==0)
{
uInt uDoCopy,i ;
- if (pfile_in_zip_read_info->stream.avail_out <
+ if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in)
uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
else
uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
-
+
for (i=0;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.next_out+i) =
*(pfile_in_zip_read_info->stream.next_in+i);
-
- pfile_in_zip_read_info->crc32 = pcrc32(pfile_in_zip_read_info->crc32,
+
+ pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
pfile_in_zip_read_info->stream.next_out,
uDoCopy);
pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
(pfile_in_zip_read_info->rest_read_compressed == 0))
flush = Z_FINISH;
*/
- err=pinflate(&pfile_in_zip_read_info->stream,flush);
+ err=inflate(&pfile_in_zip_read_info->stream,flush);
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
uOutThis = uTotalOutAfter-uTotalOutBefore;
-
- pfile_in_zip_read_info->crc32 =
- pcrc32(pfile_in_zip_read_info->crc32,bufBefore,
+
+ pfile_in_zip_read_info->crc32 =
+ crc32(pfile_in_zip_read_info->crc32,bufBefore,
(uInt)(uOutThis));
pfile_in_zip_read_info->rest_read_uncompressed -=
uOutThis;
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
-
+
if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead;
- if (err!=Z_OK)
+ if (err!=Z_OK)
break;
}
}
/*
- return 1 if the end of file was reached, 0 elsewhere
+ return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzeof (file)
unzFile file;
if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR;
-
+
if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
return 1;
else
if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf.
- the return value is the number of bytes copied in buf, or (if <0)
+ the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR;
- size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
+ size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
pfile_in_zip_read_info->pos_local_extrafield);
if (buf==NULL)
return (int)size_to_read;
-
+
if (len>size_to_read)
read_now = (uInt)size_to_read;
else
if (read_now==0)
return 0;
-
+
if (zfile_fseek(pfile_in_zip_read_info->file,
- pfile_in_zip_read_info->offset_local_extrafield +
+ pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
return UNZ_ERRNO;
TRYFREE(pfile_in_zip_read_info->read_buffer);
pfile_in_zip_read_info->read_buffer = NULL;
if (pfile_in_zip_read_info->stream_initialised)
- pinflateEnd(&pfile_in_zip_read_info->stream);
+ inflateEnd(&pfile_in_zip_read_info->stream);
pfile_in_zip_read_info->stream_initialised = 0;
TRYFREE(pfile_in_zip_read_info);
};
static struct zfile *zlist = 0;
-int is_zlib;
-
-#ifdef _WIN32
-static HMODULE zlib;
-#include "win32.h"
-#endif
-
-INFLATEINIT2 pinflateInit2;
-INFLATEINIT pinflateInit;
-INFLATEEND pinflateEnd;
-INFLATE pinflate;
-static DEFLATEINIT pdeflateInit;
-static DEFLATEEND pdeflateEnd;
-static DEFLATE pdeflate;
-CRC32 pcrc32;
-static int zlib_test (int, int);
static struct zfile *zfile_create (void)
{
{
uae_u8 buf[8];
char *ext;
-
+
if (!z)
return ZFILE_UNKNOWN;
ext = strrchr (z->name, '.');
struct zfile *z2;
uae_u8 b;
- if (!zlib_test (1, 0))
- return z;
strcpy (name, z->name);
memset (&zs, 0, sizeof (zs));
memset (header, 0, sizeof (header));
zs.avail_in = sizeof (buffer);
zfile_fread (buffer, sizeof (buffer), 1, z);
if (first) {
- if (pinflateInit2 (&zs, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
+ if (inflateInit2_ (&zs, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
break;
first = 0;
}
- ret = pinflate (&zs, 0);
+ ret = inflate (&zs, 0);
} while (ret == Z_OK);
- pinflateEnd (&zs);
+ inflateEnd (&zs);
if (ret != Z_STREAM_END || first != 0) {
zfile_fclose (z2);
return z;
{
int ret;
struct zfile *zo;
-
+
zo = zfile_fopen_empty ("zipped.dms", 1760 * 512);
if (!zo) return z;
ret = DMS_Process_File (z, zo, CMD_UNPACK, OPT_VERBOSE, 0, 0);
}
#endif
-static char *ignoreextensions[] =
+static char *ignoreextensions[] =
{ ".gif", ".jpg", ".png", ".xml", ".pdf", ".txt", 0 };
static char *diskimageextensions[] =
{ ".adf", ".adz", ".ipf", ".fdi", 0 };
{
if (arcacc_mod)
return 1;
- arcacc_mod = WIN32_LoadLibrary ("archiveaccess.dll");
+ arcacc_mod = WIN32_LoadLibrary ("archiveaccess.dll");
if (!arcacc_mod) {
arcacc_mod = WIN32_LoadLibrary ("archiveaccess-debug.dll");
if (!arcacc_mod)
return 0;
}
- openArchive = (aa_pOpenArchive) GetProcAddress (arcacc_mod, "openArchive");
+ openArchive = (aa_pOpenArchive) GetProcAddress (arcacc_mod, "openArchive");
getFileCount = (aa_pGetFileCount) GetProcAddress (arcacc_mod, "getFileCount");
- getFileInfo = (aa_pGetFileInfo) GetProcAddress (arcacc_mod, "getFileInfo");
+ getFileInfo = (aa_pGetFileInfo) GetProcAddress (arcacc_mod, "getFileInfo");
extract = (aa_pExtract) GetProcAddress (arcacc_mod, "extract");
closeArchive = (aa_pCloseArchive) GetProcAddress (arcacc_mod, "closeArchive");
if (!openArchive || !getFileCount || !getFileInfo || !extract || !closeArchive) {
skipsize = 0;
skipsize += (int)fi.UncompressedFileSize;
}
- }
+ }
}
closeArchive (ah);
arcacc_pop ();
return z;
}
-static int zlib_test (int needzlib, int nomsg)
-{
- static int zlibmsg;
- if (is_zlib)
- return 1;
-#ifdef _WIN32
- zlib = WIN32_LoadLibrary ("zlib1.dll");
- if (!zlib)
- zlib = WIN32_LoadLibrary("zlib1_64.dll");
- if (zlib) {
- pinflateInit2 = (INFLATEINIT2)GetProcAddress (zlib, "inflateInit2_");
- pinflateInit = (INFLATEINIT)GetProcAddress (zlib, "inflateInit_");
- pinflate = (INFLATE)GetProcAddress (zlib, "inflate");
- pinflateEnd = (INFLATEEND)GetProcAddress (zlib, "inflateEnd");
- pdeflateInit = (DEFLATEINIT)GetProcAddress (zlib, "deflateInit_");
- pdeflate = (DEFLATE)GetProcAddress (zlib, "deflate");
- pdeflateEnd = (DEFLATEEND)GetProcAddress (zlib, "deflateEnd");
- pcrc32 = (CRC32)GetProcAddress (zlib, "crc32");
- is_zlib = 1;
- return 1;
- }
-#endif
- if (!needzlib && arcacc_init ())
- return 1;
- if (zlibmsg || nomsg)
- return 0;
- zlibmsg = 1;
- notify_user (NUMSG_NOZLIB);
- return 0;
-}
-
static struct zfile *unzip (struct zfile *z)
{
unzFile uz;
char tmphist[MAX_DPATH];
int first = 1;
- if (!zlib_test (1, 0))
- return z;
zf = 0;
uz = unzOpen (z);
if (!uz)
}
zipcnt++;
err = unzGoToNextFile (uz);
- if (err != UNZ_OK)
+ if (err != UNZ_OK)
break;
}
if (zf) {
zfile_fseek (z, 0, SEEK_SET);
zfile_fread (header, sizeof (header), 1, z);
zfile_fseek (z, 0, SEEK_SET);
- if (!strcasecmp (ext, ".zip") && header[0] == 'P' && header[1] == 'K' && zlib_test (1, 1))
+ if (!strcasecmp (ext, ".zip") && header[0] == 'P' && header[1] == 'K')
return -1;
for (i = 0; plugins_7z[i]; i++) {
if (plugins_7z_x[i] && !strcasecmp (ext + 1, plugins_7z[i]) &&
if (ext != NULL) {
ext++;
- if (strcasecmp (ext, "zip") == 0 && zlib_test (1, 1))
+ if (strcasecmp (ext, "zip") == 0)
return unzip (z);
if (strcasecmp (ext, "gz") == 0)
return gunzip (z);
{
int i, j;
char v;
-
+
i = strlen (name) - 2;
if (zippath)
zippath[0] = 0;
struct zfile *zf;
int err;
- if (!zlib_test (1, 0))
- return 0;
zf = 0;
uz = unzOpen (z);
if (!uz)
size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z)
{
long len = l1 * l2;
-
+
if (z->writeskipbytes) {
z->writeskipbytes -= len;
if (z->writeskipbytes >= 0)
uae_u8 inbuf[4096];
int incnt;
- if (!zlib_test (1, 0))
- return 0;
memset (&zs, 0, sizeof(zs));
- if (pinflateInit (&zs, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
+ if (inflateInit_ (&zs, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
return 0;
zs.next_out = dst;
zs.avail_out = dstsize;
zs.avail_in = zfile_fread (inbuf, 1, left, src);
incnt += left;
}
- v = pinflate (&zs, 0);
+ v = inflate (&zs, 0);
}
- pinflateEnd (&zs);
+ inflateEnd (&zs);
return 0;
}
z_stream zs;
uae_u8 outbuf[4096];
- if (!is_zlib)
- return 0;
memset (&zs, 0, sizeof (zs));
- if (pdeflateInit (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
+ if (deflateInit_ (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
return 0;
zs.next_in = src;
zs.avail_in = size;
while (v == Z_OK) {
zs.next_out = outbuf;
zs.avail_out = sizeof (outbuf);
- v = pdeflate(&zs, Z_NO_FLUSH | Z_FINISH);
+ v = deflate(&zs, Z_NO_FLUSH | Z_FINISH);
if (sizeof(outbuf) - zs.avail_out > 0)
zfile_fwrite (outbuf, 1, sizeof (outbuf) - zs.avail_out, f);
}
- pdeflateEnd(&zs);
+ deflateEnd(&zs);
return zs.total_out;
}
memset (p, 0, size);
zfile_fseek (f, 0, SEEK_SET);
zfile_fread (p, 1, size, f);
- zfile_fseek (f, pos, SEEK_SET);
+ zfile_fseek (f, pos, SEEK_SET);
crc = get_crc32 (p, size);
xfree (p);
return crc;