GE-115 Emulator
An Emulator of the General Electrics GE-115 computer
disasm.h
Go to the documentation of this file.
1#ifndef DISASM_H
2#define DISASM_H
3
4#include <stdint.h>
5#include <stddef.h>
6
7/*
8 * Lightweight live disassembler for the console / debug views.
9 *
10 * Decodes straight out of a flat 64K memory image (no symbol table). All opcode
11 * bytes come from opcodes.h, so this stays in lock-step with gasm/gdis without a
12 * second opcode table to keep in sync. Address operands are printed as raw hex
13 * (or disp(N) for a modified field, bit-15 set) since there are no labels.
14 */
15
16/* Disassemble one instruction at mem[addr]. Writes the assembly text
17 * ("MNEM operands", or "DB 0xNN" for unknown/garbled) into out. Returns the
18 * instruction length in bytes (>= 1). */
19int ge_disasm_one(const uint8_t *mem, uint16_t addr, char *out, size_t outn);
20
21/* Build a gdb-style window into `out`: `before` instructions, the instruction
22 * at `pc`, then `after` instructions, one line each:
23 * "<marker><AAAA>: <hex bytes> <asm>\n"
24 * marker is '>' on the pc line and ' ' otherwise. A forward-resync heuristic
25 * aligns the preceding lines. Returns the 0-based line index of the pc line. */
26int ge_disasm_window(const uint8_t *mem, uint16_t pc,
27 int before, int after, char *out, size_t outn);
28
29#endif /* DISASM_H */
int ge_disasm_window(const uint8_t *mem, uint16_t pc, int before, int after, char *out, size_t outn)
Definition disasm.c:178
int ge_disasm_one(const uint8_t *mem, uint16_t addr, char *out, size_t outn)
Definition disasm.c:87