forked from tingox/nd100em
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrace.h
77 lines (65 loc) · 1.99 KB
/
trace.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* nd100em - ND100 Virtual Machine
*
* Copyright (c) 2006-2008 Roger Abrahamsson
*
* This file is originated from the nd100em project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the nd100em
* distribution in the file COPYING); if not, see <http://www.gnu.org/licenses/>.
*/
char tracename[]="tracefile.log";
char tracetype[]="a";
FILE *tracefile;
int trace;
char trace2name[]="trace2file.log";
char trace2type[]="a";
FILE *trace2file;
char disasm_fname[]="nd100em.disasm.log";
char disasm_ftype[]="a";
FILE *disasm_file;
int DISASM;
int disasm_ctr;
struct disasm_entry {
bool isdata;
bool iscode;
int labelno;
bool use_rel;
int rel_acc_lbl;
char asm_str[32];
bool isexr;
char exr[32];
ushort theword;
};
struct disasm_entry *disasm_arr[65536];
struct disasm_entry *(*p_DIS)[] = &disasm_arr;
volatile int ts_counter = 0;
volatile int ts_step = 0;
#define MAXTSARR 32
#define MAXTSSTR 256
char ts_block[MAXTSARR][MAXTSSTR];
extern char *regn[];
extern double instr_counter;
extern struct CpuRegs *gReg;
extern void OpToStr(char *opstr, ushort operand);
extern ushort extract_opcode(ushort instr);
void trace_instr(ushort instr);
void disasm_addword(ushort addr, ushort myword);
void disasm_init();
void disasm_dump();
void disasm_instr(ushort addr, ushort instr);
void disasm_exr(ushort addr, ushort instr);
void disasm_setlbl(ushort addr);
void disasm_userel(ushort addr, ushort where);
void disasm_set_isdata(ushort addr);