annotate disasm.h @ 2208:3809a0bd680e

Fix a couple of Z80 debugger issues
author Michael Pavone <pavone@retrodev.com>
date Sat, 27 Aug 2022 22:02:09 -0700
parents 4c265d2f6c88
children 53411df7fc71
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2206
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef DISASM_H_
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define DISASM_H_
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include <stdint.h>
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #include "tern.h"
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "backend.h"
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 typedef struct {
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 char **labels;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 uint32_t num_labels;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 uint32_t storage;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 uint32_t full_address;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 uint8_t referenced;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 } label_def;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 typedef struct {
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 tern_node *labels;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 uint8_t *visited;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 deferred_addr *deferred;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 uint32_t address_mask;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 uint32_t invalid_inst_addr_mask;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 uint32_t visit_preshift;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 } disasm_context;
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 label_def *find_label(disasm_context *context, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 void weak_label(disasm_context *context, const char *name, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 void reference(disasm_context *context, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 void add_label(disasm_context *context, const char *name, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 void visit(disasm_context *context, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 uint8_t is_visited(disasm_context *context, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 void defer_disasm(disasm_context *context, uint32_t address);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 void process_m68k_vectors(disasm_context *context, uint16_t *table, uint8_t labels_only);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 void add_segacd_maincpu_labels(disasm_context *context);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 void add_segacd_subcpu_labels(disasm_context *context);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 disasm_context *create_68000_disasm(void);
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36
4c265d2f6c88 Minor refactor of 68K disassembler
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 #endif //DISASM_H_