| 1 | // File: sim.hcxx . . $ `<file>/sim.h`/ |
| 2 | /* |
| 3 | Pep8-1 is a virtual machine for writing machine language and assembly |
| 4 | language programs. |
| 5 | |
| 6 | Copyright (C) 2009 J. Stanley Warford, Pepperdine University |
| 7 | |
| 8 | This program is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifndef SIM_H |
| 23 | #define SIM_Hcxx . . $ `sim.h:23:9`! |
| 24 | |
| 25 | #include <QVector> |
| 26 | #include "enu.h"cxx . . $ `<file>/enu.h`/ |
| 27 | |
| 28 | class Simcxx . . $ Sim# |
| 29 | { |
| 30 | public: |
| 31 | // The machine |
| 32 | static QVectorcxx . . $ QVector#<int> Memcxx . . $ Sim#Mem.; |
| 33 | static bool nBitcxx . . $ Sim#nBit., zBitcxx . . $ Sim#zBit., vBitcxx . . $ Sim#vBit., cBitcxx . . $ Sim#cBit.; |
| 34 | static int accumulatorcxx . . $ Sim#accumulator.; |
| 35 | static int indexRegistercxx . . $ Sim#indexRegister.; |
| 36 | static int stackPointercxx . . $ Sim#stackPointer.; |
| 37 | static int programCountercxx . . $ Sim#programCounter.; |
| 38 | static int instructionSpecifiercxx . . $ Sim#instructionSpecifier.; |
| 39 | static int operandSpecifiercxx . . $ Sim#operandSpecifier.; |
| 40 | static int operandcxx . . $ Sim#operand.; |
| 41 | static int operandDisplayFieldWidthcxx . . $ Sim#operandDisplayFieldWidth.; |
| 42 | |
| 43 | static QStringcxx . . $ QString# inputBuffercxx . . $ Sim#inputBuffer.; |
| 44 | static QStringcxx . . $ QString# outputBuffercxx . . $ Sim#outputBuffer.; |
| 45 | |
| 46 | static QSetcxx . . $ QSet#<int> modifiedBytescxx . . $ Sim#modifiedBytes.; |
| 47 | static bool trappedcxx . . $ Sim#trapped.; |
| 48 | static bool tracingTrapscxx . . $ Sim#tracingTraps.; |
| 49 | |
| 50 | static Enucxx . . $ Enu/::EExecStatecxx . . $ Enu/EExecState# executionStatecxx . . $ Sim#executionState.; |
| 51 | // State for keeping track of what actions are possible for user and machine |
| 52 | |
| 53 | static int toSignedDecimalcxx . . $ Sim#toSignedDecimal(7864480464b09eea).(int value); |
| 54 | // Pre: 0 <= value < 65536 |
| 55 | // Post: -32768 <= value < 32768 is returned |
| 56 | |
| 57 | static int fromSignedDecimalcxx . . $ Sim#fromSignedDecimal(7864480464b09eea).(int value); |
| 58 | // Pre: -32768 <= value < 32768 |
| 59 | // Post: 0 <= value < 65536 is returned |
| 60 | |
| 61 | static int nzvcToIntcxx . . $ Sim#nzvcToInt(b126dc7c1de90089).(); |
| 62 | // Post: NZVC is returned in postions <4..7> of the one-byte int |
| 63 | |
| 64 | static int addcxx . . $ Sim#add(9b79fb6aee4c0440).(int lhs, int rhs); |
| 65 | |
| 66 | static int addAndSetNZVCcxx . . $ Sim#addAndSetNZVC(9b79fb6aee4c0440).(int lhs, int rhs); |
| 67 | |
| 68 | static void loadMemcxx . . $ Sim#loadMem(4bb6f0c1dbf41c14).(QListcxx . . $ QList#<int> objectCodeList); |
| 69 | |
| 70 | static int readBytecxx . . $ Sim#readByte(7864480464b09eea).(int memAddr); |
| 71 | static int readWordcxx . . $ Sim#readWord(7864480464b09eea).(int memAddr); |
| 72 | static int readByteOprndcxx . . $ Sim#readByteOprnd(c5ddf319c3a3813a).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addrMode); |
| 73 | static int readWordOprndcxx . . $ Sim#readWordOprnd(c5ddf319c3a3813a).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addrMode); |
| 74 | |
| 75 | static void writeBytecxx . . $ Sim#writeByte(3e454b8ccf442868).(int memAddr, int value); |
| 76 | // Pre: 0 <= value < 256 |
| 77 | // Post: Value is stored in Mem[memAddr] |
| 78 | |
| 79 | static void writeWordcxx . . $ Sim#writeWord(3e454b8ccf442868).(int memAddr, int value); |
| 80 | // Pre: 0 <= value < 65536 |
| 81 | // Post: The high-end byte of value is stored in Mem[memAddr] |
| 82 | // and the low-end byte of value is stored in Mem[memAddr + 1] |
| 83 | |
| 84 | static void writeByteOprndcxx . . $ Sim#writeByteOprnd(78ad6eda2c6ff999).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addrMode, int value); |
| 85 | static void writeWordOprndcxx . . $ Sim#writeWordOprnd(78ad6eda2c6ff999).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addrMode, int value); |
| 86 | |
| 87 | static int cellSizecxx . . $ Sim#cellSize(10342dda07a560ad).(Enucxx . . $ Enu/::ESymbolFormatcxx . . $ Enu/ESymbolFormat# symbolFormat); |
| 88 | // This is used exclusively in the memoryTracePane/memoryCellGraphicsItem |
| 89 | // I still disagree with where this is. It should be in the MemoryCellGraphicsItem |
| 90 | // because that is what it is used for. |
| 91 | |
| 92 | static bool vonNeumannStepcxx . . $ Sim#vonNeumannStep(60608c8c3b163578).(QStringcxx . . $ QString# &errorString); |
| 93 | |
| 94 | }; |
| 95 | |
| 96 | #endif // SIM_H |