10#define I8086_SHOW_OPCODE_STATS 0
27 typedef void (*WritePort)(
void * context,
int address, uint8_t value);
28 typedef uint8_t (*ReadPort)(
void * context,
int address);
29 typedef void (*WriteVideoMemory8)(
void * context,
int address, uint8_t value);
30 typedef void (*WriteVideoMemory16)(
void * context,
int address, uint16_t value);
31 typedef uint8_t (*ReadVideoMemory8)(
void * context,
int address);
32 typedef uint16_t (*ReadVideoMemory16)(
void * context,
int address);
33 typedef bool (*Interrupt)(
void * context,
int num);
36 static void setCallbacks(
void * context, ReadPort readPort, WritePort writePort, WriteVideoMemory8 writeVideoMemory8, WriteVideoMemory16 writeVideoMemory16, ReadVideoMemory8 readVideoMemory8, ReadVideoMemory16 readVideoMemory16,Interrupt interrupt) {
38 s_readPort = readPort;
39 s_writePort = writePort;
40 s_writeVideoMemory8 = writeVideoMemory8;
41 s_writeVideoMemory16 = writeVideoMemory16;
42 s_readVideoMemory8 = readVideoMemory8;
43 s_readVideoMemory16 = readVideoMemory16;
44 s_interrupt = interrupt;
47 static void setMemory(uint8_t * memory) { s_memory = memory; }
51 static void setAL(uint8_t value);
52 static void setAH(uint8_t value);
53 static void setBL(uint8_t value);
54 static void setBH(uint8_t value);
55 static void setCL(uint8_t value);
56 static void setCH(uint8_t value);
57 static void setDL(uint8_t value);
58 static void setDH(uint8_t value);
69 static void setAX(uint16_t value);
70 static void setBX(uint16_t value);
71 static void setCX(uint16_t value);
72 static void setDX(uint16_t value);
73 static void setDI(uint16_t value);
74 static void setCS(uint16_t value);
75 static void setDS(uint16_t value);
76 static void setSS(uint16_t value);
77 static void setES(uint16_t value);
78 static void setIP(uint16_t value);
79 static void setSP(uint16_t value);
100 static bool flagDF();
101 static bool flagSF();
102 static bool flagAF();
103 static bool flagPF();
105 static void setFlagZF(
bool value);
106 static void setFlagCF(
bool value);
108 static uint16_t IP();
110 static bool halted() {
return s_halted; }
112 static bool IRQ(uint8_t interrupt_num);
119 static uint8_t WMEM8(
int addr, uint8_t value);
120 static uint16_t WMEM16(
int addr, uint16_t value);
121 static uint8_t RMEM8(
int addr);
122 static uint16_t RMEM16(
int addr);
124 static uint16_t make_flags();
125 static void set_flags(
int new_flags);
127 static void pc_interrupt(uint8_t interrupt_num);
129 static uint8_t raiseDivideByZeroInterrupt();
131 static void stepEx(uint8_t
const * opcode_stream);
134 static void * s_context;
135 static ReadPort s_readPort;
136 static WritePort s_writePort;
137 static WriteVideoMemory8 s_writeVideoMemory8;
138 static WriteVideoMemory16 s_writeVideoMemory16;
139 static ReadVideoMemory8 s_readVideoMemory8;
140 static ReadVideoMemory16 s_readVideoMemory16;
141 static Interrupt s_interrupt;
143 static bool s_pendingIRQ;
144 static uint8_t s_pendingIRQIndex;
145 static uint8_t * s_memory;
146 static bool s_halted;
This file is the all in one include file. Application can just include this file to use FabGL library...