forked from regarm/u8085
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal8085.h
150 lines (137 loc) · 3.21 KB
/
internal8085.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef INTERNAL8085_H
#define INTERNAL8085_H
#include <QObject>
#include <QMap>
#include <QBitArray>
#include "register.h"
class Internal8085 : public QObject
{
Q_OBJECT
public:
explicit Internal8085(QObject *parent = 0);
QMap<QString, int> byteCnt;
QMap<QString, int> instructionType;
void instructionTypeMapping();
void byteCntMapping();
Register cells[4096];
QMap<QString, int8_t> rIndexMap;
QMap<QString, int8_t> rpIndexMap;
QMap<QString, int8_t> rpsIndexMap;
QMap<QString, int8_t> rpwIndexMap;
QMap<int8_t, QString> revrIndexMap;
Register A, B, C, D, E, F, H, L, PC, SP;
Register temp;
Register *regs[9];
bool setValueAtCell(int, QString);
bool setValueAtCell(int, int);
QString getValueOfM(bool &);
bool getFlagC();
bool getFlagAC();
bool getFlagZ();
bool getFlagP();
bool getFlagS();
QString getValueAtCell(int, bool &);
//Instructions
bool ACI(QString);
bool ADC(int);
bool ADD(int, int carry = 0);
bool ADI(QString, int carry = 0);
bool ANA(int);
bool ANI(QString);
bool PUSH(int);
bool POP(int);
bool CALL(int);
bool CC(int);
bool CNC(int);
bool CP(int);
bool CM(int);
bool CPE(int);
bool CPO(int);
bool CZ(int);
bool CNZ(int);
bool CMA();
bool CMC();
bool CMP(int);
bool CPI(QString);
bool DAA();
bool DAD(int);
bool DCR(int);
bool DCX(int);
bool NOP();
bool SUB(int);
bool SBI(QString);
bool SBB(int);
bool INR(int);
bool INX(int);
bool JMP(int);
bool JC(int);
bool JNC(int);
bool JP(int);
bool JM(int);
bool JPE(int);
bool JPO(int);
bool JZ(int);
bool JNZ(int);
bool LDA(int);
bool LDAX(int);
bool STA(int);
bool STAX(int);
bool LHLD(int);
bool SHLD(int);
bool LXI(int, QString, QString);
bool MOV(int, int);
bool MVI(int, QString);
bool ORA(int);
bool ORI(QString);
bool PCHL();
bool STC();
bool RET();
bool RC();
bool RNC();
bool RP();
bool RM();
bool RPE();
bool RPO();
bool RZ();
bool RNZ();
bool RAR();
bool RAL();
bool RLC();
bool RRC();
bool SPHL();
bool XCHG();
bool XRA(int);
bool XRI(QString);
bool XTHL();
bool HLT();
int upAddressLimit;
int lowAddressLimit;
signals:
void accumulatorChanged();
void flagCChangedByProg(QString);
void flagACChangedByProg(QString);
void flagPChangedByProg(QString);
void flagZChangedByProg(QString);
void flagSChangedByProg(QString);
public slots:
void updateFlags();
void flagCChangedByUser(QString);
void flagPChangedByUser(QString);
void flagACChangedByUser(QString);
void flagZChangedByUser(QString);
void flagSChangedByUser(QString);
bool setValueofM(QString);
//Flag Manipulation
void setFlagC(bool);
void setFlagAC(bool);
void setFlagZ(bool);
void setFlagP(bool);
void setFlagS(bool);
void setFlagCFromOutside(QString);
void setFlagACFromOutside(QString);
void setFlagZFromOutside(QString);
void setFlagPFromOutside(QString);
void setFlagSFromOutside(QString);
void MCellChanged(QString);
};
#endif // INTERNAL8085_H