#include <math.h>
#define MAX_EV ~0ul
-//#define DEBUG_AUDIO
+#define DEBUG_AUDIO 0
#define DEBUG_CHANNEL_MASK 15
-//#define TEST_AUDIO
+#define TEST_AUDIO 0
#define PERIOD_MIN 4
#define PERIOD_MIN_NONCE 60
int sinc_output_state;
sinc_queue_t sinc_queue[SINC_QUEUE_LENGTH];
int sinc_queue_length;
-#ifdef TEST_AUDIO
+#if TEST_AUDIO > 0
bool hisample, losample;
bool have_dat;
int per_original;
static void zerostate (int nr)
{
struct audio_channel_data *cdp = audio_channel + nr;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
write_log (L"%d: ZEROSTATE\n", nr);
#endif
cdp->state = 0;
cdp->evtime = MAX_EV;
cdp->intreq2 = 0;
cdp->dmaenstore = false;
-#ifdef TEST_AUDIO
+#if TEST_AUDIO > 0
cdp->have_dat = false;
#endif
uae_u16 dmal = 0;
for (int nr = 0; nr < 4; nr++) {
struct audio_channel_data *cdp = audio_channel + nr;
- // hpos offset hack, no need for expensive event
- if (cdp->drhpos > 0 && cdp->drhpos < maxhpos - 4) {
- if (cdp->dr)
- dmal |= 1 << (nr * 2);
- if (cdp->dsr)
- dmal |= 1 << (nr * 2 + 1);
- cdp->dr = cdp->dsr = false;
- } else {
- cdp->drhpos = 1;
- }
+ if (cdp->dr)
+ dmal |= 1 << (nr * 2);
+ if (cdp->dsr)
+ dmal |= 1 << (nr * 2 + 1);
+ cdp->dr = cdp->dsr = false;
}
return dmal;
}
static void setirq (int nr, int which)
{
struct audio_channel_data *cdp = audio_channel + nr;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"SETIRQ%d (%d,%d) PC=%08X\n", nr, which, isirq (nr) ? 1 : 0, M68K_GETPC);
#endif
static void newsample (int nr, sample8_t sample)
{
struct audio_channel_data *cdp = audio_channel + nr;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (!debugchannel (nr))
sample = 0;
#endif
STATIC_INLINE void setdr (int nr)
{
struct audio_channel_data *cdp = audio_channel + nr;
-#ifdef TEST_AUDIO
- if (cdp->dr)
+#if TEST_AUDIO > 0
+ if (debugchannel (nr) && cdp->dr)
write_log (L"%d: DR already active (STATE=%d)\n", nr, cdp->state);
#endif
cdp->drhpos = current_hpos ();
cdp->dr = true;
if (cdp->wlen == 1) {
cdp->dsr = true;
- cdp->drhpos++;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"DSR%d PT=%08X PC=%08X\n", nr, cdp->pt, M68K_GETPC);
#endif
cdp[1].vol = cdp->dat;
}
} else {
-#ifdef TEST_AUDIO
- if (cdp->hisample || cdp->losample)
- write_log (L"%d: high or low sample not used\n", nr);
+#if TEST_AUDIO > 0
+ if (debugchannel (nr)) {
+ if (cdp->hisample || cdp->losample)
+ write_log (L"%d: high or low sample not used\n", nr);
+ if (!cdp->have_dat)
+ write_log (L"%d: dat not updated. STATE=%d 1=%04x 2=%04x\n", nr, cdp->state, cdp->dat, cdp->dat2);
+ }
cdp->hisample = cdp->losample = true;
- if (!cdp->have_dat)
- write_log (L"%d: dat not updated. STATE=%d\n", nr, cdp->state);
cdp->have_dat = false;
+#endif
+#if DEBUG_AUDIO > 1
+ if (debugchannel (nr))
+ write_log (L"LOAD%dDAT: New:%04x, Old:%04x\n", nr, cdp->dat, cdp->dat2);
#endif
cdp->dat2 = cdp->dat;
}
if ((cdp->state == 2 || cdp->state == 3) && usehacks () && !chan_ena && old_dma) {
// DMA switched off, state=2/3 and "too fast CPU": kill DMA instantly
// or CPU timed DMA wait routines in common tracker players will lose notes
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
write_log (L"%d: INSTADMAOFF\n", nr, M68K_GETPC);
#endif
newsample (nr, (cdp->dat2 >> 0) & 0xff);
return;
}
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr) && old_dma != chan_ena) {
write_log (L"%d:DMA=%d IRQ=%d PC=%08x\n", nr, chan_ena, isirq (nr) ? 1 : 0, M68K_GETPC);
}
// normal hardware behavior: latch it after first DMA fetch comes
cdp->dsr = true;
}
-#ifdef TEST_AUDIO
+#if TEST_AUDIO > 0
cdp->have_dat = false;
#endif
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"%d:0>1: LEN=%d PC=%08x\n", nr, cdp->wlen, M68K_GETPC);
#endif
}
if (!cdp->dat_written)
return;
-#ifdef TEST_AUDIO
- if (!cdp->have_dat)
+#if TEST_AUDIO > 0
+ if (debugchannel (nr) && !cdp->have_dat)
write_log (L"%d: state 1 but no have_dat\n", nr);
cdp->have_dat = false;
cdp->losample = cdp->hisample = false;
}
if (!cdp->dat_written)
return;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"%d:>5: LEN=%d PT=%08X PC=%08X\n", nr, cdp->wlen, cdp->pt, M68K_GETPC);
#endif
break;
case 2:
if (cdp->pbufldl) {
-#ifdef TEST_AUDIO
- if (cdp->hisample == false)
+#if TEST_AUDIO > 0
+ if (debugchannel (nr) && cdp->hisample == false)
write_log (L"%d: high sample used twice\n", nr);
cdp->hisample = false;
#endif
break;
case 3:
if (cdp->pbufldl) {
-#ifdef TEST_AUDIO
- if (cdp->losample == false)
+#if TEST_AUDIO > 0
+ if (debugchannel (nr) && cdp->losample == false)
write_log (L"%d: low sample used twice\n", nr);
cdp->losample = false;
#endif
setdr (nr);
} else {
if (isirq (nr)) {
-#ifdef DEBUG_AUDIO
- if (debugchannel (nr))
- write_log (L"%d: IDLE\n", nr);
+#if DEBUG_AUDIO > 0
+ if (debugchannel (nr))
+ write_log (L"%d: IDLE\n", nr);
#endif
zerostate (nr);
return;
struct audio_channel_data *cdp = audio_channel + nr;
int chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr));
-#ifdef DEBUG_AUDIO
- if (debugchannel (nr) && (!chan_ena || addr == 0xffffffff || (cdp->state != 2 && cdp->state != 3)))
+#if DEBUG_AUDIO > 0
+ if (debugchannel (nr) && (DEBUG_AUDIO > 1 || (!chan_ena || addr == 0xffffffff || (cdp->state != 2 && cdp->state != 3))))
write_log (L"AUD%dDAT: %04X ADDR=%08X LEN=%d/%d %d,%d,%d %06X\n", nr,
v, addr, cdp->wlen, cdp->len, cdp->state, chan_ena, isirq (nr) ? 1 : 0, M68K_GETPC);
#endif
cdp->dat = v;
cdp->dat_written = true;
-#ifdef TEST_AUDIO
- if (cdp->have_dat)
- write_log (L"%d: audxdat but old dat not yet used\n", nr);
+#if TEST_AUDIO > 0
+ if (debugchannel (nr) && cdp->have_dat)
+ write_log (L"%d: audxdat 1=%04x 2=%04x but old dat not yet used\n", nr, cdp->dat, cdp->dat2);
cdp->have_dat = true;
#endif
if (cdp->state == 2 || cdp->state == 3) {
cdp->intreq2 = true;
if (sampleripper_enabled)
do_samplerip (cdp);
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%d looped, IRQ=%d, LC=%08X LEN=%d\n", nr, isirq (nr) ? 1 : 0, cdp->pt, cdp->wlen);
#endif
AUDxDAT (nr, v, 0xffffffff);
}
-uaecptr audio_getpt (int nr, int reset)
+uaecptr audio_getpt (int nr, bool reset)
{
struct audio_channel_data *cdp = audio_channel + nr;
uaecptr p = cdp->pt;
audio_activate ();
update_audio ();
cdp->lc = (cdp->lc & 0xffff) | ((uae_u32)v << 16);
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%dLCH: %04X %08X\n", nr, v, M68K_GETPC);
#endif
audio_activate ();
update_audio ();
cdp->lc = (cdp->lc & ~0xffff) | (v & 0xFFFE);
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%dLCL: %04X %08X\n", nr, v, M68K_GETPC);
#endif
void AUDxPER (int nr, uae_u16 v)
{
struct audio_channel_data *cdp = audio_channel + nr;
- unsigned long per = v * CYCLE_UNIT;
+ unsigned long per;
audio_activate ();
update_audio ();
+
+ per = v * CYCLE_UNIT;
if (per == 0)
per = PERIOD_MAX - 1;
events_schedule ();
}
}
-#ifdef TEST_AUDIO
+#if TEST_AUDIO > 0
cdp->per_original = v;
#endif
cdp->per = per;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%dPER: %d %08X\n", nr, v, M68K_GETPC);
#endif
audio_activate ();
update_audio ();
cdp->len = v;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%dLEN: %d %08X\n", nr, v, M68K_GETPC);
#endif
audio_activate ();
update_audio ();
cdp->vol = v2;
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
if (debugchannel (nr))
write_log (L"AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC);
#endif
audio_channel[3].adk_mask = (((t >> 3) & 1) - 1);
if ((prevcon & 0xff) != (adkcon & 0xff)) {
audio_activate ();
-#ifdef DEBUG_AUDIO
+#if DEBUG_AUDIO > 0
write_log (L"ADKCON=%02x %08X\n", adkcon & 0xff, M68K_GETPC);
#endif
prevcon = adkcon;
static int do_scsi (int unitnum, uae_u8 *cmd, int cmdlen)
{
- return 0;
+ uae_u8 *p = device_func[unitnum]->exec_out (unitnum, cmd, cmdlen);
+ return p != NULL;
}
static int do_scsi (int unitnum, uae_u8 *cmd, int cmdlen, uae_u8 *out, int outsize)
{
- return 0;
+ uae_u8 *p = device_func[unitnum]->exec_in (unitnum, cmd, cmdlen, &outsize);
+ if (p)
+ memcpy (out, p, outsize);
+ return p != NULL;
}
static int failunit (int unitnum)
return 0;
if (device_func[unitnum]->read == NULL) {
uae_u8 cmd[12] = { 0xbe, 0, block >> 24, block >> 16, block >> 8, block >> 0, size >> 16, size >> 8, size >> 0, 0x10, 0, 0 };
- cmd[1] = 2 << 3; // 2048
- if (!do_scsi (unitnum, cmd, sizeof cmd, data, size * 2048))
- cmd[1] = 4 << 3; // 2048 mode2
v = do_scsi (unitnum, cmd, sizeof cmd, data, size * 2048);
} else {
v = device_func[unitnum]->read (unitnum, data, block, size);
{
int i;
for (i = 0; i < cdblen; i++) {
- write_log (L"%s%02X", i > 0 ? "." : "", cdb[i]);
+ write_log (L"%s%02X", i > 0 ? L"." : L"", cdb[i]);
}
write_log (L"\n");
if (data) {
write_log (L"DATAOUT: %d\n", datalen);
for (i = 0; i < datalen && i < 100; i++)
- write_log (L"%s%02X", i > 0 ? "." : "", data[i]);
+ write_log (L"%s%02X", i > 0 ? L"." : L"", data[i]);
if (datalen > 0)
write_log (L"\n");
}
int i;
write_log (L"DATAIN: %d\n", datalen);
for (i = 0; i < datalen && i < 100 && data; i++)
- write_log (L"%s%02X", i > 0 ? "." : "", data[i]);
+ write_log (L"%s%02X", i > 0 ? L"." : L"", data[i]);
if (data && datalen > 0)
write_log (L"\n");
if (senselen > 0) {
write_log (L"SENSE: %d,", senselen);
for (i = 0; i < senselen && i < 32; i++) {
- write_log (L"%s%02X", i > 0 ? "." : "", sense[i]);
+ write_log (L"%s%02X", i > 0 ? L"." : L"", sense[i]);
}
write_log (L"\n");
}
goto errreq;
start = toc->toc[toc->first_track_offset + start].paddress;
}
+ sys_command_cd_pause (unitnum, 0);
sys_command_cd_play (unitnum, start, end, scan);
scsi_len = 0;
}
goto errreq;
int start = toc->toc[toc->first_track_offset + strack - 1].paddress;
int end = etrack == toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress;
+ sys_command_cd_pause (unitnum, 0);
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
scsi_len = 0;
if (end > di.toc.lastaddress)
end = di.toc.lastaddress;
if (len > 0) {
+ sys_command_cd_pause (unitnum, 0);
if (!sys_command_cd_play (unitnum, start, start + len, 0))
goto notdatatrack;
}
if (start > end)
goto errreq;
if (start < end)
+ sys_command_cd_pause (unitnum, 0);
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
scsi_len = 0;
goto nodisk;
int start = rl (cmdbuf + 2);
int len;
- if (cmd= 0xa5)
+ if (cmd = 0xa5)
len = rl (cmdbuf + 6);
else
len = rw (cmdbuf + 7);
int end = start + len;
if (end > di.toc.lastaddress)
end = di.toc.lastaddress;
+ sys_command_cd_pause (unitnum, 0);
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
}
if (start > end)
goto errreq;
if (start < end) {
+ sys_command_cd_pause (unitnum, 0);
if (!sys_command_cd_play (unitnum, start, end, 0))
goto notdatatrack;
}
if (!cdu->cdda_play)
goto end;
- if (idleframes <= 0 && !isaudiotrack (&cdu->di.toc, cdda_pos)) {
+ if (idleframes <= 0 && cdda_pos >= cdu->cdda_start && !isaudiotrack (&cdu->di.toc, cdda_pos)) {
setstate (cdu, AUDIO_STATUS_PLAY_ERROR);
+ write_log (L"IMAGE CDDA: attempted to play data track %d\n", cdda_pos);
goto end; // data track?
}
}
if (bufon[0] == 0 && bufon[1] == 0) {
- while (cdu->cdda_paused && cdu->cdda_play > 0)
+ while (cdu->cdda_paused && cdu->cdda_play == oldplay)
Sleep (10);
}
p->gfx_xcenter_pos = -1; p->gfx_ycenter_pos = -1;
p->gfx_xcenter_size = -1; p->gfx_ycenter_size = -1;
p->gfx_max_horizontal = RES_HIRES;
- p->gfx_max_vertical = 1;
+ p->gfx_max_vertical = VRES_DOUBLE;
p->color_mode = 2;
p->gfx_blackerthanblack = 0;
p->gfx_backbuffers = 2;
if (v >= 6) {
v -= 6;
int nr = v / 2;
- uaecptr pt = audio_getpt (nr, v & 1);
+ uaecptr pt = audio_getpt (nr, (v & 1) != 0);
uae_u16 dat = chipmem_wget_indirect (pt);
#ifdef DEBUGGER
if (debug_dma)
dmal_emu (v);
events_dmal (0);
}
+
static void dmal_func2 (uae_u32 v)
{
for (int i = 0; i < 6 + 8; i += 2) {
} else if (currprefs.cachesize) {
dmal_func2 (0);
} else {
- event2_newevent2 (hp, 17, dmal_func2);
+ event2_newevent2 (hp, 13, dmal_func2);
}
}
if (!dmal)
return;
dmal_hpos = 0;
- for (int i = 0; i < 6 + 8; i += 2) {
- if (dmal & (3 << i)) {
- alloc_cycle_ext (i + 7, CYCLE_MISC);
+ if (currprefs.cpu_cycle_exact) {
+ for (int i = 0; i < 6 + 8; i += 2) {
+ if (dmal & (3 << i)) {
+ alloc_cycle_ext (i + 7, CYCLE_MISC);
+ }
}
}
events_dmal (7);
CIA_vsync_posthandler (ciasyncs);
}
-
if (vpos == equ_vblank_endline + 1 && lof_current != lof_store) {
// argh, line=0 field decision was wrong, someone did
// something stupid and changed LOF
#include "crc32.h"
#include "cpummu.h"
#include "rommgr.h"
+#include "inputrecord.h"
int debugger_active;
static uaecptr skipaddr_start, skipaddr_end;
}
void log_dma_record (void)
{
+ if (!input_record && !input_play)
+ return;
if (!debug_dma)
debug_dma = 1;
decode_dma_record (0, 0, 0, true);
}
}
+static uaecptr get_base (const uae_char *name)
+{
+ uaecptr v = get_long (4);
+ addrbank *b = &get_mem_bank(v);
+
+ if (!b || !b->check (v, 400) || b->flags != ABFLAG_RAM)
+ return 0;
+ v += 378; // liblist
+ while (v = get_long (v)) {
+ uae_u32 v2;
+ uae_u8 *p;
+ b = &get_mem_bank (v);
+ if (!b || !b->check (v, 32) || b->flags != ABFLAG_RAM)
+ goto fail;
+ v2 = get_long (v + 10); // name
+ b = &get_mem_bank (v2);
+ if (!b || !b->check (v2, 20))
+ goto fail;
+ if (b->flags != ABFLAG_ROM && b->flags != ABFLAG_RAM)
+ return 0;
+ p = b->xlateaddr (v2);
+ if (!memcmp (p, name, strlen (name) + 1))
+ return v;
+ }
+ return 0;
+fail:
+ return 0xffffffff;
+}
+
+static TCHAR *getfrombstr(uaecptr pp)
+{
+ uae_u8 *p = get_real_address ((uaecptr)(pp << 2));
+ TCHAR *s = xmalloc (TCHAR, p[0] + 1);
+ return au_copy (s, p[0] + 1, (char*)p + 1);
+}
+
static void show_exec_lists (TCHAR t)
{
uaecptr execbase = get_long (4);
uaecptr list = 0, node;
- if (_totupper (t) == 'I') {
+ if (_totupper (t) == 'O') { // doslist
+ uaecptr dosbase = get_base ("dos.library");
+ if (dosbase) {
+ uaecptr rootnode = get_long (dosbase + 34);
+ uaecptr dosinfo = get_long (rootnode + 24) << 2;
+ uaecptr doslist = get_long (dosinfo + 4) << 2;
+ while (doslist) {
+ int type = get_long (doslist + 4);
+ uaecptr msgport = get_long (doslist + 8);
+ TCHAR *name = getfrombstr (get_long (doslist + 40));
+ console_out_f (L"%08x: %d %08x '%s'\n", doslist, type, msgport, name);
+ if (type == 0) {
+ console_out_f (L" - H=%08x Stack=%5d Pri=%2d Start=%08x Seg=%08x GV=%08x\n",
+ get_long (doslist + 16) << 2, get_long (doslist + 20),
+ get_long (doslist + 24), get_long (doslist + 28),
+ get_long (doslist + 32) << 2, get_long (doslist + 36));
+ }
+ xfree (name);
+ doslist = get_long (doslist) << 2;
+ }
+ } else {
+ console_out_f (L"can't find dos.library\n");
+ }
+ return;
+ } else if (_totupper (t) == 'I') { // interrupts
static const int it[] = { 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0 };
static const int it2[] = { 1, 1, 1, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7 };
list = execbase + 84;
extern uae_u16 audio_dmal (void);
extern void audio_state_machine (void);
-extern uaecptr audio_getpt (int nr, int reset);
+extern uaecptr audio_getpt (int nr, bool reset);
extern int init_audio (void);
extern void ahi_install (void);
#define RES_MAX 2
#define VRES_NONDOUBLE 0
#define VRES_DOUBLE 1
+#define VRES_QUAD 2
#define VRES_MAX 1
/* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") */
};
enum {
- ev_hsync, ev_audio, ev_cia, ev_misc,
+ ev_hsync, ev_cia, ev_misc, ev_audio,
ev_max
};
exit (0);
} else if (_tcsncmp (argv[i], L"-cdimage=", 9) == 0) {
TCHAR *txt = parsetextpath (argv[i] + 9);
- cfgfile_parse_option (&currprefs, L"cdimage0", txt, 0);
+ TCHAR *txt2 = xmalloc(TCHAR, _tcslen(txt) + 2);
+ _tcscpy(txt2, txt);
+ if (_tcsrchr(txt2, ',') != NULL)
+ _tcscat(txt2, L",");
+ cfgfile_parse_option (&currprefs, L"cdimage0", txt2, 0);
+ xfree(txt2);
xfree (txt);
} else {
if (argv[i][0] == '-' && argv[i][1] != '\0') {
#define MOVEC_DEBUG 0
#define MMUOP_DEBUG 2
#define DEBUG_CD32CDTVIO 0
+#define EXCEPTION3_DEBUG 0
#include "sysconfig.h"
#include "sysdeps.h"
last_writeaccess_for_exception_3 = writeaccess;
last_instructionaccess_for_exception_3 = instructionaccess;
Exception (3);
- //activate_debugger();
+#if EXCEPTION3_DEBUG
+ activate_debugger();
+#endif
}
void exception3 (uae_u32 opcode, uaecptr addr)
int i;
int oldplay;
int idleframes;
+ int muteframes;
int readblocksize = 2352 + 96;
while (ciw->cdda_play == 0)
if (oldplay != ciw->cdda_play) {
idleframes = 0;
+ muteframes = 0;
bool seensub = false;
struct _timeb tb1, tb2;
_ftime (&tb1);
idleframes = -1;
}
// force spin up
- read_block (ciw, -1, cda->buffers[bufnum], cdda_pos, num_sectors, readblocksize);
+ if (isaudiotrack (&ciw->di.toc, cdda_pos))
+ read_block (ciw, -1, cda->buffers[bufnum], cdda_pos, num_sectors, readblocksize);
+ if (!isaudiotrack (&ciw->di.toc, cdda_pos - 150))
+ muteframes = 75;
if (ciw->cdda_scan == 0) {
// find possible P-subchannel=1 and fudge starting point so that
bool seenindex = false;
for (int sector = cdda_pos - 200; sector < cdda_pos; sector++) {
uae_u8 *dst = cda->buffers[bufnum];
- if (sector >= 0 && read_block (ciw, -1, dst, sector, 1, readblocksize)) {
+ if (sector >= 0 && isaudiotrack (&ciw->di.toc, sector) && read_block (ciw, -1, dst, sector, 1, readblocksize)) {
uae_u8 subbuf[SUB_CHANNEL_SIZE];
sub_deinterleave (dst + 2352, subbuf);
if (seenindex) {
if ((cdda_pos < ciw->cdda_end || ciw->cdda_end == 0xffffffff) && !ciw->cdda_paused && ciw->cdda_play) {
- if (idleframes <= 0 && !isaudiotrack (&ciw->di.toc, cdda_pos)) {
+ if (idleframes <= 0 && cdda_pos >= ciw->cdda_start && !isaudiotrack (&ciw->di.toc, cdda_pos)) {
setstate (ciw, AUDIO_STATUS_PLAY_ERROR);
+ write_log (L"IOCTL: attempted to play data track %d\n", cdda_pos);
goto end; // data track?
}
}
for (i = 0; i < num_sectors; i++) {
+ if (muteframes > 0) {
+ memset (cda->buffers[bufnum] + 2352 * i, 0, 2352);
+ muteframes--;
+ }
if (idleframes > 0) {
idleframes--;
memset (cda->buffers[bufnum] + 2352 * i, 0, 2352);
bufon[bufnum] = 1;
cda->setvolume (currprefs.sound_volume, ciw->cdda_volume[0], ciw->cdda_volume[1]);
- if (!cda->play(bufnum)) {
+ if (!cda->play (bufnum)) {
setstate (ciw, AUDIO_STATUS_PLAY_ERROR);
goto end; // data track?
}
}
}
- while (ciw->cdda_paused && ciw->cdda_play > 0)
+ while (ciw->cdda_paused && ciw->cdda_play == oldplay)
Sleep (10);
bufnum = 1 - bufnum;
swb.spt.Length = sizeof (SCSI_PASS_THROUGH);
swb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, SenseBuf);
+ if (as->len > DEVICE_SCSI_BUFSIZE)
+ as->len = DEVICE_SCSI_BUFSIZE;
+
uae_sem_wait (&scgp_sem);
/* the Amiga does not tell us how long the timeout shall be, so make it _very_ long (specified in seconds) */
if (as->sense_len > 32)
as->sense_len = 32;
swb.spt.SenseInfoLength = (as->flags & 4) ? 4 : /* SCSIF_OLDAUTOSENSE */
- (as->flags & 2) ? as->sense_len : /* SCSIF_AUTOSENSE */
- 32;
+ (as->flags & 2) ? as->sense_len : /* SCSIF_AUTOSENSE */ 32;
if (dev_info[unitnum].isatapi)
scsi_atapi_fixup_pre (swb.spt.Cdb, &as->cmd_len, &scsi_datap, &as->len, &parm);
+
+ memcpy (di->scsibuf, scsi_datap, as->len);
+
swb.spt.CdbLength = (UCHAR)as->cmd_len;
swb.spt.DataTransferLength = as->len;
- swb.spt.DataBuffer = scsi_datap;
+ swb.spt.DataBuffer = di->scsibuf;
status = doscsi (di, unitnum, &swb, &err);
+ memcpy (scsi_datap, di->scsibuf, as->len);
+
as->cmdactual = status == 0 ? 0 : scsi_cmd_len_orig; /* fake scsi_CmdActual */
as->status = swb.spt.ScsiStatus; /* scsi_Status */
if (swb.spt.ScsiStatus) {
if (v == 0)
return 0;
if (outlen)
- *outlen = v;
+ *outlen = v < *outlen ? v : *outlen;
return di->scsibuf;
}
int log_rp = 1;
static int rp_revision, rp_version, rp_build;
static int max_horiz_dbl = RES_HIRES;
-static int max_vert_dbl = 1;
+static int max_vert_dbl = VRES_DOUBLE;
static int default_width, default_height;
static int hwndset;
if (done)
return;
done = 1;
-
+ write_log(L"fixup_size(%d,%d)\n", prefs->gfx_xcenter_size, prefs->gfx_ycenter_size);
if (prefs->gfx_xcenter_size > 0) {
int hres = prefs->gfx_resolution;
if (prefs->gfx_filter) {
hres += (1000 / prefs->gfx_filter_horiz_zoom_mult) - 1;
hres += uaefilters[prefs->gfx_filter].intmul - 1;
}
- if (hres > RES_MAX)
- hres = RES_MAX;
+ if (hres > max_horiz_dbl)
+ hres = max_horiz_dbl;
prefs->gfx_size_win.width = prefs->gfx_xcenter_size >> (RES_MAX - hres);
prefs->gfx_filter_autoscale = 0;
}
vres += (1000 / prefs->gfx_filter_vert_zoom_mult) - 1;
vres += uaefilters[prefs->gfx_filter].intmul - 1;
}
- if (vres > RES_MAX)
- vres = RES_MAX;
- prefs->gfx_size_win.height = (prefs->gfx_ycenter_size * 2) >> (RES_MAX - vres);
+ if (vres > max_vert_dbl)
+ vres = max_vert_dbl;
+ prefs->gfx_size_win.height = (prefs->gfx_ycenter_size * 2) >> (VRES_QUAD - vres);
prefs->gfx_filter_autoscale = 0;
}
+ write_log(L"-> %dx%d\n", prefs->gfx_size_win.width, prefs->gfx_size_win.height);
+}
+
+static int getmult(int mult)
+{
+ if (mult <= 1)
+ return 0;
+ if (mult == 2)
+ return 1;
+ if (mult == 4)
+ return 2;
+ return 0;
+}
+
+static int shift (int val, int shift)
+{
+ if (shift > 0)
+ val >>= shift;
+ else if (shift < 0)
+ val <<= -shift;
+ return val;
}
+
#define LORES_WIDTH 360
#define LORES_HEIGHT 284
static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
{
- int hres;
int m;
int full = 0;
- int vres = 0;
+ int hres, vres;
int totalhdbl = -1, totalvdbl = -1;
+ int hmult, vmult;
hres = p->gfx_resolution;
- if (p->gfx_filter && p->gfx_filter_horiz_zoom_mult)
- hres += (1000 / p->gfx_filter_horiz_zoom_mult) - 1;
- if (hres > RES_MAX)
- hres = RES_MAX;
- vres = hres;
+ vres = p->gfx_vresolution;
+ hmult = 1000 / p->gfx_filter_horiz_zoom_mult;
+ vmult = 1000 / p->gfx_filter_vert_zoom_mult;
+
m = RP_SCREENMODE_1X;
if (WIN32GFX_IsPicassoScreen ()) {
full = p->gfx_afullscreen;
- if (hres == RES_HIRES)
- m = RP_SCREENMODE_2X;
- if (hres == RES_SUPERHIRES)
- m = RP_SCREENMODE_4X;
-
totalhdbl = hres;
if (hres > max_horiz_dbl)
hres = max_horiz_dbl;
+ hres += getmult (hmult);
+
totalvdbl = vres;
if (vres > max_vert_dbl)
vres = max_vert_dbl;
+ vres += getmult (vmult);
+
+ if (hres > RES_SUPERHIRES)
+ hres = RES_SUPERHIRES;
+ if (vres > VRES_QUAD)
+ vres = VRES_QUAD;
+
+ if (hres == RES_HIRES)
+ m = RP_SCREENMODE_2X;
+ else if (hres >= RES_SUPERHIRES)
+ m = RP_SCREENMODE_4X;
if (log_rp)
- write_log (L"GET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d\n",
+ write_log (L"GET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d vm=%d hm=%d\n",
totalhdbl, hres, totalvdbl, vres, full,
p->gfx_xcenter_pos, p->gfx_ycenter_pos,
- p->gfx_size_win.width, p->gfx_size_win.height);
+ p->gfx_size_win.width, p->gfx_size_win.height,
+ hmult, vmult);
+
sm->lClipLeft = p->gfx_xcenter_pos < 0 ? -1 : p->gfx_xcenter_pos;
sm->lClipTop = p->gfx_ycenter_pos < 0 ? -1 : p->gfx_ycenter_pos;
+
if (full) {
sm->lClipWidth = LORES_WIDTH << RES_MAX;
- sm->lClipHeight = LORES_HEIGHT << 1;
+ sm->lClipHeight = LORES_HEIGHT << VRES_MAX;
} else {
- sm->lClipWidth = p->gfx_size_win.width << (RES_MAX - totalhdbl);
- if (totalvdbl == 2)
- sm->lClipHeight = p->gfx_size_win.height >> 1;
- else
- sm->lClipHeight = p->gfx_size_win.height << (1 - totalvdbl);
+ sm->lClipWidth = shift (p->gfx_size_win.width, -(RES_MAX - hres));
+ sm->lClipHeight = shift (p->gfx_size_win.height, -(VRES_MAX - vres));
}
+
if (full && p->gfx_filter && p->gfx_filter_horiz_zoom_mult == 0)
m = RP_SCREENMODE_XX;
if (p->gfx_filter_scanlines || p->gfx_scanlines)
totalhdbl, hres, totalvdbl, vres, p->gfx_display, full);
}
-
-static int shift (int val, int shift)
-{
- if (shift > 0)
- val >>= shift;
- else if (shift < 0)
- val <<= -shift;
- return val;
-}
-
static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
{
int smm = RP_SCREENMODE_MODE (sm->dwScreenMode);
int display = RP_SCREENMODE_DISPLAY (sm->dwScreenMode);
int fs = 0;
- int hdbl = 1, vdbl = 1;
+ int hdbl = RES_HIRES, vdbl = VRES_DOUBLE;
int hres, vres;
+ int hmult = 1, vmult = 1;
struct MultiDisplay *disp;
minimized = 0;
if (!WIN32GFX_IsPicassoScreen ()) {
- hdbl = smm;
- if (smm == RP_SCREENMODE_3X)
+ hdbl = RES_LORES;
+ vdbl = VRES_NONDOUBLE;
+ if (smm == RP_SCREENMODE_2X || smm == RP_SCREENMODE_3X) {
hdbl = RES_HIRES;
- if (smm == RP_SCREENMODE_4X)
+ vdbl = VRES_DOUBLE;
+ } else if (smm == RP_SCREENMODE_4X) {
hdbl = RES_SUPERHIRES;
+ vdbl = VRES_DOUBLE;
+ }
if (smm > RP_SCREENMODE_4X || smm == RP_SCREENMODE_XX) {
hdbl = max_horiz_dbl;
vdbl = max_vert_dbl;
}
- if (hdbl == RES_LORES) {
- vdbl = 0;
- } else {
- vdbl = 1;
- if (hdbl == RES_SUPERHIRES)
- vdbl = 2;
- }
-
hres = hdbl;
- if (hres > max_horiz_dbl)
+ if (hres > max_horiz_dbl) {
+ hmult = 1 << (hres - max_horiz_dbl);
hres = max_horiz_dbl;
+ }
p->gfx_resolution = hres;
+
vres = vdbl;
- if (vres > max_vert_dbl)
+ if (vres > max_vert_dbl) {
+ vmult = 1 << (vres - max_vert_dbl);
vres = max_vert_dbl;
+ }
p->gfx_vresolution = vres;
if (sm->lClipWidth <= 0)
if (sm->lClipHeight <= 0) {
p->gfx_size_win.height = shift (LORES_HEIGHT, -vdbl);
} else {
- if (vdbl == 2)
- p->gfx_size_win.height = sm->lClipHeight * 2;
- else
- p->gfx_size_win.height = shift (sm->lClipHeight, 1 - vdbl);
+ p->gfx_size_win.height = sm->lClipHeight >> (VRES_MAX - vdbl);
}
if (fs == 1) {
p->gfx_size_fs.height = disp->rect.bottom - disp->rect.top;
}
- //p->gfx_filter = rp_filter_default;
- p->gfx_filter_horiz_zoom_mult = 1000;
- p->gfx_filter_vert_zoom_mult = 1000;
- if (log_rp)
- write_log (L"WW=%d WH=%d FW=%d FH=%d\n",
- p->gfx_size_win.width, p->gfx_size_win.height,
- p->gfx_size_fs.width, p->gfx_size_fs.height);
if (fs) {
if (smm == RP_SCREENMODE_XX) {
p->gfx_filter = rp_filter;
}
if (mult > 1 || fs == 2) {
p->gfx_filter = rp_filter;
- p->gfx_filter_horiz_zoom_mult = 1000 / mult;
- p->gfx_filter_vert_zoom_mult = 1000 / mult;
+ hmult = vmult = mult;
}
}
}
#endif
p->gfx_xcenter_pos = sm->lClipLeft;
p->gfx_ycenter_pos = sm->lClipTop;
- p->gfx_xcenter_size = sm->lClipWidth;
- p->gfx_ycenter_size = sm->lClipHeight;
+ if (sm->lClipWidth > 0)
+ p->gfx_xcenter_size = sm->lClipWidth;
+ if (sm->lClipHeight > 0)
+ p->gfx_ycenter_size = sm->lClipHeight;
if (p->gfx_xcenter_pos >= 0 || p->gfx_ycenter_pos >= 0)
p->gfx_filter_autoscale = AUTOSCALE_MANUAL;
else
p->gfx_filter_autoscale = AUTOSCALE_STATIC_NOMINAL;
+ //p->gfx_filter = rp_filter_default;
+ p->gfx_filter_horiz_zoom_mult = 1000 / hmult;
+ p->gfx_filter_vert_zoom_mult = 1000 / vmult;
+
p->gfx_filter_scanlines = 0;
p->gfx_scanlines = 0;
if (sm->dwScreenMode & RP_SCREENMODE_SCANLINES) {
p->gfx_filter_scanlineratio = (1 << 4) | 1;
}
+ if (log_rp)
+ write_log (L"WW=%d WH=%d FW=%d FH=%d HM=%d VM=%d\n",
+ p->gfx_size_win.width, p->gfx_size_win.height,
+ p->gfx_size_fs.width, p->gfx_size_fs.height,
+ p->gfx_filter_horiz_zoom_mult, p->gfx_filter_vert_zoom_mult);
+
+
updatewinfsmode (p);
hwndset = 0;
config_changed = 1;
rp_filter_default = rp_filter = currprefs.gfx_filter;
if (rp_filter == 0)
rp_filter = UAE_FILTER_NULL;
- //p->gfx_api = 0;
fixup_size (p);
get_screenmode (&sm, p);
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"7"
-#define WINUAEDATE MAKEBD(2010, 12, 6)
+#define WINUAEBETA L"8"
+#define WINUAEDATE MAKEBD(2010, 12, 18)
#define WINUAEEXTRA L""
#define WINUAEREV L""
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
- <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Release/winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\</AdditionalLibraryDirectories>
<AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
- <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <DelayLoadDLLs>wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;avrt.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\FullRelease/winuae.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
+Beta 8:
+
+- mixed mode CD first audio track didn't always play (uaescsi.device only)
+- some CD/DVD drives refuse to read MODE 2 Form 1 data tracks if "only read Mode 2 Form 1" sector type set. "Any type" works..
+- SCSI emulation CDA paused state should automatically unpause when play request arrives
+- most SCSI commands in uaescsi.device SPTI mode were broken since SCSI emulation was implemented..
+ (SCSI/CD audio changes should fix for example T-Zero and The Shadow of the Third Moon CDA problems)
+- comma in cdimage command line was incorrectly handled
+- audio pitch errors if audio period rate was near minimum audio DMA time (2.3.0)
+- added basic doslist debugger command ("To")
+
Beta 7:
- RTG board start address was not 16M aligned if Z3 fast board smaller than 16M was enabled (no functional difference)
return 0;
command = get_word (request + 28);
-// write_log (L"%d: CMD=%04X DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n",
+// write_log (L"%d: DATA=%08X LEN=%08X OFFSET=%08X ACTUAL=%08X\n",
// command, io_data, io_length, io_offset, io_actual);
switch (command)