| 1 | // File: pep.hcxx . . $ `<file>/pep.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 PEP_H |
| 23 | #define PEP_Hcxx . . $ `pep.h:23:9`! |
| 24 | |
| 25 | #include <QMap> |
| 26 | #include <QSet> |
| 27 | #include <QString> |
| 28 | #include <QStringList> |
| 29 | #include <QVector> |
| 30 | #include <QColor> |
| 31 | |
| 32 | #include "enu.h"cxx . . $ `<file>/enu.h`/ |
| 33 | |
| 34 | class Pepcxx . . $ Pep# |
| 35 | { |
| 36 | public: |
| 37 | // Fonts: |
| 38 | static const QStringcxx . . $ QString# codeFontcxx . . $ Pep#codeFont.; |
| 39 | static const int codeFontSizecxx . . $ Pep#codeFontSize.; |
| 40 | static const int ioFontSizecxx . . $ Pep#ioFontSize.; |
| 41 | static const QStringcxx . . $ QString# labelFontcxx . . $ Pep#labelFont.; |
| 42 | static const int labelFontSizecxx . . $ Pep#labelFontSize.; |
| 43 | |
| 44 | // Default redefine mnemonics |
| 45 | static const QStringcxx . . $ QString# defaultUnaryMnemonic0cxx . . $ Pep#defaultUnaryMnemonic0.; |
| 46 | static const QStringcxx . . $ QString# defaultUnaryMnemonic1cxx . . $ Pep#defaultUnaryMnemonic1.; |
| 47 | static const QStringcxx . . $ QString# defaultUnaryMnemonic2cxx . . $ Pep#defaultUnaryMnemonic2.; |
| 48 | static const QStringcxx . . $ QString# defaultUnaryMnemonic3cxx . . $ Pep#defaultUnaryMnemonic3.; |
| 49 | static const QStringcxx . . $ QString# defaultNonUnaryMnemonic0cxx . . $ Pep#defaultNonUnaryMnemonic0.; |
| 50 | static const bool defaultMnemon0icxx . . $ Pep#defaultMnemon0i.; |
| 51 | static const bool defaultMnemon0dcxx . . $ Pep#defaultMnemon0d.; |
| 52 | static const bool defaultMnemon0ncxx . . $ Pep#defaultMnemon0n.; |
| 53 | static const bool defaultMnemon0scxx . . $ Pep#defaultMnemon0s.; |
| 54 | static const bool defaultMnemon0sfcxx . . $ Pep#defaultMnemon0sf.; |
| 55 | static const bool defaultMnemon0xcxx . . $ Pep#defaultMnemon0x.; |
| 56 | static const bool defaultMnemon0sxcxx . . $ Pep#defaultMnemon0sx.; |
| 57 | static const bool defaultMnemon0sxfcxx . . $ Pep#defaultMnemon0sxf.; |
| 58 | static const QStringcxx . . $ QString# defaultNonUnaryMnemonic1cxx . . $ Pep#defaultNonUnaryMnemonic1.; |
| 59 | static const bool defaultMnemon1icxx . . $ Pep#defaultMnemon1i.; |
| 60 | static const bool defaultMnemon1dcxx . . $ Pep#defaultMnemon1d.; |
| 61 | static const bool defaultMnemon1ncxx . . $ Pep#defaultMnemon1n.; |
| 62 | static const bool defaultMnemon1scxx . . $ Pep#defaultMnemon1s.; |
| 63 | static const bool defaultMnemon1sfcxx . . $ Pep#defaultMnemon1sf.; |
| 64 | static const bool defaultMnemon1xcxx . . $ Pep#defaultMnemon1x.; |
| 65 | static const bool defaultMnemon1sxcxx . . $ Pep#defaultMnemon1sx.; |
| 66 | static const bool defaultMnemon1sxfcxx . . $ Pep#defaultMnemon1sxf.; |
| 67 | static const QStringcxx . . $ QString# defaultNonUnaryMnemonic2cxx . . $ Pep#defaultNonUnaryMnemonic2.; |
| 68 | static const bool defaultMnemon2icxx . . $ Pep#defaultMnemon2i.; |
| 69 | static const bool defaultMnemon2dcxx . . $ Pep#defaultMnemon2d.; |
| 70 | static const bool defaultMnemon2ncxx . . $ Pep#defaultMnemon2n.; |
| 71 | static const bool defaultMnemon2scxx . . $ Pep#defaultMnemon2s.; |
| 72 | static const bool defaultMnemon2sfcxx . . $ Pep#defaultMnemon2sf.; |
| 73 | static const bool defaultMnemon2xcxx . . $ Pep#defaultMnemon2x.; |
| 74 | static const bool defaultMnemon2sxcxx . . $ Pep#defaultMnemon2sx.; |
| 75 | static const bool defaultMnemon2sxfcxx . . $ Pep#defaultMnemon2sxf.; |
| 76 | static const QStringcxx . . $ QString# defaultNonUnaryMnemonic3cxx . . $ Pep#defaultNonUnaryMnemonic3.; |
| 77 | static const bool defaultMnemon3icxx . . $ Pep#defaultMnemon3i.; |
| 78 | static const bool defaultMnemon3dcxx . . $ Pep#defaultMnemon3d.; |
| 79 | static const bool defaultMnemon3ncxx . . $ Pep#defaultMnemon3n.; |
| 80 | static const bool defaultMnemon3scxx . . $ Pep#defaultMnemon3s.; |
| 81 | static const bool defaultMnemon3sfcxx . . $ Pep#defaultMnemon3sf.; |
| 82 | static const bool defaultMnemon3xcxx . . $ Pep#defaultMnemon3x.; |
| 83 | static const bool defaultMnemon3sxcxx . . $ Pep#defaultMnemon3sx.; |
| 84 | static const bool defaultMnemon3sxfcxx . . $ Pep#defaultMnemon3sxf.; |
| 85 | |
| 86 | // Functions for computing instruction specifiers |
| 87 | static int aaaAddressFieldcxx . . $ Pep#aaaAddressField(c5ddf319c3a3813a).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addressMode); |
| 88 | static int aAddressFieldcxx . . $ Pep#aAddressField(c5ddf319c3a3813a).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addressMode); |
| 89 | static QStringcxx . . $ QString# intToAddrModecxx . . $ Pep#intToAddrMode(1af896ebbf656e87).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addressMode); |
| 90 | static QStringcxx . . $ QString# commaSpaceToAddrModecxx . . $ Pep#commaSpaceToAddrMode(1af896ebbf656e87).(Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# addressMode); |
| 91 | |
| 92 | // Function to read text from a resource file |
| 93 | static QStringcxx . . $ QString# resToStringcxx . . $ Pep#resToString(f7f320d754b8fd09).(QStringcxx . . $ QString# fileName); |
| 94 | // Function for getting the system we're running on |
| 95 | static QStringcxx . . $ QString# getSystemcxx . . $ Pep#getSystem(4365c3963150523e).(); |
| 96 | |
| 97 | // Maps between mnemonic enums and strings |
| 98 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, QStringcxx . . $ QString#> enumToMnemonMapcxx . . $ Pep#enumToMnemonMap.; |
| 99 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#> mnemonToEnumMapcxx . . $ Pep#mnemonToEnumMap.; |
| 100 | static void initEnumMnemonMapscxx . . $ Pep#initEnumMnemonMaps(49f6e7a06ebc5aa8).(); |
| 101 | |
| 102 | // Maps to characterize each instruction |
| 103 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, int> opCodeMapcxx . . $ Pep#opCodeMap.; |
| 104 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, bool> isUnaryMapcxx . . $ Pep#isUnaryMap.; |
| 105 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, bool> addrModeRequiredMapcxx . . $ Pep#addrModeRequiredMap.; |
| 106 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, bool> isTrapMapcxx . . $ Pep#isTrapMap.; |
| 107 | static void initMnemonicMapscxx . . $ Pep#initMnemonicMaps(49f6e7a06ebc5aa8).(); |
| 108 | |
| 109 | // Map to specify legal addressing modes for each instruction |
| 110 | static QMapcxx . . $ QMap#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#, int> addrModesMapcxx . . $ Pep#addrModesMap.; |
| 111 | static void initAddrModesMapcxx . . $ Pep#initAddrModesMap(49f6e7a06ebc5aa8).(); |
| 112 | |
| 113 | // The symbol table |
| 114 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, int> symbolTablecxx . . $ Pep#symbolTable.; |
| 115 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, bool> adjustSymbolValueForBurncxx . . $ Pep#adjustSymbolValueForBurn.; |
| 116 | |
| 117 | // The trace tag tables |
| 118 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, Enucxx . . $ Enu/::ESymbolFormatcxx . . $ Enu/ESymbolFormat#> symbolFormatcxx . . $ Pep#symbolFormat.; |
| 119 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, int> symbolFormatMultipliercxx . . $ Pep#symbolFormatMultiplier.; |
| 120 | |
| 121 | // This map is for global structs. The key is the symbol defined on the .BLOCK line |
| 122 | // and QStringList contains the list of symbols from the symbol tags in the .BLOCK comment. |
| 123 | static QMapcxx . . $ QMap#<QStringcxx . . $ QString#, QStringListcxx . . $ QStringList#> globalStructSymbolscxx . . $ Pep#globalStructSymbols.; |
| 124 | |
| 125 | // This map is used to map the program counter to the stringList of tags on the corresponding line |
| 126 | // For example, line corresponds to 0x12, and has the comment ; Allocate #next #data |
| 127 | // The stringlist would contain next and data |
| 128 | static QMapcxx . . $ QMap#<int, QStringListcxx . . $ QStringList#> symbolTraceListcxx . . $ Pep#symbolTraceList.; |
| 129 | |
| 130 | static QStringListcxx . . $ QStringList# blockSymbolscxx . . $ Pep#blockSymbols.; |
| 131 | static QStringListcxx . . $ QStringList# equateSymbolscxx . . $ Pep#equateSymbols.; |
| 132 | |
| 133 | // Map from instruction memory address to assembler listing line |
| 134 | // These pointers are set to the addresses of the program or OS maps |
| 135 | // depending on whether the program or OS is being assembled |
| 136 | static QMapcxx . . $ QMap#<int, int> *memAddrssToAssemblerListingcxx . . $ Pep#memAddrssToAssemblerListing.; |
| 137 | static QMapcxx . . $ QMap#<int, Qtcxx . . $ Qt/::CheckStatecxx . . $ Qt/CheckState#> *listingRowCheckedcxx . . $ Pep#listingRowChecked.; |
| 138 | |
| 139 | static QMapcxx . . $ QMap#<int, int> memAddrssToAssemblerListingProgcxx . . $ Pep#memAddrssToAssemblerListingProg.; |
| 140 | static QMapcxx . . $ QMap#<int, Qtcxx . . $ Qt/::CheckStatecxx . . $ Qt/CheckState#> listingRowCheckedProgcxx . . $ Pep#listingRowCheckedProg.; |
| 141 | |
| 142 | static QMapcxx . . $ QMap#<int, int> memAddrssToAssemblerListingOScxx . . $ Pep#memAddrssToAssemblerListingOS.; |
| 143 | static QMapcxx . . $ QMap#<int, Qtcxx . . $ Qt/::CheckStatecxx . . $ Qt/CheckState#> listingRowCheckedOScxx . . $ Pep#listingRowCheckedOS.; |
| 144 | |
| 145 | // Decoder tables |
| 146 | static QVectorcxx . . $ QVector#<Enucxx . . $ Enu/::EMnemoniccxx . . $ Enu/EMnemonic#> decodeMnemoniccxx . . $ Pep#decodeMnemonic.; |
| 147 | static QVectorcxx . . $ QVector#<Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode#> decodeAddrModecxx . . $ Pep#decodeAddrMode.; |
| 148 | static void initDecoderTablescxx . . $ Pep#initDecoderTables(49f6e7a06ebc5aa8).(); |
| 149 | |
| 150 | // .BURN and the ROM state |
| 151 | static int byteCountcxx . . $ Pep#byteCount.; |
| 152 | static int burnCountcxx . . $ Pep#burnCount.; |
| 153 | static int dotBurnArgumentcxx . . $ Pep#dotBurnArgument.; |
| 154 | static int romStartAddresscxx . . $ Pep#romStartAddress.; |
| 155 | |
| 156 | // Memory trace state |
| 157 | static bool traceTagWarningcxx . . $ Pep#traceTagWarning.; |
| 158 | }; |
| 159 | |
| 160 | #endif // PEP_H |