[hatari-devel] [PATCH] Add some NVDI function names

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

 

The attached patch adds some vdi function names used by NVDI/SpeedoGDOS, for use by the trace feature.

 

It might also be useful to be able to disable certain calls when tracing. Eg. the builtin AES in all TOS versions (including EmuTOS) regularly calls vrq_string (opcode 31), vsin_mode (opcode 33) and vq_key_s (opcode 128). These are usually of not much interest, and just fill up the trace file quickly.

 

I did not change the "vdi info" command to print the names there, too. Dunno whether that is useful, it would need a bit of work (only subcode 0 is printed there), and would just print a lot of more names.

diff --git a/src/vdi.c b/src/vdi.c
index 216a62d0..e719a54e 100644
--- a/src/vdi.c
+++ b/src/vdi.c
@@ -436,6 +436,8 @@ void AES_Info(FILE *fp, Uint32 bShowOpcodes)
  */
 static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 {
+	unsigned int i;
+
 	static const char* names_0[] = {
 		"???",
 		"v_opnwk",
@@ -510,9 +512,16 @@ static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 		"vq_key_s",
 		"vs_clip",
 		"vqt_name",
-		"vqt_fontinfo"
-		/* 131-233: no known opcodes
-		 * 234-255: (Speedo) GDOS opcodes
+		"vqt_fontinfo",
+		"vqt_justified",
+		"vs_grayoverride",
+		"v_pat_rotate", /* GEM/3 */
+		"???", /* 135 */
+		"???", /* 136 */
+		"???", /* 137 */
+		"v_setrgb", /* NVDI 5.00 */
+		/* 139-169: no known opcodes
+		 * 170-255: NVDI/Speedo GDOS opcodes
 		 */
 	};
 	static const char* names_opcode5[] = {
@@ -547,7 +556,7 @@ static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 		"v_meta_extents",
 		"v_write_meta",
 		"vm_filename",
-		"???",
+		"v_offset",
 		"v_fontinit"
 	};
 	static const char* names_opcode11[] = {
@@ -563,6 +572,117 @@ static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 		"v_rfbox",
 		"v_justified"
 	};
+	static struct {
+		unsigned short opcode;
+		unsigned short subcode;
+		const char *name;
+	} const names_other[] = {
+		{ 170, 0, "vr_transfer_bits" },
+		{ 171, 0, "vr_clip_rects_by_dst" }, /* NVDI 5.02 */
+		{ 171, 1, "vr_clip_rects_by_src" }, /* NVDI 5.02 */
+		{ 171, 2, "vr_clip_rects32_by_dst" }, /* NVDI 5.02 */
+		{ 171, 3, "vr_clip_rects32_by_src" }, /* NVDI 5.02 */
+		{ 180, 0, "v_create_driver_info" }, /* NVDI 5.00 */
+		{ 181, 0, "v_delete_driver_info" }, /* NVDI 5.00 */
+		{ 182, 0, "v_read_default_settings" }, /* NVDI 5.00 */
+		{ 182, 1, "v_write_default_settings" }, /* NVDI 5.00 */
+		{ 190, 0, "vqt_char_index" }, /* NVDI 4.00 */
+		{ 200, 0, "vst_fg_color" }, /* NVDI 5.00 */
+		{ 200, 1, "vsf_fg_color" }, /* NVDI 5.00 */
+		{ 200, 2, "vsl_fg_color" }, /* NVDI 5.00 */
+		{ 200, 3, "vsm_fg_color" }, /* NVDI 5.00 */
+		{ 200, 4, "vsr_fg_color" }, /* NVDI 5.00 */
+		{ 201, 0, "vst_bg_color" }, /* NVDI 5.00 */
+		{ 201, 1, "vsf_bg_color" }, /* NVDI 5.00 */
+		{ 201, 2, "vsl_bg_color" }, /* NVDI 5.00 */
+		{ 201, 3, "vsm_bg_color" }, /* NVDI 5.00 */
+		{ 201, 4, "vsr_bg_color" }, /* NVDI 5.00 */
+		{ 202, 0, "vqt_fg_color" }, /* NVDI 5.00 */
+		{ 202, 1, "vqf_fg_color" }, /* NVDI 5.00 */
+		{ 202, 2, "vql_fg_color" }, /* NVDI 5.00 */
+		{ 202, 3, "vqm_fg_color" }, /* NVDI 5.00 */
+		{ 202, 4, "vqr_fg_color" }, /* NVDI 5.00 */
+		{ 203, 0, "vqt_bg_color" }, /* NVDI 5.00 */
+		{ 203, 1, "vqf_bg_color" }, /* NVDI 5.00 */
+		{ 203, 2, "vql_bg_color" }, /* NVDI 5.00 */
+		{ 203, 3, "vqm_bg_color" }, /* NVDI 5.00 */
+		{ 203, 4, "vqr_bg_color" }, /* NVDI 5.00 */
+		{ 204, 0, "v_color2value" }, /* NVDI 5.00 */
+		{ 204, 1, "v_value2color" }, /* NVDI 5.00 */
+		{ 204, 2, "v_color2nearest" }, /* NVDI 5.00 */
+		{ 204, 3, "vq_px_format" }, /* NVDI 5.00 */
+		{ 205, 0, "vs_ctab" }, /* NVDI 5.00 */
+		{ 205, 1, "vs_ctab_entry" }, /* NVDI 5.00 */
+		{ 205, 2, "vs_dflt_ctab" }, /* NVDI 5.00 */
+		{ 206, 0, "vq_ctab" }, /* NVDI 5.00 */
+		{ 206, 1, "vq_ctab_entry" }, /* NVDI 5.00 */
+		{ 206, 2, "vq_ctab_id" }, /* NVDI 5.00 */
+		{ 206, 3, "v_ctab_idx2vdi" }, /* NVDI 5.00 */
+		{ 206, 4, "v_ctab_vdi2idx" }, /* NVDI 5.00 */
+		{ 206, 5, "v_ctab_idx2value" }, /* NVDI 5.00 */
+		{ 206, 6, "v_get_ctab_id" }, /* NVDI 5.00 */
+		{ 206, 7, "vq_dflt_ctab" }, /* NVDI 5.00 */
+		{ 206, 8, "v_create_ctab" }, /* NVDI 5.00 */
+		{ 206, 9, "v_delete_ctab" }, /* NVDI 5.00 */
+		{ 207, 0, "vs_hilite_color" }, /* NVDI 5.00 */
+		{ 207, 1, "vs_min_color" }, /* NVDI 5.00 */
+		{ 207, 2, "vs_max_color" }, /* NVDI 5.00 */
+		{ 207, 3, "vs_weight_color" }, /* NVDI 5.00 */
+		{ 208, 0, "v_create_itab" }, /* NVDI 5.00 */
+		{ 208, 1, "v_delete_itab" }, /* NVDI 5.00 */
+		{ 209, 0, "vq_hilite_color" }, /* NVDI 5.00 */
+		{ 209, 1, "vq_min_color" }, /* NVDI 5.00 */
+		{ 209, 2, "vq_max_color" }, /* NVDI 5.00 */
+		{ 209, 3, "vq_weight_color" }, /* NVDI 5.00 */
+		{ 224, 100, "vs_backmap" }, /* SpeedoGDOS 5.1 */
+		{ 224, 101, "vs_outmode" }, /* SpeedoGDOS 5.1 */
+		{ 224, 105, "vs_use_fonts" }, /* SpeedoGDOS 5.1 */
+		{ 225, 0, "vqt_drv_avail" }, /* SpeedoGDOS 5.1 */
+		{ 226, 1, "v_set_cachedir" }, /* SpeedoGDOS 5.1 */
+		{ 226, 2, "v_get_cachedir" }, /* SpeedoGDOS 5.1 */
+		{ 226, 3, "v_def_cachedir" }, /* SpeedoGDOS 5.1 */
+		{ 226, 4, "v_clr_cachedir" }, /* SpeedoGDOS 5.1 */
+		{ 226, 5, "v_delete_cache" }, /* SpeedoGDOS 5.1 */
+		{ 226, 6, "v_save_cache" }, /* SpeedoGDOS 5.1 */
+		{ 229, 0, "vqt_xfntinfo" }, /* NVDI 3.02 */
+		{ 230, 0, "vst_name" }, /* NVDI 3.02 */
+		{ 230, 100, "vqt_name_and_id" }, /* NVDI 3.02 */
+		{ 231, 0, "vst_width" }, /* NVDI 3.00 */
+		{ 232, 0, "vqt_fontheader" }, /* NVDI 3.00 */
+		{ 233, 0, "v_mono_ftext" }, /* SpeedoGDOS 5.1 */
+		{ 234, 0, "vqt_trackkern" }, /* NVDI 3.00 */
+		{ 235, 0, "vqt_pairkern" }, /* NVDI 3.00 */
+		{ 236, 0, "vst_charmap" }, /* NVDI 3.00 */
+		{ 236, 0, "vst_map_mode" }, /* NVDI 4.00 */
+		{ 237, 0, "vst_kern" }, /* NVDI 3.00 */
+		{ 237, 0, "vst_track_offset" }, /* NVDI 3.00 */
+		{ 238, 0, "vq_ptsinsz" },
+		{ 239, 0, "v_getbitmap_info" }, /* NVDI 3.00 */
+		{ 240, 0, "vqt_f_extent" }, /* NVDI 3.00 */
+		{ 240, 4200, "vqt_real_extent" }, /* NVDI 3.00 */
+		{ 241, 0, "v_ftext" }, /* NVDI 3.00 */
+		{ 242, 0, "v_killoutline" }, /* FSM */
+		{ 243, 0, "v_getoutline" }, /* NVDI 3.00 */
+		{ 243, 1, "v_get_outline" }, /* NVDI 5.00 */
+		{ 243, 31, "v_fgetoutline" }, /* SpeedoGDOS 5.0d */
+		{ 244, 0, "vst_scratch" },
+		{ 245, 0, "vst_error" }, /* SpeedoGDOS 4.00 */
+		{ 246, 0, "vst_arbpt" }, /* SpeedoGDOS 4.00 */
+		{ 246, 0, "vst_arbpt32" }, /* NVDI 3.00 */
+		{ 247, 0, "vqt_advance" }, /* SpeedoGDOS 4.00 */
+		{ 247, 0, "vqt_advance32" }, /* NVDI 3.00 */
+		{ 248, 0, "vq_devinfo" }, /* NVDI 3.00 */
+		{ 248, 0, "vqt_devinfo" }, /* SpeedoGDOS 4.00 */
+		{ 248, 4242, "vq_ext_devinfo" }, /* NVDI 3.00 */
+		{ 249, 0, "v_savecache" },
+		{ 250, 0, "v_loadcache" },
+		{ 251, 0, "v_flushcache" }, /* NVDI */
+		{ 252, 0, "vst_setsize32" }, /* NVDI 3.00 */
+		{ 252, 0, "vst_setsize" }, /* SpeedoGDOS 4.00 */
+		{ 253, 0, "vst_skew" }, /* NVDI 3.00 */
+		{ 254, 0, "vqt_get_table" }, /* SpeedoGDOS 4.00 */
+		{ 255, 0, "vqt_cachesize" }, /* SpeedoGDOS 4.00 */
+	};
 
 	if (opcode == 5)
 	{
@@ -570,9 +690,9 @@ static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 			return names_opcode5[subcode];
 		}
 		if (subcode >= 98) {
-			subcode -= 98;
-			if (subcode < ARRAY_SIZE(names_opcode5_98)) {
-				return names_opcode5_98[subcode];
+			Uint16 idx = subcode - 98;
+			if (idx < ARRAY_SIZE(names_opcode5_98)) {
+				return names_opcode5_98[idx];
 			}
 		}
 	}
@@ -588,12 +708,15 @@ static const char* VDI_Opcode2Name(Uint16 opcode, Uint16 subcode)
 	}
 	else if (opcode >= 100)
 	{
-		opcode -= 100;
-		if (opcode < ARRAY_SIZE(names_100))
+		Uint16 idx = opcode - 100;
+		if (idx < ARRAY_SIZE(names_100))
 		{
-			return names_100[opcode];
+			return names_100[idx];
 		}
 	}
+	for (i = 0; i < ARRAY_SIZE(names_other); i++)
+		if (names_other[i].opcode == opcode && names_other[i].subcode == subcode)
+			return names_other[i].name;
 	return "GDOS?";
 }
 
@@ -741,6 +864,9 @@ bool VDI_AES_Entry(void)
 #if ENABLE_TRACING
 		{
 		Uint16 subcode = STMemory_ReadWord(VDIControl+2*5);
+		if (VDIOpCode != 33 && /* vsin_mode */
+			VDIOpCode != 31 && /* vrq_string */
+			VDIOpCode != 128) /* vq_key_s */
 		LOG_TRACE(TRACE_OS_VDI, "VDI call %3hd/%3hd (%s)\n",
 			  VDIOpCode, subcode,
 			  VDI_Opcode2Name(VDIOpCode, subcode));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/