chipset updates, part 1

This commit is contained in:
Toni Wilen 2023-09-16 19:33:54 +03:00
parent ed18f41e4f
commit a908d15109
8 changed files with 651 additions and 416 deletions

File diff suppressed because it is too large Load Diff

View File

@ -235,7 +235,8 @@ static const TCHAR help[] = {
_T(" dj [<level bitmask>] Enable joystick/mouse input debugging.\n")
_T(" smc [<0-1>] Enable self-modifying code detector. 1 = enable break.\n")
_T(" dm Dump current address space map.\n")
_T(" v <vpos> [<hpos>] Show DMA data (accurate only in cycle-exact mode).\n")
_T(" v <vpos> [<hpos>] [<lines>]\n")
_T(" Show DMA data (accurate only in cycle-exact mode).\n")
_T(" v [-1 to -4] = enable visual DMA debugger.\n")
_T(" vh [<ratio> <lines>] \"Heat map\"\n")
_T(" I <custom event> Send custom event string\n")
@ -2234,6 +2235,7 @@ void record_dma_read_value(uae_u32 v)
last_dma_rec->size = 2;
}
}
void record_dma_read_value_wide(uae_u64 v, bool quad)
{
if (last_dma_rec) {
@ -2245,6 +2247,7 @@ void record_dma_read_value_wide(uae_u64 v, bool quad)
last_dma_rec->size = quad ? 8 : 4;
}
}
bool record_dma_check(int hpos, int vpos)
{
if (!dma_record[0]) {
@ -2257,6 +2260,20 @@ bool record_dma_check(int hpos, int vpos)
struct dma_rec *dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos];
return dr->reg != 0xffff;
}
void record_dma_denise(int hpos, int dhpos)
{
if (!dma_record[0]) {
return;
}
hpos += dma_record_hoffset;
if (hpos >= NR_DMA_REC_HPOS || vpos >= NR_DMA_REC_VPOS) {
return;
}
struct dma_rec *dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos];
dr->dhpos = dhpos;
}
void record_dma_clear(int hpos, int vpos)
{
if (!dma_record[0]) {
@ -2362,6 +2379,7 @@ static bool get_record_dma_info(struct dma_rec *drs, struct dma_rec *dr, TCHAR *
l6[0] = 0;
int hpos = dr->hpos;
int dhpos = dr->dhpos;
if (hpos < 0) {
struct dma_rec *dr2 = dr;
int cnt = 0;
@ -2466,7 +2484,7 @@ static bool get_record_dma_info(struct dma_rec *drs, struct dma_rec *dr, TCHAR *
}
}
if (ipl >= 0) {
_stprintf(l1, _T("[%02X %d]"), hpos, ipl);
_stprintf(l1, _T("[%02X %03X %d]"), hpos, dhpos, ipl);
} else if (ipl == -2) {
_stprintf(l1, _T("[%02X -]"), hpos);
} else {
@ -2670,7 +2688,7 @@ static bool get_record_dma_info(struct dma_rec *drs, struct dma_rec *dr, TCHAR *
static void decode_dma_record(int hpos, int vpos, int toggle, bool logfile)
static void decode_dma_record(int hpos, int vpos, int count, int toggle, bool logfile)
{
struct dma_rec *dr, *dr_start;
int h, i, maxh = 0;
@ -2783,6 +2801,12 @@ static void decode_dma_record(int hpos, int vpos, int toggle, bool logfile)
console_out_f(_T("%s\n"), l6);
console_out_f(_T("\n"));
}
if (count > 0) {
count--;
if (!count) {
break;
}
}
}
if (logfile)
flush_log();
@ -2794,7 +2818,7 @@ void log_dma_record (void)
return;
if (!debug_dma)
return;
decode_dma_record (0, 0, 0, true);
decode_dma_record (0, 0, 0, 0, true);
}
static void init_record_copper(void)
@ -6950,7 +6974,7 @@ static bool debug_line (TCHAR *input)
case 'v':
case 'V':
{
int v1 = vpos, v2 = 0;
int v1 = vpos, v2 = 0, v3 = 0;
if (*inptr == 'h') {
inptr++;
if (more_params(&inptr) && *inptr == '?') {
@ -7036,19 +7060,21 @@ static bool debug_line (TCHAR *input)
if (nextcmd == 'l') {
next_char(&inptr);
}
if (more_params (&inptr))
v1 = readint (&inptr, NULL);
if (more_params (&inptr))
v2 = readint (&inptr, NULL);
if (more_params(&inptr))
v1 = readint(&inptr, NULL);
if (more_params(&inptr))
v2 = readint(&inptr, NULL);
if (more_params(&inptr))
v3 = readint(&inptr, NULL);
if (debug_dma && v1 >= 0 && v2 >= 0) {
decode_dma_record (v2, v1, cmd == 'v', nextcmd == 'l');
decode_dma_record(v2, v1, v3, cmd == 'v', nextcmd == 'l');
} else {
if (debug_dma) {
record_dma_reset(0);
reset_drawing();
}
debug_dma = v1 < 0 ? -v1 : 1;
console_out_f (_T("DMA debugger enabled, mode=%d.\n"), debug_dma);
console_out_f(_T("DMA debugger enabled, mode=%d.\n"), debug_dma);
}
}
}

View File

@ -262,6 +262,7 @@ static int hblank_left_start, hblank_right_stop;
static int hblank_left_start_hard, hblank_right_stop_hard;
static bool extborder, exthblanken, exthblankon;
static int exthblank;
static bool exthblank_force;
static int exthblank_set;
static bool ehb_enable;
static bool syncdebug;
@ -595,7 +596,7 @@ int get_vertical_visible_height(bool useoldsize)
int vbstrt, vbstop;
if (programmedmode <= 1) {
h = maxvpos_display + maxvpos_display_vsync - minfirstline;
h = maxvsize_display;
if (useoldsize) {
// 288/576 or 243/486
if (h == 288 || h == 243) {
@ -1082,7 +1083,9 @@ static int sprite_playfield_start, sprite_end;
static int may_require_hard_way;
static int linetoscr_diw_start, linetoscr_diw_end;
static int native_ddf_left, native_ddf_right;
#if 0
static int hamleftborderhidden;
#endif
static int pixels_offset;
static int src_pixel;
@ -1110,7 +1113,7 @@ static xcolnr getbgc(int blank)
//return colors_for_drawing.acolors[0];
return xcolors[0xf0f];
#endif
if (exthblank > 0) {
if (exthblank > 0 || exthblank_force) {
return fullblack;
}
bool extblken = ce_is_extblankset(colors_for_drawing.extra);
@ -1160,7 +1163,6 @@ static void pfield_init_linetoscr (bool border)
/* First, get data fetch start/stop in DIW coordinates. */
int ddf_left = dp_for_drawing->plfleft + DIW_DDF_OFFSET - DDF_OFFSET;
int ddf_right = dp_for_drawing->plfright + DIW_DDF_OFFSET - DDF_OFFSET;
int leftborderhidden;
int native_ddf_left2;
bool expanded = false;
@ -1188,10 +1190,6 @@ static void pfield_init_linetoscr (bool border)
if (linetoscr_diw_start < 0) {
linetoscr_diw_start = 0;
}
// OCS Denise shows only background until hpos 95.
if (!ecs_denise && linetoscr_diw_start < shres_coord_hw_to_window_x(95 << 2)) {
linetoscr_diw_start = shres_coord_hw_to_window_x(95 << 2);
}
/* Perverse cases happen. */
if (linetoscr_diw_end < linetoscr_diw_start)
linetoscr_diw_end = linetoscr_diw_start;
@ -1364,13 +1362,15 @@ static void pfield_init_linetoscr (bool border)
ddf_left <<= bplres;
pixels_offset = MAX_PIXELS_PER_LINE - ddf_left;
leftborderhidden = playfield_start - native_ddf_left2;
hamleftborderhidden = 0;
int leftborderhidden = playfield_start - native_ddf_left2;
#if 0
hamleftborderhidden = 0;
if (hblank_left_start > playfield_start) {
leftborderhidden += hblank_left_start - playfield_start;
hamleftborderhidden = hblank_left_start - playfield_start;
}
#endif
src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window(leftborderhidden);
@ -1698,7 +1698,7 @@ static void fill_line2(int startpos, int len)
}
}
static void fill_line_border(int lineno)
static void fill_line_border(int lineno, int bordertype)
{
struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
int lastpos = visible_left_border;
@ -1712,7 +1712,7 @@ static void fill_line_border(int lineno)
int b = hposblank;
hposblank = 3;
fill_line2(lastpos, w);
if (syncdebug) {
if (syncdebug && bordertype >= 0) {
pfield_do_darken_line(lastpos, endpos, lineno);
}
if (need_genlock_data) {
@ -1726,7 +1726,7 @@ static void fill_line_border(int lineno)
if (hposblank) {
hposblank = 3;
fill_line2(lastpos, w);
if (syncdebug) {
if (syncdebug && bordertype >= 0) {
pfield_do_darken_line(lastpos, endpos, lineno);
}
if (need_genlock_data) {
@ -1769,7 +1769,7 @@ static uae_u8 render_sprites(int pos, int dualpf, uae_u8 apixel, int aga)
int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms;
int maskshift, plfmask;
if (exthblank) {
if (exthblank || exthblank_force) {
return 0;
}
if (extborder && (ce_is_borderblank(colors_for_drawing.extra) || !ce_is_bordersprite(colors_for_drawing.extra))) {
@ -1869,7 +1869,7 @@ static uae_u8 sh_render_sprites(int pos, int dualpf, uae_u8 apixel, int aga)
int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms;
int maskshift, plfmask;
if (exthblank) {
if (exthblank || exthblank_force) {
return 0;
}
if (extborder && ce_is_borderblank(colors_for_drawing.extra)) {
@ -2257,7 +2257,7 @@ static call_linetoscrb pfield_do_linetoscr_spriteonly;
static void pfield_do_linetoscr(int start, int stop, int blank)
{
int pixel = pfield_do_linetoscr_normal(src_pixel, start, stop);
if (exthblank) {
if (exthblank || exthblank_force) {
pfield_do_fill_line(start, stop, 1);
} else if (extborder) {
#if EXTBORDER_BLANK
@ -2279,10 +2279,10 @@ static void pfield_do_linetoscr_spr(int start, int stop, int blank)
bool bb = ce_is_borderblank(colors_for_drawing.extra);
#endif
pixel = pfield_do_linetoscr_sprite(src_pixel, start, stop);
pfield_do_fill_line(start, stop, bb || exthblank > 0);
pfield_do_fill_line(start, stop, bb || exthblank > 0 || exthblank_force);
} else {
pixel = pfield_do_linetoscr_sprite(src_pixel, start, stop);
if (exthblank) {
if (exthblank || exthblank_force) {
pfield_do_fill_line(start, stop, 1);
}
}
@ -2667,7 +2667,7 @@ static void pfield_set_linetoscr (void)
// A1000 Denise right border bug: sprites have 1 extra lores pixel visible
static void pfield_do_linetoscr_bordersprite_a1000(int start, int stop, int blank)
{
if (blank || exthblank > 0 || extborder) {
if (blank || exthblank > 0 || exthblank_force || extborder) {
pfield_do_fill_line(start, stop, blank);
return;
}
@ -2687,7 +2687,7 @@ static void pfield_do_linetoscr_bordersprite_a1000(int start, int stop, int blan
// left or right AGA border sprite
static void pfield_do_linetoscr_bordersprite_aga(int start, int stop, int blank)
{
if (blank || exthblank > 0 || extborder) {
if (blank || exthblank > 0 || exthblank_force || extborder) {
pfield_do_fill_line(start, stop, blank);
return;
}
@ -2772,7 +2772,10 @@ static void init_ham_decoding(void)
{
int unpainted_amiga = unpainted;
ham_decode_pixel = src_pixel - hamleftborderhidden;
ham_decode_pixel = src_pixel;
#if 0
ham_decode_pixel = -hamleftborderhidden;
#endif
ham_lastcolor = color_reg_get(&colors_for_drawing, 0);
while (unpainted_amiga-- > 0) {
decode_ham_pixel(ham_decode_pixel++);
@ -3146,6 +3149,7 @@ static void NOINLINE pfield_doline64_n8(uae_u64 *data, int count, uae_u8* real_b
static void pfield_doline(int lineno)
{
uae_u8 *real_bplpt[8];
int offset = 0; // currprefs.chipset_hr ? 8 : 0;
#if 0
int wordcount = (dp_for_drawing->plflinelen + 1) / 2;
@ -3181,7 +3185,7 @@ static void pfield_doline(int lineno)
int wordcount = dp_for_drawing->plflinelen;
uae_u32 *data = pixdata.apixels_l + MAX_PIXELS_PER_LINE / sizeof(uae_u32);
#define DATA_POINTER(n) ((debug_bpl_mask & (1 << n)) ? (line_data[lineno] + (n) * MAX_WORDS_PER_LINE * 2) : (debug_bpl_mask_one ? all_ones : all_zeros))
#define DATA_POINTER(n) ((debug_bpl_mask & (1 << n)) ? (line_data[lineno] + (n) * MAX_WORDS_PER_LINE * 2 + offset) : (debug_bpl_mask_one ? all_ones : all_zeros))
real_bplpt[0] = DATA_POINTER(0);
real_bplpt[1] = DATA_POINTER(1);
real_bplpt[2] = DATA_POINTER(2);
@ -3525,6 +3529,15 @@ static void pfield_expand_dp_bplconx (int regno, int v, int hp, int vp)
exthblank = 0;
}
return;
case 0x208: // forced hblank
if (v) {
exthblanken = true;
exthblankon = true;
} else {
exthblanken = false;
exthblank = 0;
}
return;
case 0x202: // hsync (debug)
hsync_debug = v;
return;
@ -3657,6 +3670,10 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker
if (nextpos_in_range > lastpos && lastpos < hblank_left) {
int t = nextpos_in_range <= hblank_left ? nextpos_in_range : hblank_left;
(*worker_border)(lastpos, t, 1);
// if playfield starts before hblank end: adjust back to playfield start
if (t > playfield_start) {
t = playfield_start;
}
lastpos = t;
}
@ -3684,6 +3701,10 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker
} else {
(*worker_pfield)(lastpos, t, 0);
}
// playfield started inside hblank? Overwrite it with blank.
if (playfield_start < hblank_left) {
(*worker_border)(playfield_start, hblank_left, 1);
}
lastpos = t;
}
@ -3756,10 +3777,18 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker
colors_for_drawing.acolors[regno] = getxcolor(value);
} else if (regno == 0 && (value & COLOR_CHANGE_MASK)) {
if ((value & COLOR_CHANGE_MASK) == COLOR_CHANGE_ACTBORDER) {
if (value & 1) {
extborder = true;
if (value & 2) {
if (value & 1) {
exthblank_force = true;
} else {
exthblank_force = false;
}
} else {
extborder = false;
if (value & 1) {
extborder = true;
} else {
extborder = false;
}
}
} else if (value & COLOR_CHANGE_BLANK) {
if (value & 1) {
@ -3992,18 +4021,18 @@ static void pfield_draw_line(struct vidbuffer *vb, int lineno, int gfx_ypos, int
// blanked border line
int tmp = hposblank;
hposblank = 1;
fill_line_border(lineno);
fill_line_border(lineno, border);
hposblank = tmp;
} else {
// normal border line
fill_line_border(lineno);
fill_line_border(lineno, border);
}
if (do_double) {
if (dh == dh_buf) {
xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_pixbytes;
xlinebuffer_genlock = row_map_genlock[follow_ypos] - linetoscr_x_adjust_pixels;
fill_line_border(lineno);
fill_line_border(lineno, border);
}
/* If dh == dh_line, do_flush_line will re-use the rendered line
* from linemem. */
@ -4047,7 +4076,7 @@ static void pfield_draw_line(struct vidbuffer *vb, int lineno, int gfx_ypos, int
// top or bottom blanking region
int tmp = hposblank;
hposblank = 1;
fill_line_border(lineno);
fill_line_border(lineno, border);
hposblank = tmp;
}
@ -5316,6 +5345,7 @@ void reset_drawing(void)
max_diwstop = 0;
vb_state = 0;
exthblank = 0;
exthblank_force = false;
exthblank_set = syncdebug ? -1 : 1;
exthblanken = false;
exthblankon = false;

View File

@ -360,7 +360,16 @@ void MISC_handler(void)
recursive--;
}
void event2_newevent_xx (int no, evt_t t, uae_u32 data, evfunc2 func)
void event2_newevent_xx_ce(evt_t t, uae_u32 data, evfunc2 func)
{
if (!currprefs.cpu_memory_cycle_exact) {
func(data);
return;
}
event2_newevent_xx(-1, t, data, func);
}
void event2_newevent_xx(int no, evt_t t, uae_u32 data, evfunc2 func)
{
evt_t et;
static int next = ev2_misc;

View File

@ -143,14 +143,15 @@ extern uae_u16 INTREQR(void);
#define VSYNC_ENDLINE_PAL 5
#define VSYNC_ENDLINE_NTSC 6
#define EQU_ENDLINE_PAL 8
#define EQU_ENDLINE_NTSC 10
#define EQU_ENDLINE_NTSC 9
#define OCS_DENISE_HBLANK_DISABLE_HPOS 0x2d
#define OCS_DENISE_HBLANK_DISABLE_HPOS 0x2e
extern int maxhpos, maxhposm0, maxhpos_short;
extern int maxvpos, maxvpos_nom, maxvpos_display, maxvpos_display_vsync, maxhpos_display;
extern int maxvsize_display;
extern int hsyncstartpos_hw, hsyncendpos_hw;
extern int minfirstline, vblank_endline, numscrlines;
extern int minfirstline, minfirstline_linear, vblank_endline, numscrlines;
extern float vblank_hz, fake_vblank_hz;
extern float hblank_hz;
extern int vblank_skip, doublescan;

View File

@ -226,6 +226,7 @@ extern struct peekdma peekdma_data;
struct dma_rec
{
int hpos, vpos;
int dhpos;
uae_u16 reg;
uae_u64 dat;
uae_u16 size;
@ -312,6 +313,7 @@ extern void record_dma_reoffset(int, int, int);
extern void record_cia_access(int r, int mask, uae_u16 value, bool rw, int hpos, int vpos, int phase);
extern void record_dma_ipl(int hpos, int vpos);
extern void record_dma_ipl_sample(int hpos, int vpos);
extern void record_dma_denise(int pos, int dhpos);
extern void debug_mark_refreshed(uaecptr);
extern void debug_draw(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors);

View File

@ -89,7 +89,7 @@ STATIC_INLINE int PIXEL_XPOS(int xx)
return x;
}
#define min_diwlastword (0)
#define min_diwlastword (PIXEL_XPOS(hsyncstartpos_start_cycles << CCK_SHRES_SHIFT))
#define max_diwlastword (PIXEL_XPOS(denisehtotal))
STATIC_INLINE int coord_window_to_hw_x(int x)

View File

@ -137,6 +137,7 @@ extern void event2_newevent_xx(int no, evt_t t, uae_u32 data, evfunc2 func);
extern void event2_newevent_x_replace(evt_t t, uae_u32 data, evfunc2 func);
extern void event2_newevent_x_replace_exists(evt_t t, uae_u32 data, evfunc2 func);
extern void event2_newevent_x_remove(evfunc2 func);
extern void event2_newevent_xx_ce(evt_t t, uae_u32 data, evfunc2 func);
STATIC_INLINE void event2_newevent_x(int no, evt_t t, uae_u32 data, evfunc2 func)
{