diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 1f6715b..903305e 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,35 +1,9 @@ { - "version": 4, - "env": { - "def_include": [ - "${workspaceRoot}/libpal/include", - "${workspaceRoot}/libpal/include/pal", - "${workspaceRoot}/nufxlib", - "${workspaceRoot}/diskimg", - "${workspaceRoot}/libhfs", - "${workspaceRoot}" - ] - }, "configurations": [ { - "name": "CMake", - "configurationProvider": "ms-vscode.cmake-tools", - "includePath": [ - "${def_include}" - ], - "browse": { - "path": [ - "${def_include}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db" - }, - //"compilerPath": "/usr/bin/clang++", - //"compilerArgs": [ - // "-Wall" - //], - "compileCommands": "${workspaceFolder}/compile_commands.json", - //"intelliSenseMode": "linux-clang-x64", + "name": "cmake", + "configurationProvider": "ms-vscode.cmake-tools" } - ] + ], + "version": 4 } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 2973862..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "DEBUG", - "type": "cppdbg", - "request": "launch", - // Resolved by CMake Tools: - "program": "${workspaceFolder}/build/qasm", - "args": [ - //"${workspaceFolder}/testdata/3006-pea.S", - "${workspaceFolder}/test.s", - "-d", - "-d", - "-d", - "-l", - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - //"externalConsole": true, - "environment": [ - { - // add the directory where our target was built to the PATHs - // it gets resolved by CMake Tools: - "name": "PATH", - "value": "${env:PATH}:${workspaceFolder}/build" - }, - { - "name": "OTHER_VALUE", - "value": "Something something" - } - ], - //"console": "externalTerminal", - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 5917422..9648bab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ project(QAsm) set(APPVERSION "4.0.10") set(LIBRARY_NAME pal) -set(FIND_LIBRARY_USE_LIB64_PATHS TRUE) #message("root: ${PROJECT_ROOT}") @@ -42,6 +41,7 @@ set(SOURCE ${PROJECT_ROOT}/psuedo.cpp ${PROJECT_ROOT}/qoptions.cpp ${PROJECT_ROOT}/cider.cpp + ${PROJECT_ROOT}/shell.cpp ${PROJECT_ROOT}/util.cpp ) @@ -89,6 +89,8 @@ target_link_libraries ( ${PROJECT_NAME} ${LIBRARY_NAME} pthread +readline +history ${CIDERLIBS} ${Poco_LIBRARIES} ) diff --git a/asm.cpp b/asm.cpp index 4f9b39e..40cb7a0 100644 --- a/asm.cpp +++ b/asm.cpp @@ -318,6 +318,7 @@ void CLASS::clear() { shiftchar=0; wholetext = ""; + operparams.clear(); lable = ""; printlable = ""; opcode = ""; @@ -1625,6 +1626,7 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) } } +#if 0 if (line.addressmode == syn_imm) //page 83 merlin16 manual { //printf("immediate mode\n"); @@ -1703,6 +1705,7 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) { line.flags |= FLAG_FORCEABS; } +#endif auto itr = opcodes.find(Poco::toUpper(op)); if (itr != opcodes.end()) @@ -1997,6 +2000,14 @@ void CLASS::complete(void) } +int CLASS::split_params(string param_string, std::vector ¶ms) +{ + int res=-1; + printf("split: |%s|\n",param_string.c_str()); + TOperParam p(param_string); + + return(res); +} int CLASS::evaluate(MerlinLine &line, std::string expr, int64_t &value) { int res = -1; @@ -2011,7 +2022,7 @@ int CLASS::evaluate(MerlinLine &line, std::string expr, int64_t &value) if (line.addressmode==syn_data) { - printf("\n\n"); + //printf("\n\n"); value=0; int l=line.operand_expr.length(); int i=0; @@ -2023,10 +2034,13 @@ int CLASS::evaluate(MerlinLine &line, std::string expr, int64_t &value) } res=0; } - else if (line.addressmode==syn_params) + //else if ((line.addressmode==syn_params) || (line.addressmode=syn_data)) + else if ((line.addressmode==syn_params)) + { // if this is a parameter list, don't eval here, because it will // fail + split_params(expr,line.operparams); res=0; } else diff --git a/asm.h b/asm.h index 74100af..a30f460 100644 --- a/asm.h +++ b/asm.h @@ -7,6 +7,7 @@ #define OPHANDLER(ACB) std::bind(ACB, this, std::placeholders::_1, std::placeholders::_2) +#define DEF_VAL 0 #define FLAG_FORCELONG 0x01 #define FLAG_FORCEABS 0x02 @@ -112,7 +113,184 @@ extern uint8_t opCodeCompatibility[256]; #endif +class TOperParam +{ +public: + std::string splitString; + //const string splitHex="^[$]?(?'hex'[A-Za-z0-9]+)(?'sep'[[:blank:],;]*)$"; + //const string splitNum="^(?'number'[0-9]+)(?'sep'[[:blank:],;]*)$"; + //const string splitBin="^[%]?(?'binary'[01]+)(?'sep'[[:blank:],;]*)$"; + //const string splitLabel="^[#|<>^]?(?'label'[A-Za-z:]?[A-Za-z0-9_]*)[:]?(?'sep'[[:blank:],;]*)$"; + //const string splitVariable="^[#|<>\\^]?[\\]]{1}(?'variable'[A-Za-z:]?[A-Za-z0-9_]*)[:]?(?'sep'[[:blank:],;]*)$"; + //Poco::RegularExpression splitStringRegEx; + //Poco::RegularExpression splitStringRegEx(&splitString,0,true); + +#if 0 +/(?x) # ignore pattern whitespace +(?(DEFINE) + (? (?'open'[!0-9\\,]{1})(?'str'.*?)(?'close'\k'open')) + (? \d+ ) + (? + \s* (?: + (?&dstring) + | (?&number) + | (?&list) + ) \s* + ) + (? \\ (?&value) (?: [,;]* (?&value) )* \\ ) +) +^(?&value)$/gm + +---- + +/[;,[:space:]]*(?'dstring'(?'delim'[^0-9,\\[:space:]])(?'str'.*?(?=\2))(?'close'\2)(?>[;,[:space:]]+))/gm // merlin delimited string +/[;,[:space:]]*(?'binarystr'(?'delim'[%])(?'val'[0-1+?)(?'close'\2)(?>[;,[:space:]]+))/gm // binary value %01001 +/[;,[:space:]]*(?'decimalstr'(?'val'[0-9*?)(?'close'\2)(?>[;,[:space:]]+))/gm // integer +/[;,[:space:]]*(?'delim'[\$])(?'hexval'[0-9a-zA-Z]+?)(?'end'[;,[:space:]]+)/gm // hex +/[;,[:space:]]*(?'delim'[\%])(?'binval'[0-9a-zA-Z]+?)(?'end'[;,[:space:]]+)/gm // binary %1001 + +(?'stringval'[;,[:space:]]*(?'dstring'(?'delim'[^0-9,\\[:space:]])(?'str'.*?(?=(?P=delim)))(?'close'(?P=delim)(?>[;,[:space:]]+)))) + +/(?x) # ignore pattern whitespace +(?(DEFINE) + (?(?'s_delim'[^0-9\/[:space:]])(?'strout'.*?(?=(?P=s_delim)))(?'e_delim'(?P=s_delim))) + (? (?'numout'[\#]?[<>|\^]?\d+ )) + (?([\#]?[<>|\^]?%[01]+)) + (?(?'hexout'[\#]?[<>|\^]?\$[A-Fa-f0-9]+)) + (?(?'hexlist'[A-Fa-f0-9]+)) + (?