| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,116 @@ |
| 1 |
+/* |
|
| 2 |
+ * Author: Pawel Jablonski |
|
| 3 |
+ * E-mail: pj@xirx.net |
|
| 4 |
+ * WWW: xirx.net |
|
| 5 |
+ * GIT: git.xirx.net |
|
| 6 |
+ * |
|
| 7 |
+ * License: You can use this code however you like |
|
| 8 |
+ * but leave information about the original author. |
|
| 9 |
+ * Code is free for non-commercial and commercial use. |
|
| 10 |
+ */ |
|
| 11 |
+ |
|
| 12 |
+#ifndef EMU_H |
|
| 13 |
+#define EMU_H |
|
| 14 |
+ |
|
| 15 |
+#include <QMainWindow> |
|
| 16 |
+#include <QFileDialog> |
|
| 17 |
+#include <QFile> |
|
| 18 |
+#include <QMessageBox> |
|
| 19 |
+#include <QMouseEvent> |
|
| 20 |
+#include <QKeyEvent> |
|
| 21 |
+#include <QScrollBar> |
|
| 22 |
+ |
|
| 23 |
+#include "cpu.h" |
|
| 24 |
+#include "io.h" |
|
| 25 |
+ |
|
| 26 |
+//! User Interface namespace |
|
| 27 |
+namespace Ui |
|
| 28 |
+{
|
|
| 29 |
+ class Emu; //!< Form class for the emulator window |
|
| 30 |
+} |
|
| 31 |
+ |
|
| 32 |
+class Emu : public QMainWindow |
|
| 33 |
+{
|
|
| 34 |
+ Q_OBJECT |
|
| 35 |
+ |
|
| 36 |
+ public: |
|
| 37 |
+ Emu(QWidget *parent = nullptr); |
|
| 38 |
+ ~Emu() override; |
|
| 39 |
+ |
|
| 40 |
+ Emu(const Emu &) = delete; |
|
| 41 |
+ Emu &operator=(const Emu &) = delete; |
|
| 42 |
+ Emu(Emu &&) = delete; |
|
| 43 |
+ Emu &operator=(Emu &&) = delete; |
|
| 44 |
+ |
|
| 45 |
+ private: |
|
| 46 |
+ void reset(); |
|
| 47 |
+ void update(); |
|
| 48 |
+ |
|
| 49 |
+ bool loadMemoryFile(const QString &path, CPU::Memory &memory); |
|
| 50 |
+ |
|
| 51 |
+ void romSetPage(int page); |
|
| 52 |
+ void ramSetPage(int page); |
|
| 53 |
+ |
|
| 54 |
+ void mousePressEvent(QMouseEvent *event) override; |
|
| 55 |
+ bool focusNextPrevChild(bool next) override; |
|
| 56 |
+ |
|
| 57 |
+ void keyPressEvent(QKeyEvent *event) override; |
|
| 58 |
+ |
|
| 59 |
+ Ui::Emu *ui; //!< Form for the emulator window |
|
| 60 |
+ |
|
| 61 |
+ bool loaded; //!< Status of loading all necessary files for emulation |
|
| 62 |
+ bool started; //!< Status of started the emulation process. It is "1" when the start button was clicked. |
|
| 63 |
+ bool running; //!< Status of running the emulation process. It is "1" when the emulation is active executing. |
|
| 64 |
+ |
|
| 65 |
+ CPU cpu; //!< CPU instance for emulating the processor |
|
| 66 |
+ IO io; //!< IO instance for emulating the motherboard |
|
| 67 |
+ |
|
| 68 |
+ int romPage; //!< Number of the ROM page to show |
|
| 69 |
+ int ramPage; //!< Number of the RAM page to show |
|
| 70 |
+ |
|
| 71 |
+ private slots: |
|
| 72 |
+ void updateSlot(); |
|
| 73 |
+ |
|
| 74 |
+ void updateLEDRunSlot(bool enable); |
|
| 75 |
+ void updateLEDErrorSlot(bool enable); |
|
| 76 |
+ |
|
| 77 |
+ void updateRS232TxSlot(unsigned char c); |
|
| 78 |
+ void updateRS232RxSlot(unsigned char c); |
|
| 79 |
+ |
|
| 80 |
+ void updateRTCDateTimeSlot(const QDateTime &dateTime); |
|
| 81 |
+ |
|
| 82 |
+ void updateSpeakerStatusSlot(int bufferUsed); |
|
| 83 |
+ |
|
| 84 |
+ void on_fileUrom0OpenButton_clicked(); |
|
| 85 |
+ void on_fileUrom1OpenButton_clicked(); |
|
| 86 |
+ void on_fileRomOpenButton_clicked(); |
|
| 87 |
+ void on_fileFSDirOpenButton_clicked(); |
|
| 88 |
+ |
|
| 89 |
+ void on_fileUrom0ReloadButton_clicked(); |
|
| 90 |
+ void on_fileUrom1ReloadButton_clicked(); |
|
| 91 |
+ void on_fileRomReloadButton_clicked(); |
|
| 92 |
+ |
|
| 93 |
+ void on_emuControlRunButton_clicked(); |
|
| 94 |
+ void on_emuControlStepButton_clicked(); |
|
| 95 |
+ void on_emuControlPauseButton_clicked(); |
|
| 96 |
+ void on_emuControlStopButton_clicked(); |
|
| 97 |
+ |
|
| 98 |
+ void on_speakerVolumeSlider_valueChanged(int value); |
|
| 99 |
+ |
|
| 100 |
+ void on_rtcSetCurrentButton_clicked(); |
|
| 101 |
+ |
|
| 102 |
+ void on_romGoToOSButton_clicked(); |
|
| 103 |
+ void on_romGoToAppButton_clicked(); |
|
| 104 |
+ void on_romMinusButton_clicked(); |
|
| 105 |
+ void on_romPlusButton_clicked(); |
|
| 106 |
+ |
|
| 107 |
+ void on_ramGoToOSButton_clicked(); |
|
| 108 |
+ void on_ramGoToSPButton_clicked(); |
|
| 109 |
+ void on_ramGoToAppButton_clicked(); |
|
| 110 |
+ void on_ramMinusButton_clicked(); |
|
| 111 |
+ void on_ramPlusButton_clicked(); |
|
| 112 |
+ |
|
| 113 |
+ void on_rs232RxSendButton_clicked(); |
|
| 114 |
+}; |
|
| 115 |
+ |
|
| 116 |
+#endif |