if (!hcenterblank_state && hcenter_v2 < chpos && hcenter_v2 >= last_recorded_diw_hpos) {
hcenterblank_state = true;
if ((bplcon0 & 1) && (bplcon3 & 1)) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hcenter_v2;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 1;
- next_color_change++;
- cc[1].regno = -1;
- last_recorded_diw_hpos = cc->linepos;
+ addcc(hcenter_v2, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 1);
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBS, diw_to_hpos(hcenter_v2), vpos);
}
+#endif
thisline_changed = 1;
}
}
if (hcenterblank_state && hcenter_v2_end < chpos && hcenter_v2_end >= last_recorded_diw_hpos) {
hcenterblank_state = false;
if ((bplcon0 & 1) && (bplcon3 & 1)) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hcenter_v2_end;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 0;
- next_color_change++;
- cc[1].regno = -1;
- last_recorded_diw_hpos = cc->linepos;
+ addcc(hcenter_v2_end, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 0);
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBE, diw_to_hpos(hcenter_v2), vpos);
}
+#endif
thisline_changed = 1;
}
}
// inject programmed hblank start and end in color changes
if (hbstrt_v2 <= hbstop_v2) {
if (hbstrt_v2 < chpos && hbstrt_v2 >= last_recorded_diw_hpos) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hbstrt_v2;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 1;
- next_color_change++;
- cc[1].regno = -1;
+ addcc(hbstrt_v2, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 1);
hblank_reset(hbstrt_v2);
exthblank_state = true;
- last_recorded_diw_hpos = cc->linepos;
- last_hblank_start = cc->linepos;
+ last_hblank_start = hbstrt_v2;
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBS, diw_to_hpos(hbstrt_v2), vpos);
}
+#endif
}
if (hbstop_v2 < chpos && hbstop_v2 >= last_recorded_diw_hpos) {
// do_color_changes() HBLANK workaround
if (next_color_change == last_color_change && exthblank_state) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = 0;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 1;
- next_color_change++;
- }
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hbstop_v2;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 0;
- next_color_change++;
- cc[1].regno = -1;
+ addcc(0, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 1);
+ }
+ addcc(hbstop_v2, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 0);
exthblank_state = false;
- last_recorded_diw_hpos = cc->linepos;
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBE, diw_to_hpos(hbstop_v2), vpos);
}
+#endif
}
- } else if (hbstrt_v2 > hbstop_v2) { // equal: blank disable wins
+ } else if (hbstrt_v2 > hbstop_v2) { // equal: blank disable wins
if (hbstop_v2 < chpos && hbstop_v2 >= last_recorded_diw_hpos) {
if (next_color_change == last_color_change && exthblank_state) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = 0;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 1;
- next_color_change++;
- }
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hbstop_v2;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 0;
- next_color_change++;
- cc[1].regno = -1;
+ addcc(0, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 1);
+ }
+ addcc(hbstop_v2, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 0);
exthblank_state = false;
- last_recorded_diw_hpos = cc->linepos;
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBE, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBE, diw_to_hpos(hbstop_v2), vpos);
}
+#endif
}
if (hbstrt_v2 < chpos && hbstrt_v2 >= last_recorded_diw_hpos) {
- cc = &curr_color_changes[next_color_change];
- cc->linepos = hbstrt_v2;
- cc->regno = RECORDED_REGISTER_CHANGE_OFFSET + 0x200;
- cc->value = 1;
- next_color_change++;
- cc[1].regno = -1;
+ addcc(hbstrt_v2, RECORDED_REGISTER_CHANGE_OFFSET + 0x200, 1);
hblank_reset(hbstrt_v2);
exthblank_state = true;
- last_recorded_diw_hpos = cc->linepos;
- last_hblank_start = cc->linepos;
+ last_hblank_start = hbstrt_v2;
+#ifdef DEBUGGER
if (debug_dma) {
- record_dma_event(DMA_EVENT_HBS, diw_to_hpos(cc->linepos), vpos);
+ record_dma_event(DMA_EVENT_HBS, diw_to_hpos(hbstrt_v2), vpos);
}
+#endif
}
}
}
}
}
+#ifdef DEBUGGER
debug_hsync();
+#endif
}
- STATIC_INLINE bool is_last_line(void)
- {
- return vpos + 1 == maxvpos + lof_store;
- }
-
// low latency vsync
#define LLV_DEBUG 0
audio_reset();
if (!isrestore()) {
+ memset(&cop_state, 0, sizeof(cop_state));
+ cop_state.state = COP_stop;
/* must be called after audio_reset */
adkcon = 0;
+#ifdef SERIAL_PORT
serial_uartbreak(0);
+#endif
audio_update_adkmasks();
}
j++;
}
}
+#endif
if (j > 0)
console_out_f (_T("\n"));
- console_out_f (_T("T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d STP=%d\n"),
- regs.t1, regs.t0, regs.s, regs.m,
- GET_XFLG (), GET_NFLG (), GET_ZFLG (),
- GET_VFLG (), GET_CFLG (),
+ console_out_f (_T("SR=%04X T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IM=%d STP=%d\n"),
+ regs.sr, regs.t1, regs.t0, regs.s, regs.m,
+ GET_XFLG(), GET_NFLG(), GET_ZFLG(),
+ GET_VFLG(), GET_CFLG(),
regs.intmask, regs.stopped);
#ifdef FPUEMU
if (currprefs.fpu_model) {