}
static int cycles_toggle;
+static int record_dma_maxhpos, record_dma_maxvpos;
-static void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors)
+static void debug_draw_cycles(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors)
{
int y, x, xx, dx, xplus, yplus;
struct dma_rec *dr;
if (y < 0)
return;
- if (y > maxvpos)
+ if (y > record_dma_maxvpos)
return;
if (y >= height)
return;
- dx = width - xplus * ((maxhpos + 1) & ~1) - 16;
+ dx = width - xplus * ((record_dma_maxhpos + 1) & ~1) - 16;
+ bool ended = false;
uae_s8 intlev = 0;
- for (x = 0; x < maxhpos; x++) {
+ for (x = 0; x < record_dma_maxhpos; x++) {
uae_u32 c = debug_colors[0].l[0];
xx = x * xplus + dx;
dr = &dma_record[t][y * NR_DMA_REC_HPOS + x];
- if (dr->reg != 0xffff && debug_colors[dr->type].enabled) {
- // General DMA slots
- c = debug_colors[dr->type].l[dr->extra & 7];
-
- // Special cases
- if (dr->cf_reg != 0xffff && ((cycles_toggle ^ line) & 1)) {
- c = debug_colors[DMARECORD_CONFLICT].l[0];
- } else if (dr->extra > 0xF) {
- // High bits of "extra" contain additional blitter state.
- if (dr->extra & 0x10)
- c = debug_colors[dr->type].l[4]; // blit fill, channels A-D
- else if (dr->extra & 0x20)
- c = debug_colors[dr->type].l[6]; // blit line, channels A-D
+ if (dr->end) {
+ ended = true;
+ }
+ if (ended) {
+ c = 0;
+ } else {
+ if (dr->reg != 0xffff && debug_colors[dr->type].enabled) {
+ // General DMA slots
+ c = debug_colors[dr->type].l[dr->extra & 7];
+
+ // Special cases
+ if (dr->cf_reg != 0xffff && ((cycles_toggle ^ line) & 1)) {
+ c = debug_colors[DMARECORD_CONFLICT].l[0];
+ } else if (dr->extra > 0xF) {
+ // High bits of "extra" contain additional blitter state.
+ if (dr->extra & 0x10)
+ c = debug_colors[dr->type].l[4]; // blit fill, channels A-D
+ else if (dr->extra & 0x20)
+ c = debug_colors[dr->type].l[6]; // blit line, channels A-D
+ }
}
}
if (dr->intlev > intlev)
intlev = dr->intlev;
- putpixel (buf, bpp, xx + 4, c);
- if (xplus)
- putpixel (buf, bpp, xx + 4 + 1, c);
- if (debug_dma >= 6)
- putpixel (buf, bpp, xx + 4 + 2, c);
+ putpixel(buf, bpp, xx + 4, c);
+ if (xplus > 1)
+ putpixel(buf, bpp, xx + 4 + 1, c);
+ if (xplus > 2)
+ putpixel(buf, bpp, xx + 4 + 2, c);
}
putpixel (buf, bpp, dx + 0, 0);
putpixel (buf, bpp, dx + 1, lc(intlevc[intlev]));
rd->cnt = 0;
}
-void record_dma_hsync(void)
+void record_dma_vsync(int vp)
+{
+ struct dma_rec *dr;
+
+ if (!dma_record[0])
+ return;
+ if (vp >= NR_DMA_REC_VPOS)
+ return;
+
+ dr = &dma_record[dma_record_toggle][vp * NR_DMA_REC_HPOS];
+ dr->end = true;
+
+ cycles_toggle = cycles_toggle ? 0 : 1;
+}
+
+void record_dma_hsync(int lasthpos)
{
- if (vpos == 0) {
- cycles_toggle = cycles_toggle ? 0 : 1;
+ struct dma_rec *dr;
+
+ if (!dma_record[0])
+ return;
+ if (lasthpos >= NR_DMA_REC_HPOS || vpos >= NR_DMA_REC_VPOS)
+ return;
+
+ dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + lasthpos];
+ dr->end = true;
+ if (lasthpos > record_dma_maxhpos) {
+ record_dma_maxhpos = lasthpos;
+ }
+ if (vpos > record_dma_maxvpos) {
+ record_dma_maxvpos = vpos;
}
+
#if 0
refcheck_count++;
if (refcheck_count >= REFRESH_LINES / 8) {
debug_mark_refreshed(dr->addr);
}
-static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, evt_t cycles, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5, TCHAR *l6)
+static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5, TCHAR *l6)
{
int longsize = dr->size;
bool got = false;
uae_u32 extraval;
bool noval = false;
- cycles += (vpos * maxhpos + hpos) * CYCLE_UNIT;
-
if (l1)
l1[0] = 0;
if (l2)
static void decode_dma_record (int hpos, int vpos, int toggle, bool logfile)
{
struct dma_rec *dr, *dr_start;
- int h, i, maxh;
- evt_t cycles;
+ int h, i, maxh = 0;
if (!dma_record[0] || hpos < 0 || vpos < 0)
return;
else
console_out_f (_T("Line: %02X %3d HPOS %02X %3d:\n"), vpos, vpos, hpos, hpos);
h = hpos;
- dr += hpos;
- maxh = hpos + (logfile ? maxhpos_short : 80);
- if (maxh > maxhpos_short)
- maxh = maxhpos_short;
- cycles = vsync_cycles;
- if (toggle)
- cycles -= maxvpos * maxhpos_short * CYCLE_UNIT;
+ while (maxh < NR_DMA_REC_HPOS) {
+ if (dr->end)
+ break;
+ maxh++;
+ dr++;
+ }
+ dr = dr_start;
+ if (!logfile && maxh - h > 80) {
+ maxh = h + 80;
+ }
while (h < maxh) {
int cols = (logfile ? 16 : 8);
TCHAR l1[200];
for (i = 0; i < cols && h < maxh; i++, h++, dr++) {
TCHAR l1l[16], l2l[16], l3l[16], l4l[16], l5l[16], l6l[16];
- get_record_dma_info(dr, h, vpos, cycles, l1l, l2l, l3l, l4l, l5l, l6l);
- if (dr_start[3 + 2].evt & DMA_EVENT_LOL) {
- if (maxh == maxhpos_short) {
- maxh++;
- }
- }
+ get_record_dma_info(dr, h, vpos, l1l, l2l, l3l, l4l, l5l, l6l);
TCHAR *p = l1 + _tcslen(l1);
_stprintf(p, _T("%9s "), l1l);
if (!dr)
return;
TCHAR l1[16], l2[16], l3[16], l4[16];
- if (get_record_dma_info(dr, hp, vp, 0, l1, l2, l3, l4, NULL, NULL)) {
+ if (get_record_dma_info(dr, hp, vp, l1, l2, l3, l4, NULL, NULL)) {
console_out_f(_T(" - %02X %s %s %s\n"), hp, l2, l3, l4);
}
hp++;
- if (hp >= maxhpos) {
+ if (dr->end) {
hp = 0;
vp++;
if (vp >= maxvpos + 1) {