uae_u16 intena, intreq;
uae_u16 dmacon;
uae_u16 adkcon; /* used by audio code */
-uae_u32 last_custom_value1;
-uae_u16 last_custom_value2;
+uae_u16 last_custom_value;
static bool dmacon_bpl;
static uae_u32 cop1lc, cop2lc, copcon;
* 0x00 0 HCB
* 0x01 1 HC1 (HSTART)
* 0x09 9 VR1
-* 0x12 18 SHS (Horizontal blank start)
+* 0x12 18 SHS (Horizontal sync start)
* 0x1a 26 VER1 PAL
* 0x1b 27 VER1 NTSC
-* 0x23 35 RHS (Horizontal blank end)
+* 0x23 35 RHS (Horizontal sync end)
* 0x73 115 VR2
* 0x84 132 CEN (HCENTER)
* 0x8c 140 VER2 PAL
COP_read1,
COP_read2,
COP_bltwait,
+ COP_bltwait2,
COP_wait_in2,
COP_skip_in2,
COP_wait1,
static void events_dmal(int);
static uae_u16 dmal, dmal_hpos;
+static uae_u16 dmal_htotal_mask;
static bool dmal_ce;
/* The number of bits left from the last fetched words.
}
#endif
fetched_aga[nr] = fetched[nr] = v;
- last_custom_value1 = v;
- last_custom_value2 = (uae_u16)last_custom_value1;
+ regs.chipset_latch_rw = v;
+ last_custom_value = (uae_u16)regs.chipset_latch_rw;
break;
}
#ifdef AGA
record_dma_read_value_wide(fetched_aga[nr], false);
}
#endif
- last_custom_value1 = (uae_u32)fetched_aga[nr];
- last_custom_value2 = (uae_u16)last_custom_value1;
+ regs.chipset_latch_rw = (uae_u32)fetched_aga[nr];
+ last_custom_value = (uae_u16)regs.chipset_latch_rw;
fetched[nr] = (uae_u16)fetched_aga[nr];
break;
}
record_dma_read_value_wide(fetched_aga[nr], true);
}
#endif
- last_custom_value1 = (uae_u32)fetched_aga[nr];
- last_custom_value2 = (uae_u16)last_custom_value1;
+ regs.chipset_latch_rw = (uae_u32)fetched_aga[nr];
+ last_custom_value = (uae_u16)regs.chipset_latch_rw;
fetched[nr] = (uae_u16)fetched_aga[nr];
break;
}
ddfstop_hpos = -1;
last_diw_hpos = 0;
last_diw_hpos2 = 0;
+ blt_info.finishhpos = -1;
/* Default to no bitplane DMA overriding sprite DMA */
plfstrt_sprite = 0x100;
vblank_hz_lace = clk / ((maxvpos + 0.5) * (maxhpos + 0.5));
}
- if (beamcon0 & 0x80) {
+ dmal_htotal_mask = 0xffff;
+ if (beamcon0 & 0x0080) {
// programmable scanrates (ECS Agnus)
if (vtotal >= MAXVPOS) {
vtotal = MAXVPOS - 1;
htotal = MAXHPOS - 1;
}
maxhpos = htotal + 1;
+
+ if (maxhpos < DMAL_FIRST_HPOS) {
+ dmal_htotal_mask = 0;
+ } else if (maxhpos < DMAL_FIRST_HPOS + 6 * 2) {
+ int cnt = (maxhpos - DMAL_FIRST_HPOS) / 2;
+ dmal_htotal_mask = (1 << cnt) - 1;
+ }
}
// after vsync, it seems earlier possible visible line is vsync+3.
return 0xFFFF;
}
-static bool blit_busy(void)
+static bool blit_busy(int hpos, bool dmaconr)
{
+ // DMACONR latch load takes 1 cycle. Copper sees it immediately.
+ if (dmaconr && blt_info.finishhpos == hpos) {
+ return true;
+ }
if (!blt_info.blit_main && !blt_info.blit_finald) {
return false;
}
decide_line(hpos);
decide_fetch_safe(hpos);
dmacon &= ~(0x4000 | 0x2000);
- dmacon |= (blit_busy() ? 0x4000 : 0x0000) | (blt_info.blitzero ? 0x2000 : 0);
+ dmacon |= (blit_busy(hpos, true) ? 0x4000 : 0x0000) | (blt_info.blitzero ? 0x2000 : 0);
return dmacon;
}
STATIC_INLINE uae_u16 INTENAR(void)
static void VHPOSW(uae_u16 v)
{
int oldvpos = vpos;
- bool changed = false;
#if 0
if (M68K_GETPC < 0xf00000 || 1)
write_log (_T("VHPOSW %04X PC=%08x\n"), v, M68K_GETPC);
int chp = current_hpos_safe() - 4;
int hp = v & 0xff;
if (chp >= 0x21 && chp <= 0x29 && hp == 0x2d) {
- hack_delay_shift = 4;
+ hack_delay_shift = 0;
record_color_change(chp, 0, COLOR_CHANGE_HSYNC_HACK | 6);
thisline_changed = 1;
}
v >>= 8;
vpos &= 0xff00;
vpos |= v;
- if (vpos != oldvpos && !changed) {
+ if (vpos != oldvpos) {
vposw_change++;
}
if (vpos < oldvpos) {
flush_display(fetchmode);
fetched[num] = vv;
if ((fmode & 3) == 3) {
- fetched_aga[num] = ((uae_u64)last_custom_value2 << 48) | ((uae_u64)vv << 32) | (vv << 16) | vv;
+ fetched_aga[num] = ((uae_u64)last_custom_value << 48) | ((uae_u64)vv << 32) | (vv << 16) | vv;
} else if ((fmode & 3) == 2) {
- fetched_aga[num] = (last_custom_value2 << 16) | vv;
+ fetched_aga[num] = (last_custom_value << 16) | vv;
} else if ((fmode & 3) == 1) {
fetched_aga[num] = (vv << 16) | vv;
} else {
static void BLTADAT(int hpos, uae_u16 v)
{
maybe_blit(hpos, 0);
-
blt_info.bltadat = v;
}
/*
static void BLTBDAT(int hpos, uae_u16 v)
{
maybe_blit(hpos, 0);
-
int shift = bltcon1 >> 12;
-
- if (bltcon1 & 2)
+ if (bltcon1 & 2) {
blt_info.bltbhold = (((uae_u32)v << 16) | blt_info.bltbold) >> (16 - shift);
- else
+ } else {
blt_info.bltbhold = (((uae_u32)blt_info.bltbold << 16) | v) >> shift;
-
+ }
blt_info.bltbdat = v;
blt_info.bltbold = v;
}
-static void BLTCDAT(int hpos, uae_u16 v) { maybe_blit(hpos, 0); blt_info.bltcdat = v; reset_blit(0); }
-
-static void BLTAMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); reset_blit(0); }
-static void BLTBMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); reset_blit(0); }
-static void BLTCMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); reset_blit(0); }
-static void BLTDMOD(int hpos, uae_u16 v) { maybe_blit(hpos, 1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); reset_blit(0); }
-
-static void BLTCON0(int hpos, uae_u16 v) { maybe_blit (hpos, 2); bltcon0 = v; reset_blit(1); }
+static void BLTCDAT(int hpos, uae_u16 v)
+{
+ maybe_blit(hpos, 0);
+ blt_info.bltcdat = v;
+ reset_blit(0);
+}
+static void BLTAMOD(int hpos, uae_u16 v)
+{
+ maybe_blit(hpos, 1);
+ blt_info.bltamod = (uae_s16)(v & 0xFFFE);
+ reset_blit(0);
+}
+static void BLTBMOD(int hpos, uae_u16 v)
+{
+ maybe_blit(hpos, 1);
+ blt_info.bltbmod = (uae_s16)(v & 0xFFFE);
+ reset_blit(0);
+}
+static void BLTCMOD(int hpos, uae_u16 v)
+{
+ maybe_blit(hpos, 1);
+ blt_info.bltcmod = (uae_s16)(v & 0xFFFE);
+ reset_blit(0);
+}
+static void BLTDMOD(int hpos, uae_u16 v)
+{
+ maybe_blit(hpos, 1);
+ blt_info.bltdmod = (uae_s16)(v & 0xFFFE);
+ reset_blit(0);
+}
+static void BLTCON0(int hpos, uae_u16 v)
+{
+ maybe_blit (hpos, 2);
+ bltcon0 = v;
+ reset_blit(1);
+}
/* The next category is "Most useless hardware register".
* And the winner is... */
static void BLTCON0L(int hpos, uae_u16 v)
bltcon1 = v;
reset_blit(2);
}
-
static void BLTAFWM(int hpos, uae_u16 v) {
maybe_blit(hpos, 2);
blt_info.bltafwm = v;
blt_info.bltalwm = v;
reset_blit(0);
}
-
static void BLTAPTH(int hpos, uae_u16 v)
{
maybe_blit(hpos, 0);
if ((fmode & 4) && get_bitplane_dma_rel(hpos, -1)) {
sprite_get_bpl_data(hpos, s, &s->data[0]);
} else {
- s->data[0] = last_custom_value2;
+ s->data[0] = last_custom_value;
}
}
}
if ((fmode & 4) && get_bitplane_dma_rel(hpos, -1)) {
sprite_get_bpl_data(hpos, s, &s->datb[0]);
} else {
- s->datb[0] = last_custom_value2;
+ s->datb[0] = last_custom_value;
}
}
}
debug_getpeekdma_chipram(cop_state.ip, MW_MASK_COPPER, 0x8c, cop_state.last_strobe == 2 ? 0x84 : 0x80);
}
#endif
- cop_state.ir[0] = last_custom_value1 = last_custom_value2 = chipmem_wget_indirect(cop_state.ip);
+ cop_state.ir[0] = regs.chipset_latch_rw = last_custom_value = chipmem_wget_indirect(cop_state.ip);
#ifdef DEBUGGER
if (debug_dma) {
record_dma_read_value(cop_state.ir[0]);
debug_getpeekdma_chipram(cop_state.ip, MW_MASK_COPPER, 0x1fe, 0x1fe);
}
#endif
- cop_state.ir[0] = last_custom_value1 = last_custom_value2 = chipmem_wget_indirect(cop_state.ip);
+ cop_state.ir[0] = regs.chipset_latch_rw = last_custom_value = chipmem_wget_indirect(cop_state.ip);
#ifdef DEBUGGER
if (debug_dma) {
record_dma_read_value(cop_state.ir[0]);
debug_getpeekdma_chipram(cop_state.ip, MW_MASK_COPPER, 0x8c, cop_state.last_strobe == 2 ? 0x84 : 0x80);
}
#endif
- cop_state.ir[0] = last_custom_value1 = last_custom_value2 = chipmem_wget_indirect(cop_state.ip);
+ cop_state.ir[0] = regs.chipset_latch_rw = last_custom_value = chipmem_wget_indirect(cop_state.ip);
#ifdef DEBUGGER
if (debug_dma) {
record_dma_read_value(cop_state.ir[0]);
#endif
cop_state.ignore_next = 0;
}
- last_custom_value1 = last_custom_value2 = cop_state.ir[1];
+ regs.chipset_latch_rw = last_custom_value = cop_state.ir[1];
check_copper_stop();
break;
if ((cop_state.ir[1] & 0x8000) == 0) {
decide_blitter(hpos);
- if (blit_busy()) {
+ if (blit_busy(-1, false)) {
if (blitwait) {
/* We need to wait for the blitter. */
cop_state.state = COP_bltwait;
static void compute_spcflag_copper(void)
{
- if (!dmaen(DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_waitforever || cop_state.state == COP_bltwait || nocustom())
+ if (!dmaen(DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_waitforever || cop_state.state == COP_bltwait || cop_state.state == COP_bltwait2 || nocustom())
return;
if (cop_state.state == COP_wait1) {
int vp = vpos & (((cop_state.ir[1] >> 8) & 0x7F) | 0x80);
static void blitter_done_notify_wakeup(uae_u32 temp)
{
- if (cop_state.state != COP_bltwait) {
+ if (cop_state.state != COP_bltwait2) {
return;
}
// blitter_done_notify() might be called too early, wait a bit if blitter is still busy.
- if (blit_busy()) {
+ if (blit_busy(-1, false)) {
event2_newevent_xx(-1, 1 * CYCLE_UNIT, 0, blitter_done_notify_wakeup);
return;
}
if (cop_state.state != COP_bltwait) {
return;
}
+ cop_state.state = COP_bltwait2;
event2_newevent_xx(-1, 1 * CYCLE_UNIT, 0, blitter_done_notify_wakeup);
}
static uae_u16 sprite_fetch(struct sprite *s, uaecptr pt, int hpos, int slot, int mode)
{
- uae_u16 data = last_custom_value1;
+ uae_u16 data = regs.chipset_latch_rw;
#if CYCLE_CONFLICT_LOGGING
if ((hpos & 1) != (SPR_FIRST_HPOS & 1)) {
debug_getpeekdma_chipram(pt, MW_MASK_SPR_0 << num, num * 8 + 0x140 + mode * 4 + slot * 2, num * 4 + 0x120);
}
#endif
- data = last_custom_value1 = chipmem_wget_indirect(pt);
+ data = regs.chipset_latch_rw = chipmem_wget_indirect(pt);
alloc_cycle(hpos, CYCLE_SPRITE);
return data;
}
config_check_vsync();
}
+ vsync_rendered = false;
+ frame_shown = false;
+ frame_rendered = false;
+
if (quit_program > 0) {
/* prevent possible infinite loop at wait_cycles().. */
ad->framecnt = 0;
return;
}
- vsync_rendered = false;
- frame_shown = false;
- frame_rendered = false;
-
if (vblank_hz_mult > 0) {
vblank_hz_state ^= 1;
} else {
}
#endif
}
- last_custom_value1 = last_custom_value2 = dat;
+ regs.chipset_latch_rw = last_custom_value = dat;
AUDxDAT(nr, dat, pt);
} else {
uae_u16 dat = 0;
}
#endif
}
- last_custom_value1 = last_custom_value2 = dat;
+ regs.chipset_latch_rw = last_custom_value = dat;
DSKDAT(dat);
}
} else {
static void dmal_func2(uae_u32 v)
{
while (dmal) {
- if (dmal & 3)
+ if (dmal & 3) {
dmal_emu(dmal_hpos + ((dmal & 2) ? 1 : 0));
+ }
dmal_hpos += 2;
dmal >>= 2;
}
}
}
-static void events_dmal_hsync(void)
+static void events_dmal_hsync2(uae_u32 v)
{
+ int dmal_first = DMAL_FIRST_HPOS - v;
// 3 disk + 4 audio
- if (dmal)
- write_log (_T("DMAL error!? %04x\n"), dmal);
+ if (dmal) {
+ write_log(_T("DMAL error!? %04x\n"), dmal);
+ }
dmal = audio_dmal();
dmal <<= (3 * 2);
dmal |= disk_dmal();
+ dmal &= dmal_htotal_mask;
dmal_alloc_mask = dmal;
- if (!dmal)
+ if (!dmal) {
return;
+ }
dmal_hpos = 0;
if (currprefs.cpu_memory_cycle_exact) {
for (int i = 0; i < 3 * 2 + 4 * 2; i += 2) {
if (dmal & (3 << i)) {
- alloc_cycle_ext(i + DMAL_FIRST_HPOS, CYCLE_MISC);
+ alloc_cycle_ext(DMAL_FIRST_HPOS + i, CYCLE_MISC);
}
}
}
- events_dmal(DMAL_FIRST_HPOS);
+ events_dmal(dmal_first);
+}
+
+static void events_dmal_hsync(void)
+{
+ if (currprefs.cpu_compatible) {
+ int delay = REFRESH_FIRST_HPOS + 1;
+ event2_newevent2(delay, delay, events_dmal_hsync2);
+ } else {
+ events_dmal_hsync2(0);
+ }
}
static void lightpen_trigger_func(uae_u32 v)
}
// this prepares for new line
-static void hsync_handler_post (bool onvsync)
+static void hsync_handler_post(bool onvsync)
{
#ifdef CPUEMU_13
if (1 || currprefs.cpu_memory_cycle_exact || currprefs.blitter_cycle_exact) {
CIAB_tod_handler(18);
} else if (ciahsyncs) {
CIA_hsync_posthandler(true, ciahsyncs);
- if (beamcon0 & (0x80 | 0x100)) {
+ if (beamcon0 & 0x0100) {
if (hsstop < (maxhpos & ~1) && hsstrt < maxhpos) {
- CIAB_tod_handler(hsstop);
+ CIAB_tod_handler(hsstrt);
}
} else {
- CIAB_tod_handler(18);
+ CIAB_tod_handler(18); // hsync start
}
}
}
- events_dmal_hsync ();
+ events_dmal_hsync();
#if 0
// AF testing stuff
static int cnt = 0;
vs_state = false;
vs_state_hw = false;
vs_state_on = false;
+ dmal_htotal_mask = 0xffff;
memset(custom_storage, 0, sizeof(custom_storage));
if (!currprefs.cs_dipagnus) {
vb_start_line = 1;
*
* AGA:
* Can also return last CPU accessed value
- * Remembers old last_custom_value1
+ * Remembers old regs.chipset_latch_rw
*/
- v = last_custom_value1;
+ v = regs.chipset_latch_rw;
SET_LINE_CYCLEBASED;
if (!noput) {
int r, c, bmdma;
bmdma = bitplane_dma_access(hpos, 0);
if (aga_mode) {
if (bmdma || (c > CYCLE_REFRESH && c < CYCLE_CPU)) {
- v = last_custom_value1;
+ v = regs.chipset_latch_rw;
} else if (c == CYCLE_CPU) {
v = regs.db;
} else {
- v = last_custom_value1 >> ((addr & 2) ? 0 : 16);
+ v = regs.chipset_latch_rw >> ((addr & 2) ? 0 : 16);
}
} else {
if (bmdma || (c > CYCLE_REFRESH && c < CYCLE_CPU)) {
- v = last_custom_value1;
+ v = regs.chipset_latch_rw;
} else {
// refresh checked because refresh cycles do not always
- // set last_custom_value1 for performance reasons.
+ // set regs.chipset_latch_rw for performance reasons.
v = 0xffff;
}
}
currprefs.ntscmode = changed_prefs.ntscmode = i & 1;
}
fmode = RW; /* 1FC FMODE */
- last_custom_value1 = last_custom_value2 = RW;/* 1FE ? */
+ last_custom_value = RW; /* 1FE ? */
bplcon0_saved = bplcon0;
bplcon1_saved = bplcon1;
SW(0); /* 1F8 */
SW(0x8000 | (currprefs.ntscmode ? 1 : 0)); /* 1FA (re-used for NTSC) */
SW(fmode); /* 1FC FMODE */
- SW (last_custom_value1); /* 1FE */
+ SW (last_custom_value); /* 1FE */
*len = dst - dstbak;
return dstbak;
update_copper(hpos);
}
-#define SETIFCHIP \
- if (addr < 0xd80000) \
- last_custom_value1 = v;
-
uae_u32 wait_cpu_cycle_read(uaecptr addr, int mode)
{
uae_u32 v = 0;
int reg = 0x1000;
if (mode == -3) {
reg |= 2;
- v = last_custom_value1;
+ v = regs.chipset_latch_rw;
} else if (mode < 0) {
reg |= 4;
} else if (mode > 0) {
#endif
regs.chipset_latch_rw = regs.chipset_latch_read = v;
- SETIFCHIP;
x_do_cycles_post(CYCLE_UNIT, v);
#endif
regs.chipset_latch_rw = regs.chipset_latch_read = v;
- SETIFCHIP;
x_do_cycles_post(CYCLE_UNIT, v);
}
regs.chipset_latch_rw = regs.chipset_latch_write = v;
- SETIFCHIP;
x_do_cycles_post(CYCLE_UNIT, v);
}
regs.chipset_latch_rw = regs.chipset_latch_write = v;
- SETIFCHIP;
// chipset buffer latches the write, CPU does
// not need to wait for the chipset cycle to finish.
#include "debugmem.h"
#include "disasm.h"
+int disasm_flags = DISASM_FLAG_LC_MNEMO | DISASM_FLAG_LC_REG | DISASM_FLAG_LC_SIZE | DISASM_FLAG_LC_HEX | DISASM_FLAG_CC | DISASM_FLAG_EA | DISASM_FLAG_VAL | DISASM_FLAG_WORDS;
+int disasm_min_words = 5;
+int disasm_max_words = 16;
+TCHAR disasm_hexprefix[3] = { '$', 0 };
+
+static TCHAR disasm_areg, disasm_dreg;
+static TCHAR disasm_pcreg[3], disasm_fpreg[3];
+
+void disasm_init(void)
+{
+ _tcscpy(disasm_pcreg, _T("PC"));
+ _tcscpy(disasm_fpreg, _T("FP"));
+ if (disasm_flags & DISASM_FLAG_LC_REG) {
+ _tcscpy(disasm_pcreg, _T("pc"));
+ _tcscpy(disasm_fpreg, _T("fp"));
+ }
+ disasm_areg = (disasm_flags & DISASM_FLAG_LC_REG) ? 'a' : 'A';
+ disasm_dreg = (disasm_flags & DISASM_FLAG_LC_REG) ? 'd' : 'D';
+
+}
+
+static void disasm_lc_mnemo(TCHAR *s)
+{
+ if (!(disasm_flags & DISASM_FLAG_LC_MNEMO) && !(disasm_flags & DISASM_FLAG_LC_SIZE)) {
+ return;
+ }
+ if ((disasm_flags & DISASM_FLAG_LC_MNEMO) && (disasm_flags & DISASM_FLAG_LC_SIZE)) {
+ to_lower(s, -1);
+ return;
+ }
+ TCHAR *s2 = _tcschr(s, '.');
+ if (s2) {
+ if (disasm_flags & DISASM_FLAG_LC_SIZE) {
+ to_lower(s2, -1);
+ }
+ if (disasm_flags & DISASM_FLAG_LC_MNEMO) {
+ s2[0] = 0;
+ to_lower(s, -1);
+ s2[0] = '.';
+ }
+ } else {
+ if (disasm_flags & DISASM_FLAG_LC_MNEMO) {
+ to_lower(s, -1);
+ return;
+ }
+ }
+}
+
+static const TCHAR *disasm_lc_size(const TCHAR *s)
+{
+ static TCHAR tmp[32];
+ if (disasm_flags & DISASM_FLAG_LC_SIZE) {
+ _tcscpy(tmp, s);
+ to_lower(tmp, -1);
+ return tmp;
+ }
+ return s;
+}
+
+static const TCHAR *disasm_lc_reg(const TCHAR *s)
+{
+ static TCHAR tmp[32];
+ if (disasm_flags & DISASM_FLAG_LC_REG) {
+ _tcscpy(tmp, s);
+ to_lower(tmp, -1);
+ return tmp;
+ }
+ return s;
+}
+
+static const TCHAR *disasm_lc_hex2(const TCHAR *s, bool noprefix)
+{
+ static TCHAR tmp[32];
+ bool copied = false;
+ if (disasm_flags & DISASM_FLAG_LC_HEX) {
+ const TCHAR *s2 = _tcschr(s, 'X');
+ if (s2) {
+ _tcscpy(tmp, s);
+ copied = true;
+ tmp[s2 - s] = 'x';
+ for (;;) {
+ s2 = _tcschr(tmp, 'X');
+ if (!s2) {
+ break;
+ }
+ tmp[0] = 'x';
+ }
+ }
+ }
+ if (!noprefix) {
+ if (disasm_hexprefix[0] != '$' || disasm_hexprefix[1] != 0 || s[0] != '$') {
+ if (!copied) {
+ _tcscpy(tmp, s);
+ copied = true;
+ }
+ const TCHAR *s2 = _tcschr(tmp, '%');
+ if (s2) {
+ int len = _tcslen(disasm_hexprefix);
+ if (s2 > tmp && s2[-1] == '$') {
+ len--;
+ s2--;
+ }
+ if (len < 0) {
+ memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (_tcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
+ } else {
+ if (len > 0) {
+ memmove(tmp + (s2 - tmp) + len, s2, (_tcslen(s2) + 1) * sizeof(TCHAR));
+ }
+ memcpy(tmp + (s2 - tmp), disasm_hexprefix, _tcslen(disasm_hexprefix) * sizeof(TCHAR));
+ }
+ }
+ return tmp;
+ }
+ }
+ if (copied) {
+ return tmp;
+ }
+ return s;
+}
+
+static const TCHAR *disasm_lc_hex(const TCHAR *s)
+{
+ return disasm_lc_hex2(s, false);
+}
+static const TCHAR *disasm_lc_nhex(const TCHAR *s)
+{
+ return disasm_lc_hex2(s, true);
+}
+
struct cpum2c m2cregs[] = {
{ 0, 31, _T("SFC") },
struct mnemolookup *lookup;
struct instr *table = &table68k[opcode];
+#if UAE
if (addr >= 0xe90000 && addr < 0xf00000)
goto skip;
if (addr >= 0xdff000 && addr < 0xe00000)
goto skip;
+#endif
+
+ if (!(disasm_flags & DISASM_FLAG_VAL)) {
+ goto skip;
+ }
for (lookup = lookuptab; lookup->mnemo != table->mnemo; lookup++)
;
if ((dp & 0x30) == 0x20) { // BD SIZE = 2 (WORD)
disp = (uae_s32)(uae_s16)get_iword_debug(pc);
if (buffer) {
- _stprintf(p, _T("$%04x,"), (uae_s16)disp);
+ _stprintf(p, disasm_lc_hex(_T("$%04X,")), (uae_s16)disp);
p += _tcslen(p);
}
pc += 2;
} else if ((dp & 0x30) == 0x30) { // BD SIZE = 3 (LONG)
disp = get_ilong_debug(pc);
if (buffer) {
- _stprintf(p, _T("$%08x,"), disp);
+ _stprintf(p, disasm_lc_hex(_T("$%08X,")), disp);
p += _tcslen(p);
}
pc += 4;
if ((dp & 0x03) == 0x02) {
outer = (uae_s32)(uae_s16)get_iword_debug(pc);
if (buffer) {
- _stprintf(p, _T("$%04x,"), (uae_s16)outer);
+ _stprintf(p, disasm_lc_hex(_T("$%04X,")), (uae_s16)outer);
p += _tcslen(p);
}
pc += 2;
} else if ((dp & 0x03) == 0x03) {
outer = get_ilong_debug(pc);
if (buffer) {
- _stprintf(p, _T("$%08x,"), outer);
+ _stprintf(p, disasm_lc_hex(_T("$%08X,")), outer);
p += _tcslen(p);
}
pc += 4;
addr = base + outer;
if (buffer) {
- _stprintf(p, _T(" == $%08x"), addr);
+ _stprintf(p, disasm_lc_hex(_T(" == $%08X")), addr);
p += _tcslen(p);
}
}
}
regstr[0] = 0;
- _stprintf(regstr, _T(",%c%d.%c"), dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W');
+ _stprintf(regstr, _T(",%c%d.%c"), dp & 0x8000 ? disasm_areg : disasm_dreg, (int)r, dp & 0x800 ? 'L' : 'W');
addr = base + (uae_s32)((uae_s8)disp8) + dispreg;
if (buffer) {
if (pcrel) {
buffer[0] = 0;
switch (mode){
case Dreg:
- _stprintf (buffer, _T("D%d"), reg);
+ _stprintf(buffer, _T("%c%d"), disasm_dreg, reg);
if (actualea)
*actualea = 0;
break;
case Areg:
- _stprintf (buffer, _T("A%d"), reg);
+ _stprintf(buffer, _T("%c%d"), disasm_areg, reg);
if (actualea)
*actualea = 0;
break;
case Aind:
- _stprintf (buffer, _T("(A%d)"), reg);
+ _stprintf(buffer, _T("(%c%d)"), disasm_areg, reg);
addr = regs.regs[reg + 8];
showea_val(buffer, opcode, addr, size);
break;
case Aipi:
- _stprintf (buffer, _T("(A%d)+"), reg);
+ _stprintf(buffer, _T("(%c%d)+"), disasm_areg, reg);
addr = regs.regs[reg + 8];
showea_val(buffer, opcode, addr, size);
break;
case Apdi:
- _stprintf (buffer, _T("-(A%d)"), reg);
+ _stprintf(buffer, _T("-(%c%d)"), disasm_areg, reg);
addr = regs.regs[reg + 8] - datasizes[size];
showea_val(buffer, opcode, addr, size);
break;
case Ad16:
{
- TCHAR offtxt[8];
+ TCHAR offtxt[32];
disp16 = get_iword_debug (pc); pc += 2;
if (disp16 < 0)
- _stprintf (offtxt, _T("-$%04x"), -disp16);
+ _stprintf (offtxt, disasm_lc_hex(_T("-$%04X")), -disp16);
else
- _stprintf (offtxt, _T("$%04x"), disp16);
+ _stprintf (offtxt, disasm_lc_hex(_T("$%04X")), disp16);
addr = m68k_areg (regs, reg) + disp16;
- _stprintf (buffer, _T("(A%d,%s) == $%08x"), reg, offtxt, addr);
+ _stprintf(buffer, _T("(%c%d,%s)"), disasm_areg, reg, offtxt);
+ if (disasm_flags & DISASM_FLAG_VAL) {
+ _stprintf(buffer + _tcslen(buffer), disasm_lc_hex(_T(" == $%08X")), addr);
+ }
showea_val(buffer, opcode, addr, size);
}
break;
case Ad8r:
{
TCHAR name[10];
- _stprintf(name, _T("A%d"), reg);
+ _stprintf(name, _T("%c%d"), disasm_areg, reg);
addr = ShowEA_disp(&pc, m68k_areg(regs, reg), buffer, name, false);
showea_val(buffer, opcode, addr, size);
}
case PC16:
disp16 = get_iword_debug (pc); pc += 2;
addr += (uae_s16)disp16;
- _stprintf (buffer, _T("(PC,$%04x) == $%08x"), disp16 & 0xffff, addr);
+ _stprintf(buffer, _T("(%s"), disasm_pcreg);
+ _stprintf(buffer + _tcslen(buffer), disasm_lc_hex(_T(",$%04X)")), disp16 & 0xffff);
+ if (disasm_flags & DISASM_FLAG_VAL) {
+ _stprintf(buffer + _tcslen(buffer), disasm_lc_hex(_T(" == $%08X")), addr);
+ }
showea_val(buffer, opcode, addr, size);
break;
case PC8r:
{
- addr = ShowEA_disp(&pc, addr, buffer, _T("PC"), true);
+ addr = ShowEA_disp(&pc, addr, buffer, disasm_pcreg, true);
showea_val(buffer, opcode, addr, size);
}
break;
case absw:
addr = (uae_s32)(uae_s16)get_iword_debug (pc);
- _stprintf (buffer, _T("$%04x"), (uae_u16)addr);
+ _stprintf (buffer, disasm_lc_hex(_T("$%04X")), (uae_u16)addr);
pc += 2;
showea_val(buffer, opcode, addr, size);
break;
case absl:
addr = get_ilong_debug (pc);
- _stprintf (buffer, _T("$%08x"), addr);
+ _stprintf (buffer, disasm_lc_hex(_T("$%08X")), addr);
pc += 4;
showea_val(buffer, opcode, addr, size);
break;
*actualea = 0;
switch (size){
case sz_byte:
- _stprintf (buffer, _T("#$%02x"), (get_iword_debug (pc) & 0xff));
+ _stprintf (buffer, disasm_lc_hex(_T("#$%02X")), (get_iword_debug (pc) & 0xff));
pc += 2;
break;
case sz_word:
- _stprintf (buffer, _T("#$%04x"), (get_iword_debug (pc) & 0xffff));
+ _stprintf (buffer, disasm_lc_hex(_T("#$%04X")), (get_iword_debug (pc) & 0xffff));
pc += 2;
break;
case sz_long:
- _stprintf(buffer, _T("#$%08x"), (get_ilong_debug(pc)));
+ _stprintf(buffer, disasm_lc_hex(_T("#$%08X")), (get_ilong_debug(pc)));
pc += 4;
break;
case sz_single:
break;
}
case sz_packed:
- _stprintf(buffer, _T("#$%08x%08x%08x"), get_ilong_debug(pc), get_ilong_debug(pc + 4), get_ilong_debug(pc + 8));
+ _stprintf(buffer, disasm_lc_hex(_T("#$%08X%08X%08X")), get_ilong_debug(pc), get_ilong_debug(pc + 4), get_ilong_debug(pc + 8));
pc += 12;
break;
default:
break;
case imm0:
offset = (uae_s32)(uae_s8)get_iword_debug (pc);
- _stprintf (buffer, _T("#$%02x"), (uae_u32)(offset & 0xff));
+ _stprintf (buffer, disasm_lc_hex(_T("#$%02X")), (uae_u32)(offset & 0xff));
addr = pc + 2 + offset;
if ((opcode & 0xf000) == 0x6000) {
showea_val(buffer, opcode, addr, 1);
case imm1:
offset = (uae_s32)(uae_s16)get_iword_debug (pc);
buffer[0] = 0;
- _stprintf (buffer, _T("#$%04x"), (uae_u32)(offset & 0xffff));
+ _stprintf (buffer, disasm_lc_hex(_T("#$%04X")), (uae_u32)(offset & 0xffff));
addr = pc + offset;
if ((opcode & 0xf000) == 0x6000) {
showea_val(buffer, opcode, addr, 2);
break;
case imm2:
offset = (uae_s32)get_ilong_debug (pc);
- _stprintf (buffer, _T("#$%08x"), (uae_u32)offset);
+ _stprintf (buffer, disasm_lc_hex(_T("#$%08X")), (uae_u32)offset);
addr = pc + offset;
if ((opcode & 0xf000) == 0x6000) {
showea_val(buffer, opcode, addr, 4);
break;
case immi:
offset = (uae_s32)(uae_s8)(reg & 0xff);
- _stprintf (buffer, _T("#$%02x"), (uae_u8)offset);
+ _stprintf (buffer, disasm_lc_hex(_T("#$%02X")), (uae_u8)offset);
addr = pc + offset;
if (actualea)
*actualea = 0;
_T("FPIAR")
};
-static void addmovemreg (TCHAR *out, int *prevreg, int *lastreg, int *first, int reg, int fpmode)
+static void addmovemreg(TCHAR *out, int *prevreg, int *lastreg, int *first, int reg, int fpmode)
{
+ TCHAR s[10];
TCHAR *p = out + _tcslen (out);
if (*prevreg < 0) {
*prevreg = reg;
return;
}
if (reg < 0 || fpmode == 2 || (*prevreg) + 1 != reg || (reg & 8) != ((*prevreg & 8))) {
- _stprintf (p, _T("%s%s"), (*first) ? _T("") : _T("/"), movemregs[*lastreg]);
+ _tcscpy(s, movemregs[*lastreg]);
+ if (disasm_flags & DISASM_FLAG_LC_REG) {
+ to_lower(s, -1);
+ }
+ _stprintf (p, _T("%s%s"), (*first) ? _T("") : _T("/"), s);
p = p + _tcslen (p);
if (*lastreg != *prevreg) {
+ _tcscpy(s, movemregs[*prevreg]);
+ if (disasm_flags & DISASM_FLAG_LC_REG) {
+ to_lower(s, -1);
+ }
if ((*lastreg) + 2 == reg) {
- _stprintf(p, _T("/%s"), movemregs[*prevreg]);
+ _stprintf(p, _T("/%s"), s);
} else if ((*lastreg) != (*prevreg)) {
- _stprintf(p, _T("-%s"), movemregs[*prevreg]);
+ _stprintf(p, _T("-%s"), s);
}
}
*lastreg = reg;
*prevreg = reg;
}
-static bool movemout (TCHAR *out, uae_u16 mask, int mode, int fpmode, bool dst)
+static bool movemout(TCHAR *out, uae_u16 mask, int mode, int fpmode, bool dst)
{
unsigned int dmask, amask;
int prevreg = -1, lastreg = -1, first = 1;
return dataout;
}
-static void disasm_size (TCHAR *instrname, struct instr *dp)
+static void disasm_size(TCHAR *instrname, struct instr *dp)
{
int size = dp->size;
if (dp->unsized) {
int m = dp->mnemo;
if (dp->suse && dp->smode == immi &&
(m == i_MOVE || m == i_ADD || m == i_ADDA || m == i_SUB || m == i_SUBA)) {
- _tcscat(instrname, _T("Q"));
+ _tcscat(instrname, disasm_lc_size(_T("Q")));
if (m == i_MOVE)
size = -1;
}
// EXT.B -> EXTB.L
if (m == i_EXT && dp->size == sz_byte) {
- _tcscat(instrname,_T("B"));
+ _tcscat(instrname, disasm_lc_size(_T("B")));
size = sz_long;
}
switch (size)
{
case sz_byte:
- _tcscat (instrname, _T(".B "));
+ _tcscat(instrname, disasm_lc_size(_T(".B ")));
break;
case sz_word:
- _tcscat (instrname, _T(".W "));
+ _tcscat(instrname, disasm_lc_size(_T(".W ")));
break;
case sz_long:
- _tcscat (instrname, _T(".L "));
+ _tcscat(instrname, disasm_lc_size(_T(".L ")));
break;
default:
- _tcscat (instrname, _T(" "));
+ _tcscat(instrname, disasm_lc_size(_T(" ")));
break;
}
}
if (opcode == 0x4ef9) { // JMP x.l
TCHAR *p = s + _tcslen(s);
uae_u32 addr2 = get_long_debug(addr + 2);
- _stprintf(p, _T(" == $%08x "), addr2);
+ _stprintf(p, disasm_lc_hex(_T(" == $%08X ")), addr2);
showea_val(p + _tcslen(p), opcode, addr2, 4);
TCHAR txt[256];
bool ext;
_stprintf(out, _T("#%d"), extra & 7);
return true;
case 0x0008:
- _stprintf(out, _T("D%d"), extra & 7);
+ _stprintf(out, _T("%c%d"), disasm_dreg, extra & 7);
return true;
case 0x0000:
if (extra & 1) {
- _tcscpy(out, _T("DFC"));
+ _tcscpy(out, disasm_lc_reg(_T("DFC")));
} else {
- _tcscpy(out, _T("SFC"));
+ _tcscpy(out, disasm_lc_reg(_T("SFC")));
}
return true;
default:
if (fd)
_tcscat(instrname, _T("FD"));
_tcscat(instrname, _T(" "));
+ disasm_lc_mnemo(instrname);
if (!rw) {
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, actualea, safemode);
_tcscat(instrname, _T(","));
}
- _tcscat(instrname, r);
+ _tcscat(instrname, disasm_lc_reg(r));
if (rw) {
_tcscat(instrname, _T(","));
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, actualea, safemode);
case 0x02: // PLOAD R
if (mmu_op30_invea(opcode))
break;
- _stprintf(instrname, _T("PLOAD%c %s,"), mode == 0 ? 'W' : 'R', fc);
+ _stprintf(instrname, _T("PLOAD%c"), mode == 0 ? 'W' : 'R');
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), _T(" %s,"), fc);
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, actualea, safemode);
break;
case 0x04: // PFLUSHA
if (fc_bits)
break;
_tcscpy(instrname, _T("PFLUSHA"));
+ disasm_lc_mnemo(instrname);
break;
case 0x10: // FC
if (!mmu_op30_helper_get_fc(extra, fc))
break;
- _stprintf(instrname, _T("PFLUSH %s,%d"), fc, fc_mask);
+ _tcscpy(instrname, _T("PFLUSH"));
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), _T(" %s,%d"), fc, fc_mask);
break;
case 0x18: // FC + EA
if (mmu_op30_invea(opcode))
break;
if (!mmu_op30_helper_get_fc(extra, fc))
break;
- _stprintf(instrname, _T("PFLUSH %s,%d"), fc, fc_mask);
+ _tcscpy(instrname, _T("PFLUSH"));
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), _T(" %s,%d"), fc, fc_mask);
_tcscat(instrname, _T(","));
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, actualea, safemode);
break;
break;
if (!level && a)
break;
- _stprintf(instrname, _T("PTEST%c %s,"), rw ? 'R' : 'W', fc);
+ _stprintf(instrname, _T("PTEST%c"), rw ? 'R' : 'W');
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), _T(" %s,"), fc);
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr2, actualea, safemode);
_stprintf(instrname + _tcslen(instrname), _T(",#%d"), level);
if (a)
- _stprintf(instrname + _tcslen(instrname), _T(",A%d"), areg);
+ _stprintf(instrname + _tcslen(instrname), _T(",%c%d"), disasm_areg, areg);
break;
}
+ default:
+ disasm_lc_mnemo(instrname);
+ break;
}
return pc;
}
}
symbolpos = buf;
- buf = buf_out (buf, &bufsize, _T("%08X "), pc);
+ buf = buf_out (buf, &bufsize, disasm_lc_nhex(_T("%08X ")), pc);
if (segid) {
buf = buf_out(buf, &bufsize, _T("%s "), segout);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
if (lookup->friendlyname)
- _tcscpy (instrname, lookup->friendlyname);
+ _tcscpy(instrname, lookup->friendlyname);
else
- _tcscpy (instrname, lookup->name);
- ccpt = _tcsstr (instrname, _T("cc"));
+ _tcscpy(instrname, lookup->name);
+ ccpt = _tcsstr(instrname, _T("cc"));
if (ccpt != 0) {
if ((opcode & 0xf000) == 0xf000) {
if (lookup->mnemo == i_FBcc) {
}
} else {
_tcsncpy(ccpt, ccnames[dp->cc], 2);
+ if (dp->cc == 0) {
+ _tcscpy(ccpt, _T("BRA"));
+ }
}
}
- disasm_size (instrname, dp);
+ disasm_lc_mnemo(instrname);
+ disasm_size(instrname, dp);
if (lookup->mnemo == i_MOVEC2 || lookup->mnemo == i_MOVE2C) {
uae_u16 imm = extra;
if (m2cregs[j].regno == creg)
break;
}
- _stprintf(regs, _T("%c%d"), r >= 8 ? 'A' : 'D', r >= 8 ? r - 8 : r);
+ _stprintf(regs, _T("%c%d"), r >= 8 ? disasm_areg : disasm_dreg, r >= 8 ? r - 8 : r);
if (m2cregs[j].regname)
cname = m2cregs[j].regname;
if (lookup->mnemo == i_MOVE2C) {
if (!(extra & 0x0800)) {
instrname[1] = 'M';
instrname[2] = 'P';
+ disasm_lc_mnemo(instrname);
}
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
p = instrname + _tcslen(instrname);
- _stprintf(p, (extra & 0x8000) ? _T(",A%d") : _T(",D%d"), (extra >> 12) & 7);
+ _stprintf(p, _T(",%c%d"), (extra & 0x8000) ? disasm_areg : disasm_dreg, (extra >> 12) & 7);
} else if (lookup->mnemo == i_CAS) {
TCHAR *p = instrname + _tcslen(instrname);
- _stprintf(p, _T("D%d,D%d,"), extra & 7, (extra >> 6) & 7);
+ _stprintf(p, _T("%c%d,%c%d,"), disasm_dreg, extra & 7, disasm_dreg, (extra >> 6) & 7);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &deaddr2, &actualea_dst, safemode);
} else if (lookup->mnemo == i_CAS2) {
TCHAR *p = instrname + _tcslen(instrname);
uae_u16 extra2 = get_word_debug(pc + 2);
- _stprintf(p, _T("D%d:D%d,D%d,D%d,(%c%d):(%c%d)"),
- extra & 7, extra2 & 7, (extra >> 6) & 7, (extra2 >> 6) & 7,
- (extra & 0x8000) ? 'A' : 'D', (extra >> 12) & 7,
- (extra2 & 0x8000) ? 'A' : 'D', (extra2 >> 12) & 7);
+ _stprintf(p, _T("%c%d:%c%d,%c%d,%c%d,(%c%d):(%c%d)"),
+ disasm_dreg, extra & 7, disasm_dreg, extra2 & 7, disasm_dreg, (extra >> 6) & 7, disasm_dreg, (extra2 >> 6) & 7,
+ (extra & 0x8000) ? disasm_areg : disasm_dreg, (extra >> 12) & 7,
+ (extra2 & 0x8000) ? disasm_dreg : disasm_dreg, (extra2 >> 12) & 7);
add_disasm_word(&pc, &bufpc, &bufpcsize, 4);
} else if (lookup->mnemo == i_ORSR || lookup->mnemo == i_ANDSR || lookup->mnemo == i_EORSR) {
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
- _tcscat(instrname, dp->size == sz_byte ? _T(",CCR") : _T(",SR"));
+ _tcscat(instrname, dp->size == sz_byte ? disasm_lc_reg(_T(",CCR")) : disasm_lc_reg(_T(",SR")));
} else if (lookup->mnemo == i_MVR2USP) {
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
- _tcscat(instrname, _T(",USP"));
+ _tcscat(instrname, disasm_lc_reg(_T(",USP")));
} else if (lookup->mnemo == i_MVUSP2R) {
- _tcscat(instrname, _T("USP,"));
+ _tcscat(instrname, disasm_lc_reg(_T("USP,")));
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
} else if (lookup->mnemo == i_MV2SR) {
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
- _tcscat(instrname, dp->size == sz_byte ? _T(",CCR") : _T(",SR"));
+ _tcscat(instrname, dp->size == sz_byte ? disasm_lc_reg(_T(",CCR")) : disasm_lc_reg(_T(",SR")));
} else if (lookup->mnemo == i_MVSR2) {
- _tcscat(instrname, dp->size == sz_byte ? _T("CCR,") : _T("SR,"));
+ _tcscat(instrname, dp->size == sz_byte ? disasm_lc_reg(_T("CCR,")) : disasm_lc_reg(_T("SR,")));
pc = ShowEA(NULL, pc, opcode, dp->sreg, dp->smode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
} else if (lookup->mnemo == i_MVMEL) {
uae_u16 mask = extra;
instrname[5] = instrname[4];
instrname[4] = 'L';
}
+ disasm_lc_mnemo(instrname);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
p = instrname + _tcslen(instrname);
if (extra & 0x0400)
- _stprintf(p, _T(",D%d:D%d"), extra & 7, (extra >> 12) & 7);
+ _stprintf(p, _T(",%c%d:%c%d"), disasm_dreg, extra & 7, disasm_dreg, (extra >> 12) & 7);
else
- _stprintf(p, _T(",D%d"), (extra >> 12) & 7);
+ _stprintf(p, _T(",%c%d"), disasm_dreg, (extra >> 12) & 7);
} else if (lookup->mnemo == i_MOVES) {
TCHAR *p;
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
if (!(extra & 0x0800)) {
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &deaddr2, &actualea_dst, safemode);
p = instrname + _tcslen(instrname);
- _stprintf(p, _T(",%c%d"), (extra & 0x8000) ? 'A' : 'D', (extra >> 12) & 7);
+ _stprintf(p, _T(",%c%d"), (extra & 0x8000) ? disasm_areg : disasm_dreg, (extra >> 12) & 7);
} else {
p = instrname + _tcslen(instrname);
- _stprintf(p, _T("%c%d,"), (extra & 0x8000) ? 'A' : 'D', (extra >> 12) & 7);
+ _stprintf(p, _T("%c%d,"), (extra & 0x8000) ? disasm_areg : disasm_dreg, (extra >> 12) & 7);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
}
} else if (lookup->mnemo == i_BFEXTS || lookup->mnemo == i_BFEXTU ||
if (lookup->mnemo == i_BFEXTS || lookup->mnemo == i_BFEXTU || lookup->mnemo == i_BFFFO || lookup->mnemo == i_BFINS)
reg = (extra >> 12) & 7;
if (lookup->mnemo == i_BFINS)
- _stprintf(p, _T("D%d,"), reg);
+ _stprintf(p, _T("%c%d,"), disasm_dreg, reg);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &seaddr2, &actualea_src, safemode);
_tcscat(instrname, _T(" {"));
p = instrname + _tcslen(instrname);
if (extra & 0x0800)
- _stprintf(p, _T("D%d"), (extra >> 6) & 7);
+ _stprintf(p, _T("%c%d"), disasm_dreg, (extra >> 6) & 7);
else
_stprintf(p, _T("%d"), (extra >> 6) & 31);
_tcscat(instrname, _T(":"));
p = instrname + _tcslen(instrname);
if (extra & 0x0020)
- _stprintf(p, _T("D%d"), extra & 7);
+ _stprintf(p, _T("%c%d"), disasm_dreg, extra & 7);
else
_stprintf(p, _T("%d"), extra & 31);
_tcscat(instrname, _T("}"));
p = instrname + _tcslen(instrname);
if (lookup->mnemo == i_BFFFO || lookup->mnemo == i_BFEXTS || lookup->mnemo == i_BFEXTU)
- _stprintf(p, _T(",D%d"), reg);
+ _stprintf(p, _T(",%c%d"), disasm_dreg, reg);
} else if (lookup->mnemo == i_CPUSHA || lookup->mnemo == i_CPUSHL || lookup->mnemo == i_CPUSHP ||
lookup->mnemo == i_CINVA || lookup->mnemo == i_CINVL || lookup->mnemo == i_CINVP) {
if ((opcode & 0xc0) == 0xc0)
- _tcscat(instrname, _T("BC"));
+ _tcscat(instrname, disasm_lc_reg(_T("BC")));
else if (opcode & 0x80)
- _tcscat(instrname, _T("IC"));
+ _tcscat(instrname, disasm_lc_reg(_T("IC")));
else if (opcode & 0x40)
- _tcscat(instrname, _T("DC"));
+ _tcscat(instrname, disasm_lc_reg(_T("DC")));
else
_tcscat(instrname, _T("?"));
if (lookup->mnemo == i_CPUSHL || lookup->mnemo == i_CPUSHP || lookup->mnemo == i_CINVL || lookup->mnemo == i_CINVP) {
TCHAR *p = instrname + _tcslen(instrname);
- _stprintf(p, _T(",(A%d)"), opcode & 7);
+ _stprintf(p, _T(",(%c%d)"), disasm_areg, opcode & 7);
}
} else if (lookup->mnemo == i_MOVE16) {
TCHAR *p = instrname + _tcslen(instrname);
if (opcode & 0x20) {
- _stprintf(p, _T("(A%d)+,(A%d)+"), opcode & 7, (extra >> 12) & 7);
+ _stprintf(p, _T("(%c%d)+,(%c%d)+"), disasm_areg, opcode & 7, disasm_areg, (extra >> 12) & 7);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
} else {
uae_u32 addr = get_long_debug(pc);
switch ((opcode >> 3) & 3)
{
case 0:
- _stprintf(p, _T("(A%d)+,$%08x"), ay, addr);
+ _stprintf(p, _T("(%c%d)+,$%08x"), disasm_areg, ay, addr);
break;
case 1:
- _stprintf(p, _T("$%08x,(A%d)+"), addr, ay);
+ _stprintf(p, _T("$%08x,(%c%d)+"), addr, disasm_areg, ay);
break;
case 2:
- _stprintf(p, _T("(A%d),$%08x"), ay, addr);
+ _stprintf(p, _T("(%c%d),$%08x"), disasm_areg, ay, addr);
break;
case 3:
- _stprintf(p, _T("$%08x,(A%d)"), addr, ay);
+ _stprintf(p, _T("$%08x,(%c%d)"), addr, disasm_areg, ay);
break;
}
}
_tcscat(instrname, _T(","));
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, dp->size, instrname, &deaddr2, &actualea_dst, safemode);
extra = get_word_debug(pc);
- _stprintf(instrname + _tcslen(instrname), _T(",#$%04x"), extra);
+ _stprintf(instrname + _tcslen(instrname), disasm_lc_hex(_T(",#$%04X")), extra);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
} else if (lookup->mnemo == i_LPSTOP) {
if (extra == 0x01c0) {
uae_u16 extra2 = get_word_debug(pc + 2);
- _stprintf(instrname, _T("LPSTOP #$%04x"), extra2);
+ _tcscpy(instrname, _T("LPSTOP"));
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), disasm_lc_hex(_T(" #$%04X")), extra2);
add_disasm_word(&pc, &bufpc, &bufpcsize, 4);
} else {
- _stprintf(instrname, _T("ILLG #$%04x"), extra);
+ _tcscpy(instrname, _T("ILLG"));
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), disasm_lc_hex(_T(" #$%04X")), extra);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
}
} else if (lookup->mnemo == i_CALLM) {
if ((extra & 0xfc00) == 0x5c00) { // FMOVECR (=i_FPP with source specifier = 7)
fpdata fp;
fpu_get_constant(&fp, extra & 0x7f);
- _stprintf(instrname, _T("FMOVECR.X #0x%02x [%s],FP%d"), extra & 0x7f, fpp_print(&fp, 0), (extra >> 7) & 7);
+ _tcscpy(instrname, _T("FMOVECR.X"));
+ disasm_lc_mnemo(instrname);
+ _stprintf(instrname + _tcslen(instrname), _T(" #0x%02x [%s],%s%d"), extra & 0x7f, fpp_print(&fp, 0), disasm_fpreg, (extra >> 7) & 7);
} else if ((extra & 0x8000) == 0x8000) { // FMOVEM or FMOVE control register
int dr = (extra >> 13) & 1;
int mode;
regmask = extra & 0xff; // FMOVEM FPx
fpmode = 1;
_tcscpy(instrname, _T("FMOVEM.X "));
+ disasm_lc_mnemo(instrname);
} else {
mode = 0;
regmask = (extra >> 10) & 7; // FMOVEM or FMOVE control
_tcscpy(instrname, _T("FMOVEM.L "));
if (regmask == 1 || regmask == 2 || regmask == 4)
_tcscpy(instrname, _T("FMOVE.L "));
+ disasm_lc_mnemo(instrname);
}
p = instrname + _tcslen(instrname);
if (dr) {
if (mode & 1)
- _stprintf(p, _T("D%d"), dreg);
+ _stprintf(p, _T("%c%d"), disasm_dreg, dreg);
else
movemout(p, regmask, dp->dmode, fpmode, false);
_tcscat(instrname, _T(","));
_tcscat(p, _T("/"));
entry = true;
p = instrname + _tcslen(instrname);
- _stprintf(p, _T("#$%08x"), get_ilong_debug(pc));
+ _stprintf(p, disasm_lc_hex(_T("#$%08X")), get_ilong_debug(pc));
add_disasm_word(&pc, &bufpc, &bufpcsize, 4);
}
}
}
p = instrname + _tcslen(instrname);
if (mode & 1)
- _stprintf(p, _T(",D%d"), dreg);
+ _stprintf(p, _T(",%c%d"), disasm_dreg, dreg);
else
movemout(p, regmask, dp->dmode, fpmode, true);
}
if (fpuopcodes[ins]) {
_tcscpy(instrname, fpuopcodes[ins]);
} else {
- _stprintf(instrname, _T("F?%02X"), ins);
+ _stprintf(instrname, _T("%s?%02X"), disasm_lc_reg(_T("F")), ins);
}
+ disasm_lc_mnemo(instrname);
if ((extra & (0x8000 | 0x4000 | 0x2000)) == (0x4000 | 0x2000)) { // FMOVE to memory/data register
int kfactor = extra & 0x7f;
_tcscpy(instrname, _T("FMOVE."));
_tcscat(instrname, fpsizes[size]);
+ disasm_lc_mnemo(instrname);
_tcscat(instrname, _T(" "));
p = instrname + _tcslen(instrname);
- _stprintf(p, _T("FP%d,"), (extra >> 7) & 7);
+ _stprintf(p, _T("%s%d,"), disasm_fpreg, (extra >> 7) & 7);
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, fpsizeconv[size], instrname, &deaddr2, &actualea_dst, safemode);
p = instrname + _tcslen(instrname);
if (size == 7) {
- _stprintf(p, _T(" {D%d}"), (kfactor >> 4));
+ _stprintf(p, _T(" {%c%d}"), disasm_dreg, (kfactor >> 4));
} else if (kfactor) {
if (kfactor & 0x40)
kfactor |= ~0x3f;
} else if ((extra & (0x8000 | 0x2000)) == 0) {
if (extra & 0x4000) { // source is EA
_tcscat(instrname, _T("."));
- _tcscat(instrname, fpsizes[size]);
+ _tcscat(instrname, disasm_lc_size(fpsizes[size]));
_tcscat(instrname, _T(" "));
pc = ShowEA(NULL, pc, opcode, dp->dreg, dp->dmode, fpsizeconv[size], instrname, &seaddr2, &actualea_src, safemode);
} else { // source is FPx
p = instrname + _tcslen(instrname);
- _stprintf(p, _T(".X FP%d"), (extra >> 10) & 7);
+ _tcscat(p, disasm_lc_reg(_T(".X")));
+ p = instrname + _tcslen(instrname);
+ _stprintf(p, _T(" %s%d"), disasm_fpreg, (extra >> 10) & 7);
}
p = instrname + _tcslen(instrname);
if ((extra & 0x4000) || (((extra >> 7) & 7) != ((extra >> 10) & 7)))
- _stprintf(p, _T(",FP%d"), (extra >> 7) & 7);
+ _stprintf(p, _T(",%s%d"), disasm_fpreg, (extra >> 7) & 7);
if (ins >= 0x30 && ins < 0x38) { // FSINCOS
p = instrname + _tcslen(instrname);
- _stprintf(p, _T(",FP%d"), extra & 7);
+ _stprintf(p, _T(",%s%d"), disasm_fpreg, extra & 7);
}
}
if (ins >= 0x40 && currprefs.fpu_model >= 68881 && fpuopcodes[ins]) {
pc = disasm_mmu030(pc, opcode, extra, dp, instrname, &seaddr2, &actualea_src, safemode);
} else if ((opcode & 0xf000) == 0xa000) {
_tcscpy(instrname, _T("A-LINE"));
+ disasm_lc_mnemo(instrname);
} else {
if (lookup->mnemo == i_FBcc && (opcode & 0x1f) == 0 && extra == 0) {
_tcscpy(instrname, _T("FNOP"));
+ disasm_lc_mnemo(instrname);
add_disasm_word(&pc, &bufpc, &bufpcsize, 2);
} else {
if (dp->suse) {
if (lookup->mnemo == i_RTE || lookup->mnemo == i_RTR) {
a += 2;
}
- _stprintf(eas, _T(" == $%08x"), get_ilong_debug(a));
+ if (disasm_flags & DISASM_FLAG_EA) {
+ _stprintf(eas, disasm_lc_hex(_T(" == $%08X")), get_ilong_debug(a));
+ }
_tcscat(instrname, eas);
}
}
}
- for (i = 0; i < (pc - oldpc) / 2; i++) {
- buf = buf_out (buf, &bufsize, _T("%04x "), get_word_debug (oldpc + i * 2));
+ if (disasm_flags & DISASM_FLAG_WORDS) {
+ for (i = 0; i < (pc - oldpc) / 2 && i < disasm_max_words; i++) {
+ buf = buf_out(buf, &bufsize, disasm_lc_nhex(_T("%04X ")), get_word_debug(oldpc + i * 2));
+ }
+ while (i++ < disasm_min_words) {
+ buf = buf_out(buf, &bufsize, _T(" "));
+ }
}
- while (i++ < 5)
- buf = buf_out (buf, &bufsize, _T(" "));
if (illegal)
buf = buf_out (buf, &bufsize, _T("[ "));
*deaddr = pc;
if ((opcode & 0xf000) == 0xf000) {
if (currprefs.fpu_model) {
+ buf = buf_out(buf, &bufsize, disasm_lc_hex(_T(" == $%08X")), addr2);
if (fpp_cond(dp->cc)) {
- buf = buf_out(buf, &bufsize, _T(" == $%08x (T)"), addr2);
+ buf = buf_out(buf, &bufsize, _T(" (T)"));
} else {
- buf = buf_out(buf, &bufsize, _T(" == $%08x (F)"), addr2);
+ buf = buf_out(buf, &bufsize, _T(" (F)"));
}
}
} else {
if (dp->mnemo == i_Bcc || dp->mnemo == i_DBcc) {
- if (cctrue(dp->cc)) {
- buf = buf_out(buf, &bufsize, _T(" == $%08x (T)"), addr2);
- } else {
- buf = buf_out(buf, &bufsize, _T(" == $%08x (F)"), addr2);
- }
- } else {
+ buf = buf_out(buf, &bufsize, disasm_lc_hex(_T(" == $%08X")), addr2);
if (cctrue(dp->cc)) {
buf = buf_out(buf, &bufsize, _T(" (T)"));
} else {
buf = buf_out(buf, &bufsize, _T(" (F)"));
}
+ } else {
+ if (disasm_flags & DISASM_FLAG_CC) {
+ if (cctrue(dp->cc)) {
+ buf = buf_out(buf, &bufsize, _T(" (T)"));
+ } else {
+ buf = buf_out(buf, &bufsize, _T(" (F)"));
+ }
+ }
}
}
} else if ((opcode & 0xff00) == 0x6100) { /* BSR */
if (deaddr)
*deaddr = pc;
- buf = buf_out (buf, &bufsize, _T(" == $%08x"), seaddr2);
+ if (disasm_flags & DISASM_FLAG_EA) {
+ buf = buf_out(buf, &bufsize, disasm_lc_hex(_T(" == $%08X")), seaddr2);
+ }
}
buf = buf_out (buf, &bufsize, _T("\n"));