diff --git a/.vscode/launch.json b/.vscode/launch.json index 216d036..2973862 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,15 +2,18 @@ "version": "0.2.0", "configurations": [ { - "name": "Debug", + "name": "DEBUG", "type": "cppdbg", "request": "launch", // Resolved by CMake Tools: "program": "${workspaceFolder}/build/qasm", "args": [ + //"${workspaceFolder}/testdata/3006-pea.S", "${workspaceFolder}/test.s", "-d", - "-l" + "-d", + "-d", + "-l", ], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/CMakeLists.txt b/CMakeLists.txt index e00f945..5917422 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.0) -#set(CIDER "1") -#set (CMAKE_C_COMPILER /usr/bin/clang) -#set (CMAKE_CXX_COMPILER /usr/bin/clang++) - +set(CIDER "1") set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/asm.cpp b/asm.cpp index c1d601a..4f9b39e 100644 --- a/asm.cpp +++ b/asm.cpp @@ -1,22 +1,16 @@ #define ADD_ERROR_STRINGS -#include "asm.h" -#include "eval.h" -#include "psuedo.h" -#include -#include -#include - +#include "app.h" #define CLASS MerlinLine -CLASS::CLASS(ConfigOptions &opt) : options(&opt) +CLASS::CLASS(ConfigOptions &opt) : qoptions(&opt) { clear(); } -CLASS::CLASS(std::string line, ConfigOptions &opt) : options(&opt) +CLASS::CLASS(std::string line, ConfigOptions &opt) : qoptions(&opt) { clear(); set(line); @@ -67,11 +61,11 @@ void CLASS::print(uint32_t lineno) } bool np=(flags & FLAG_NOLINEPRINT)?true:false; - if (options->isQuiet()) + if (qoptions->isQuiet()) { np=true; } - if (options->isList()) + if (qoptions->isList()) { np=false; } @@ -83,7 +77,7 @@ void CLASS::print(uint32_t lineno) { return; } - if (options->useColor()) + if (qoptions->useColor()) { if (errorcode > 0) { @@ -151,7 +145,7 @@ void CLASS::print(uint32_t lineno) } - string addrmode=options->addrModeEnglish(addressmode).c_str(); + string addrmode=qoptions->addrModeEnglish(addressmode).c_str(); pcol+=printf("%s ",addrmode.c_str()); pcol+=printf("/%04X ",flags); @@ -268,7 +262,7 @@ void CLASS::print(uint32_t lineno) } //printf("\n"); - if ((options->useColor()) && (errorcode > 0)) + if ((qoptions->useColor()) && (errorcode > 0)) { SetColor(CL_NORMAL); } @@ -349,6 +343,7 @@ void CLASS::clear() lineno = 0; addressmode = 0; expr_value = 0; + //expr_shift=0; eval_result = 0; flags = 0; outbytes.clear(); @@ -542,7 +537,7 @@ void CLASS::set(std::string line) { // M32 syntax allows a colon after lable, and it is not part of the lable //if ((syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32) - if (options->isMerlin32()) + if (qoptions->isMerlin32()) { while ((x > 1) && (lable[x - 1] == ':')) { @@ -559,7 +554,7 @@ void CLASS::set(std::string line) #undef CLASS #define CLASS TFileProcessor -CLASS::CLASS(ConfigOptions &opt) : options(opt) +CLASS::CLASS(ConfigOptions &opt) : qoptions(opt) { int x; errorct = 0; @@ -584,7 +579,7 @@ CLASS::~CLASS() void CLASS::setLanguage(string lang,bool force) { - options.setLanguage(lang,force); + qoptions.setLanguage(lang,force); } void CLASS::errorOut(uint16_t code) @@ -971,7 +966,7 @@ int CLASS::doline(int lineno, std::string line) { UNUSED(lineno); - MerlinLine l(line, options); + MerlinLine l(line, qoptions); lines.push_back(l); return 0; } @@ -1360,9 +1355,9 @@ TSymbol * CLASS::findSymbol(std::string symname) //printf("symbol found: |%s| |%s|\n",symname.c_str(),res->var_text.c_str()); TEvaluator eval(*this); int64_t er_val=0; - uint8_t shift=0; + //uint8_t shift=0; int er; - er = eval.evaluate(res->var_text, er_val, shift); + er = eval.evaluate(res->var_text, er_val); if (er == 0) { res->value=er_val; @@ -1646,14 +1641,12 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) //line.expr_value = (line.expr_value >> 16); //line.expr_value = (line.expr_value >> 16) & 0xFFFF; break; - case '|': // should never get here, handled in getAddrMode - //if (syntax == SYNTAX_MERLIN) - if (options.isMerlin()) + case '|': + if (qoptions.isMerlin()) { line.setError(errBadOperand); line.expr_value = 0; } - //line.shiftchar=0; break; } } @@ -1662,14 +1655,14 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) switch (line.shiftchar) // page 84 Merlin16 manual { case '<': - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { line.flags |= FLAG_DP; line.expr_value &= 0xFF; } break; case '>': - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { // bug in M32 or not, do what it does //line.flags |= FLAG_FORCEABS; @@ -1679,7 +1672,7 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) { // Merlin16+ uses this to force long addressing // need to check Merlin16 - if (!options.isMerlin()) // not merlin8 + if (!qoptions.isMerlin()) // not merlin8 { line.flags |= FLAG_FORCELONG; } @@ -1687,18 +1680,22 @@ int CLASS::callOpCode(std::string op, MerlinLine &line) } break; case '|': - if ((!options.isMerlin32()) && (options.isMerlinCompat())) + if ((!qoptions.isMerlin32()) && (qoptions.isMerlinCompat())) { line.flags |= FLAG_FORCEABS; //line.shiftchar=0; } break; case '^': - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { line.flags |= FLAG_DP; line.expr_value >>= 16; } + else + { + line.expr_value >>= 16; + } break; } } @@ -1750,7 +1747,9 @@ const TaddrMode addrRegEx[] = {"^\\[(?'expr'.+)\\]$", syn_dil, "[e]"}, // [expr] {"^(?'expr'.+)[,]{1}[(X|x)]{1}$", syn_absx, "addr,x"}, // expr,x {"^(?'expr'.+)[,]{1}[(Y|y)]{1}$", syn_absy, "addr,y"}, // expr,y - {"^(?'expr'.+)[,]{1}(?'expr2'.+)$", syn_bm, "block"}, // block move expr,expr1 + {"^[[:punct:]]{1}(?'expr'.+)[[:punct:]]{1}$", syn_data, "data"}, // delimitted string + {"^(?'expr'.+)[,]{1}(?'expr2'.+)$", syn_params, "params"}, // block move expr,expr1 + {"^(?'expr'.+)$", syn_abs, "absolute"}, // expr (MUST BE LAST) {"", 0, ""} }; @@ -1814,15 +1813,15 @@ void CLASS::initpass(void) outputbytes.clear(); trackrep = getBool("asm.trackrep", false); - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { trackrep = true; // can't turn this off in M32 } - else if (options.isMerlin()) + else if (qoptions.isMerlin()) { trackrep = false; // can't turn this ON in M16 } - else if (options.isNative()) + else if (qoptions.isNative()) { // we will allow this to be settable default off trackrep = false; @@ -1842,12 +1841,22 @@ void CLASS::initpass(void) s = getConfig("asm.cpu", "M6502"); s = Poco::trim(Poco::toUpper(s)); + if (qoptions.isMerlin()) + { + cpumode=MODE_6502; + } + else + { + cpumode = MODE_65816; + } + mx = 0x03; + s=PAL::getString("option.instruction",""); + s=Poco::trim(Poco::toUpper(s)); if (s!="") { //printf("CPU command line %s\n",s.c_str()); - cpumode = MODE_65816; - mx = 0x03; + if (s == "M65816") { @@ -1870,7 +1879,7 @@ void CLASS::initpass(void) mx = 0x03; } } - mx = getInt("asm.startmx", mx);; + //mx = getInt("asm.startmx", mx);; savepath = getConfig("option.objfile", ""); @@ -1879,7 +1888,7 @@ void CLASS::initpass(void) lastcarry = false; relocatable = false; currentsym = NULL; - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { // M32 allows locals that don't have a global above. this is the catchall for that currentsym = &topSymbol; // this is the default symbol for :locals without a global above; @@ -1933,8 +1942,8 @@ void CLASS::complete(void) std::string currentdir = Poco::Path::current(); //savepath = processFilename(savepath, currentdir, 0); - savepath=options.formatPath(savepath); - if (!options.isQuiet()) + savepath=qoptions.formatPath(savepath); + if (!qoptions.isQuiet()) { printf("saving to file: %s\n", savepath.c_str()); } @@ -1971,14 +1980,14 @@ void CLASS::complete(void) printf("unable to save file.\n"); // TODO SGQ need to push error up the so exit code is non-zero } } - if ((!options.isQuiet()) || (options.isList())) + if ((!qoptions.isQuiet()) || (qoptions.isList())) { printf("\n\nEnd qASM assembly, %d bytes, %u errors, %lu lines, %lu symbols.\n", PC.totalbytes, errorct, lines.size(), symbols.size()); } TFileProcessor::complete(); - if ((errorct==0) && (listing) && (!options.isQuiet())) + if ((errorct==0) && (listing) && (!qoptions.isQuiet())) { showSymbolTable(true); showSymbolTable(false); @@ -1993,46 +2002,72 @@ int CLASS::evaluate(MerlinLine &line, std::string expr, int64_t &value) int res = -1; int64_t result = 0; + line.eval_result = 0; + if (expr.length() > 0) { TEvaluator eval(*this); - line.eval_result = 0; - res = eval.evaluate(expr, result, line.expr_shift); - if (res != 0) + if (line.addressmode==syn_data) { - if (isDebug() > 2) + printf("\n\n"); + value=0; + int l=line.operand_expr.length(); + int i=0; + while ((i 0) && (isDebug() > 2)) + // if this is a parameter list, don't eval here, because it will + // fail + res=0; + } + else + { + //res = eval.evaluate(expr, result, line.expr_shift); + res = eval.evaluate(expr, result); + + if (res != 0) { - uint32_t rr = v1 & 0xFFFFFFFF; - printf("EV1=%08X '%c'\n", rr, line.expr_shift); + if (isDebug() > 2) + { + int c; + if (qoptions.useColor()) + { + c = SetColor(CL_RED); + } + uint32_t rr = result & 0xFFFFFFFF; + printf("eval Error=%d %08X |%s|\n", res, rr, eval.badsymbol.c_str()); + if (qoptions.useColor()) + { + SetColor(c); + } + } } - if (v1 >= 0x10000) + if (res == 0) { - line.flags |= FLAG_BIGNUM; - } - if (v1 < 0x100) - { - line.flags |= FLAG_DP; + uint64_t v1 = (uint64_t) result; + value = result; + if ((listing) && (pass > 0) && (isDebug() > 2)) + { + //uint32_t rr = v1 & 0xFFFFFFFF; + //printf("EV1=%08X '%c'\n", rr); + } + if (v1 >= 0x10000) + { + line.flags |= FLAG_BIGNUM; + } + if (v1 < 0x100) + { + line.flags |= FLAG_DP; + } } } } @@ -2056,9 +2091,9 @@ int CLASS::getAddrMode(MerlinLine & line) int idx, x; std::string s, oper; std::vector groups; - char shiftchar; + shiftStruct shift(line.operand); - oper = line.operand; + oper=line.operand; int l=oper.length(); int ol=line.opcode.length(); if ((ol == 0) || (l <= 0)) @@ -2073,80 +2108,10 @@ int CLASS::getAddrMode(MerlinLine & line) } } - bool supportbar=false; - bool modified=false; - - shiftchar=oper[0]; - if (shiftchar=='#') - { - shiftchar=0; - if (l>1) - { - shiftchar=oper[1]; - - //oper=oper.substr(1); - //oper="#"+oper; - } - } - if (shiftchar=='^') - { - if (options.isMerlin()) - { - return(syn_err); - //shiftchar=0x00; // merlin8 does not support the bank addr - } - } - if (shiftchar=='|') - { - if (options.isMerlinCompat()) - { - if ((options.isMerlin() || options.isMerlin16())) // merlin8 and merlin16 do not support the bar - { - return(syn_err); - } - else - { - supportbar=true; - } - } - } - - if ((shiftchar=='^') || (shiftchar=='<') || (shiftchar=='>') || (supportbar && (shiftchar=='|'))) - { - modified=true; - } - - if (modified) - { - line.shiftchar=shiftchar; - if (oper[0]=='#') - { - oper=oper.substr(2); - oper="#"+oper; - l=oper.length(); - } - else if (shiftchar!=0) - { - oper=oper.substr(1); - l=oper.length(); - } - if (isDebug()>1) - { - printf("old: |%s| new: |%s|\n",line.operand.c_str(),oper.c_str()); - } - line.strippedoperand=oper; - } - - if (supportbar && shiftchar=='|') - { - //if ((options.isMerlin32()) || (options.isNative())) - if (options.isMerlin32()) - { - // regular Merlin16/16+ seems to accept this character, but does NOT force long (bank) addressing - line.flags|=FLAG_FORCELONG; - } - //shiftchar=0; // don't process this as a shift because we only needed to set a flag to force long addressing - } + //shift.parse(); + oper = shift.shiftString; + //printf("shiftstring: |%s|\n",oper.c_str()); + line.shiftchar=shift.shiftchar; idx = 0; RegularExpression valEx(valExpression, 0, true); @@ -2201,7 +2166,7 @@ int CLASS::getAddrMode(MerlinLine & line) // symbol is defined later, we will generate different // bytes on the next pass - if (options.isMerlin32()) + if (qoptions.isMerlin32()) //if ((line.syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32) { if (Poco::toUpper(oper) == "A") // check the whole operand, not just the expression @@ -2277,7 +2242,7 @@ int CLASS::parseOperand(MerlinLine & line) } if (isDebug()>1) { - printf("addressmode=%d %s\n",res,options.addrModeEnglish(res).c_str()); + //printf("addressmode=%d %s\n",res,qoptions.addrModeEnglish(res).c_str()); } return (res); } @@ -2473,7 +2438,7 @@ void CLASS::process(void) int x;; char c; char buff[256]; - MerlinLine errLine(options); + MerlinLine errLine(qoptions); std::string op, realop, operand, ls; pass = 0; @@ -2668,7 +2633,7 @@ void CLASS::process(void) for (uint32_t lc = expand_macro.start; lc < expand_macro.end; lc++) { //printf("pushing %s\n", lines[lc].wholetext.c_str()); - MerlinLine nl(lines[lc].wholetext,options); // create a new clean line (without errors,data) + MerlinLine nl(lines[lc].wholetext,qoptions); // create a new clean line (without errors,data) expand_macro.lines.push_back(nl); } expand_macro.running = true; @@ -2780,7 +2745,7 @@ void CLASS::process(void) { errorct++; } - if (((!skiplist) && (listing) && (pass == 1)) || (line.errorcode != 0) || (options.isList())) + if (((!skiplist) && (listing) && (pass == 1)) || (line.errorcode != 0) || (qoptions.isList())) { line.print(lineno); } @@ -2816,7 +2781,7 @@ int CLASS::doline(int lineno, std::string line) UNUSED(lineno); - MerlinLine l(line,options); + MerlinLine l(line,qoptions); op = Poco::toLower(l.opcode); lines.push_back(l); diff --git a/asm.h b/asm.h index a6c7e6a..74100af 100644 --- a/asm.h +++ b/asm.h @@ -1,8 +1,10 @@ #pragma once -#include "app.h" +#include "qasm.h" // +//extern ConfigOptions qoptions; + #define OPHANDLER(ACB) std::bind(ACB, this, std::placeholders::_1, std::placeholders::_2) @@ -153,12 +155,149 @@ public: #endif }; +class shiftStruct +{ +public: + string shiftString; + string origString; + uint32_t flags; + uint32_t amode; + uint8_t shiftchar; + uint8_t shiftamount; + bool immediate; + bool iserror; + + shiftStruct(string in) : shiftStruct() + { + origString=in; + parse(); + } + + shiftStruct() + { + shiftString=""; + origString=""; + flags=0; + shiftchar=0; + immediate=false; + iserror=true; + shiftamount=0; + amode=syn_none; + } + + ~shiftStruct() + { + + } + int parse() + { + int res=0; + string oper; + flags=0; + shiftchar=0; + shiftamount=0; + iserror=false; + amode=syn_none; + + oper=trim(origString); + shiftString=oper; + + bool supportbar=false; + bool modified=false; + + int l=oper.length(); + if (l==0) + { + return(res); + } + + shiftchar=oper[0]; + if (shiftchar=='#') + { + shiftchar=0; + immediate=true; + if (l>1) + { + shiftchar=oper[1]; + } + } + if (shiftchar=='^') + { + if (qoptions.isMerlin()) + { + iserror=true; + amode=syn_err; + return(res); + //shiftchar=0x00; // merlin8 does not support the bank addr + } + } + if (shiftchar=='|') + { + if (qoptions.isMerlinCompat()) + { + if ((qoptions.isMerlin() || qoptions.isMerlin16())) // merlin8 and merlin16 do not support the bar + { + //line.setError(errIllegalCharOperand); + amode=syn_err; + iserror=true; + return(res); + } + else + { + supportbar=true; + } + } + } + + if ((shiftchar=='^') || (shiftchar=='<') || (shiftchar=='>') || (supportbar && (shiftchar=='|'))) + { + modified=true; + } + else + { + shiftchar=0; // erase anything that is not one of those above + } + + if (modified) + { + //line.shiftchar=shiftchar; + if (oper[0]=='#') + { + oper=oper.substr(2); + oper="#"+oper; + l=oper.length(); + } + else if (shiftchar!=0) + { + oper=oper.substr(1); + l=oper.length(); + } + shiftString=oper; + if (isDebug()>1) + { + //printf("old: |%s| new: |%s|\n",origString.c_str(),shiftString.c_str()); + } + } + + if (supportbar && shiftchar=='|') + { + if (qoptions.isMerlin32()) + { + // regular Merlin16/16+ seems to accept this character, but does NOT force long (bank) addressing + flags|=FLAG_FORCELONG; + } + //shiftchar=0; // don't process this as a shift because we only needed to set a flag to force long addressing + } + return(res); + } +}; + class MerlinLine { public: //uint32_t syntax; - ConfigOptions *options; + ConfigOptions *qoptions; std::string wholetext; std::string lable; std::string printlable; @@ -184,7 +323,7 @@ public: int32_t startpc; uint32_t addressmode; uint32_t expr_value; - uint8_t expr_shift; // after an eval, this byte will reflect any shift code on expr (|^<>) + //uint8_t expr_shift; // after an eval, this byte will reflect any shift code on expr (|^<>) int32_t eval_result; // this is the error code from the evaluate routing (0 or neg) uint32_t errorcode; std::string errorText; @@ -219,7 +358,7 @@ protected: uint32_t filecount; // how many files have been read in (because of included files from source public: - ConfigOptions &options; + ConfigOptions &qoptions; uint32_t errorct; std::string filename; uint32_t format_flags; diff --git a/cider.cpp b/cider.cpp index 8c30468..c87aebf 100644 --- a/cider.cpp +++ b/cider.cpp @@ -1,15 +1,6 @@ #ifdef CIDERPRESS -#include "asm.h" -#include "eval.h" -#include "psuedo.h" -#include -#include -#include - -#include -#include -#include +#include "app.h" #undef CLASS #define CLASS CiderPress @@ -25,7 +16,7 @@ void dbgMessage(const char *file, int line, const char *msg) } } -CLASS::CLASS() : TFileProcessor() +CLASS::CLASS(ConfigOptions &opt): TFileProcessor(opt) { if (!Global::GetAppInitCalled()) { diff --git a/cider.h b/cider.h index e2c1ccb..ab40a8c 100644 --- a/cider.h +++ b/cider.h @@ -1,17 +1,45 @@ #ifdef CIDERPRESS #pragma once -#include "asm.h" -#include "eval.h" -#include "psuedo.h" -#include -#include -#include -#include "DiskImg.h" - -#define CLASS CiderPress enum CIDER_VOLFORMAT {CP_PRODOS,CP_HFS}; + +#undef CLASS +#define CLASS A2Volume + +class CLASS +{ +protected: + string volumeName; + string volumePath; + string filename; + string fileFormat; + string format; + string sizeString; +public: + CLASS() + { + volumeName=""; + volumePath=""; + filename=""; + fileFormat=""; + format=""; + sizeString=""; + } + + virtual ~CLASS() + { + + } + int CreateVolume(string OSName, string VolName, uint64_t size, CIDER_VOLFORMAT format) + { + return(-1); + } + +}; + +#undef CLASS +#define CLASS CiderPress class CLASS : public TFileProcessor { protected: diff --git a/eval.cpp b/eval.cpp index 214f99e..ce6888e 100644 --- a/eval.cpp +++ b/eval.cpp @@ -1,7 +1,4 @@ -#include "asm.h" -#include "eval.h" -#include -#include +#include "app.h" #define CLASS TEvaluator @@ -9,13 +6,13 @@ std::ostream& operator<<(std::ostream& os, const Token& token) { - os << token.str; - return os; + os << token.str; + return os; } CLASS::CLASS(T65816Asm &_asm) : assembler(_asm) { - allowMX = false; + allowMX = false; } CLASS::~CLASS() @@ -24,765 +21,776 @@ CLASS::~CLASS() std::deque CLASS::exprToTokens(const std::string& expr) { - std::deque tokens; - int state = 0; - char c; - char delim; - std::string ident; - //, asc; + std::deque tokens; + int state = 0; + char c; + char delim; + std::string ident; + //, asc; - std::string ops = "+-*//^!.&()"; - std::string c1; - char *tokptr; - char *tptr; - bool numexpect; - //bool highascii = false; - Token::Type t; + std::string ops = "+-*//^!.&()"; + std::string c1; + char *tokptr; + char *tptr; + bool numexpect; + //bool highascii = false; + Token::Type t; - delim = 0; - numexpect = true; - for (const auto* p = expr.c_str(); *p; ++p) - { - c = *p; - c1 = c; - tptr = (char *)c1.c_str(); - tokptr = strpbrk(tptr, (const char *)ops.c_str()); - // printf("state=%d %c %p\n", state, c,tokptr); + delim = 0; + numexpect = true; + for (const auto* p = expr.c_str(); *p; ++p) + { + c = *p; + c1 = c; + tptr = (char *)c1.c_str(); + tokptr = strpbrk(tptr, (const char *)ops.c_str()); + // printf("state=%d %c %p\n", state, c,tokptr); - switch (state) - { - default: - printf("bad token state\n"); - state = 0; - break; - case 11: - if ((c < ' ') || (c == delim)) - { - // SGQ - convert ascii to a number here - //asc = "0"; - //printf("ascii ident=|%s|\n", ident.c_str()); - if (ident.length() > 0) - { - // SGQ - convert ascii to a number here - } - ident = delim + ident + delim; + switch (state) + { + default: + printf("bad token state\n"); + state = 0; + break; + case 11: + if ((c < ' ') || (c == delim)) + { + // SGQ - convert ascii to a number here + //asc = "0"; + //printf("ascii ident=|%s|\n", ident.c_str()); + if (ident.length() > 0) + { + // SGQ - convert ascii to a number here + } + ident = delim + ident + delim; - t = Token::Type::Ascii; - int pr = 1; // precedence - bool ra = false; - tokens.push_back(Token - { - t, ident, pr, ra - }); - ident = ""; - state = 0; - if (c != delim) - { - p--; - } - //highascii = false; - delim = 0; - } - else - { - ident += c; - } - break; - case 10: - case 20: - if ((c <= ' ') || (tokptr != NULL)) - { - if (ident.length() > 0) - { - if (state == 20) - { - t = Token::Type::Symbol; - } - else - { - t = Token::Type::Number; - } - int pr = 1; // precedence - bool ra = false; // rightAssociative - tokens.push_back(Token - { - t, ident, pr, ra - }); - ident = ""; - } - state = 0; - p--; - } - else - { - ident += c; - } - break; - case 0: - if ((c == '$') && (numexpect)) - { - state = 10; - ident += c; - numexpect = false; + t = Token::Type::Ascii; + int pr = 1; // precedence + bool ra = false; + tokens.push_back(Token + { + t, ident, pr, ra + }); + ident = ""; + state = 0; + if (c != delim) + { + p--; + } + //highascii = false; + delim = 0; + } + else + { + ident += c; + } + break; + case 10: + case 20: + if ((c <= ' ') || (tokptr != NULL)) + { + if (ident.length() > 0) + { + if (state == 20) + { + t = Token::Type::Symbol; + } + else + { + t = Token::Type::Number; + } + int pr = 1; // precedence + bool ra = false; // rightAssociative + tokens.push_back(Token + { + t, ident, pr, ra + }); + ident = ""; + } + state = 0; + p--; + } + else + { + ident += c; + } + break; + case 0: + if ((c == '$') && (numexpect)) + { + state = 10; + ident += c; + numexpect = false; - } - else if ((numexpect) && ( (c == '^') || (c == '<') || (c == '>') || (c == '|'))) - { - ident = c; - tokens.push_back(Token{Token::Type::Shift, ident, 1, true}); - ident = ""; - } - else if ((c == '*') && (numexpect)) - { - numexpect = false; - state = 0; - ident += c; - tokens.push_back(Token{Token::Type::Symbol, ident, 1, false}); - ident = ""; - } - else if ((c == '%') && (numexpect)) - { - state = 10; - ident += c; - numexpect = false; + } + //else if ((numexpect) && ( (c == '^') || (c == '<') || (c == '>') || (c == '|'))) + //{ + // ident = c; + // tokens.push_back(Token{Token::Type::Shift, ident, 1, true}); + // ident = ""; + //} + else if ((c == '*') && (numexpect)) + { + numexpect = false; + state = 0; + ident += c; + tokens.push_back(Token{Token::Type::Symbol, ident, 1, false}); + ident = ""; + } + else if ((c == '%') && (numexpect)) + { + state = 10; + ident += c; + numexpect = false; - } - else if ((c == '\'') && (numexpect)) - { - delim = c; - state = 11; - numexpect = false; - } - else if ((c == '"') && (numexpect)) - { - delim = c; - state = 11; - //highascii = true; - numexpect = false; - } - else if (((c == '-') || (c == '+')) && (numexpect)) - { - state = 10; - ident += c; - } - else if (isdigit(c)) - { - state = 10; - ident += c; - numexpect = false; + } + else if ((c == '\'') && (numexpect)) + { + delim = c; + state = 11; + numexpect = false; + } + else if ((c == '"') && (numexpect)) + { + delim = c; + state = 11; + //highascii = true; + numexpect = false; + } + else if (((c == '-') || (c == '+')) && (numexpect)) + { + state = 10; + ident += c; + } + else if (isdigit(c)) + { + state = 10; + ident += c; + numexpect = false; - } - else if (c >= ':') - { - state = 20; - ident += c; - numexpect = false; - } - else if ((tokptr != NULL) && (!numexpect)) - { - t = Token::Type::Unknown; - int pr = -1; // precedence - bool ra = false; // rightAssociative - switch (c) - { - default: break; - case '(': t = Token::Type::LeftParen; break; - case ')': t = Token::Type::RightParen; break; - case '!': t = Token::Type::Operator; pr = 5; break; - case '.': t = Token::Type::Operator; pr = 5; break; - case '&': t = Token::Type::Operator; pr = 5; break; - case '^': t = Token::Type::Operator; pr = 4; ra = true; break; - case '*': t = Token::Type::Operator; pr = 3; break; - case '/': t = Token::Type::Operator; pr = 3; break; - case '+': t = Token::Type::Operator; pr = 2; break; - case '-': t = Token::Type::Operator; pr = 2; break; + } + else if (c >= ':') + { + state = 20; + ident += c; + numexpect = false; + } + else if ((tokptr != NULL) && (!numexpect)) + { + t = Token::Type::Unknown; + int pr = -1; // precedence + bool ra = false; // rightAssociative + switch (c) + { + default: + break; + case '(': + t = Token::Type::LeftParen; + break; + case ')': + t = Token::Type::RightParen; + break; + case '!': + t = Token::Type::Operator; + pr = 5; + break; + case '.': + t = Token::Type::Operator; + pr = 5; + break; + case '&': + t = Token::Type::Operator; + pr = 5; + break; + case '^': + t = Token::Type::Operator; + pr = 4; + ra = true; + break; + case '*': + t = Token::Type::Operator; + pr = 3; + break; + case '/': + t = Token::Type::Operator; + pr = 3; + break; + case '+': + t = Token::Type::Operator; + pr = 2; + break; + case '-': + t = Token::Type::Operator; + pr = 2; + break; - } - tokens.push_back(Token - { - t, std::string(1, c), pr, ra - }); - numexpect = true; - } - } - } + } + tokens.push_back(Token + { + t, std::string(1, c), pr, ra + }); + numexpect = true; + } + } + } - return tokens; + return tokens; } std::deque CLASS::shuntingYard(const std::deque& tokens) { - std::deque queue; - std::vector stack; - TSymbol *sym; - char buff[128]; + std::deque queue; + std::vector stack; + TSymbol *sym; + char buff[128]; - // While there are tokens to be read: - for (auto token : tokens) - { - // Read a token - switch (token.type) - { - case Token::Type::Symbol: - token.type = Token::Type::Number; - if (token.str == "*") - { - sprintf(buff, "$%X", assembler.PC.currentpc); - token.str = buff; - } - else - { - std::string tok = Poco::toUpper(token.str); - if ((tok == "MX") && (allowMX)) - { - //printf("MX EVAL\n"); - sprintf(buff,"$%02X",assembler.mx&0x03); - token.str=buff;; - } - else - { - sym = assembler.findSymbol(token.str); - //printf("symbol find |%s| %p\n",token.str.c_str(),sym); + // While there are tokens to be read: + for (auto token : tokens) + { + // Read a token + switch (token.type) + { + case Token::Type::Symbol: + token.type = Token::Type::Number; + if (token.str == "*") + { + sprintf(buff, "$%X", assembler.PC.currentpc); + token.str = buff; + } + else + { + std::string tok = Poco::toUpper(token.str); + if ((tok == "MX") && (allowMX)) + { + //printf("MX EVAL\n"); + sprintf(buff,"$%02X",assembler.mx&0x03); + token.str=buff;; + } + else + { + sym = assembler.findSymbol(token.str); + //printf("symbol find |%s| %p\n",token.str.c_str(),sym); - if (sym != NULL) - { - sym->used = true; - sprintf(buff, "$%X", sym->value); - token.str = buff; - } - else - { - setError(Token::unknownSymbolErr); - badsymbol = token.str; - token.str = "0"; - } - } - } - queue.push_back(token); - break; - case Token::Type::Ascii: - case Token::Type::Number: - // If the token is a number, then add it to the output queue - queue.push_back(token); - break; + if (sym != NULL) + { + sym->used = true; + sprintf(buff, "$%X", sym->value); + token.str = buff; + } + else + { + setError(Token::unknownSymbolErr); + badsymbol = token.str; + token.str = "0"; + } + } + } + queue.push_back(token); + break; + case Token::Type::Ascii: + case Token::Type::Number: + // If the token is a number, then add it to the output queue + queue.push_back(token); + break; - case Token::Type::Shift: - stack.push_back(token); - break; - case Token::Type::Operator: - { - // If the token is operator, o1, then: - const auto o1 = token; + //case Token::Type::Shift: + // stack.push_back(token); + // break; + case Token::Type::Operator: + { + // If the token is operator, o1, then: + const auto o1 = token; - // while there is an operator token, - while (!stack.empty()) - { - // o2, at the top of stack, and - const auto o2 = stack.back(); + // while there is an operator token, + while (!stack.empty()) + { + // o2, at the top of stack, and + const auto o2 = stack.back(); - // either o1 is left-associative and its precedence is - // *less than or equal* to that of o2, - // or o1 if right associative, and has precedence - // *less than* that of o2, - if ( - (! o1.rightAssociative && o1.precedence <= o2.precedence) - || ( o1.rightAssociative && o1.precedence < o2.precedence) - ) - { - // then pop o2 off the stack, - stack.pop_back(); - // onto the output queue; - queue.push_back(o2); + // either o1 is left-associative and its precedence is + // *less than or equal* to that of o2, + // or o1 if right associative, and has precedence + // *less than* that of o2, + if ( + (! o1.rightAssociative && o1.precedence <= o2.precedence) + || ( o1.rightAssociative && o1.precedence < o2.precedence) + ) + { + // then pop o2 off the stack, + stack.pop_back(); + // onto the output queue; + queue.push_back(o2); - continue; - } + continue; + } - // @@ otherwise, exit. - break; - } + // @@ otherwise, exit. + break; + } - // push o1 onto the stack. - stack.push_back(o1); - } - break; + // push o1 onto the stack. + stack.push_back(o1); + } + break; - case Token::Type::LeftParen: - // If token is left parenthesis, then push it onto the stack - stack.push_back(token); - break; + case Token::Type::LeftParen: + // If token is left parenthesis, then push it onto the stack + stack.push_back(token); + break; - case Token::Type::RightParen: - // If token is right parenthesis: - { - bool match = false; - while (! stack.empty()) - { - // Until the token at the top of the stack - // is a left parenthesis, - const auto tos = stack.back(); - if (tos.type != Token::Type::LeftParen) - { - // pop operators off the stack - stack.pop_back(); - // onto the output queue. - queue.push_back(tos); - } + case Token::Type::RightParen: + // If token is right parenthesis: + { + bool match = false; + while (! stack.empty()) + { + // Until the token at the top of the stack + // is a left parenthesis, + const auto tos = stack.back(); + if (tos.type != Token::Type::LeftParen) + { + // pop operators off the stack + stack.pop_back(); + // onto the output queue. + queue.push_back(tos); + } - // Pop the left parenthesis from the stack, - // but not onto the output queue. - stack.pop_back(); - match = true; - break; - } + // Pop the left parenthesis from the stack, + // but not onto the output queue. + stack.pop_back(); + match = true; + break; + } - if (!match && stack.empty()) - { - // If the stack runs out without finding a left parenthesis, - // then there are mismatched parentheses. - //printf("RightParen error (%s)\n", token.str.c_str()); - setError(Token::operatorErr); - return queue; - } - } - break; + if (!match && stack.empty()) + { + // If the stack runs out without finding a left parenthesis, + // then there are mismatched parentheses. + //printf("RightParen error (%s)\n", token.str.c_str()); + setError(Token::operatorErr); + return queue; + } + } + break; - default: - setError(Token::syntaxErr); + default: + setError(Token::syntaxErr); - //printf("error (%s)\n", token.str.c_str()); - return queue; - break; - } + //printf("error (%s)\n", token.str.c_str()); + return queue; + break; + } - //debugReport(token, queue, stack); - } + //debugReport(token, queue, stack); + } - // When there are no more tokens to read: - // While there are still operator tokens in the stack: - while (! stack.empty()) - { - // If the operator token on the top of the stack is a parenthesis, - // then there are mismatched parentheses. - if (stack.back().type == Token::Type::LeftParen) - { - setError(Token::parenErr); - //printf("Mismatched parentheses error\n"); - return queue; - } + // When there are no more tokens to read: + // While there are still operator tokens in the stack: + while (! stack.empty()) + { + // If the operator token on the top of the stack is a parenthesis, + // then there are mismatched parentheses. + if (stack.back().type == Token::Type::LeftParen) + { + setError(Token::parenErr); + //printf("Mismatched parentheses error\n"); + return queue; + } - // Pop the operator onto the output queue. - queue.push_back(std::move(stack.back())); - stack.pop_back(); - } + // Pop the operator onto the output queue. + queue.push_back(std::move(stack.back())); + stack.pop_back(); + } - //debugReport(Token { Token::Type::Unknown, "End" }, queue, stack); + //debugReport(Token { Token::Type::Unknown, "End" }, queue, stack); - //Exit. - return queue; + //Exit. + return queue; } int CLASS::parseAscii(std::string n, int64_t &val) { - int res = -1; - val = 0; - bool err = false; - uint64_t tval = 0; - bool high = false; - uint8_t c; + int res = -1; + val = 0; + bool err = false; + uint64_t tval = 0; + bool high = false; + uint8_t c; - uint32_t l = (uint32_t)n.length(); - for (uint32_t i = 0; i < l - 1; i++) - { - c = n[i]; - if (i == 0) - { - if (c == '"') - { - high = true; - } - } - else - { - tval <<= 8; - if (high) - { - c |= 0x80; - } - else - { - c &= 0x7F; - } - tval = ((tval & 0xFFFFFF00) | c); - } - } + uint32_t l = (uint32_t)n.length(); + for (uint32_t i = 0; i < l - 1; i++) + { + c = n[i]; + if (i == 0) + { + if (c == '"') + { + high = true; + } + } + else + { + tval <<= 8; + if (high) + { + c |= 0x80; + } + else + { + c &= 0x7F; + } + tval = ((tval & 0xFFFFFF00) | c); + } + } - if (!err) - { - val = (uint32_t)(tval & 0xFFFFFFFF); - res = 0; - } + if (!err) + { + val = (uint32_t)(tval & 0xFFFFFFFF); + res = 0; + } - //printf("parseASCII |%s| %d %016lX\n", n.c_str(), res, val); - return (res); + //printf("parseASCII |%s| %d %016lX\n", n.c_str(), res, val); + return (res); } int CLASS::parseNumber(std::string n, int64_t &val) { - int res = -1; - int state = 0; - char c; - std::string s; - uint32_t i, l; - bool valid = false; - bool err = false; - bool neg = false; - int64_t tval = 0; - val = 0; + int res = -1; + int state = 0; + char c; + std::string s; + uint32_t i, l; + bool valid = false; + bool err = false; + bool neg = false; + int64_t tval = 0; + val = 0; - //printf("parseNumber |%s|\n",n.c_str()); - i = 0; - l = (uint32_t)n.length(); - s = ""; - for (i = 0; i < l; i++) - { - c = n[i]; - switch (state) - { - case 0: - if (c == '$') - { - state = 10; - } - else if (c == '%') - { - state = 20; - } - else if (c == '-') - { - if (!valid) - { - neg = !neg; - } - else - { - state = 99; - } - } - else if (isdigit(c)) - { - s += c; - valid = true; - state = 1; - tval = c - '0'; - } - else - { - state = 99; - } - break; - case 1: - if (isdigit(c)) - { - valid = true; - s += c; - tval *= 10; - tval += c - '0'; - } - else - { - state = 99; - } - break; - case 10: + //printf("parseNumber |%s|\n",n.c_str()); + i = 0; + l = (uint32_t)n.length(); + s = ""; + for (i = 0; i < l; i++) + { + c = n[i]; + switch (state) + { + case 0: + if (c == '$') + { + state = 10; + } + else if (c == '%') + { + state = 20; + } + else if (c == '-') + { + if (!valid) + { + neg = !neg; + } + else + { + state = 99; + } + } + else if (isdigit(c)) + { + s += c; + valid = true; + state = 1; + tval = c - '0'; + } + else + { + state = 99; + } + break; + case 1: + if (isdigit(c)) + { + valid = true; + s += c; + tval *= 10; + tval += c - '0'; + } + else + { + state = 99; + } + break; + case 10: - if ((c >= 'a') && (c <= 'f')) - { - c = c - 0x20; // make it uppercase - s += c; - tval <<= 4; - tval |= (c - 'A') + 10; - valid = true; - } - else if ((c >= 'A') && (c <= 'F')) - { - s += c; - tval <<= 4; - tval |= (c - 'A') + 10; - valid = true; + if ((c >= 'a') && (c <= 'f')) + { + c = c - 0x20; // make it uppercase + s += c; + tval <<= 4; + tval |= (c - 'A') + 10; + valid = true; + } + else if ((c >= 'A') && (c <= 'F')) + { + s += c; + tval <<= 4; + tval |= (c - 'A') + 10; + valid = true; - } - else if ((c >= '0') && (c <= '9')) - { - s += c; - tval <<= 4;; - tval += c - '0'; - valid = true; - } - else { state = 99; } - break; - case 20: - if ((c >= '0') && (c <= '1')) - { - s += c; - tval <<= 1; - if (c == '1') - { - tval |= 1; - } - valid = true; - } - else if (c == '_') - { - // allow these in binary - } - else { state = 99; } - break; + } + else if ((c >= '0') && (c <= '9')) + { + s += c; + tval <<= 4;; + tval += c - '0'; + valid = true; + } + else + { + state = 99; + } + break; + case 20: + if ((c >= '0') && (c <= '1')) + { + s += c; + tval <<= 1; + if (c == '1') + { + tval |= 1; + } + valid = true; + } + else if (c == '_') + { + // allow these in binary + } + else + { + state = 99; + } + break; - case 99: - err = true; - // if you get into this state there is an error - break; - } - } + case 99: + err = true; + // if you get into this state there is an error + break; + } + } - uint32_t tv = (uint32_t)tval; - uint64_t tv1 = tv; - if (tv1 > (int64_t)0xFFFFFFFF) - { - setError(Token::overflowErr); - } + uint32_t tv = (uint32_t)tval; + uint64_t tv1 = tv; + if (tv1 > (int64_t)0xFFFFFFFF) + { + setError(Token::overflowErr); + } - if ((state == 99) || (err)) - { - setError(Token::syntaxErr); - valid = false; - val = DEF_VAL; - } + if ((state == 99) || (err)) + { + setError(Token::syntaxErr); + valid = false; + val = DEF_VAL; + } - if ((valid) && (!err)) - { - if (neg) - { - tval = -tval; - } - val = tval; - //printf("value=%08lX\n", val); - res = 0; - } - if (res != 0) - { - if (isDebug() > 2) - { - printf("parsenumber error result: %d\n", res); - } - } - return (res); + if ((valid) && (!err)) + { + if (neg) + { + tval = -tval; + } + val = tval; + //printf("value=%08lX\n", val); + res = 0; + } + if (res != 0) + { + if (isDebug() > 2) + { + printf("parsenumber error result: %d\n", res); + } + } + return (res); } void CLASS::setError(int ecode) { - if ((evalerror == Token::noError) || (ecode == Token::noError)) - { - evalerror = ecode; - } - if (evalerror == Token::noError) - { - badsymbol = ""; - } + if ((evalerror == Token::noError) || (ecode == Token::noError)) + { + evalerror = ecode; + } + if (evalerror == Token::noError) + { + badsymbol = ""; + } } -int CLASS::evaluate(std::string & e, int64_t &res, uint8_t &_shiftmode) +//int CLASS::evaluate(std::string & e, int64_t &res, uint8_t &_shiftmode) +int CLASS::evaluate(std::string & e, int64_t &res) { - // const std::string expr = "3+4*2/(1-5)^2^3"; // Wikipedia's example - // const std::string expr = "20-30/3+4*2^3"; + // const std::string expr = "3+4*2/(1-5)^2^3"; // Wikipedia's example + // const std::string expr = "20-30/3+4*2^3"; - _shiftmode = shiftmode = 0; - res = DEF_VAL; - setError(Token::noError); + //printf("\n|%s|\n",e.c_str()); + res=0; + //_shiftmode=0; - int u; - int64_t val; - std::string expr = Poco::trim(e); - expr += " "; // add a space at end to make parsing easier + //_shiftmode = shiftmode = 0; - if (isDebug() >= 3) - { - printf("eval: expression: |%s|\n", expr.c_str()); - } - const auto tokens = exprToTokens(expr); - auto queue = shuntingYard(tokens); - std::vector stack; + shiftStruct shift(e); + //printf("eval: |%s| %d\n",shift.shiftString.c_str(),shift.immediate); - // printf("\nCalculation\n"); - //printf("|%-3s|%-32s|%-10s|\n", "Tkn", "Queue", "Stack"); + res = DEF_VAL; + setError(Token::noError); - while (! queue.empty()) - { - //std::string op; + int u; + int64_t val; + std::string expr = Poco::trim(shift.shiftString); + expr += " "; // add a space at end to make parsing easier - const auto token = queue.front(); - queue.pop_front(); - switch (token.type) - { - case Token::Type::Symbol: - stack.push_back(std::stoi((char *)"0")); - //op = "Push " + token.str; - //printf("shouldn't get this kind of token\n"); - break; - case Token::Type::Ascii: - val = 0; - u = parseAscii(token.str, val); - if (u < 0) - { - setError(Token::numberErr); - val = DEF_VAL; - } - stack.push_back(val); - //op = "Push " + token.str; - break; + const auto tokens = exprToTokens(expr); + auto queue = shuntingYard(tokens); + std::vector stack; - case Token::Type::Number: - val = 0; - u = parseNumber(token.str, val); - if (u < 0) - { - setError(Token::numberErr); - val = DEF_VAL; - } - stack.push_back(val); - //op = "Push " + token.str; - break; + // printf("\nCalculation\n"); + //printf("|%-3s|%-32s|%-10s|\n", "Tkn", "Queue", "Stack"); - case Token::Type::Shift: - { - auto rhs = DEF_VAL; + while (! queue.empty()) + { + //std::string op; - if (stack.size() > 0) - { - rhs = stack.back(); - stack.pop_back(); - shiftmode = token.str[0]; + const auto token = queue.front(); + queue.pop_front(); + switch (token.type) + { + case Token::Type::Symbol: + stack.push_back(std::stoi((char *)"0")); + //op = "Push " + token.str; + //printf("shouldn't get this kind of token\n"); + break; + case Token::Type::Ascii: - if (token.str == "^") - { - //rhs = (rhs >> 16) &0xFFFF ; - } - else if (token.str == "|") - { - //rhs = (rhs >> 16) & 0xFFFF; - } - else if (token.str == "<") - { - //rhs = (rhs) & 0xFFFF; - } - else if (token.str == ">") - { - //rhs=(rhs>>8) & 0xFFFF; - } + val = 0; + u = parseAscii(token.str, val); + if (u < 0) + { + setError(Token::numberErr); + val = DEF_VAL; + } + stack.push_back(val); + //op = "Push " + token.str; + break; - stack.push_back(rhs); - } - else - { - //printf("nothing on stack\n"); - } - } - break; - case Token::Type::Operator: - { + case Token::Type::Number: + val = 0; + u = parseNumber(token.str, val); + if (u < 0) + { + setError(Token::numberErr); + val = DEF_VAL; + } + stack.push_back(val); + //op = "Push " + token.str; + break; + case Token::Type::Operator: + { - auto rhs = DEF_VAL; - auto lhs = DEF_VAL; + auto rhs = DEF_VAL; + auto lhs = DEF_VAL; - bool v = true; - if (stack.size() > 0) - { - rhs = stack.back(); - stack.pop_back(); - } - else - { - v = false; - } - if (stack.size() > 0) - { - lhs = stack.back(); - stack.pop_back(); - } - else - { - v = false; - } + bool v = true; + if (stack.size() > 0) + { + rhs = stack.back(); + stack.pop_back(); + } + else + { + v = false; + } + if (stack.size() > 0) + { + lhs = stack.back(); + stack.pop_back(); + } + else + { + v = false; + } - if (!v) - { - setError(Token::badParamErr); - //printf("not enough parameters for the operator\n"); - } + if (!v) + { + setError(Token::badParamErr); + //printf("not enough parameters for the operator\n"); + } - switch (token.str[0]) - { - default: - setError(Token::operatorErr); - //printf("Operator error [%s]\n", token.str.c_str()); - return (-1); - break; - case '^': - stack.push_back(static_cast(pow(lhs, rhs))); - break; - case '*': - stack.push_back(lhs * rhs); - break; - case '/': - if (rhs != 0) - { - stack.push_back(lhs / rhs); - } - else - { - stack.push_back(0); - } - break; - case '+': - stack.push_back(lhs + rhs); - break; - case '-': - stack.push_back(lhs - rhs); - break; - case '!': - stack.push_back(lhs ^ rhs); - break; - case '&': - stack.push_back(lhs & rhs); - break; - break; case '.': - stack.push_back(lhs | rhs); - break; - } - } - break; + switch (token.str[0]) + { + default: + setError(Token::operatorErr); + //printf("Operator error [%s]\n", token.str.c_str()); + return (-1); + break; + case '^': + stack.push_back(static_cast(pow(lhs, rhs))); + break; + case '*': + stack.push_back(lhs * rhs); + break; + case '/': + if (rhs != 0) + { + stack.push_back(lhs / rhs); + } + else + { + stack.push_back(0); + } + break; + case '+': + stack.push_back(lhs + rhs); + break; + case '-': + stack.push_back(lhs - rhs); + break; + case '!': + stack.push_back(lhs ^ rhs); + break; + case '&': + stack.push_back(lhs & rhs); + break; + break; + case '.': + stack.push_back(lhs | rhs); + break; + } + } + break; - default: - //printf("Token error\n"); - setError(Token::syntaxErr); - goto out; - } - } + default: + //printf("Token error\n"); + setError(Token::syntaxErr); + goto out; + } + } out: - int64_t v = DEF_VAL; - if (stack.size() > 0) - { - v = stack.back(); - } - else - { - setError(Token::syntaxErr); - } - _shiftmode = shiftmode; - res = v; - return (evalerror); + int64_t v = DEF_VAL; + if (stack.size() > 0) + { + v = stack.back(); + if (isDebug() > 0) + { + printf("eval: expression: |%s| %08lX\n", expr.c_str(),v); + } + } + else + { + setError(Token::syntaxErr); + } + //_shiftmode = shiftmode; + res = v; + return (evalerror); } diff --git a/eval.h b/eval.h index f0ed9a2..8705c53 100644 --- a/eval.h +++ b/eval.h @@ -5,15 +5,7 @@ // // https://ideone.com/kn4FUu // -#include "asm.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "qasm.h" #define CLASS TEvaluator @@ -42,7 +34,7 @@ public: Number, Symbol, Ascii, - Shift, + //Shift, Operator, LeftParen, RightParen, @@ -64,7 +56,7 @@ protected: T65816Asm &assembler; int evalerror; void setError(int ecode); - uint8_t shiftmode; + //uint8_t shiftmode; public: CLASS(T65816Asm &_asm); ~CLASS(); @@ -75,7 +67,7 @@ public: int parseNumber(std::string n, int64_t &val); int parseAscii(std::string n, int64_t &val); - int evaluate(std::string &expr, int64_t &res, uint8_t &_shiftmode); + int evaluate(std::string &expr, int64_t &res); }; diff --git a/macros/Ace.Macs.s b/macros/Ace.Macs.s new file mode 100644 index 0000000..c23225c --- /dev/null +++ b/macros/Ace.Macs.s @@ -0,0 +1,62 @@ +* ACE tool macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; + +_ACEBootInit MAC + Tool $11D + <<< +~ACEStartUp MAC + PHW ]1 +_ACEStartUp MAC + Tool $21D + <<< +_ACEShutDown MAC + Tool $31D + <<< +~ACEVersion MAC + PHA +_ACEVersion MAC + Tool $41D + <<< +_ACEReset MAC + Tool $51D + <<< +~ACEStatus MAC + PHA +_ACEStatus MAC + Tool $61D + <<< +~ACEInfo MAC + P2SW ]1 +_ACEInfo MAC + Tool $71D + <<< +~ACECompress MAC + PxL ]1;]2;]3;]4 + PxW ]5;]6 +_ACECompress MAC + Tool $91D + <<< +~ACEExpand MAC + PxL ]1;]2;]3;]4 + PxW ]5;]6 +_ACEExpand MAC + Tool $A1D + <<< +_ACECompBegin MAC + Tool $B1D + <<< +_ACEExpBegin MAC + Tool $C1D + <<< +_GetACEExpState MAC + Tool $D1D + <<< +_SetACEExpState MAC + Tool $E1D + <<< + diff --git a/macros/Adb.Macs.s b/macros/Adb.Macs.s new file mode 100644 index 0000000..d118a3e --- /dev/null +++ b/macros/Adb.Macs.s @@ -0,0 +1,91 @@ +* Desktop Bus tool macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_ADBBootInit MAC + Tool $109 + <<< +_ADBStartUp MAC + Tool $209 + <<< +_ADBShutDown MAC + Tool $309 + <<< +_ADBVersion MAC + Tool $409 + <<< +_ADBReset MAC + Tool $509 + <<< +~ADBStatus MAC + PHA +_ADBStatus MAC + Tool $609 + <<< +~SendInfo MAC + PHW ]1 + PHLW ]2;]3 +_SendInfo MAC + Tool $909 + <<< +~ReadKeyMicroData MAC + PHW ]1 + PHLW ]2;]3 +_ReadKeyMicroData MAC + Tool $A09 + <<< +~ReadKeyMicroMem MAC + PxL ]1;]2 + PHW ]3 +_ReadKeyMicroMem MAC + Tool $B09 + <<< +~AsyncADBReceive MAC + PHLW ]1;]2 +_AsyncADBReceive MAC + Tool $D09 + <<< +~SyncADBReceive MAC + PHW ]1 + PHLW ]2;]3 +_SyncADBReceive MAC + Tool $E09 + <<< +_AbsOn MAC + Tool $F09 + <<< +_AbsOff MAC + Tool $1009 + <<< +~ReadAbs MAC + PHA +_ReadAbs MAC + Tool $1109 + <<< +~GetAbsScale MAC + PHL ]1 +_GetAbsScale MAC + Tool $1209 + <<< +~SetAbsScale MAC + PHL ]1 +_SetAbsScale MAC + Tool $1309 + <<< +~SRQPoll MAC + PHLW ]1;]2 +_SRQPoll MAC + Tool $1409 + <<< +~SRQRemove MAC + PHW ]1 +_SRQRemove MAC + Tool $1509 + <<< +_ClearSRQTable MAC + Tool $1609 + <<< + diff --git a/macros/Anim.s b/macros/Anim.s new file mode 100644 index 0000000..4b4f63e --- /dev/null +++ b/macros/Anim.s @@ -0,0 +1,83 @@ +* +* Anim Tool Set +* + +_AnimBootInit MAC + Tool $0125 + <<< +_AnimStartUp MAC + Tool $0225 + <<< +_AnimShutDown MAC + Tool $0325 + <<< +_AnimVersion MAC + Tool $0425 + <<< +_AnimReset MAC + Tool $0525 + <<< +_AnimStatus MAC + Tool $0623 + <<< +_AnimIdleDebug MAC + Tool $0825 + <<< +_StartScene MAC + Tool $0925 + <<< +_StopScene MAC + Tool $0A25 + <<< +_StartFrameTimer MAC + Tool $0B25 + <<< +_StopFrameTimer MAC + Tool $0C25 + <<< +_SetBackGndPort MAC + Tool $0D25 + <<< +_RefreshBack MAC + Tool $0E25 + <<< +_StartChar MAC + Tool $0F25 + <<< +_MoveChar MAC + Tool $1025 + <<< +_GetCharRecPtr MAC + Tool $1125 + <<< +_KillChar MAC + Tool $1225 + <<< +_LoadActor MAC + Tool $1325 + <<< +_SetCharScript MAC + Tool $1425 + <<< +_RunAnimScripts MAC + Tool $1525 + <<< +_FillAddrTable MAC + Tool $1625 + <<< +_CompileRect MAC + Tool $1725 + <<< +_StartTockTask MAC + Tool $1825 + <<< +_FireTockTask MAC + Tool $1925 + <<< +_SetForeGndPort MAC + Tool $1A25 + <<< +_SetAnimWindow MAC + Tool $1B25 + <<< + diff --git a/macros/Ctl.Macs.s b/macros/Ctl.Macs.s new file mode 100644 index 0000000..413fbce --- /dev/null +++ b/macros/Ctl.Macs.s @@ -0,0 +1,305 @@ +* Control Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_CtlBootInit MAC + Tool $110 + <<< +~CtlStartUp MAC + PxW ]1;]2 +_CtlStartUp MAC +_InitCtrlMgr MAC + Tool $210 + <<< +_CtlShutDown MAC +_CtrlShutDown MAC + Tool $310 + <<< +~CtlVersion MAC + PHA +_CtlVersion MAC + Tool $410 + <<< +_CtlReset MAC + Tool $510 + <<< +~CtlStatus MAC + PHA +_CtlStatus MAC + Tool $610 + <<< +_NewControl MAC + Tool $910 + <<< +~DisposeControl MAC + PHL ]1 +_DisposeControl MAC + Tool $A10 + <<< +~KillControls MAC + PHL ]1 +_KillControls MAC + Tool $B10 + <<< +~SetCtlTitle MAC + PxL ]1;]2 +_SetCtlTitle MAC + Tool $C10 + <<< +~GetCtlTitle MAC + P2SL ]1 +_GetCtlTitle MAC + Tool $D10 + <<< +~HideControl MAC + PHL ]1 +_HideControl MAC + Tool $E10 + <<< +~ShowControl MAC + PHL ]1 +_ShowControl MAC + Tool $F10 + <<< +~DrawControls MAC + PHL ]1 +_DrawControls MAC + Tool $1010 + <<< +~HiliteControl MAC + PHWL ]1;]2 +_HiliteControl MAC + Tool $1110 + <<< +_CtlNewRes MAC + Tool $1210 + <<< +~FindControl MAC + PHA + PHLW ]1;]2 + PHWL ]3;]4 +_FindControl MAC + Tool $1310 + <<< +~TestControl MAC + P1SW ]1 + PHWL ]2;]3 +_TestControl MAC + Tool $1410 + <<< +~TrackControl MAC + PHA + PxW ]1;]2 + PxL ]3;]4 +_TrackControl MAC + Tool $1510 + <<< +~MoveControl MAC + PxW ]1;]2 + PHL ]3 +_MoveControl MAC + Tool $1610 + <<< +~DragControl MAC + PxW ]1;]2 + PxL ]3;]4 + PHWL ]5;]6 +_DragControl MAC + Tool $1710 + <<< +~SetCtlIcons MAC + P2SL ]1 +_SetCtlIcons MAC + Tool $1810 + <<< +~SetCtlValue MAC + PHWL ]1;]2 +_SetCtlValue MAC + Tool $1910 + <<< +~GetCtlValue MAC + P1SL ]1 +_GetCtlValue MAC + Tool $1A10 + <<< +~SetCtlParams MAC + PxW ]1;]2 + PHL ]3 +_SetCtlParams MAC + Tool $1B10 + <<< +~GetCtlParams MAC + P2SL ]1 +_GetCtlParams MAC + Tool $1C10 + <<< +~DragRect MAC + P2SL ]1 + PHLW ]2;]3 + PHWL ]4;]5 + PxL ]6;]7 + PHW ]8 +_DragRect MAC + Tool $1D10 + <<< +~GrowSize MAC + PHS 2 +_GrowSize MAC + Tool $1E10 + <<< +~GetCtlDpage MAC + PHA +_GetCtlDpage MAC + Tool $1F10 + <<< +~SetCtlAction MAC + PxL ]1;]2 +_SetCtlAction MAC + Tool $2010 + <<< +~GetCtlAction MAC + P2SL ]1 +_GetCtlAction MAC + Tool $2110 + <<< +~SetCtlRefCon MAC + PxL ]1;]2 +_SetCtlRefCon MAC + Tool $2210 + <<< +~GetCtlRefCon MAC + P2SL ]1 +_GetCtlRefCon MAC + Tool $2310 + <<< +~EraseControl MAC + PHL ]1 +_EraseControl MAC + Tool $2410 + <<< +~DrawOneCtl MAC + PHL ]1 +_DrawOneCtl MAC + Tool $2510 + <<< +~FindTargetCtl MAC + PHS 2 +_FindTargetCtl MAC + Tool $2610 + <<< +~MakeNextCtlTarget MAC + PHS 2 +_MakeNextCtlTarget MAC + Tool $2710 + <<< +~MakeThisCtlTarget MAC + PHL ]1 +_MakeThisCtlTarget MAC + Tool $2810 + <<< +~SendEventToCtl MAC + P1SW ]1 + PxL ]2;]3 +_SendEventToCtl MAC + Tool $2910 + <<< +~GetCtlID MAC + P2SL ]1 +_GetCtlID MAC + Tool $2A10 + <<< +~SetCtlID MAC + PxL ]1;]2 +_SetCtlID MAC + Tool $2B10 + <<< +~CallCtlDefProc MAC + PHLW ]1;]2 + PHL ]3 +_CallCtlDefProc MAC + Tool $2C10 + <<< +~NotifyCtls MAC + PxW ]1;]2 + PxL ]3;]4 +_NotifyCtls MAC + Tool $2D10 + <<< +~GetCtlMoreFlags MAC + P1SL ]1 +_GetCtlMoreFlags MAC + Tool $2E10 + <<< +~SetCtlMoreFlags MAC + PHWL ]1;]2 +_SetCtlMoreFlags MAC + Tool $2F10 + <<< +~GetCtlHandleFromID MAC + PHS 2 + PxL ]1;]2 +_GetCtlHandleFromID MAC + Tool $3010 + <<< +~NewControl2 MAC + P2SL ]1 + PHWL ]2;]3 +_NewControl2 MAC + Tool $3110 + <<< +~CMLoadResource MAC + P2SW ]1 + PHL ]2 +_CMLoadResource MAC + Tool $3210 + <<< +~CMReleaseResource MAC + PHWL ]1;]2 +_CMReleaseResource MAC + Tool $3310 + <<< +~SetCtlParamPtr MAC + PHL ]1 +_SetCtlParamPtr MAC + Tool $3410 + <<< +~GetCtlParamPtr MAC + PHS 2 +_GetCtlParamPtr MAC + Tool $3510 + <<< +~InvalCtls MAC + PHL ]1 +_InvalCtls MAC + Tool $3710 + <<< +~qCtlStartUp MAC + PHW ]1 + NextDP ]2;$100 + Tool $210 + <<< +_FindRadioButton MAC + Tool $3910 + <<< +_SetLETextByID MAC + Tool $3A10 + <<< +_GetLETextByID MAC + Tool $3B10 + <<< +_SetCtlValueByID MAC + Tool $3C10 + <<< +_GetCtlValueByID MAC + Tool $3D10 + <<< +_InvalOneCtlByID MAC + Tool $3E10 + <<< +_HiliteCtlByID MAC + Tool $3F10 + <<< + diff --git a/macros/Desk.Macs.s b/macros/Desk.Macs.s new file mode 100644 index 0000000..7e9057f --- /dev/null +++ b/macros/Desk.Macs.s @@ -0,0 +1,143 @@ +* Desk Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_DeskBootInit MAC + Tool $105 + <<< +_DeskStartUp MAC + Tool $205 + <<< +_DeskShutDown MAC + Tool $305 + <<< +~DeskVersion MAC + PHA +_DeskVersion MAC + Tool $405 + <<< +_DeskReset MAC + Tool $505 + <<< +~DeskStatus MAC + PHA +_DeskStatus MAC + Tool $605 + <<< +_SaveScrn MAC + Tool $905 + <<< +_RestScrn MAC + Tool $A05 + <<< +_SaveAll MAC + Tool $B05 + <<< +_RestAll MAC + Tool $C05 + <<< +~InstallNDA MAC + PHL ]1 +_InstallNDA MAC + Tool $E05 + <<< +~InstallCDA MAC + PHL ]1 +_InstallCDA MAC + Tool $F05 + <<< +_ChooseCDA MAC + Tool $1105 + <<< +~SetDAStrPtr MAC + PxL ]1;]2 +_SetDAStrPtr MAC + Tool $1305 + <<< +~GetDAStrPtr MAC + PHS 2 +_GetDAStrPtr MAC + Tool $1405 + <<< +~OpenNDA MAC + P1SW ]1 +_OpenNDA MAC + Tool $1505 + <<< +~CloseNDA MAC + PHW ]1 +_CloseNDA MAC + Tool $1605 + <<< +~SystemClick MAC + PxL ]1;]2 + PHW ]3 +_SystemClick MAC + Tool $1705 + <<< +~SystemEdit MAC + P1SW ]1 +_SystemEdit MAC + Tool $1805 + <<< +_SystemTask MAC + Tool $1905 + <<< +~SystemEvent MAC + P1SW ]1 + PxL ]2;]3;]4 + PHW ]5 +_SystemEvent MAC + Tool $1A05 + <<< +~GetNumNDAs MAC + PHA +_GetNumNDAs MAC + Tool $1B05 + <<< +~CloseNDAbyWinPtr MAC + PHL ]1 +_CloseNDAbyWinPtr MAC + Tool $1C05 + <<< +_CloseAllNDAs MAC + Tool $1D05 + <<< +~FixAppleMenu MAC + PHW ]1 +_FixAppleMenu MAC + Tool $1E05 + <<< +~AddToRunQ MAC + PHL ]1 +_AddToRunQ MAC + Tool $1F05 + <<< +~RemoveFromRunQ MAC + PHL ]1 +_RemoveFromRunQ MAC + Tool $2005 + <<< +~RemoveCDA MAC + PHL ]1 +_RemoveCDA MAC + Tool $2105 + <<< +~RemoveNDA MAC + PHL ]1 +_RemoveNDA MAC + Tool $2205 + <<< +_GetDeskAccInfo MAC + Tool $2305 + <<< +_CallDeskAcc MAC + Tool $2405 + <<< +_GetDeskGlobal MAC + Tool $2505 + <<< + diff --git a/macros/Dialog.Macs.s b/macros/Dialog.Macs.s new file mode 100644 index 0000000..3fde1f2 --- /dev/null +++ b/macros/Dialog.Macs.s @@ -0,0 +1,285 @@ +* Dialog Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_DialogBootInit MAC + Tool $115 + <<< +~DialogStartUp MAC + PHW ]1 +_DialogStartUp MAC + Tool $215 + <<< +_DialogShutDown MAC + Tool $315 + <<< +~DialogVersion MAC + PHA +_DialogVersion MAC + Tool $415 + <<< +_DialogReset MAC + Tool $515 + <<< +~DialogStatus MAC + PHA +_DialogStatus MAC + Tool $615 + <<< +~ErrorSound MAC + PHL ]1 +_ErrorSound MAC + Tool $915 + <<< +~NewModalDialog MAC + P2SL ]1 + PHWL ]2;]3 +_NewModalDialog MAC + Tool $A15 + <<< +~NewModelessDialog MAC + P2SL ]1 + PxL ]2;]3 + PHWL ]4;]5 + PHL ]6 +_NewModelessDialog MAC + Tool $B15 + <<< +~CloseDialog MAC + PHL ]1 +_CloseDialog MAC + Tool $C15 + <<< +~NewDItem MAC + PHLW ]1;]2 + PHLW ]3;]4 + PHLW ]5;]6 + PHWL ]7;]8 +_NewDItem MAC + Tool $D15 + <<< +~RemoveDItem MAC + PHLW ]1;]2 +_RemoveDItem MAC + Tool $E15 + <<< +~ModalDialog MAC + P1SL ]1 +_ModalDialog MAC + Tool $F15 + <<< +~IsDialogEvent MAC + P1SL ]1 +_IsDialogEvent MAC + Tool $1015 + <<< +~DialogSelect MAC + P1SL ]1 + PxL ]2;]3 +_DialogSelect MAC + Tool $1115 + <<< +~DlgCut MAC + PHL ]1 +_DlgCut MAC + Tool $1215 + <<< +~DlgCopy MAC + PHL ]1 +_DlgCopy MAC + Tool $1315 + <<< +~DlgPaste MAC + PHL ]1 +_DlgPaste MAC + Tool $1415 + <<< +~DlgDelete MAC + PHL ]1 +_DlgDelete MAC + Tool $1515 + <<< +~DrawDialog MAC + PHL ]1 +_DrawDialog MAC + Tool $1615 + <<< +~Alert MAC + PHA + PxL ]1;]2 +_Alert MAC + Tool $1715 + <<< +~StopAlert MAC + PHA + PxL ]1;]2 +_StopAlert MAC + Tool $1815 + <<< +~NoteAlert MAC + PHA + PxL ]1;]2 +_NoteAlert MAC + Tool $1915 + <<< +~CautionAlert MAC + PHA + PxL ]1;]2 +_CautionAlert MAC + Tool $1A15 + <<< +~ParamText MAC + PxL ]1;]2;]3;]4 +_ParamText MAC + Tool $1B15 + <<< +~SetDAFont MAC + PHL ]1 +_SetDAFont MAC + Tool $1C15 + <<< +~GetControlDItem MAC + PHS 2 + PHLW ]1;]2 +_GetControlDItem MAC + Tool $1E15 + <<< +~GetIText MAC + PHL ]1 + PHWL ]2;]3 +_GetIText MAC + Tool $1F15 + <<< +~SetIText MAC + PHL ]1 + PHWL ]2;]3 +_SetIText MAC + Tool $2015 + <<< +~SelectIText MAC + PHL ]1 + PxW ]2;]3;]4 +_SelectIText MAC + Tool $2115 + <<< +~HideDItem MAC + PHLW ]1;]2 +_HideDItem MAC + Tool $2215 + <<< +~ShowDItem MAC + PHLW ]1;]2 +_ShowDItem MAC + Tool $2315 + <<< +~FindDItem MAC + PHA + PxL ]1;]2 +_FindDItem MAC + Tool $2415 + <<< +~UpdateDialog MAC + PxL ]1;]2 +_UpdateDialog MAC + Tool $2515 + <<< +~GetDItemType MAC + PHA + PHLW ]1;]2 +_GetDItemType MAC + Tool $2615 + <<< +~SetDItemType MAC + PHW ]1 + PHLW ]2;]3 +_SetDItemType MAC + Tool $2715 + <<< +~GetDItemBox MAC + PHL ]1 + PHWL ]2;]3 +_GetDItemBox MAC + Tool $2815 + <<< +~SetDItemBox MAC + PHL ]1 + PHWL ]2;]3 +_SetDItemBox MAC + Tool $2915 + <<< +~GetFirstDItem MAC + P1SL ]1 +_GetFirstDItem MAC + Tool $2A15 + <<< +~GetNextDItem MAC + PHA + PHLW ]1;]2 +_GetNextDItem MAC + Tool $2B15 + <<< +~ModalDialog2 MAC + P2SL ]1 +_ModalDialog2 MAC + Tool $2C15 + <<< +~GetDItemValue MAC + PHA + PHLW ]1;]2 +_GetDItemValue MAC + Tool $2E15 + <<< +~SetDItemValue MAC + PHW ]1 + PHLW ]2;]3 +_SetDItemValue MAC + Tool $2F15 + <<< +~GetNewModalDialog MAC + P2SL ]1 +_GetNewModalDialog MAC + Tool $3215 + <<< +~GetNewDItem MAC + PxL ]1;]2 +_GetNewDItem MAC + Tool $3315 + <<< +~GetAlertStage MAC + PHA +_GetAlertStage MAC + Tool $3415 + <<< +_ResetAlertStage MAC + Tool $3515 + <<< +~DefaultFilter MAC + PHA + PxL ]1;]2;]3 +_DefaultFilter MAC + Tool $3615 + <<< +~GetDefButton MAC + P1SL ]1 +_GetDefButton MAC + Tool $3715 + <<< +~SetDefButton MAC + PHWL ]1;]2 +_SetDefButton MAC + Tool $3815 + <<< +~DisableDItem MAC + PHLW ]1;]2 +_DisableDItem MAC + Tool $3915 + <<< +~EnableDItem MAC + PHLW ]1;]2 +_EnableDItem MAC + Tool $3A15 + <<< + diff --git a/macros/Dos.16.Macs.s b/macros/Dos.16.Macs.s new file mode 100644 index 0000000..f154166 --- /dev/null +++ b/macros/Dos.16.Macs.s @@ -0,0 +1,177 @@ +*=============================== +* ProDOS-16 macro and equates +* +* Use with syntax: +* +* _CMDNAME PARMADR +* +* where "CMDNAME" is one of the +* following labels and "PARMADR" +* is the label of the parameters +* table to use. +* +*------------------------------- + +; +; Copyright Apple Computer, Inc. 1986, 1987 +; All Rights Reserved +; +open = $10 +read = $12 +write = $13 +close = $14 + +_CREATE MAC + DOS16 $01;]1 + <<< + +_DESTROY MAC + DOS16 $02;]1 + <<< + +_CHANGE_PATH MAC + DOS16 $04;]1 + <<< + +_SET_FILE_INFO MAC + DOS16 $05;]1 + <<< + +_GET_FILE_INFO MAC + DOS16 $06;]1 + <<< + +_VOLUME MAC + DOS16 $08;]1 + <<< + +_SET_PREFIX MAC + DOS16 $09;]1 + <<< + +_SETPREFIX MAC ; alternate name + DOS16 $09;]1 + <<< + +_GET_PREFIX MAC + DOS16 $0A;]1 + <<< + +_GETPREFIX MAC ; alternate name + DOS16 $0A;]1 + <<< + +_CLEAR_BACKUP_BIT MAC + DOS16 $0B;]1 + <<< + +_OPEN MAC + DOS16 $10;]1 + <<< + +_NEWLINE MAC + DOS16 $11;]1 + <<< + +_READ MAC + DOS16 $12;]1 + <<< + +_WRITE MAC + DOS16 $13;]1 + <<< + +_CLOSE MAC + DOS16 $14;]1 + <<< + +_FLUSH MAC + DOS16 $15;]1 + <<< + +_SET_MARK MAC + DOS16 $16;]1 + <<< + +_GET_MARK MAC + DOS16 $17;]1 + <<< + +_SET_EOF MAC + DOS16 $18;]1 + <<< + +_GET_EOF MAC + DOS16 $19;]1 + <<< + +_SET_LEVEL MAC + DOS16 $1A;]1 + <<< + +_GET_LEVEL MAC + DOS16 $1B;]1 + <<< + +_GET_DIR_ENTRY MAC + DOS16 $1C;]1 + <<< + +_GET_DEV_NUM MAC + DOS16 $20;]1 + <<< + +_GET_LAST_DEV MAC + DOS16 $21;]1 + <<< + +_READ_BLOCK MAC + DOS16 $22;]1 + <<< + +_WRITE_BLOCK MAC + DOS16 $23;]1 + <<< + +_FORMAT MAC + DOS16 $24;]1 + <<< + +_ERASE_DISK MAC + DOS16 $25;]1 + <<< + +_GET_NAME MAC + DOS16 $27;]1 + <<< + +_GET_BOOT_VOL MAC + DOS16 $28;]1 + <<< + +_QUIT MAC + DOS16 $29;]1 + <<< + +_GET_VERSION MAC + DOS16 $2A;]1 + <<< + +_D_INFO MAC + DOS16 $2C;]1 + <<< + +_ALLOC_INTERRUPT MAC + DOS16 $31;]1 + <<< + +_DEALLOC_INTERRUPT MAC + DOS16 $32;]1 + <<< + +DOS16 MAC + JSL $E100A8 + DA ]1 ; Change to ]1.$2000 for Class 1 P16 calls. + ADRL ]2 + <<< + diff --git a/macros/Dos.8.Macs.s b/macros/Dos.8.Macs.s new file mode 100644 index 0000000..3f0ec1a --- /dev/null +++ b/macros/Dos.8.Macs.s @@ -0,0 +1,142 @@ +*=============================== +* ProDOS-8 macro and equates +* +* Use with syntax: +* +* command PARMADR +* +* where "command" is one of the +* following labels and "PARMADR" +* is the label of the parameters +* table to use. +* +*------------------------------- + +; +; Copyright Apple Computer, Inc. 1986, 1987 +; All Rights Reserved +; +* MLI call codes: + +ALLOC_INTERRUPT MAC + DOS8 $40;]1 + <<< + +DEALLOC_INTERRUPT MAC + DOS8 $41;]1 + <<< + +APPLE_TALK MAC + DOS8 $42;]1 + <<< + +SPECIAL_OPEN_FORK MAC + DOS8 $43;]1 + <<< + +BYTE_RANGE_LOCK MAC + DOS8 $44;]1 + <<< + +QUIT MAC + DOS8 $65;]1 + <<< + +READ_BLOCK MAC + DOS8 $80;]1 + <<< + +WRITE_BLOCK MAC + DOS8 $81;]1 + <<< + +GET_TIME MAC + DOS8 $82;]1 + <<< + +CREATE MAC + DOS8 $C0;]1 + <<< + +DESTROY MAC + DOS8 $C1;]1 + <<< + +RENAME MAC + DOS8 $C2;]1 + <<< + +SET_FILE_INFO MAC + DOS8 $C3;]1 + <<< + +GET_FILE_INFO MAC + DOS8 $C4;]1 + <<< + +ON_LINE MAC + DOS8 $C5;]1 + <<< + +SET_PREFIX MAC + DOS8 $C6;]1 + <<< + +GET_PREFIX MAC + DOS8 $C7;]1 + <<< + +OPEN MAC + DOS8 $C8;]1 + <<< + +NEWLINE MAC + DOS8 $C9;]1 + <<< + +READ MAC + DOS8 $CA;]1 + <<< + +WRITE MAC + DOS8 $CB;]1 + <<< + +CLOSE MAC + DOS8 $CC;]1 + <<< + +FLUSH MAC + DOS8 $CD;]1 + <<< + +SET_MARK MAC + DOS8 $CE;]1 + <<< + +GET_MARK MAC + DOS8 $CF;]1 + <<< + +SET_EOF MAC + DOS8 $D0;]1 + <<< + +GET_EOF MAC + DOS8 $D1;]1 + <<< + +SET_BUF MAC + DOS8 $D2;]1 + <<< + +GET_BUF MAC + DOS8 $D3;]1 + <<< + +DOS8 MAC + JSR $BF00 + DFB ]1 + DA ]2 + <<< + diff --git a/macros/Event.Macs.s b/macros/Event.Macs.s new file mode 100644 index 0000000..5c40376 --- /dev/null +++ b/macros/Event.Macs.s @@ -0,0 +1,144 @@ +* Event Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_EMBootInit MAC + Tool $106 + <<< +~EMStartUp MAC + PxW ]1;]2;]3;]4 + PxW ]5;]6;]7 +_EMStartUp MAC + Tool $206 + <<< +_EMShutDown MAC + Tool $306 + <<< +~EMVersion MAC + PHA +_EMVersion MAC + Tool $406 + <<< +_EMReset MAC + Tool $506 + <<< +~EMStatus MAC + PHA +_EMStatus MAC + Tool $606 + <<< +~DoWindows MAC + PHA +_DoWindows MAC + Tool $906 + <<< +~GetNextEvent MAC + PHA + PHWL ]1;]2 +_GetNextEvent MAC + Tool $A06 + <<< +~EventAvail MAC + PHA + PHWL ]1;]2 +_EventAvail MAC + Tool $B06 + <<< +~GetMouse MAC + PHL ]1 +_GetMouse MAC + Tool $C06 + <<< +~Button MAC + P1SW ]1 +_Button MAC + Tool $D06 + <<< +~StillDown MAC + P1SW ]1 +_StillDown MAC + Tool $E06 + <<< +~WaitMouseUp MAC + P1SW ]1 +_WaitMouseUp MAC + Tool $F06 + <<< +~TickCount MAC + PHS 2 +_TickCount MAC + Tool $1006 + <<< +~GetDblTime MAC + PHS 2 +_GetDblTime MAC + Tool $1106 + <<< +~GetCaretTime MAC + PHS 2 +_GetCaretTime MAC + Tool $1206 + <<< +_SetSwitch MAC + Tool $1306 + <<< +~PostEvent MAC + PHA + PHWL ]1;]2 +_PostEvent MAC + Tool $1406 + <<< +~FlushEvents MAC + PHA + PxW ]1;]2 +_FlushEvents MAC + Tool $1506 + <<< +~GetOSEvent MAC + PHA + PHWL ]1;]2 +_GetOSEvent MAC + Tool $1606 + <<< +~OSEventAvail MAC + PHA + PHWL ]1;]2 +_OSEventAvail MAC + Tool $1706 + <<< +~SetEventMask MAC + PHW ]1 +_SetEventMask MAC + Tool $1806 + <<< +~FakeMouse MAC + PxW ]1;]2;]3;]4 + PHW ]5 +_FakeMouse MAC + Tool $1906 + <<< +~SetAutoKeyLimit MAC + PHW ]1 +_SetAutoKeyLimit MAC + Tool $1A06 + <<< +~GetKeyTranslation MAC + P1SW ]1 +_GetKeyTranslation MAC + Tool $1B06 + <<< +~SetKeyTranslation MAC + PHW ]1 +_SetKeyTranslation MAC + Tool $1C06 + <<< +~qEMStartUp MAC + NextDP ]1;$100 + PxW ]2;]3;]4;]5 + PxW ]6;]7 + Tool $206 + <<< + diff --git a/macros/Female.Macs.s b/macros/Female.Macs.s new file mode 100644 index 0000000..cbe99f6 --- /dev/null +++ b/macros/Female.Macs.s @@ -0,0 +1,26 @@ +* +* Female Voice tool calls +* + +_FemaleBootInit mac + Tool $0133 + <<< +_FemaleStartUp mac + Tool $0233 + <<< +_FemaleShutDown mac + Tool $0333 + <<< +_FemaleVersion mac + Tool $0433 + <<< +_FemaleReset mac + Tool $0533 + <<< +_FemaleStatus mac + Tool $0633 + <<< +_FemaleSpeak mac + Tool $0933 + <<< + diff --git a/macros/Font.Macs.s b/macros/Font.Macs.s new file mode 100644 index 0000000..5696b44 --- /dev/null +++ b/macros/Font.Macs.s @@ -0,0 +1,142 @@ +* Font Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_FMBootInit MAC + Tool $11B + <<< +~FMStartUp MAC + PxW ]1;]2 +_FMStartUp MAC + Tool $21B + <<< +_FMShutDown MAC + Tool $31B + <<< +~FMVersion MAC + PHA +_FMVersion MAC + Tool $41B + <<< +_FMReset MAC + Tool $51B + <<< +~FMStatus MAC + PHA +_FMStatus MAC + Tool $61B + <<< +~CountFamilies MAC + P1SW ]1 +_CountFamilies MAC + Tool $91B + <<< +~FindFamily MAC + P1SW ]1 + PHWL ]2;]3 +_FindFamily MAC + Tool $A1B + <<< +~GetFamInfo MAC + PHA + PHWL ]1;]2 +_GetFamInfo MAC + Tool $B1B + <<< +~GetFamNum MAC + P1SL ]1 +_GetFamNum MAC + Tool $C1B + <<< +~AddFamily MAC + PHWL ]1;]2 +_AddFamily MAC + Tool $D1B + <<< +~InstallFont MAC + PHLW ]1;]2 +_InstallFont MAC + Tool $E1B + <<< +~SetPurgeStat MAC + PHLW ]1;]2 +_SetPurgeStat MAC + Tool $F1B + <<< +~CountFonts MAC + P1SL ]1 + PHW ]2 +_CountFonts MAC + Tool $101B + <<< +~FindFontStats MAC + PHLW ]1;]2 + PHWL ]3;]4 +_FindFontStats MAC + Tool $111B + <<< +~LoadFont MAC + PHLW ]1;]2 + PHWL ]3;]4 +_LoadFont MAC + Tool $121B + <<< +_LoadSysFont MAC + Tool $131B + <<< +~AddFontVar MAC + PHLW ]1;]2 +_AddFontVar MAC + Tool $141B + <<< +~FixFontMenu MAC + PxW ]1;]2;]3 +_FixFontMenu MAC + Tool $151B + <<< +~ChooseFont MAC + P2SL ]1 + PHW ]2 +_ChooseFont MAC + Tool $161B + <<< +~ItemID2FamNum MAC + P1SW ]1 +_ItemID2FamNum MAC + Tool $171B + <<< +~FMSetSysFont MAC + PHL ]1 +_FMSetSysFont MAC + Tool $181B + <<< +~FMGetSysFID MAC + PHS 2 +_FMGetSysFID MAC + Tool $191B + <<< +~FMGetCurFID MAC + PHS 2 +_FMGetCurFID MAC + Tool $1A1B + <<< +~FamNum2ItemID MAC + P1SW ]1 +_FamNum2ItemID MAC + Tool $1B1B + <<< +~InstallWithStats MAC + PHLW ]1;]2 + PHL ]3 +_InstallWithStats MAC + Tool $1C1B + <<< +~qFMStartUp MAC + PHW ]1 + NextDP ]2;$100 + Tool $21B + <<< + diff --git a/macros/GsOs.Macs.s b/macros/GsOs.Macs.s new file mode 100644 index 0000000..1835453 --- /dev/null +++ b/macros/GsOs.Macs.s @@ -0,0 +1,39 @@ +* File: MGSOS +* +* Copyright 1989 by Dave Klimas +* +* IMPORTANT! To use these macros, you must also include the +* label equates as defined in the file E16.GSOS from the TOOL.EQUATES +* directory. +*----------------------------------------------- +* +* xGSOS ;;class 0/1 flag +* +* iGSOS _Create;addr;0 ;this is a class 0 Create call +* +*----------------------------------------------- +* Inline GS/OS call macro + +iGSOS MAC + JSL $E100A8 + DO ]3 + DA ]1.$2000 + ELSE + DA ]1 + FIN + ADRL ]2 + <<< + +*----------------------------------------------- +* Stack GS/OS call macro + +sGSOS MAC + PHL ]2 + DO ]3 + PEA ]1.$2000 + ELSE + PEA ]1 + FIN + JSL $E100B0 + <<< + diff --git a/macros/Int.Macs.s b/macros/Int.Macs.s new file mode 100644 index 0000000..85f57d8 --- /dev/null +++ b/macros/Int.Macs.s @@ -0,0 +1,221 @@ +* Integer Math macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_IMBootInit MAC + Tool $10B + <<< +_IMStartUp MAC +_IntStartUp MAC + Tool $20B + <<< +_IMShutDown MAC +_IntShutDown MAC + Tool $30B + <<< +~IMVersion MAC + PHA +_IMVersion MAC + Tool $40B + <<< +_IMReset MAC + Tool $50B + <<< +~IMStatus MAC + PHA +_IMStatus MAC + Tool $60B + <<< +~Multiply MAC + PHS 2 + PxW ]1;]2 +_Multiply MAC + Tool $90B + <<< +~SDivide MAC + PHS 2 + PxW ]1;]2 +_SDivide MAC + Tool $A0B + <<< +~UDivide MAC + PHS 2 + PxW ]1;]2 +_UDivide MAC + Tool $B0B + <<< +~LongMul MAC + PHS 4 + PxL ]1;]2 +_LongMul MAC + Tool $C0B + <<< +~LongDivide MAC + PHS 4 + PxL ]1;]2 +_LongDivide MAC + Tool $D0B + <<< +~FixRatio MAC + PHS 2 + PxW ]1;]2 +_FixRatio MAC + Tool $E0B + <<< +~FixMul MAC + PHS 2 + PxL ]1;]2 +_FixMul MAC + Tool $F0B + <<< +~FracMul MAC + PHS 2 + PxL ]1;]2 +_FracMul MAC + Tool $100B + <<< +~FixDiv MAC + PHS 2 + PxL ]1;]2 +_FixDiv MAC + Tool $110B + <<< +~FracDiv MAC + PHS 2 + PxL ]1;]2 +_FracDiv MAC + Tool $120B + <<< +~FixRound MAC + P1SL ]1 +_FixRound MAC + Tool $130B + <<< +~FracSqrt MAC + P2SL ]1 +_FracSqrt MAC + Tool $140B + <<< +~FracCos MAC + P2SL ]1 +_FracCos MAC + Tool $150B + <<< +~FracSin MAC + P2SL ]1 +_FracSin MAC + Tool $160B + <<< +~FixATan2 MAC + PHS 2 + PxL ]1;]2 +_FixATan2 MAC + Tool $170B + <<< +~HiWord MAC + P1SL ]1 +_HiWord MAC + Tool $180B + <<< +~LoWord MAC + P1SL ]1 +_LoWord MAC + Tool $190B + <<< +~Long2Fix MAC + P2SL ]1 +_Long2Fix MAC + Tool $1A0B + <<< +~Fix2Long MAC + P2SL ]1 +_Fix2Long MAC + Tool $1B0B + <<< +~Fix2Frac MAC + P2SL ]1 +_Fix2Frac MAC + Tool $1C0B + <<< +~Frac2Fix MAC + P2SL ]1 +_Frac2Fix MAC + Tool $1D0B + <<< +~Fix2X MAC + PxL ]1;]2 +_Fix2X MAC + Tool $1E0B + <<< +~Frac2X MAC + PxL ]1;]2 +_Frac2X MAC + Tool $1F0B + <<< +~X2Fix MAC + P2SL ]1 +_X2Fix MAC + Tool $200B + <<< +~X2Frac MAC + P2SL ]1 +_X2Frac MAC + Tool $210B + <<< +~Int2Hex MAC + PHW ]1 + PHLW ]2;]3 +_Int2Hex MAC + Tool $220B + <<< +~Long2Hex MAC + PxL ]1;]2 + PHW ]3 +_Long2Hex MAC + Tool $230B + <<< +~Hex2Int MAC + PHA + PHLW ]1;]2 +_Hex2Int MAC + Tool $240B + <<< +~Hex2Long MAC + PHS 2 + PHLW ]1;]2 +_Hex2Long MAC + Tool $250B + <<< +~Int2Dec MAC + PHWL ]1;]2 + PxW ]3;]4 +_Int2Dec MAC + Tool $260B + <<< +~Long2Dec MAC + PxL ]1;]2 + PxW ]3;]4 +_Long2Dec MAC + Tool $270B + <<< +~Dec2Int MAC + P1SL ]1 + PxW ]2;]3 +_Dec2Int MAC + Tool $280B + <<< +~Dec2Long MAC + P2SL ]1 + PxW ]2;]3 +_Dec2Long MAC + Tool $290B + <<< +~HexIt MAC + P2SW ]1 +_HexIt MAC + Tool $2A0B + <<< + diff --git a/macros/Line.Macs.s b/macros/Line.Macs.s new file mode 100644 index 0000000..59443a9 --- /dev/null +++ b/macros/Line.Macs.s @@ -0,0 +1,183 @@ +* LineEdit macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_LEBootInit MAC + Tool $114 + <<< +~LEStartUp MAC + PxW ]1;]2 +_LEStartUp MAC + Tool $214 + <<< +_LEShutDown MAC + Tool $314 + <<< +~LEVersion MAC + PHA +_LEVersion MAC + Tool $414 + <<< +_LEReset MAC + Tool $514 + <<< +~LEStatus MAC + PHA +_LEStatus MAC + Tool $614 + <<< +~LENew MAC + P2SL ]1 + PHLW ]2;]3 +_LENew MAC + Tool $914 + <<< +~LEDispose MAC + PHL ]1 +_LEDispose MAC + Tool $A14 + <<< +~LESetText MAC + PHL ]1 + PHWL ]2;]3 +_LESetText MAC + Tool $B14 + <<< +~LEIdle MAC + PHL ]1 +_LEIdle MAC + Tool $C14 + <<< +~LEClick MAC + PxL ]1;]2 +_LEClick MAC + Tool $D14 + <<< +~LESetSelect MAC + PxW ]1;]2 + PHL ]3 +_LESetSelect MAC + Tool $E14 + <<< +~LEActivate MAC + PHL ]1 +_LEActivate MAC + Tool $F14 + <<< +~LEDeactivate MAC + PHL ]1 +_LEDeactivate MAC + Tool $1014 + <<< +~LEKey MAC + PxW ]1;]2 + PHL ]3 +_LEKey MAC + Tool $1114 + <<< +~LECut MAC + PHL ]1 +_LECut MAC + Tool $1214 + <<< +~LECopy MAC + PHL ]1 +_LECopy MAC + Tool $1314 + <<< +~LEPaste MAC + PHL ]1 +_LEPaste MAC + Tool $1414 + <<< +~LEDelete MAC + PHL ]1 +_LEDelete MAC + Tool $1514 + <<< +~LEInsert MAC + PHL ]1 + PHWL ]2;]3 +_LEInsert MAC + Tool $1614 + <<< +~LEUpdate MAC + PHL ]1 +_LEUpdate MAC + Tool $1714 + <<< +~LETextBox MAC + PHLW ]1;]2 + PHLW ]3;]4 +_LETextBox MAC + Tool $1814 + <<< +_LEFromScrap MAC + Tool $1914 + <<< +_LEToScrap MAC + Tool $1A14 + <<< +~LEScrapHandle MAC + PHS 2 +_LEScrapHandle MAC + Tool $1B14 + <<< +~LEGetScrapLen MAC + PHA +_LEGetScrapLen MAC + Tool $1C14 + <<< +~LESetScrapLen MAC + PHW ]1 +_LESetScrapLen MAC + Tool $1D14 + <<< +~LESetHilite MAC + PxL ]1;]2 +_LESetHilite MAC + Tool $1E14 + <<< +~LESetCaret MAC + PxL ]1;]2 +_LESetCaret MAC + Tool $1F14 + <<< +~LETextBox2 MAC + PHLW ]1;]2 + PHLW ]3;]4 +_LETextBox2 MAC + Tool $2014 + <<< +~LESetJust MAC + PHWL ]1;]2 +_LESetJust MAC + Tool $2114 + <<< +~LEGetTextHand MAC + P2SL ]1 +_LEGetTextHand MAC + Tool $2214 + <<< +~LEGetTextLen MAC + P1SL ]1 +_LEGetTextLen MAC + Tool $2314 + <<< +~GetLEDefProc MAC + PHS 2 +_GetLEDefProc MAC + Tool $2414 + <<< +~qLEStartUp MAC + PHW ]1 + NextDP ]2;$100 + Tool $214 + <<< +_LEClassifyKey MAC + Tool $2514 + <<< + diff --git a/macros/List.Macs.s b/macros/List.Macs.s new file mode 100644 index 0000000..9fe3751 --- /dev/null +++ b/macros/List.Macs.s @@ -0,0 +1,111 @@ +* List Mgr. macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_ListBootInit MAC + Tool $011C + <<< +_ListStartup MAC + Tool $021C + <<< +_ListShutDown MAC + Tool $031C + <<< +~ListVersion MAC + PHA +_ListVersion MAC + Tool $041C + <<< +_ListReset MAC + Tool $051C + <<< +~ListStatus MAC + PHA +_ListStatus MAC + Tool $061C + <<< +~CreateList MAC + PHS 2 + PxL ]1;]2 +_CreateList MAC + Tool $091C + <<< +~SortList MAC + PxL ]1;]2 +_SortList MAC + Tool $0A1C + <<< +~NextMember MAC + PHS 2 + PxL ]1;]2 +_NextMember MAC + Tool $0B1C + <<< +~DrawMember MAC + PxL ]1;]2 +_DrawMember MAC + Tool $0C1C + <<< +~SelectMember MAC + PxL ]1;]2 +_SelectMember MAC + Tool $0D1C + <<< +~GetListDefProc MAC + PHS 2 +_GetListDefProc MAC + Tool $0E1C + <<< +~ResetMember MAC + P2SL ]1 +_ResetMember MAC + Tool $0F1C + <<< +~NewList MAC + PxL ]1;]2 +_NewList MAC + Tool $101C + <<< +~DrawMember2 MAC + PHWL ]1;]2 +_DrawMember2 MAC + Tool $111C + <<< +~NextMember2 MAC + PHA + PHWL ]1;]2 +_NextMember2 MAC + Tool $121C + <<< +~ResetMember2 MAC + P1SL ]1 +_ResetMember2 MAC + Tool $131C + <<< +~SelectMember2 MAC + PHWL ]1;]2 +_SelectMember2 MAC + Tool $141C + <<< +~SortList2 MAC + PxL ]1;]2 +_SortList2 MAC + Tool $151C + <<< +~NewList2 MAC + PHL ]1 + PxW ]2;]3;]4;]5 + PHL ]6 +_NewList2 MAC + Tool $161C + <<< +_ListKey MAC + Tool $171C + <<< +_CompareStrings MAC + Tool $181C + <<< + diff --git a/macros/Load.Macs.s b/macros/Load.Macs.s new file mode 100644 index 0000000..9d96ddd --- /dev/null +++ b/macros/Load.Macs.s @@ -0,0 +1,113 @@ +* Load Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_LoaderInitialization MAC + Tool $111 + <<< +_LoaderStartUp MAC + Tool $211 + <<< +_LoaderShutDown MAC + Tool $311 + <<< +~LoaderVersion MAC + PHA +_LoaderVersion MAC + Tool $411 + <<< +_LoaderReset MAC + Tool $511 + <<< +~LoaderStatus MAC + PHA +_LoaderStatus MAC + Tool $611 + <<< +~InitialLoad MAC + PHS 5 + PHWL ]1;]2 + PHW ]3 +_InitialLoad MAC + Tool $911 + <<< +~InitialLoad2 MAC + PHS 5 + PHWL ]1;]2 + PxW ]3;]4 +_InitialLoad2 MAC + Tool $2011 + <<< +~Restart MAC + PHS 5 + PHW ]1 +_Restart MAC + Tool $A11 + <<< +~LoadSegNum MAC + PHS 2 + PxW ]1;]2;]3 +_LoadSegNum MAC + Tool $B11 + <<< +~UnloadSegNum MAC + PxW ]1;]2;]3 +_UnloadSegNum MAC + Tool $C11 + <<< +~LoadSegName MAC + PHS 4 + PHW ]1 + PxL ]2;]3 +_LoadSegName MAC + Tool $D11 + <<< +~UnloadSeg MAC + PHS 3 + PHL ]1 +_UnloadSeg MAC + Tool $E11 + <<< +~GetLoadSegInfo MAC + PxW ]1;]2;]3 + PHL ]4 +_GetLoadSegInfo MAC + Tool $F11 + <<< +~GetUserID MAC + P1SL ]1 +_GetUserID MAC + Tool $1011 + <<< +~GetUserID2 MAC + P1SL ]1 +_GetUserID2 MAC + Tool $2111 + <<< +~LGetPathname MAC + PHS 2 + PxW ]1;]2 +_LGetPathname MAC + Tool $1111 + <<< +~LGetPathname2 MAC + PHS 2 + PxW ]1;]2 +_LGetPathname2 MAC + Tool $2211 + <<< +~UserShutDown MAC + PHA + PxW ]1;]2 +_UserShutDown MAC + Tool $1211 + <<< +~RenamePathname MAC + PxL ]1;]2 +_RenamePathname MAC + Tool $1311 + <<< + diff --git a/macros/Locator.Macs.s b/macros/Locator.Macs.s new file mode 100644 index 0000000..2d2e891 --- /dev/null +++ b/macros/Locator.Macs.s @@ -0,0 +1,135 @@ +* Tool Locator macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_TLBootInit MAC + Tool $101 + <<< +_TLStartUp MAC + Tool $201 + <<< +_TLShutDown MAC + Tool $301 + <<< +~TLVersion MAC + PHA +_TLVersion MAC + Tool $401 + <<< +_TLReset MAC + Tool $501 + <<< +~TLStatus MAC + PHA +_TLStatus MAC + Tool $601 + <<< +~GetTSPtr MAC + PHS 2 + PxW ]1;]2 +_GetTSPtr MAC + Tool $901 + <<< +~SetTSPtr MAC + PxW ]1;]2 + PHL ]3 +_SetTSPtr MAC + Tool $A01 + <<< +~GetFuncPtr MAC + PHS 2 + PxW ]1;]2 +_GetFuncPtr MAC + Tool $B01 + <<< +~GetWAP MAC + PHS 2 + PxW ]1;]2 +_GetWAP MAC + Tool $C01 + <<< +~SetWAP MAC + PxW ]1;]2 + PHL ]3 +_SetWAP MAC + Tool $D01 + <<< +~LoadTools MAC + PHL ]1 +_LoadTools MAC + Tool $E01 + <<< +~LoadOneTool MAC + PxW ]1;]2 +_LoadOneTool MAC + Tool $F01 + <<< +~UnloadOneTool MAC + PHW ]1 +_UnloadOneTool MAC + Tool $1001 + <<< +~TLMountVolume MAC + PHA + PxW ]1;]2 + PxL ]3;]4;]5;]6 +_TLMountVolume MAC + Tool $1101 + <<< +~TLTextMountVolume MAC + PHA + PxL ]1;]2;]3;]4 +_TLTextMountVolume MAC + Tool $1201 + <<< +~SaveTextState MAC + PHS 2 +_SaveTextState MAC + Tool $1301 + <<< +~RestoreTextState MAC + PHL ]1 +_RestoreTextState MAC + Tool $1401 + <<< +~MessageCenter MAC + PxW ]1;]2 + PHL ]3 +_MessageCenter MAC + Tool $1501 + <<< +_SetDefaultTPT MAC + Tool $1601 + <<< +~MessageByName MAC + PHS 2 + PHWL ]1;]2 + PxW ]3;]4 +_MessageByName MAC + Tool $1701 + <<< +~StartUpTools MAC + PHA + PxW ]1;]2 + PxL ]3;]4 +_StartUpTools MAC + Tool $1801 + <<< +~ShutDownTools MAC + PHWL ]1;]2 +_ShutDownTools MAC + Tool $1901 + <<< +_GetMsgHandle MAC + Tool $1A01 + <<< +_AcceptRequests MAC + Tool $1B01 + <<< +_SendRequest MAC + Tool $1C01 + <<< + diff --git a/macros/Logo.Macs.s b/macros/Logo.Macs.s new file mode 100644 index 0000000..4cd188c --- /dev/null +++ b/macros/Logo.Macs.s @@ -0,0 +1,87 @@ +*----------------------------- +* LoGo's useful tools... +*----------------------------- + +_En8 mac + sec + xce + sep #$30 + <<< + +_En16 mac + clc + xce + rep #$30 + <<< + +_ClrScr mac + ldx #$7ffe + lda #$0000 +]lp stal $e12000,x + stal $012000,x + dex + dex + bpl ]lp + <<< + +_fadeIN mac ; Fait un fondu de l'image + lda ]1 ; A= banc/adrh de l'image + ldy ]2 ; Y= $0000, fondu sur l'image + jsr fadeIN ; $ffff, que sur les palettes + <<< + +_fadeOUT mac ; Efface l'ecran doucement + jsr fadeOUT + <<< + +_File mac ; Charge un fichier + lda ]1 + ldx ]2 + jsr loadFILE + <<< + +_Key mac ; Attend une touche au clavier +]lp ldal $e0bfff + bpl ]lp + stal $e0c010 + <<< + +_Unpack mac ; Decompacte un fichier + lda ]1 ; A= banc/adrh du fichier source + jsr unPACK + <<< + +_wait mac ; Routine d'attente + lda ]1 ; A= duree d'attente (env. 1 seconde) + jsr nowWAIT + eom + +_Write8 mac ; Affiche un message + lda ]1 ; A= adresse de la chaine + ldx ]2 ; X= coordonnee sur l'ecran + ldy ]3 ; Y= banc/adrh ou afficher + jsr Print8 + <<< + +_Write16 mac ; Affiche un message + lda ]1 ; A= adresse de la chaine + ldx ]2 ; X= coordonnee sur l'ecran + ldy ]3 ; Y= banc/adrh ou afficher + jsr Print16 + <<< + +_Reset mac + lda #$51 + sta $0 + PushWord #2 + PushWord #0 + PushWord #0 + PushWord #8 + Tool $0909 + sec + xce + lda #0 + stal $0003f4 + jmp ($fffc) + <<< + diff --git a/macros/Macros.s b/macros/Macros.s new file mode 100644 index 0000000..25e0db5 --- /dev/null +++ b/macros/Macros.s @@ -0,0 +1,571 @@ +*------------------------- +* Macro library +*------------------------- + +INCD MAC ;Two byte INC + INC ]1 + IF MX>1 + BNE NC + INC ]1+1 +NC FIN + <<< + +DECD MAC ;Two byte DEC + IF MX>1 + LDA ]1 + BNE NC + DEC ]1+1 +NC FIN + DEC ]1 + <<< + +MOV MAC + LDA ]1 + STA ]2 + <<< + +MOVD MAC + MOV ]1;]2 + IF MX>1 ;If A is short + IF (=]1 ;Syntax MOVD (ADR1),Y;???? + INY + IF (=]2 ; MOVD (ADR1),Y;(ADR2),Y + MOV ]1;]2 + ELSE ; MOVD (ADR1),Y;ADR2 + MOV ]1;]2+1 + FIN + ELSE + IF (=]2 ;Syntax MOVD ????;(ADR2),Y + INY + IF #=]1 ; MOVD #ADR1;(ADR2),Y + MOV ]1/$100;]2 + ELSE ; MOVD ADR1;(ADR2),Y + MOV ]1+1;]2 + FIN + ELSE ;Syntax MOVD ????;ADR2 + IF #=]1 ; MOVD #ADR1;ADR2 + MOV ]1/$100;]2+1 + ELSE ; MOVD ADR1;ADR2 + MOV ]1+1;]2+1 + FIN + FIN + FIN + FIN + <<< + +LDHI MAC ;For calls from other macs + IF #=]1 + LDA ]1/$100 + ELSE + LDA ]1+1 + FIN + <<< + +ADD MAC + IF #=]2 + IF #=]1 + ERR 1 ;Error if ADD #lab1;#lab2.. + FIN + FIN + CLC + LDA ]1 ;Syntax ADD lab1;lab2;lab3 + ADC ]2 ; or ADD #lab1;lab2;lab3 etc + DO ]0/3 + STA ]3 ;If 3 parms + ELSE ;2 parm cases: + IF #=]2 + STA ]1 ;Syntax ADD lab1;#lab2 + ELSE ;Syntax ADD lab1;lab2 + STA ]2 ; or ADD #lab1;lab2 -> lab2 + FIN + FIN + IF MX>1 ;Following ignored if M long + LDA ]1+1 + IF #=]2 + ADC ]2/$100 + ELSE + ADC ]2+1 + FIN + DO ]0/3 + STA ]3+1 ;If 3 parms + ELSE ;Two parm cases: + IF #=]2 + STA ]1+1 ;Syntax ADD lab1;#lab2 + ELSE ; -> lab1 + STA ]2+1 ;Syntax ADD lab1;lab2 -> lab2 + FIN ; or ADD #lab1;lab2 -> lab2 + FIN + FIN + <<< + +SUB MAC + IF #=]2 + IF #=]1 + ERR 1 ;Error if SUB #lab1;#lab2.. + FIN + FIN + SEC + LDA ]1 ;Syntax SUB lab1;lab2;lab3 + SBC ]2 ; or SUB #lab1;lab2;lab3 etc + DO ]0/3 + STA ]3 ;If 3 parms + ELSE ;Two parm cases: + IF #=]2 + STA ]1 ;Syntax SUB lab1;#lab2 + ELSE ;Syntax SUB lab1;lab2 + STA ]2 ; or SUB #lab1;lab2 -> lab2 + FIN + FIN ;Of 2 parm cases + IF MX>1 ;Rest ignored if M long + LDHI ]1 + IF #=]2 + SBC ]2/$100 ;Case #lab2 + ELSE + SBC ]2+1 ;Case lab2 + FIN + DO ]0/3 + STA ]3+1 ;If 3 parms + ELSE ;Two parm cases: + IF #=]2 + STA ]1+1 ;Syntax SUB lab1;#lab2 + ELSE ; -> lab1 + STA ]2+1 ;Syntax SUB lab1;lab2 -> lab2 + FIN ; or SUB #lab1;lab2 -> lab2 + FIN ;Of 2 parm cases + FIN ;Of M short + <<< + +ADDX MAC + TXA +ADDA MAC + CLC + ADC ]1 + STA ]2 + IF MX>1 + LDHI ]1 + ADC #0 + STA ]2+1 + FIN + <<< + +ADDY MAC + TYA + ADDA ]1;]2 + <<< + +ADDNUM MAC + LDA #]1 + CLC + ADC ]2 + STA ]2 + IF MX>1 + BCC NC + INC ]2+1 +NC FIN + <<< + +SWAP MAC + LDA ]1 + PHA + LDA ]2 + STA ]1 + PLA + STA ]2 + <<< + +COMPARE MAC + LDA ]1 + CMP ]2 + IF MX>1 + LDHI ]1 ;Syntax COMPARE lab1;lab2 + IF #=]2 ; or COMPARE lab1;#lab2 + SBC ]2/$100 + ELSE + SBC ]2+1 + FIN + FIN + <<< + +POKE MAC + MOV #]2;]1 + <<< + +STADR MAC + POKE ]2;]1 + IF MX>1 ;If M is short, do high byte + POKE ]2+1;]1/$100 + FIN + <<< + +*================================================= +* Save and restore registers macros. Recommended +* for use at the start and end of subroutines +* which might be called from unknown status and +* which must set up register lengths. +*------------------------------------------------- + +SAVSTAT MAC ;Save registers & status + PHA + PHY + PHX + PHP + <<< + +RESTORE MAC ;Restore regs & status + PLP ;This must come first + PLX ; so register restores + PLY ; have correct length. + PLA + <<< + +*================================================= +* Conditional branches not available on the 65816: +*------------------------------------------------- + +BLE MAC ;Branch if less than or = + BEQ ]1 + BLT ]1 + <<< + +BGT MAC ;Branch if greater than + BEQ OV + BGE ]1 +OV <<< + +*================================================= +* Conditional long branches. For use when out of +* range of a short branch and branching mechanism +* is wanted to be hidden on the listing. +*------------------------------------------------- + +BRTL MAC ;BRL if less than (long) +BCCL MAC ;BRL if carry clear (long) + BCS OV + BRL ]1 +OV <<< + +BGEL MAC ;BRL if greater or equal (long) +BCSL MAC ;BRL if carry set (long) + BCC OV + BRL ]1 +OV <<< + +BPLL MAC ;BRL if plus (long) + BMI OV + BRL ]1 +OV <<< + +BMIL MAC ;BRL if minus (long) + BPL OV + BRL ]1 +OV <<< + +BEQL MAC ;BRL if equal (long) + BNE OV + BRL ]1 +OV <<< + +BNEL MAC ;BRL if not equal (long) + BEQ OV + BRL ]1 +OV <<< + +BVCL MAC ;BRL if V clear (long) + BVS OV + BRL ]1 +OV <<< + +BVSL MAC ;BRL if V set (long) + BVC OV + BRL ]1 +OV <<< + +BLEL MAC ;BRL if less or equal (long) + BEQ BR + BGE OV +BR BRL ]1 +OV <<< + +BLTL MAC ;BRL if less than (long) + BGE OV + BRL ]1 +OV <<< + +BGTL MAC ;BRL if greater than (long) + BEQ OV + BLT OV +BR BRL ]1 +OV <<< + +*================================================= +* The I/O macros below expect the COUT routine +* to be included or linked in as an external. +* PRINT expects the same of the SENDMSG routine. +* +* (Just declare COUT and SENDMSG as externals +* and include the linker command LIB 5 in the +* linker command file. SENDMSG also requires an +* OUTPUT routine in your source declared as an +* entry. It can be as simple as: +* +* OUTPUT JMP COUT +* +* SENDMSG and COUT are in the LIB directory and +* their source files are in the SOURCE directory. +*------------------------------------------------- + +PRINT MAC ;Syntax PRINT "message" + JSR SENDMSG ; or PRINT 8D8D or + ASC ]1 ; PRINT 8D8D"text"8D"more" + BRK ; etc. + <<< + +OUT MAC + LDA ]1 ;Syntax OUT #"A" + JSR COUT ; or OUT ADDRESS + <<< ; or OUT (PNT),Y etc. + +HOME MAC ;Clear 80 col screen + OUT #"L"&$9F + <<< + +NORMAL MAC ;Set normal text + OUT #"N"&$9F + <<< + +INVERSE MAC ;Set inverse text + OUT #"O"&$9F + <<< + +MOUSEON MAC ;Turn mousetext on + OUT #"["&$9F + INVERSE + <<< + +MOUSEOFF MAC ;Turn mousetext off + OUT #"X"&$9F + NORMAL + <<< + +BELL MAC ;Ring bell + OUT #"G"&$9F + <<< + +CLEOL MAC ;Clear to end of line + OUT #$9D + <<< + +CLEOP MAC ;Clear to end of screen + OUT #$8B + <<< + +OUTCR MAC ;Do carriage return + OUT #$8D + <<< + +GOTOXY MAC ;Pascal output only! + OUT #$1E + LDA ]1 ;X coor (imm or location) + CLC + ADC #' ' + JSR COUT + LDA ]2 ;Y coor (") + CLC + ADC #' ' + JSR COUT + <<< + +CURSXY MAC ;GOTOXY for BASIC output + OUT #"Y"&$9F ;Home cursor + LDX ]2 ;Syntax (both versions): + BEQ H ; CURSXY #55;#10 or +CR OUTCR ; CURSXY XLOC,YLOC etc. + DEX + BNE CR +H IF MX<2 ;If M is long then + SEP %00100000 ; must shorten it + LDA ]1 + STAL $24 + REP %00100000 ; and lengthen on exit. + ELSE ;If M is short then + LDA ]1 ; leave as is + STAL $24 + FIN + <<< + +************************************************** +* APW-Equivalent Macros 1/20/89 * +* For use with APW or ORCA/M source listings. * +* * +************************************************** + +*================================================ + +DP MAC + ADRL ]1 + <<< + +ASL4 MAC + LDA ]1+2 + DO ]0/2 ;If 2 parms then set + LDX ]2 ; X to 2nd parm. + FIN +]A ASL ;Otherwise use X to + ASL ]1 ; decide how many + ADC #0 ; ASL's to do. + DEX + BNE ]A + STA ]1+2 + <<< + +LSR4 MAC + DO ]0/2 ;If 2 parms, then COMPLEMENT + LDA ]2 ; of X must be 2nd parm. + EOR $FFFF + CLC + ADC #1 + TAX + FIN + LDA ]1 +]A LSR + LSR ]1+2 + BCC ]B + ORA #$8000 +]B INX + BNE ]A + STA ]1 + <<< + +DEC4 MAC + IF MX/2-1 ; IF M IS SHORT + ERR 1 ; ERR IF NOT 16-BIT MODE + ELSE + DEC ]1 + BPL ]A + DEC ]1+2 +]A FIN + <<< + +INC4 MAC + IF MX/2-1 ; IF M IS SHORT + ERR 1 ; ERR IF NOT 16-BIT MODE + ELSE + INC ]1 + BNE ]A + INC ]1+2 +]A FIN + <<< + +ADD4 MAC + CLC ;If 3 parms then use + DO ]0/3 ; raw 4 byte addresses. + + IF #=]1 + LDA #<]1 + ELSE ;Make sure we use the + LDA ]1 ; right LDA for data + FIN ; or addresses. + + IF #=]2 + ADC #<]2 + ELSE ;Make sure we use the + ADC ]2 ; right ADC for data + FIN ; or addresses. + + STA ]3 + + IF #=]1 + LDA #^]1 + ELSE ;Make sure we use the + LDA ]1+2 ; right LDA for data + FIN ; or addresses. + + IF #=]2 + ADC #^]2 + ELSE ;Make sure we use the + ADC ]2+2 ; right ADC for data + FIN ; or addresses. + + STA ]3+2 + + ELSE ;If 2 parms then use +; 2 byte Accumulator. + + + IF #=]1 + ADC #<]1 + ELSE ;Make sure we use the + ADC ]1 ; right ADC for data + FIN ; or addresses. + + STA ]2 + + + IF #=]1 + LDA #^]1 + ELSE ;Make sure we use the + LDA ]1+2 ; right LDA for data + FIN ; or addresses. + + ADC #0 + STA ]2+2 + + FIN + <<< + +SUB4 MAC + SEC ;If 3 parms then use + DO ]0/3 ; raw 4 byte addresses. + + + IF #=]1 + LDA #<]1 + ELSE ;Make sure we use the + LDA ]1 ; right LDA for data + FIN ; or addresses. + + IF #=]2 + SBC #<]2 + ELSE ;Make sure we use the + SBC ]2 ; right SBC for data + FIN ; or addresses. + + STA ]3 + + + IF #=]1 + LDA #^]1 + ELSE ;Make sure we use the + LDA ]1+2 ; right LDA for data + FIN ; or addresses. + + IF #=]2 + SBC #^]2 + ELSE ;Make sure we use the + SBC ]2+2 ; right SBC for data + FIN ; or addresses. + + STA ]3+2 + + ELSE + + IF #=]1 + SBC #<]1 + ELSE ;Make sure we use the + SBC ]1 ; right SBC for data + FIN ; or addresses. + + STA ]2 + + IF #=]1 + LDA #^]1 + ELSE ;Make sure we use the + LDA ]1+2 ; right LDA for data + FIN ; or addresses. + + SBC #0 + STA ]2+2 + + FIN + <<< + diff --git a/macros/Male.Macs.s b/macros/Male.Macs.s new file mode 100644 index 0000000..31da52f --- /dev/null +++ b/macros/Male.Macs.s @@ -0,0 +1,26 @@ +* +* Male Voice tool calls +* + +_MaleBootInit mac + Tool $0132 + <<< +_MaleStartUp mac + Tool $0232 + <<< +_MaleShutDown mac + Tool $0332 + <<< +_MaleVersion mac + Tool $0432 + <<< +_MaleReset mac + Tool $0532 + <<< +_MaleStatus mac + Tool $0632 + <<< +_MaleSpeak mac + Tool $0932 + <<< + diff --git a/macros/Media.Macs.s b/macros/Media.Macs.s new file mode 100644 index 0000000..090d387 --- /dev/null +++ b/macros/Media.Macs.s @@ -0,0 +1,137 @@ +* +* Media Controller tool calls +* + +_MCBootInit mac + Tool $0126 + <<< +_MCStartUp mac + Tool $0226 + <<< +_MCShutDown mac + Tool $0326 + <<< +_MCVersion mac + Tool $0426 + <<< +_MCReset mac + Tool $0526 + <<< +_MCStatus mac + Tool $0626 + <<< +_MCGetErrorMsg mac + Tool $0926 + <<< +_MCLoadDriver mac + Tool $0a26 + <<< +_MCUnLoadDriver mac + Tool $0b26 + <<< +_MCTime2Bin mac + Tool $0c26 + <<< +_MCBin2Time mac + Tool $0d26 + <<< +_MCGetTrackTitle mac + Tool $0e26 + <<< +_MCSetTrackTitle mac + Tool $0f26 + <<< +_MCGetProgram mac + Tool $1026 + <<< +_MCSetProgram mac + Tool $1126 + <<< +_MCGetDiscTitle mac + Tool $1226 + <<< +_MCSetDiscTitle mac + Tool $1326 + <<< +_MCDStartUp mac + Tool $1426 + <<< +_MCDShutDown mac + Tool $1526 + <<< +_MCGetFeatures mac + Tool $1626 + <<< +_MCPlay mac + Tool $1726 + <<< +_MCPause mac + Tool $1826 + <<< +_MCSendRawData mac + Tool $1926 + <<< +_MCGetStatus mac + Tool $1a26 + <<< +_MCControl mac + Tool $1b26 + <<< +_MCScan mac + Tool $1c26 + <<< +_MCGetSpeeds mac + Tool $1d26 + <<< +_MCSpeed mac + Tool $1e26 + <<< +_MCStopAt mac + Tool $1f26 + <<< +_MCJog mac + Tool $2026 + <<< +_MCSearchTo mac + Tool $2126 + <<< +_MCSearchDone mac + Tool $2226 + <<< +_MCSearchWait mac + Tool $2326 + <<< +_MCGetPosition mac + Tool $2426 + <<< +_MCSetAudio mac + Tool $2526 + <<< +_MCGetTimes mac + Tool $2626 + <<< +_MCGetDiscTOC mac + Tool $2726 + <<< +_MCGetDiscID mac + Tool $2826 + <<< +_MCGetNoTracks mac + Tool $2926 + <<< +_MCRecord mac + Tool $2a26 + <<< +_MCStop mac + Tool $2b26 + <<< +_MCWaitRawData mac + Tool $2c26 + <<< +_MCGetName mac + Tool $2d26 + <<< +_MCSetVolume mac + Tool $2e26 + <<< + diff --git a/macros/Mem.Macs.s b/macros/Mem.Macs.s new file mode 100644 index 0000000..5d2b7d5 --- /dev/null +++ b/macros/Mem.Macs.s @@ -0,0 +1,179 @@ +* Memory Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_MMBootInit MAC + Tool $102 + <<< +~MMStartUp MAC + PHA +_MMStartUp MAC + Tool $202 + <<< +~MMShutDown MAC + PHW ]1 +_MMShutDown MAC + Tool $302 + <<< +~MMVersion MAC + PHA +_MMVersion MAC + Tool $402 + <<< +_MMReset MAC + Tool $502 + <<< +~MMStatus MAC + PHA +_MMStatus MAC + Tool $602 + <<< +~NewHandle MAC + P2SL ]1 + PxW ]2;]3 + PHL ]4 +_NewHandle MAC + Tool $902 + <<< +~ReallocHandle MAC + PHLW ]1;]2 + PHWL ]3;]4 + PHL ]5 +_ReallocHandle MAC + Tool $A02 + <<< +~RestoreHandle MAC + PHL ]1 +_RestoreHandle MAC + Tool $B02 + <<< +~AddToOOMQueue MAC + PHL ]1 +_AddToOOMQueue MAC + Tool $C02 + <<< +~DeleteFromOOMQueue MAC + PHL ]1 +_DeleteFromOOMQueue MAC + Tool $D02 + <<< +~DisposeHandle MAC + PHL ]1 +_DisposeHandle MAC + Tool $1002 + <<< +~DisposeAll MAC + PHW ]1 +_DisposeAll MAC + Tool $1102 + <<< +~PurgeHandle MAC + PHL ]1 +_PurgeHandle MAC + Tool $1202 + <<< +~PurgeAll MAC + PHW ]1 +_PurgeAll MAC + Tool $1302 + <<< +~GetHandleSize MAC + P2SL ]1 +_GetHandleSize MAC + Tool $1802 + <<< +~SetHandleSize MAC + PxL ]1;]2 +_SetHandleSize MAC + Tool $1902 + <<< +~FindHandle MAC + P2SL ]1 +_FindHandle MAC + Tool $1A02 + <<< +~FreeMem MAC + PHS 2 +_FreeMem MAC + Tool $1B02 + <<< +~MaxBlock MAC + PHS 2 +_MaxBlock MAC + Tool $1C02 + <<< +~TotalMem MAC + PHS 2 +_TotalMem MAC + Tool $1D02 + <<< +~CheckHandle MAC + PHL ]1 +_CheckHandle MAC + Tool $1E02 + <<< +_CompactMem MAC + Tool $1F02 + <<< +~HLock MAC + PHL ]1 +_HLock MAC + Tool $2002 + <<< +~HLockAll MAC + PHW ]1 +_HLockAll MAC + Tool $2102 + <<< +~HUnlock MAC + PHL ]1 +_HUnlock MAC + Tool $2202 + <<< +~HUnlockAll MAC + PHW ]1 +_HUnlockAll MAC + Tool $2302 + <<< +~SetPurge MAC + PHWL ]1;]2 +_SetPurge MAC + Tool $2402 + <<< +~SetPurgeAll MAC + PxW ]1;]2 +_SetPurgeAll MAC + Tool $2502 + <<< +~PtrToHand MAC + PxL ]1;]2;]3 +_PtrToHand MAC + Tool $2802 + <<< +~HandToPtr MAC + PxL ]1;]2;]3 +_HandToPtr MAC + Tool $2902 + <<< +~HandToHand MAC + PxL ]1;]2;3 +_HandToHand MAC + Tool $2A02 + <<< +~BlockMove MAC + PxL ]1;]2;]3 +_BlockMove MAC + Tool $2B02 + <<< +~RealFreeMem MAC + PHS 2 +_RealFreeMem MAC + Tool $2F02 + <<< +_SetHandleID MAC + Tool $3002 + <<< + diff --git a/macros/Menu.Macs.s b/macros/Menu.Macs.s new file mode 100644 index 0000000..3c87e62 --- /dev/null +++ b/macros/Menu.Macs.s @@ -0,0 +1,372 @@ +* Menu Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_MenuBootInit MAC + Tool $10F + <<< +~MenuStartUp MAC + PxW ]1;]2 +_MenuStartUp MAC + Tool $20F + <<< +_MenuShutDown MAC + Tool $30F + <<< +~MenuVersion MAC + PHA +_MenuVersion MAC + Tool $40F + <<< +_MenuReset MAC + Tool $50F + <<< +~MenuStatus MAC + PHA +_MenuStatus MAC + Tool $60F + <<< +~MenuKey MAC + PxL ]1;]2 +_MenuKey MAC + Tool $90F + <<< +~GetMenuBar MAC + PHS 2 +_GetMenuBar MAC + Tool $A0F + <<< +~MenuRefresh MAC + PHL ]1 +_MenuRefresh MAC + Tool $B0F + <<< +_FlashMenuBar MAC + Tool $C0F + <<< +~InsertMenu MAC + PHLW ]1;]2 +_InsertMenu MAC + Tool $D0F + <<< +~DeleteMenu MAC + PHW ]1 +_DeleteMenu MAC + Tool $E0F + <<< +~InsertMItem MAC + PHL ]1 + PxW ]2;]3 +_InsertMItem MAC + Tool $F0F + <<< +~DeleteMItem MAC + PHW ]1 +_DeleteMItem MAC + Tool $100F + <<< +~GetSysBar MAC + PHS 2 +_GetSysBar MAC + Tool $110F + <<< +~SetSysBar MAC + PHL ]1 +_SetSysBar MAC + Tool $120F + <<< +~FixMenuBar MAC + PHA +_FixMenuBar MAC + Tool $130F + <<< +~CountMItems MAC + P1SW ]1 +_CountMItems MAC + Tool $140F + <<< +~NewMenuBar MAC + P2SL ]1 +_NewMenuBar MAC + Tool $150F + <<< +~GetMHandle MAC + P2SW ]1 +_GetMHandle MAC + Tool $160F + <<< +~SetBarColors MAC + PxW ]1;]2;]3 +_SetBarColors MAC + Tool $170F + <<< +~GetBarColors MAC + PHS 2 +_GetBarColors MAC + Tool $180F + <<< +~SetMTitleStart MAC + PHW ]1 +_SetMTitleStart MAC + Tool $190F + <<< +~GetMTitleStart MAC + PHA +_GetMTitleStart MAC + Tool $1A0F + <<< +~GetMenuMgrPort MAC + PHS 2 +_GetMenuMgrPort MAC + Tool $1B0F + <<< +~CalcMenuSize MAC + PxW ]1;]2;]3 +_CalcMenuSize MAC + Tool $1C0F + <<< +~SetMTitleWidth MAC + PxW ]1;]2 +_SetMTitleWidth MAC + Tool $1D0F + <<< +~GetMTitleWidth MAC + P1SW ]1 +_GetMTitleWidth MAC + Tool $1E0F + <<< +~SetMenuFlag MAC + PxW ]1;]2 +_SetMenuFlag MAC + Tool $1F0F + <<< +~GetMenuFlag MAC + P1SW ]1 +_GetMenuFlag MAC + Tool $200F + <<< +~SetMenuTitle MAC + PHLW ]1;]2 +_SetMenuTitle MAC + Tool $210F + <<< +~GetMenuTitle MAC + P2SW ]1 +_GetMenuTitle MAC + Tool $220F + <<< +~MenuGlobal MAC + P1SW ]1 +_MenuGlobal MAC + Tool $230F + <<< +~SetMItem MAC + PHLW ]1;]2 +_SetMItem MAC + Tool $240F + <<< +~GetMItem MAC + PHLW ]1;]2 +_GetMItem MAC + Tool $250F + <<< +~SetMItemFlag MAC + PxW ]1;]2 +_SetMItemFlag MAC + Tool $260F + <<< +~GetMItemFlag MAC + P1SW ]1 +_GetMItemFlag MAC + Tool $270F + <<< +~SetMItemBlink MAC + PHW ]1 +_SetMItemBlink MAC + Tool $280F + <<< +_MenuNewRes MAC + Tool $290F + <<< +_DrawMenuBar MAC + Tool $2A0F + <<< +~MenuSelect MAC + PxL ]1;]2 +_MenuSelect MAC + Tool $2B0F + <<< +~HiliteMenu MAC + PxW ]1;]2 +_HiliteMenu MAC + Tool $2C0F + <<< +~NewMenu MAC + P2SL ]1 +_NewMenu MAC + Tool $2D0F + <<< +~DisposeMenu MAC + PHL ]1 +_DisposeMenu MAC + Tool $2E0F + <<< +_InitPalette MAC + Tool $2F0F + <<< +~EnableMItem MAC + PHW ]1 +_EnableMItem MAC + Tool $300F + <<< +~DisableMItem MAC + PHW ]1 +_DisableMItem MAC + Tool $310F + <<< +~CheckMItem MAC + PxW ]1;]2 +_CheckMItem MAC + Tool $320F + <<< +~SetMItemMark MAC + PxW ]1;]2 +_SetMItemMark MAC + Tool $330F + <<< +~GetMItemMark MAC + P1SW ]1 +_GetMItemMark MAC + Tool $340F + <<< +~SetMItemStyle MAC + PxW ]1;]2 +_SetMItemStyle MAC + Tool $350F + <<< +~GetMItemStyle MAC + P1SW ]1 +_GetMItemStyle MAC + Tool $360F + <<< +~SetMenuID MAC + PxW ]1;]2 +_SetMenuID MAC + Tool $370F + <<< +~SetMItemID MAC + PxW ]1;]2 +_SetMItemID MAC + Tool $380F + <<< +~SetMenuBar MAC + PHL ]1 +_SetMenuBar MAC + Tool $390F + <<< +~SetMItemName MAC + PHLW ]1;]2 +_SetMItemName MAC + Tool $3A0F + <<< +~GetPopUpDefProc MAC + PHS 2 +_GetPopUpDefProc MAC + Tool $3B0F + <<< +~PopUpMenuSelect MAC + PHA + PxW ]1;]2;]3;]4 + PHL ]5 +_PopUpMenuSelect MAC + Tool $3C0F + <<< +~DrawPopUp MAC + PxW ]1;]2;]3;]4 + PxW ]5;]6;]7 +_DrawPopUp MAC + Tool $3D0F + <<< +~NewMenu2 MAC + P2SW ]1 + PHL ]2 +_NewMenu2 MAC + Tool $3E0F + <<< +~InsertMItem2 MAC + PHWL ]1;]2 + PxW ]3;]4 +_InsertMItem2 MAC + Tool $3F0F + <<< +~SetMenuTitle2 MAC + PHWL ]1;]2 + PHW ]3 +_SetMenuTitle2 MAC + Tool $400F + <<< +~SetMItem2 MAC + PHWL ]1;]2 + PHW ]3 +_SetMItem2 MAC + Tool $410F + <<< +~SetMItemName2 MAC + PHWL ]1;]2 + PHW ]3 +_SetMItemName2 MAC + Tool $420F + <<< +~NewMenuBar2 MAC + P2SW ]1 + PxL ]2;]3 +_NewMenuBar2 MAC + Tool $430F + <<< +_HideMenuBar MAC + Tool $450F + <<< +_ShowMenuBar MAC + Tool $460F + <<< +_SetMItemIcon MAC + Tool $470F + <<< +_GetMItemIcon MAC + Tool $480F + <<< +_SetMItemStruct MAC + Tool $490F + <<< +_GetMItemStruct MAC + Tool $4A0F + <<< +_RemoveMItemStruct MAC + Tool $4B0F + <<< +_GetMItemFlag2 MAC + Tool $4C0F + <<< +_SetMItemFlag2 MAC + Tool $4D0F + <<< +_GetMItemBlink MAC + Tool $4F0F + <<< +_InsertPathMItems MAC + Tool $500F + <<< +~qMenuStartUp MAC + PHW ]1 + NextDP ]2;$100 + Tool $20F + <<< +~qNewMenu MAC + ~NewMenu ]1 + PHW #0 + _InsertMenu + <<< + diff --git a/macros/Midi.Macs.s b/macros/Midi.Macs.s new file mode 100644 index 0000000..147dd4c --- /dev/null +++ b/macros/Midi.Macs.s @@ -0,0 +1,79 @@ +* MIDI tool macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; + +_MidiBootInit MAC + Tool $120 + <<< +~MidiStartUp MAC + PxW ]1;]2 +_MidiStartUp MAC + Tool $220 + <<< +_MidiShutDown MAC + Tool $320 + <<< +~MidiVersion MAC + PHA +_MidiVersion MAC + Tool $420 + <<< +_MidiReset MAC + Tool $520 + <<< +~MidiStatus MAC + PHA +_MidiStatus MAC + Tool $620 + <<< +~MidiControl MAC + PHWL ]1;]2 +_MidiControl MAC + Tool $920 + <<< +~MidiDevice MAC + PHWL ]1;]2 +_MidiDevice MAC + Tool $A20 + <<< +~MidiClock MAC + PHWL ]1;]2 +_MidiClock MAC + Tool $B20 + <<< +~MidiInfo MAC + P2SW ]1 +_MidiInfo MAC + Tool $C20 + <<< +~MidiReadPacket MAC + P1SL ]1 + PHW ]2 +_MidiReadPacket MAC + Tool $D20 + <<< +~MidiWritePacket MAC + P1SL ]1 +_MidiWritePacket MAC + Tool $E20 + <<< +_MidiRecordSeq MAC + Tool $F20 + <<< +_MidiStopRecord MAC + Tool $1020 + <<< +_MidiPlaySeq MAC + Tool $1120 + <<< +_MidiStopPlay MAC + Tool $1220 + <<< +_MidiConvert MAC + Tool $1320 + <<< + diff --git a/macros/MidiSyn.Macs.s b/macros/MidiSyn.Macs.s new file mode 100644 index 0000000..01950a1 --- /dev/null +++ b/macros/MidiSyn.Macs.s @@ -0,0 +1,119 @@ +* +* Midi Synth tool calls +* + +_MSBootInit mac + Tool $0123 + <<< +_MSStartUp mac + Tool $0223 + <<< +_MSShutDown mac + Tool $0323 + <<< +_MSVersion mac + Tool $0423 + <<< +_MSReset mac + Tool $0523 + <<< +_MSStatus mac + Tool $0623 + <<< +_SetBasicChannel mac + Tool $0923 + <<< +_SetMIDIMode mac + Tool $0a23 + <<< +_PlayNote mac + Tool $0b23 + <<< +_StopNote mac + Tool $0c23 + <<< +_KillAllNotes mac + Tool $0d23 + <<< +_SetRecTrack mac + Tool $0e23 + <<< +_SetPlayTrack mac + Tool $0f23 + <<< +_TrackToChannel mac + Tool $1023 + <<< +_Locate mac + Tool $1123 + <<< +_SetVelComp mac + Tool $1223 + <<< +_SetMIDIPort mac + Tool $1323 + <<< +_SetInstrument mac + Tool $1423 + <<< +_SeqPlayer mac + Tool $1523 + <<< +_SetTempo mac + Tool $1623 + <<< +_SetCallBack mac + Tool $1723 + <<< +_SysExOut mac + Tool $1823 + <<< +_SetBeat mac + Tool $1923 + <<< +_MIDIMessage mac + Tool $1a23 + <<< +_LocateEnd mac + Tool $1b23 + <<< +_Merge mac + Tool $1c23 + <<< +_DeleteTrack mac + Tool $1d23 + <<< +_SetMetro mac + Tool $1e23 + <<< +_GetMSData mac + Tool $1f23 + <<< +_ConvertToTime mac + Tool $2023 + <<< +_ConvertToMeasure mac + Tool $2123 + <<< +_MSSuspend mac + Tool $2223 + <<< +_MSResume mac + Tool $2323 + <<< +_SetTuningTable mac + Tool $2423 + <<< +_GetTuningTable mac + Tool $2523 + <<< +_SetTrackOut mac + Tool $2623 + <<< +_InitMIDIDriver mac + Tool $2723 + <<< +_RemoveMIDIDriver mac + Tool $2823 + <<< + diff --git a/macros/Misc.Macs.s b/macros/Misc.Macs.s new file mode 100644 index 0000000..76e0b62 --- /dev/null +++ b/macros/Misc.Macs.s @@ -0,0 +1,278 @@ +* Misc Tool macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_MTBootInit MAC + Tool $103 + <<< +_MTStartUp MAC + Tool $203 + <<< +_MTShutDown MAC + Tool $303 + <<< +~MTVersion MAC + PHA +_MTVersion MAC + Tool $403 + <<< +_MTReset MAC + Tool $503 + <<< +~MTStatus MAC + PHA +_MTStatus MAC + Tool $603 + <<< +~WriteBRam MAC + PHL ]1 +_WriteBRam MAC + Tool $903 + <<< +~ReadBRam MAC + PHL ]1 +_ReadBRam MAC + Tool $A03 + <<< +~WriteBParam MAC + PxW ]1;]2 +_WriteBParam MAC + Tool $B03 + <<< +~ReadBParam MAC + P1SW ]1 +_ReadBParam MAC + Tool $C03 + <<< +~ReadTimeHex MAC + PHS 4 +_ReadTimeHex MAC + Tool $D03 + <<< +~WriteTimeHex MAC + PxW ]1;]2;]3 +_WriteTimeHex MAC + Tool $E03 + <<< +~ReadAsciiTime MAC + PHL ]1 +_ReadAsciiTime MAC + Tool $F03 + <<< +~SetVector MAC + PHWL ]1;]2 +_SetVector MAC + Tool $1003 + <<< +~GetVector MAC + P2SW ]1 +_GetVector MAC + Tool $1103 + <<< +~SetHeartBeat MAC + PHL ]1 +_SetHeartBeat MAC + Tool $1203 + <<< +~DelHeartBeat MAC + PHL ]1 +_DelHeartBeat MAC + Tool $1303 + <<< +_ClrHeartBeat MAC + Tool $1403 + <<< +~SysFailMgr MAC + PHWL ]1;]2 +_SysFailMgr MAC + Tool $1503 + <<< +~GetAddr MAC + P2SW ]1 +_GetAddr MAC + Tool $1603 + <<< +~ReadMouse MAC + PHS 3 +_ReadMouse MAC + Tool $1703 + <<< +~InitMouse MAC + PHW ]1 +_InitMouse MAC + Tool $1803 + <<< +~SetMouse MAC + PHW ]1 +_SetMouse MAC + Tool $1903 + <<< +_HomeMouse MAC + Tool $1A03 + <<< +_ClearMouse MAC + Tool $1B03 + <<< +~ClampMouse MAC + PxW ]1;]2;]3;]4 +_ClampMouse MAC + Tool $1C03 + <<< +~GetMouseClamp MAC + PHS 4 +_GetMouseClamp MAC + Tool $1D03 + <<< +~PosMouse MAC + PxW ]1;]2 +_PosMouse MAC + Tool $1E03 + <<< +~ServeMouse MAC + PHA +_ServeMouse MAC + Tool $1F03 + <<< +~GetNewID MAC + P1SW ]1 +_GetNewID MAC + Tool $2003 + <<< +~DeleteID MAC + PHW ]1 +_DeleteID MAC + Tool $2103 + <<< +~StatusID MAC + PHW ]1 +_StatusID MAC + Tool $2203 + <<< +~IntSource MAC + PHW ]1 +_IntSource MAC + Tool $2303 + <<< +~FWEntry MAC + PHS 4 + PxW ]1;]2;]3;]4 +_FWEntry MAC + Tool $2403 + <<< +~GetTick MAC + PHS 2 +_GetTick MAC + Tool $2503 + <<< +~PackBytes MAC + P1SL ]1 + PxL ]2;]3 + PHW ]4 +_PackBytes MAC + Tool $2603 + <<< +~UnPackBytes MAC + P1SL ]1 + PHW ]2 + PxL ]3;]4 +_UnPackBytes MAC + Tool $2703 + <<< +~Munger MAC + P1SL ]1 + PxL ]2;]3 + PHWL ]4;]5 + PHWL ]6;]7 +_Munger MAC + Tool $2803 + <<< +~GetIRQEnable MAC + PHA +_GetIRQEnable MAC + Tool $2903 + <<< +~SetAbsClamp MAC + PxW ]1;]2;]3;]4 +_SetAbsClamp MAC + Tool $2A03 + <<< +~GetAbsClamp MAC + PHS 4 +_GetAbsClamp MAC + Tool $2B03 + <<< +_SysBeep MAC + Tool $2C03 + <<< +~AddToQueue MAC + PxL ]1;]2 +_AddToQueue MAC + Tool $2E03 + <<< +~DeleteFromQueue MAC + PxL ]1;]2 +_DeleteFromQueue MAC + Tool $2F03 + <<< +~SetInterruptState MAC + PHLW ]1;]2 +_SetInterruptState MAC + Tool $3003 + <<< +~GetInterruptState MAC + PHLW ]1;]2 +_GetInterruptState MAC + Tool $3103 + <<< +~GetIntStateRecSize MAC + PHA +_GetIntStateRecSize MAC + Tool $3203 + <<< +~ReadMouse2 MAC + PHS 3 +_ReadMouse2 MAC + Tool $3303 + <<< +~GetCodeResConverter MAC + PHS 2 +_GetCodeResConverter MAC + Tool $3403 + <<< +_GetROMResource MAC ;private + Tool $3503 + <<< +_ReleaseROMResource MAC ;private + Tool $3603 + <<< +_ConvSeconds MAC + Tool $3703 + <<< +_SysBeep2 MAC + Tool $3803 + <<< +_VersionString MAC + Tool $3903 + <<< +_WaitUntil MAC + Tool $3A03 + <<< +_StringToText MAC + Tool $3B03 + <<< +_ShowBootInfo MAC + Tool $3C03 + <<< +_ScanDevices MAC + Tool $3D03 + <<< +_AlertMessage MAC + Tool $3E03 + <<< +_DoSysPrefs MAC + Tool $3F03 + <<< + diff --git a/macros/NoteSeq.Macs.s b/macros/NoteSeq.Macs.s new file mode 100644 index 0000000..facd288 --- /dev/null +++ b/macros/NoteSeq.Macs.s @@ -0,0 +1,89 @@ +* Note sequencer macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_SeqBootInit MAC + Tool $011A + <<< +~SeqStartUp MAC + PxW ]1;]2;]3;]4 +_SeqStartUp MAC + Tool $021A + <<< +_SeqShutDown MAC + Tool $031A + <<< +~SeqVersion MAC + PHA +_SeqVersion MAC + Tool $041A + <<< +_SeqReset MAC + Tool $051A + <<< +~SeqStatus MAC + PHA +_SeqStatus MAC + Tool $061A + <<< +~SetIncr MAC + PHW ]1 +_SetIncr MAC + Tool $091A + <<< +~ClearIncr MAC + PHA +_ClearIncr MAC + Tool $0A1A + <<< +~GetTimer MAC + PHA +_GetTimer MAC + Tool $0B1A + <<< +~GetLoc MAC + PHS 3 +_GetLoc MAC + Tool $0C1A + <<< +_SeqAllNotesOff MAC + Tool $0D1A + <<< +~SetTrkInfo MAC + PxW ]1;]2;]3 +_SetTrkInfo MAC + Tool $0E1A + <<< +~StartSeq MAC + PxL ]1;]2;]3 +_StartSeq MAC + Tool $0F1A + <<< +_StepSeq MAC + Tool $101A + <<< +~StopSeq MAC + PHW ]1 +_StopSeq MAC + Tool $111A + <<< +~SetInstTable MAC + PHL ]1 +_SetInstTable MAC + Tool $121A + <<< +_StartInts MAC + Tool $131A + <<< +_StopInts MAC + Tool $141A + <<< +~StartSeqRel MAC + PxL ]1;]2;]3 +_StartSeqRel MAC + Tool $151A + <<< + diff --git a/macros/NoteSyn.Macs.s b/macros/NoteSyn.Macs.s new file mode 100644 index 0000000..af201c3 --- /dev/null +++ b/macros/NoteSyn.Macs.s @@ -0,0 +1,66 @@ +* Note synthesizer macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_NSBootInit MAC + Tool $119 + <<< +~NSStartUp MAC + PHWL ]1;]2 +_NSStartUp MAC + Tool $219 + <<< +_NSShutDown MAC + Tool $319 + <<< +~NSVersion MAC + PHA +_NSVersion MAC + Tool $419 + <<< +_NSReset MAC + Tool $519 + <<< +~NSStatus MAC + PHA +_NSStatus MAC + Tool $619 + <<< +~AllocGen MAC + P1SW ]1 +_AllocGen MAC + Tool $919 + <<< +~DeallocGen MAC + PHW ]1 +_DeallocGen MAC + Tool $A19 + <<< +~NoteOn MAC + PxW ]1;]2;]3 + PHL ]4 +_NoteOn MAC + Tool $B19 + <<< +~NoteOff MAC + PxW ]1;]2 +_NoteOff MAC + Tool $C19 + <<< +_AllNotesOff MAC + Tool $D19 + <<< +~NSSetUpdateRate MAC + P1SW ]1 +_NSSetUpdateRate MAC + Tool $E19 + <<< +~NSSetUserUpdateRtn MAC + P2SL ]1 +_NSSetUserUpdateRtn MAC + Tool $F19 + <<< + diff --git a/macros/Print.Macs.s b/macros/Print.Macs.s new file mode 100644 index 0000000..eb65d3a --- /dev/null +++ b/macros/Print.Macs.s @@ -0,0 +1,220 @@ +* Print Mgr. macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_PMBootInit MAC + Tool $0113 + <<< +~PMStartUp MAC + PxW ]1;]2 +_PMStartUp MAC + Tool $0213 + <<< +_PMShutDown MAC + Tool $0313 + <<< +~PMVersion MAC + PHA +_PMVersion MAC + Tool $0413 + <<< +_PMReset MAC + Tool $0513 + <<< +~PMStatus MAC + PHA +_PMStatus MAC + Tool $0613 + <<< +~PrDefault MAC + PHL ]1 +_PrDefault MAC + Tool $0913 + <<< +~PrValidate MAC + P1SL ]1 +_PrValidate MAC + Tool $0A13 + <<< +~PrStlDialog MAC + P1SL ]1 +_PrStlDialog MAC + Tool $0B13 + <<< +~PrJobDialog MAC + P1SL ]1 +_PrJobDialog MAC + Tool $0C13 + <<< +~PrPixelMap MAC + PxL ]1;]2 + PHW ]3 +_PrPixelMap MAC + Tool $0D13 + <<< +~PrOpenDoc MAC + P2SL ]1 + PHL ]2 +_PrOpenDoc MAC + Tool $0E13 + <<< +~PrCloseDoc MAC + PHL ]1 +_PrCloseDoc MAC + Tool $0F13 + <<< +~PrOpenPage MAC + PxL ]1;]2 +_PrOpenPage MAC + Tool $1013 + <<< +~PrClosePage MAC + PHL ]1 +_PrClosePage MAC + Tool $1113 + <<< +~PrPicFile MAC + PxL ]1;]2;]3 +_PrPicFile MAC + Tool $1213 + <<< +_PrControl MAC + Tool $1313 + <<< +~PrError MAC + PHA +_PrError MAC + Tool $1413 + <<< +~PrSetError MAC + PHW ]1 +_PrSetError MAC + Tool $1513 + <<< +~PrChoosePrinter MAC + PHA +_PrChoosePrinter MAC + Tool $1613 + <<< +_GetDeviceName MAC + Tool $1703 + <<< +~PrGetPrinterSpecs MAC + PHS 2 +_PrGetPrinterSpecs MAC + Tool $1813 + <<< +_PrDevPrChanged MAC + Tool $1913 + <<< +_PrDevStartup MAC + Tool $1A13 + <<< +_PrDevShutDown MAC + Tool $1B13 + <<< +_PrDevOpen MAC + Tool $1C13 + <<< +_PrDevRead MAC + Tool $1D13 + <<< +_PrDevWrite MAC + Tool $1E13 + <<< +_PrDevClose MAC + Tool $1F13 + <<< +_PrDevStatus MAC + Tool $2013 + <<< +_PrDevAsyncRead MAC + Tool $2113 + <<< +_PrDevWriteBackground MAC + Tool $2213 + <<< +~PrDriverVer MAC + PHA +_PrDriverVer MAC + Tool $2313 + <<< +~PrPortVer MAC + PHA +_PrPortVer MAC + Tool $2413 + <<< +~PrGetZoneName MAC + PHS 2 +_PrGetZoneName MAC + Tool $2513 + <<< +~PrGetPrinterDvrName MAC + PHS 2 +_PrGetPrinterDvrName MAC + Tool $2813 + <<< +~PrGetPortDvrName MAC + PHS 2 +_PrGetPortDvrName MAC + Tool $2913 + <<< +~PrGetUserName MAC + PHS 2 +_PrGetUserName MAC + Tool $2A13 + <<< +~PrGetNetworkName MAC + PHS 2 +_PrGetNetworkName MAC + Tool $2B13 + <<< +_PrDevIsItSafe MAC + Tool $3013 + <<< +_GetZoneList MAC + Tool $3113 + <<< +_GetMyZone MAC + Tool $3213 + <<< +_GetPrinterList MAC + Tool $3313 + <<< +~PMUnloadDriver MAC + PHW ]1 +_PMUnloadDriver MAC + Tool $3413 + <<< +~PMLoadDriver MAC + PHW ]1 +_PMLoadDriver MAC + Tool $3513 + <<< +~PrGetDocName MAC + PHS 2 +_PrGetDocName MAC + Tool $3613 + <<< +~PrSetDocName MAC + PHL ]1 +_PrSetDocName MAC + Tool $3713 + <<< +~PrGetPgOrientation MAC + P1SL ]1 +_PrGetPgOrientation MAC + Tool $3813 + <<< +~qPMStartUp MAC + PHW ]1 + CLC + LDA ]2 + ADC ]NextDP + PHA + Tool $0213 + <<< + diff --git a/macros/Qd.Macs.s b/macros/Qd.Macs.s new file mode 100644 index 0000000..08ecdba --- /dev/null +++ b/macros/Qd.Macs.s @@ -0,0 +1,1102 @@ +* QuickDraw II macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_QDBootInit MAC + Tool $104 + <<< +~QDStartUp MAC + PxW ]1;]2;]3;]4 +_QDStartUp MAC + Tool $204 + <<< +_QDShutDown MAC + Tool $304 + <<< +~QDVersion MAC + PHA +_QDVersion MAC + Tool $404 + <<< +_QDReset MAC + Tool $504 + <<< +~QDStatus MAC + PHA +_QDStatus MAC + Tool $604 + <<< +~GetAddress MAC + P2SW ]1 +_GetAddress MAC + Tool $904 + <<< +_GrafOn MAC + Tool $A04 + <<< +_GrafOff MAC + Tool $B04 + <<< +~GetStandardSCB MAC + PHA +_GetStandardSCB MAC + Tool $C04 + <<< +~InitColorTable MAC + PHL ]1 +_InitColorTable MAC + Tool $D04 + <<< +~SetColorTable MAC + PHWL ]1;]2 +_SetColorTable MAC + Tool $E04 + <<< +~GetColorTable MAC + PHWL ]1;]2 +_GetColorTable MAC + Tool $F04 + <<< +~SetColorEntry MAC + PxW ]1;]2;]3 +_SetColorEntry MAC + Tool $1004 + <<< +~GetColorEntry MAC + PHA + PxW ]1;]2 +_GetColorEntry MAC + Tool $1104 + <<< +~SetSCB MAC + PxW ]1;]2 +_SetSCB MAC + Tool $1204 + <<< +~GetSCB MAC + P1SW ]1 +_GetSCB MAC + Tool $1304 + <<< +~SetAllSCBs MAC + PHW ]1 +_SetAllSCBs MAC + Tool $1404 + <<< +~ClearScreen MAC + PHW ]1 +_ClearScreen MAC + Tool $1504 + <<< +~SetMasterSCB MAC + PHW ]1 +_SetMasterSCB MAC + Tool $1604 + <<< +~GetMasterSCB MAC + PHA +_GetMasterSCB MAC + Tool $1704 + <<< +~OpenPort MAC + PHL ]1 +_OpenPort MAC + Tool $1804 + <<< +~InitPort MAC + PHL ]1 +_InitPort MAC + Tool $1904 + <<< +~ClosePort MAC + PHL ]1 +_ClosePort MAC + Tool $1A04 + <<< +~SetPort MAC + PHL ]1 +_SetPort MAC + Tool $1B04 + <<< +~GetPort MAC + PHS 2 +_GetPort MAC + Tool $1C04 + <<< +~SetPortLoc MAC + PHL ]1 +_SetPortLoc MAC + Tool $1D04 + <<< +~GetPortLoc MAC + PHL ]1 +_GetPortLoc MAC + Tool $1E04 + <<< +~SetPortRect MAC + PHL ]1 +_SetPortRect MAC + Tool $1F04 + <<< +~GetPortRect MAC + PHL ]1 +_GetPortRect MAC + Tool $2004 + <<< +~SetPortSize MAC + PxW ]1;]2 +_SetPortSize MAC + Tool $2104 + <<< +~MovePortTo MAC + PxW ]1;]2 +_MovePortTo MAC + Tool $2204 + <<< +~SetOrigin MAC + PxW ]1;]2 +_SetOrigin MAC + Tool $2304 + <<< +~SetClip MAC + PHL ]1 +_SetClip MAC + Tool $2404 + <<< +~GetClip MAC + PHL ]1 +_GetClip MAC + Tool $2504 + <<< +~ClipRect MAC + PHL ]1 +_ClipRect MAC + Tool $2604 + <<< +_HidePen MAC + Tool $2704 + <<< +_ShowPen MAC + Tool $2804 + <<< +~GetPen MAC + PHL ]1 +_GetPen MAC + Tool $2904 + <<< +~SetPenState MAC + PHL ]1 +_SetPenState MAC + Tool $2A04 + <<< +~GetPenState MAC + PHL ]1 +_GetPenState MAC + Tool $2B04 + <<< +~SetPenSize MAC + PxW ]1;]2 +_SetPenSize MAC + Tool $2C04 + <<< +~GetPenSize MAC + PHL ]1 +_GetPenSize MAC + Tool $2D04 + <<< +~SetPenMode MAC + PHW ]1 +_SetPenMode MAC + Tool $2E04 + <<< +~GetPenMode MAC + PHA +_GetPenMode MAC + Tool $2F04 + <<< +~SetPenPat MAC + PHL ]1 +_SetPenPat MAC + Tool $3004 + <<< +~GetPenPat MAC + PHL ]1 +_GetPenPat MAC + Tool $3104 + <<< +~SetPenMask MAC + PHL ]1 +_SetPenMask MAC + Tool $3204 + <<< +~GetPenMask MAC + PHL ]1 +_GetPenMask MAC + Tool $3304 + <<< +~SetBackPat MAC + PHL ]1 +_SetBackPat MAC + Tool $3404 + <<< +~GetBackPat MAC + PHL ]1 +_GetBackPat MAC + Tool $3504 + <<< +_PenNormal MAC + Tool $3604 + <<< +~SetSolidPenPat MAC + PHW ]1 +_SetSolidPenPat MAC + Tool $3704 + <<< +~SetSolidBackPat MAC + PHW ]1 +_SetSolidBackPat MAC + Tool $3804 + <<< +~SolidPattern MAC + PHWL ]1;]2 +_SolidPattern MAC + Tool $3904 + <<< +~MoveTo MAC +GotoXY MAC +QDGotoXY MAC + PxW ]1;]2 +_MoveTo MAC + Tool $3A04 + <<< +~Move MAC + PxW ]1;]2 +_Move MAC + Tool $3B04 + <<< +~LineTo MAC + PxW ]1;]2 +_LineTo MAC + Tool $3C04 + <<< +~Line MAC + PxW ]1;]2 +_Line MAC + Tool $3D04 + <<< +~SetPicSave MAC + PHL ]1 +_SetPicSave MAC + Tool $3E04 + <<< +~GetPicSave MAC + PHS 2 +_GetPicSave MAC + Tool $3F04 + <<< +~SetRgnSave MAC + PHL ]1 +_SetRgnSave MAC + Tool $4004 + <<< +~GetRgnSave MAC + PHS 2 +_GetRgnSave MAC + Tool $4104 + <<< +~SetPolySave MAC + PHL ]1 +_SetPolySave MAC + Tool $4204 + <<< +~GetPolySave MAC + PHS 2 +_GetPolySave MAC + Tool $4304 + <<< +~SetGrafProcs MAC + PHL ]1 +_SetGrafProcs MAC + Tool $4404 + <<< +~GetGrafProcs MAC + PHS 2 +_GetGrafProcs MAC + Tool $4504 + <<< +~SetUserField MAC + PHL ]1 +_SetUserField MAC + Tool $4604 + <<< +~GetUserField MAC + PHS 2 +_GetUserField MAC + Tool $4704 + <<< +~SetSysField MAC + PHL ]1 +_SetSysField MAC + Tool $4804 + <<< +~GetSysField MAC + PHS 2 +_GetSysField MAC + Tool $4904 + <<< +~SetRect MAC + PHL ]1 + PxW ]2;]3;]4;]5 +_SetRect MAC + Tool $4A04 + <<< +~OffsetRect MAC + PHL ]1 + PxW ]2;]3 +_OffsetRect MAC + Tool $4B04 + <<< +~InsetRect MAC + PHL ]1 + PxW ]2;]3 +_InsetRect MAC + Tool $4C04 + <<< +~SectRect MAC + PHA + PxL ]1;]2;]3 +_SectRect MAC + Tool $4D04 + <<< +~UnionRect MAC + PxL ]1;]2;]3 +_UnionRect MAC + Tool $4E04 + <<< +~PtInRect MAC + PHA + PxL ]1;]2 +_PtInRect MAC + Tool $4F04 + <<< +~Pt2Rect MAC + PxL ]1;]2;]3 +_Pt2Rect MAC + Tool $5004 + <<< +~EqualRect MAC + PHA + PxL ]1;]2 +_EqualRect MAC + Tool $5104 + <<< +~NotEmptyRect MAC + P1SL ]1 +_NotEmptyRect MAC + Tool $5204 + <<< +~EmptyRect MAC + P1SL ]1 +_EmptyRect MAC + Tool $5204 + <<< +~FrameRect MAC + PHL ]1 +_FrameRect MAC + Tool $5304 + <<< +~PaintRect MAC + PHL ]1 +_PaintRect MAC + Tool $5404 + <<< +~EraseRect MAC + PHL ]1 +_EraseRect MAC + Tool $5504 + <<< +~InvertRect MAC + PHL ]1 +_InvertRect MAC + Tool $5604 + <<< +~FillRect MAC + PxL ]1;]2 +_FillRect MAC + Tool $5704 + <<< +~FrameOval MAC + PHL ]1 +_FrameOval MAC + Tool $5804 + <<< +~PaintOval MAC + PHL ]1 +_PaintOval MAC + Tool $5904 + <<< +~EraseOval MAC + PHL ]1 +_EraseOval MAC + Tool $5A04 + <<< +~InvertOval MAC + PHL ]1 +_InvertOval MAC + Tool $5B04 + <<< +~FillOval MAC + PxL ]1;]2 +_FillOval MAC + Tool $5C04 + <<< +~FrameRRect MAC + PHL ]1 + PxW ]2;]3 +_FrameRRect MAC + Tool $5D04 + <<< +~PaintRRect MAC + PHL ]1 + PxW ]2;]3 +_PaintRRect MAC + Tool $5E04 + <<< +~EraseRRect MAC + PHL ]1 + PxW ]2;]3 +_EraseRRect MAC + Tool $5F04 + <<< +~InvertRRect MAC + PHL ]1 + PxW ]2;]3 +_InvertRRect MAC + Tool $6004 + <<< +~FillRRect MAC + PHLW ]1;]2 + PHWL ]3;]4 +_FillRRect MAC + Tool $6104 + <<< +~FrameArc MAC + PHL ]1 + PxW ]2;]3 +_FrameArc MAC + Tool $6204 + <<< +~PaintArc MAC + PHL ]1 + PxW ]2;]3 +_PaintArc MAC + Tool $6304 + <<< +~EraseArc MAC + PHL ]1 + PxW ]2;]3 +_EraseArc MAC + Tool $6404 + <<< +~InvertArc MAC + PHL ]1 + PxW ]2;]3 +_InvertArc MAC + Tool $6504 + <<< +~FillArc MAC + PHLW ]1;]2 + PHWL ]3;]4 +_FillArc MAC + Tool $6604 + <<< +~NewRgn MAC + PHS 2 +_NewRgn MAC + Tool $6704 + <<< +~DisposeRgn MAC + PHL ]1 +_DisposeRgn MAC + Tool $6804 + <<< +~CopyRgn MAC + PxL ]1;]2 +_CopyRgn MAC + Tool $6904 + <<< +~SetEmptyRgn MAC + PHL ]1 +_SetEmptyRgn MAC + Tool $6A04 + <<< +~SetRectRgn MAC + PHL ]1 + PxW ]2;]3;]4;]5 +_SetRectRgn MAC + Tool $6B04 + <<< +~RectRgn MAC + PxL ]1;]2 +_RectRgn MAC + Tool $6C04 + <<< +_OpenRgn MAC + Tool $6D04 + <<< +~CloseRgn MAC + PHL ]1 +_CloseRgn MAC + Tool $6E04 + <<< +~OffsetRgn MAC + PHL ]1 + PxW ]2;]3 +_OffsetRgn MAC + Tool $6F04 + <<< +~InsetRgn MAC + PHL ]1 + PxW ]2;]3 +_InsetRgn MAC + Tool $7004 + <<< +~SectRgn MAC + PxL ]1;]2;]3 +_SectRgn MAC + Tool $7104 + <<< +~UnionRgn MAC + PxL ]1;]2;]3 +_UnionRgn MAC + Tool $7204 + <<< +~DiffRgn MAC + PxL ]1;]2;]3 +_DiffRgn MAC + Tool $7304 + <<< +~XorRgn MAC + PxL ]1;]2;]3 +_XorRgn MAC + Tool $7404 + <<< +~PtInRgn MAC + PHA + PxL ]1;]2 +_PtInRgn MAC + Tool $7504 + <<< +~RectInRgn MAC + PHA + PxL ]1;]2 +_RectInRgn MAC + Tool $7604 + <<< +~EqualRgn MAC + PHA + PxL ]1;]2 +_EqualRgn MAC + Tool $7704 + <<< +~EmptyRgn MAC + P1SL ]1 +_EmptyRgn MAC + Tool $7804 + <<< +~FrameRgn MAC + PHL ]1 +_FrameRgn MAC + Tool $7904 + <<< +~PaintRgn MAC + PHL ]1 +_PaintRgn MAC + Tool $7A04 + <<< +~EraseRgn MAC + PHL ]1 +_EraseRgn MAC + Tool $7B04 + <<< +~InvertRgn MAC + PHL ]1 +_InvertRgn MAC + Tool $7C04 + <<< +~FillRgn MAC + PxL ]1;]2 +_FillRgn MAC + Tool $7D04 + <<< +~ScrollRect MAC + PHLW ]1;]2 + PHWL ]3;]4 +_ScrollRect MAC + Tool $7E04 + <<< +~PaintPixels MAC + PHL ]1 +_PaintPixels MAC + Tool $7F04 + <<< +~AddPt MAC + PxL ]1;]2 +_AddPt MAC + Tool $8004 + <<< +~SubPt MAC + PxL ]1;]2 +_SubPt MAC + Tool $8104 + <<< +~SetPt MAC + PHL ]1 + PxW ]2;]3 +_SetPt MAC + Tool $8204 + <<< +~EqualPt MAC + PHA + PxL ]1;]2 +_EqualPt MAC + Tool $8304 + <<< +~LocalToGlobal MAC + PHL ]1 +_LocalToGlobal MAC + Tool $8404 + <<< +~GlobalToLocal MAC + PHL ]1 +_GlobalToLocal MAC + Tool $8504 + <<< +~Random MAC + PHA +_Random MAC + Tool $8604 + <<< +~SetRandSeed MAC + PHL ]1 +_SetRandSeed MAC + Tool $8704 + <<< +~GetPixel MAC + PHA + PxW ]1;]2 +_GetPixel MAC + Tool $8804 + <<< +~ScalePt MAC + PxL ]1;]2;]3 +_ScalePt MAC + Tool $8904 + <<< +~MapPt MAC + PxL ]1;]2;]3 +_MapPt MAC + Tool $8A04 + <<< +~MapRect MAC + PxL ]1;]2;]3 +_MapRect MAC + Tool $8B04 + <<< +~MapRgn MAC + PxL ]1;]2;]3 +_MapRgn MAC + Tool $8C04 + <<< +~SetStdProcs MAC + PHL ]1 +_SetStdProcs MAC + Tool $8D04 + <<< +~SetCursor MAC + PHL ]1 +_SetCursor MAC + Tool $8E04 + <<< +~GetCursorAdr MAC + PHS 2 +_GetCursorAdr MAC + Tool $8F04 + <<< +_HideCursor MAC + Tool $9004 + <<< +_ShowCursor MAC + Tool $9104 + <<< +_ObscureCursor MAC + Tool $9204 + <<< +_SetMouseLoc MAC + Tool $9304 + <<< +~SetFont MAC + PHL ]1 +_SetFont MAC + Tool $9404 + <<< +~GetFont MAC + PHS 2 +_GetFont MAC + Tool $9504 + <<< +~GetFontInfo MAC + PHL ]1 +_GetFontInfo MAC + Tool $9604 + <<< +~GetFontGlobals MAC + PHL ]1 +_GetFontGlobals MAC + Tool $9704 + <<< +~SetFontFlags MAC + PHW ]1 +_SetFontFlags MAC + Tool $9804 + <<< +~GetFontFlags MAC + PHA +_GetFontFlags MAC + Tool $9904 + <<< +~SetTextFace MAC + PHW ]1 +_SetTextFace MAC + Tool $9A04 + <<< +~GetTextFace MAC + PHA +_GetTextFace MAC + Tool $9B04 + <<< +~SetTextMode MAC + PHW ]1 +_SetTextMode MAC + Tool $9C04 + <<< +~GetTextMode MAC + PHA +_GetTextMode MAC + Tool $9D04 + <<< +~SetSpaceExtra MAC + PHL ]1 +_SetSpaceExtra MAC + Tool $9E04 + <<< +~GetSpaceExtra MAC + PHS 2 +_GetSpaceExtra MAC + Tool $9F04 + <<< +~SetForeColor MAC + PHW ]1 +_SetForeColor MAC + Tool $A004 + <<< +~GetForeColor MAC + PHA +_GetForeColor MAC + Tool $A104 + <<< +~SetBackColor MAC + PHW ]1 +_SetBackColor MAC + Tool $A204 + <<< +~GetBackColor MAC + PHA +_GetBackColor MAC + Tool $A304 + <<< +~DrawChar MAC + PHW ]1 +_DrawChar MAC + Tool $A404 + <<< +~DrawString MAC + PHL ]1 +_DrawString MAC + Tool $A504 + <<< +~DrawCString MAC + PHL ]1 +_DrawCString MAC + Tool $A604 + <<< +~DrawText MAC + PHLW ]1;]2 +_DrawText MAC + Tool $A704 + <<< +~CharWidth MAC + P1SW ]1 +_CharWidth MAC + Tool $A804 + <<< +~StringWidth MAC + P1SL ]1 +_StringWidth MAC + Tool $A904 + <<< +~CStringWidth MAC + P1SL ]1 +_CStringWidth MAC + Tool $AA04 + <<< +~TextWidth MAC + P1SL ]1 + PHW ]2 +_TextWidth MAC + Tool $AB04 + <<< +~CharBounds MAC + PHWL ]1;]2 +_CharBounds MAC + Tool $AC04 + <<< +~StringBounds MAC + PxL ]1;]2 +_StringBounds MAC + Tool $AD04 + <<< +~CStringBounds MAC + PxL ]1;]2 +_CStringBounds MAC + Tool $AE04 + <<< +~TextBounds MAC + PHLW ]1;]2 + PHL ]3 +_TextBounds MAC + Tool $AF04 + <<< +~SetArcRot MAC + PHW ]1 +_SetArcRot MAC + Tool $B004 + <<< +~GetArcRot MAC + PHA +_GetArcRot MAC + Tool $B104 + <<< +~SetSysFont MAC + PHL ]1 +_SetSysFont MAC + Tool $B204 + <<< +~GetSysFont MAC + PHS 2 +_GetSysFont MAC + Tool $B304 + <<< +~SetVisRgn MAC + PHL ]1 +_SetVisRgn MAC + Tool $B404 + <<< +~GetVisRgn MAC + PHL ]1 +_GetVisRgn MAC + Tool $B504 + <<< +~SetIntUse MAC + PHW ]1 +_SetIntUse MAC + Tool $B604 + <<< +~OpenPicture MAC + P2SL ]1 +_OpenPicture MAC + Tool $B704 + <<< +~PicComment MAC + PHW ]1 + PHWL ]2;]3 +_PicComment MAC + Tool $B804 + <<< +_ClosePicture MAC + Tool $B904 + <<< +~DrawPicture MAC + PxL ]1;]2 +_DrawPicture MAC + Tool $BA04 + <<< +~KillPicture MAC + PHL ]1 +_KillPicture MAC + Tool $BB04 + <<< +~FramePoly MAC + PHL ]1 +_FramePoly MAC + Tool $BC04 + <<< +~PaintPoly MAC + PHL ]1 +_PaintPoly MAC + Tool $BD04 + <<< +~ErasePoly MAC + PHL ]1 +_ErasePoly MAC + Tool $BE04 + <<< +~InvertPoly MAC + PHL ]1 +_InvertPoly MAC + Tool $BF04 + <<< +~FillPoly MAC + PxL ]1;]2 +_FillPoly MAC + Tool $C004 + <<< +~OpenPoly MAC + PHS 2 +_OpenPoly MAC + Tool $C104 + <<< +_ClosePoly MAC + Tool $C204 + <<< +~KillPoly MAC + PHL ]1 +_KillPoly MAC + Tool $C304 + <<< +~OffsetPoly MAC + PHL ]1 + PxW ]2;]3 +_OffsetPoly MAC + Tool $C404 + <<< +~MapPoly MAC + PxL ]1;]2;]3 +_MapPoly MAC + Tool $C504 + <<< +~SetClipHandle MAC + PHL ]1 +_SetClipHandle MAC + Tool $C604 + <<< +~GetClipHandle MAC + PHS 2 +_GetClipHandle MAC + Tool $C704 + <<< +~SetVisHandle MAC + PHL ]1 +_SetVisHandle MAC + Tool $C804 + <<< +~GetVisHandle MAC + PHS 2 +_GetVisHandle MAC + Tool $C904 + <<< +_InitCursor MAC + Tool $CA04 + <<< +~SetBufDims MAC + PxW ]1;]2;]3 +_SetBufDims MAC + Tool $CB04 + <<< +~ForceBufDims MAC + PxW ]1;]2;]3 +_ForceBufDims MAC + Tool $CC04 + <<< +~SaveBufDims MAC + PHL ]1 +_SaveBufDims MAC + Tool $CD04 + <<< +~RestoreBufDims MAC + PHL ]1 +_RestoreBufDims MAC + Tool $CE04 + <<< +~GetFGSize MAC + PHA +_GetFGSize MAC + Tool $CF04 + <<< +~SetFontID MAC + PHL ]1 +_SetFontID MAC + Tool $D004 + <<< +~GetFontID MAC + PHS 2 +_GetFontID MAC + Tool $D104 + <<< +~SetTextSize MAC + PHW ]1 +_SetTextSize MAC + Tool $D204 + <<< +~GetTextSize MAC + PHA +_GetTextSize MAC + Tool $D304 + <<< +~SetCharExtra MAC + PHL ]1 +_SetCharExtra MAC + Tool $D404 + <<< +~GetCharExtra MAC + PHS 2 +_GetCharExtra MAC + Tool $D504 + <<< +~PPToPort MAC + PxL ]1;]2 + PxW ]3;]4;]5 +_PPToPort MAC + Tool $D604 + <<< +~InflateTextBuffer MAC + PxW ]1;]2 +_InflateTextBuffer MAC + Tool $D704 + <<< +~GetRomFont MAC + PHL ]1 +_GetRomFont MAC + Tool $D804 + <<< +~GetFontLore MAC + PHA + PHLW ]1;]2 +_GetFontLore MAC + Tool $D904 + <<< +_Get640Colors MAC + Tool $DA04 + <<< +_Set640Color MAC + Tool $DB04 + <<< +~qQDStartUp MAC + NextDP ]1;$300 + PxW ]2;]3;]4 + Tool $204 + <<< + diff --git a/macros/QdAux.Macs.s b/macros/QdAux.Macs.s new file mode 100644 index 0000000..eb15572 --- /dev/null +++ b/macros/QdAux.Macs.s @@ -0,0 +1,86 @@ +* QuickDraw Aux macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_QDAuxBootInit MAC + Tool $112 + <<< +_QDAuxStartUp MAC + Tool $212 + <<< +_QDAuxShutDown MAC + Tool $312 + <<< +~QDAuxVersion MAC + PHA +_QDAuxVersion MAC + Tool $412 + <<< +_QDAuxReset MAC + Tool $512 + <<< +~QDAuxStatus MAC + PHA +_QDAuxStatus MAC + Tool $612 + <<< +~CopyPixels MAC + PxL ]1;]2;]3;]4 + PHWL ]5;]6 +_CopyPixels MAC + Tool $912 + <<< +_WaitCursor MAC + Tool $A12 + <<< +~DrawIcon MAC + PHLW ]1;]2 + PxW ]3;]4 +_DrawIcon MAC + Tool $B12 + <<< +~SpecialRect MAC + PHL ]1 + PxW ]2;]3 +_SpecialRect MAC + Tool $C12 + <<< +~SeedFill MAC + PxL ]1;]2;]3;]4 + PxW ]5;]6;]7 + PxL ]8;]9 +_SeedFill MAC + Tool $D12 + <<< +~CalcMask MAC + PxL ]1;]2;]3;]4 + PHW ]5 + PxL ]6;]7 +_CalcMask MAC + Tool $E12 + <<< +_GetSysIcon MAC + Tool $F12 + <<< +_PixelMap2Rgn MAC + Tool $1012 + <<< +_IBeamCursor MAC + Tool $1312 + <<< +_WhooshRect MAC + Tool $1412 + <<< +_DrawStringWidth MAC + Tool $1512 + <<< +_UseColorTable MAC + Tool $1612 + <<< +_RestoreColorTable MAC + Tool $1712 + <<< + diff --git a/macros/Resource.Macs.s b/macros/Resource.Macs.s new file mode 100644 index 0000000..f1ee030 --- /dev/null +++ b/macros/Resource.Macs.s @@ -0,0 +1,229 @@ +* Resource macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_ResourceBootInit MAC + Tool $11E + <<< +~ResourceStartUp MAC + PHW ]1 +_ResourceStartUp MAC + Tool $21E + <<< +_ResourceShutDown MAC + Tool $31E + <<< +~ResourceVersion MAC + PHA +_ResourceVersion MAC + Tool $41E + <<< +_ResourceReset MAC + Tool $51E + <<< +~ResourceStatus MAC + PHA +_ResourceStatus MAC + Tool $61E + <<< +~CreateResourceFile MAC + PHLW ]1;]2 + PHWL ]3;]4 +_CreateResourceFile MAC + Tool $91E + <<< +~OpenResourceFile MAC + P1SW ]1 + PxL ]2;]3 +_OpenResourceFile MAC + Tool $A1E + <<< +~CloseResourceFile MAC + PHW ]1 +_CloseResourceFile MAC + Tool $B1E + <<< +~AddResource MAC + PHLW ]1;]2 + PHWL ]3;]4 +_AddResource MAC + Tool $C1E + <<< +~UpdateResourceFile MAC + PHW ]1 +_UpdateResourceFile MAC + Tool $D1E + <<< +~LoadResource MAC + P2SW ]1 + PHL ]2 +_LoadResource MAC + Tool $E1E + <<< +~RemoveResource MAC + PHWL ]1;]2 +_RemoveResource MAC + Tool $F1E + <<< +~MarkResourceChange MAC + PxW ]1;]2 + PHL ]3 +_MarkResourceChange MAC + Tool $101E + <<< +~SetCurResourceFile MAC + PHW ]1 +_SetCurResourceFile MAC + Tool $111E + <<< +~GetCurResourceFile MAC + PHA +_GetCurResourceFile MAC + Tool $121E + <<< +~SetCurResourceApp MAC + PHW ]1 +_SetCurResourceApp MAC + Tool $131E + <<< +~GetCurResourceApp MAC + PHA +_GetCurResourceApp MAC + Tool $141E + <<< +~HomeResourceFile MAC + P1SW ]1 + PHL ]2 +_HomeResourceFile MAC + Tool $151E + <<< +~WriteResource MAC + PHWL ]1;]2 +_WriteResource MAC + Tool $161E + <<< +~ReleaseResource MAC + PxW ]1;]2 + PHL ]3 +_ReleaseResource MAC + Tool $171E + <<< +~DetachResource MAC + PHWL ]1;]2 +_DetachResource MAC + Tool $181E + <<< +~UniqueResourceID MAC + P2SW ]1 + PHW ]2 +_UniqueResourceID MAC + Tool $191E + <<< +~SetResourceID MAC + PHLW ]1;]2 + PHL ]3 +_SetResourceID MAC + Tool $1A1E + <<< +~GetResourceAttr MAC + P1SW ]1 + PHL ]2 +_GetResourceAttr MAC + Tool $1B1E + <<< +~SetResourceAttr MAC + PxW ]1;]2 + PHL ]3 +_SetResourceAttr MAC + Tool $1C1E + <<< +~GetResourceSize MAC + P2SW ]1 + PHL ]2 +_GetResourceSize MAC + Tool $1D1E + <<< +~MatchResourceHandle MAC + PxL ]1;]2 +_MatchResourceHandle MAC + Tool $1E1E + <<< +~GetOpenFileRefNum MAC + P1SW ]1 +_GetOpenFileRefNum MAC + Tool $1F1E + <<< +~CountTypes MAC + PHA +_CountTypes MAC + Tool $201E + <<< +~GetIndType MAC + P1SW ]1 +_GetIndType MAC + Tool $211E + <<< +~CountResources MAC + P2SW ]1 +_CountResources MAC + Tool $221E + <<< +~GetIndResource MAC + P2SW ]1 + PHL ]2 +_GetIndResource MAC + Tool $231E + <<< +~SetResourceLoad MAC + P1SW ]1 +_SetResourceLoad MAC + Tool $241E + <<< +~SetResourceFileDepth MAC + P1SW ]1 +_SetResourceFileDepth MAC + Tool $251E + <<< +~GetMapHandle MAC + P2SW ]1 +_GetMapHandle MAC + Tool $261E + <<< +~LoadAbsResource MAC + P2SL ]1 + PHL ]2 + PHWL ]3;]4 +_LoadAbsResource MAC + Tool $271E + <<< +~ResourceConverter MAC + PHL ]1 + PxW ]2;]3 +_ResourceConverter MAC + Tool $281E + <<< +_LoadResource2 MAC + Tool $291E + <<< +_RMFindeNamedResource MAC + Tool $2A1E + <<< +_RMGetResourceName MAC + Tool $2B1E + <<< +_RMLoadNamedResource MAC + Tool $2C1E + <<< +_RMSetResourceName MAC + Tool $2D1E + <<< +_OpenResourceFileByID MAC + Tool $2E1E + <<< +_CompactResourceFile MAC + Tool $2F1E + <<< + diff --git a/macros/Sane.Macs.s b/macros/Sane.Macs.s new file mode 100644 index 0000000..4f0a4bd --- /dev/null +++ b/macros/Sane.Macs.s @@ -0,0 +1,604 @@ +* Sane Toolset macros. +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_SANEBootInit MAC + Tool $10A + <<< +~SANEStartUp MAC + PHW ]1 +_SANEStartUp MAC + Tool $20A + <<< +_SANEShutDown MAC + Tool $30A + <<< +~SANEVersion MAC + PHA +_SANEVersion MAC + Tool $40A + <<< +_SANEReset MAC + Tool $50A + <<< +~SANEStatus MAC + PHA +_SANEStatus MAC + Tool $60A + <<< +_SANEFP816 MAC + Tool $90A + <<< +_SANEDecStr816 MAC + Tool $A0A + <<< +_SANEElems816 MAC + Tool $B0A + <<< +~qSANEStartUp MAC + NextDP ]1;$100 + Tool $20A + <<< +* Auxiliary macros + +FOPRF MAC ;call FP + PEA ]1 + _SANEFP816 + <<< +FOPRD MAC ;call DecStr + PEA ]1 + _SANEDecStr816 + <<< +FOPRE MAC ;call Elems + PEA ]1 + _SANEElems816 + <<< +* Addition + +FADDX MAC + FOPRF 0 + <<< +FADDD MAC + FOPRF $100 + <<< +FADDS MAC + FOPRF $200 + <<< +FADDC MAC + FOPRF $500 + <<< +FADDI MAC + FOPRF $400 + <<< +FADDL MAC + FOPRF $300 + <<< +* Subtraction + +FSUBX MAC + FOPRF $002 + <<< +FSUBD MAC + FOPRF $102 + <<< +FSUBS MAC + FOPRF $202 + <<< +FSUBC MAC + FOPRF $502 + <<< +FSUBI MAC + FOPRF $402 + <<< +FSUBL MAC + FOPRF $302 + <<< +* Multiplication + +FMULX MAC + FOPRF $004 + <<< +FMULD MAC + FOPRF $104 + <<< +FMULS MAC + FOPRF $204 + <<< +FMULC MAC + FOPRF $504 + <<< +FMULI MAC + FOPRF $404 + <<< +FMULL MAC + FOPRF $304 + <<< +* Division + +FDIVX MAC + FOPRF $006 + <<< +FDIVD MAC + FOPRF $106 + <<< +FDIVS MAC + FOPRF $206 + <<< +FDIVC MAC + FOPRF $506 + <<< +FDIVI MAC + FOPRF $406 + <<< +FDIVL MAC + FOPRF $306 + <<< +* Square root + +FSQRTX MAC + FOPRF $12 + <<< + +* Round to integer, according to the current rounding mode + +FRINTX MAC + FOPRF $14 + <<< + +* Truncate to integer, using round toward zero. + +FTINTX MAC + FOPRF $16 + <<< +* Remainder + +FREMX MAC + FOPRF $00C + <<< +FREMD MAC + FOPRF $10C + <<< +FREMS MAC + FOPRF $20C + <<< +FREMC MAC + FOPRF $50C + <<< +FREMI MAC + FOPRF $40C + <<< +FREML MAC + FOPRF $30C + <<< +* Logb + +FLOGBX MAC + FOPRF $1A + <<< +* Scalb + +FSCALBX MAC + FOPRF $18 + <<< +* Copy-sign + +FCPYSGNX MAC + FOPRF $011 + <<< +FCPYSGND MAC + FOPRF $111 + <<< +FCPYSGNS MAC + FOPRF $211 + <<< +FCPYSGNC MAC + FOPRF $511 + <<< +FCPYSGNI MAC + FOPRF $411 + <<< +FCPYSGNL MAC + FOPRF $311 + <<< +* Negate + +FNEGX MAC + FOPRF $0D + <<< + +* Absolute value + +FABSX MAC + FOPRF $0F + <<< + +* Next-after. NOTE: both operands are of the +* the same format, as specified by the usual suffix. + +FNEXTS MAC + FOPRF $21E + <<< +FNEXTD MAC + FOPRF $11E + <<< +FNEXTX MAC + FOPRF $01E + <<< + +* Conversion to extended + +FX2X MAC + FOPRF $00E + <<< +FD2X MAC + FOPRF $10E + <<< +FS2X MAC + FOPRF $20E + <<< + +* 16-bit integer, by address + +FI2X MAC + FOPRF $40E + <<< + +* 32-bit integer, by address + +FL2X MAC + FOPRF $30E + <<< +FC2X MAC + FOPRF $50E + <<< + +* Conversion from extended + +FX2D MAC + FOPRF $110 + <<< +FX2S MAC + FOPRF $210 + <<< +FX2I MAC + FOPRF $410 + <<< +FX2L MAC + FOPRF $310 + <<< +FX2C MAC + FOPRF $510 + <<< + +* Binary to decimal conversion + +FX2DEC MAC + FOPRF $00B + <<< +FD2DEC MAC + FOPRF $10B + <<< +FS2DEC MAC + FOPRF $20B + <<< +FC2DEC MAC + FOPRF $50B + <<< +FI2DEC MAC + FOPRF $40B + <<< +FL2DEC MAC + FOPRF $30B + <<< + +* Decimal to binary conversion + +FDEC2X MAC + FOPRF $009 + <<< +FDEC2D MAC + FOPRF $109 + <<< +FDEC2S MAC + FOPRF $209 + <<< +FDEC2C MAC + FOPRF $509 + <<< +FDEC2I MAC + FOPRF $409 + <<< +FDEC2L MAC + FOPRF $309 + <<< + +* Compare, not signaling invalid on unordered + +FCMPX MAC + FOPRF $008 + <<< +FCMPD MAC + FOPRF $108 + <<< +FCMPS MAC + FOPRF $208 + <<< +FCMPC MAC + FOPRF $508 + <<< +FCMPI MAC + FOPRF $408 + <<< +FCMPL MAC + FOPRF $308 + <<< + +* Compare, signaling invalid on unordered + +FCPXX MAC + FOPRF $00A + <<< +FCPXD MAC + FOPRF $10A + <<< +FCPXS MAC + FOPRF $20A + <<< +FCPXC MAC + FOPRF $50A + <<< +FCPXI MAC + FOPRF $40A + <<< +FCPXL MAC + FOPRF $30A + <<< + +* The following macros define a set of so-called floating +* branches. They presume that the appropriate compare +* operation, macro FCMPz or FCPXz, precedes. + +FBEQ MAC + BEQ ]1 + <<< +FBLT MAC ;less + BMI ]1 + <<< +FBLE MAC ;less or equal + BMI ]1 + BEQ ]1 + <<< +FBGT MAC ;greater + BVS ]1 + <<< +FBGE MAC ;greater or equal + BVS ]1 + BEQ ]1 + <<< +FBULT MAC ;less or unordered + BMI ]1 + BVS *+4 + BNE ]1 + <<< +FBULE MAC ;unordered, less, or equal + BMI ]1 + BEQ ]1 + BVC ]1 + <<< +FBUGT MAC ;unordered or greater + BVS ]1 + BMI *+4 + BNE ]1 + <<< +FBUGE MAC ;unordered, greater, or equal + BVS ]1 + BEQ ]1 + BPL ]1 + <<< +FBU MAC ;unordered + BVS *+6 + BMI *+4 + BNE ]1 + <<< +FBO MAC ;ordered + BMI ]1 + BVS ]1 + BEQ ]1 + <<< +FBNE MAC ;not equal + BMI ]1 + BVS ]1 + BNE ]1 + <<< +FBUE MAC ;unordered, equal + BEQ ]1 + BMI *+4 + BVC ]1 + <<< +FBLG MAC ;less or greater + BMI ]1 + BVS ]1 + <<< + +FCLASSS MAC + FOPRF $21C + <<< +FCLASSD MAC + FOPRF $11C + <<< +FCLASSX MAC + FOPRF $01C + <<< +FCLASSC MAC + FOPRF $51C + <<< +FCLASSI MAC + FOPRF $41C + <<< +FCLASSL MAC + FOPRF $31C + <<< + +* The following macros provide branches based on the +* the result of a FCLASSz macro. + +FBSNAN MAC ;signaling NaN + TXA + ASL + CMP #2*$FC + BEQ ]1 + <<< +FBQNAN MAC ;quiet NaN + TXA + ASL + CMP #2*$FD + BEQ ]1 + <<< +FBINF MAC ;infinite + TXA + ASL + CMP #2*$FE + BEQ ]1 + <<< +FBZERO MAC ;zero + TXA + ASL + CMP #2*$FF + BEQ ]1 + <<< +FBNORM MAC ;normal + TXA + ASL + BEQ ]1 + <<< +FBDENORM MAC ;denormal + TXA + ASL + CMP #2*1 + BEQ ]1 + <<< +FBNZENUM MAC ;non-zero num (norm or denorm) + TXA + XBA + ASL + BCC ]1 + <<< +FBNUM MAC ;number (zero, norm or denorm) + TXA + INC A + XBA + ASL + BCC ]1 + <<< +FBMINUS MAC ;minus sign + BMI ]1 + <<< +FBPLUS MAC ;plus sign + BPL ]1 + <<< + +* Get and set environment + +FGETENV MAC + FOPRF $03 + <<< +FSETENV MAC + FOPRF $01 + <<< + +* Test and set exception + +FTESTXCP MAC + FOPRF $1B + <<< +FSETXCP MAC + FOPRF $15 + <<< + +* Procedure entry and exit + +FPROCENTRY MAC + FOPRF $17 + <<< +FPROCEXIT MAC + FOPRF $19 + <<< + +* Get and set halt vector + +FGETHV MAC + FOPRF $07 + <<< +FSETHV MAC + FOPRF $05 + <<< + +* Elementary function macros + +FLNX MAC ;natural (base-e) log + FOPRE $00 + <<< +FLOG2X MAC ;base-2 log + FOPRE $02 + <<< +FLN1X MAC ;ln (1 + x) + FOPRE $04 + <<< +FLOG21X MAC ;log2 (1 +x) + FOPRE $06 + <<< +FEXPX MAC ;base-e exponential + FOPRE $08 + <<< +FEXP2X MAC ;base-2 exponential + FOPRE $0A + <<< +FEXP1X MAC ;exp (x) - 1 + FOPRE $0C + <<< +FEXP21X MAC ;exp2 (x) - 1 + FOPRE $0E + <<< +FXPWRI MAC ;integer exponential + FOPRE $10 + <<< +FXPWRY MAC ;general exponential + FOPRE $12 + <<< +FCOMPOUND MAC ;compound + FOPRE $14 + <<< +FANNUITY MAC ;annuity + FOPRE $16 + <<< +FATANX MAC ;arctangent + FOPRE $18 + <<< +FSINX MAC ;sine + FOPRE $1A + <<< +FCOSX MAC ;cosine + FOPRE $1C + <<< +FTANX MAC ;tangent + FOPRE $1E + <<< +FRANDX MAC ;random number generator + FOPRE $20 + <<< + +* Scanner and formatter function macros + +FPSTR2DEC MAC ;pascal string to decimal record + FOPRD 0 + <<< +FDEC2STR MAC ;decimal record to pascal string + FOPRD 1 + <<< +FCSTR2DEC MAC ;C string to decimal record + FOPRD 2 + <<< + diff --git a/macros/Sch.Macs.s b/macros/Sch.Macs.s new file mode 100644 index 0000000..d576686 --- /dev/null +++ b/macros/Sch.Macs.s @@ -0,0 +1,38 @@ +* Scheduler macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_SchBootInit MAC + Tool $107 + <<< +_SchStartUp MAC + Tool $207 + <<< +_SchShutDown MAC + Tool $307 + <<< +~SchVersion MAC + PHA +_SchVersion MAC + Tool $407 + <<< +_SchReset MAC + Tool $507 + <<< +~SchStatus MAC + PHA +_SchStatus MAC + Tool $607 + <<< +~SchAddTask MAC + P1SL ]1 +_SchAddTask MAC + Tool $907 + <<< +_SchFlush MAC + Tool $A07 + <<< + diff --git a/macros/Scrap.Macs.s b/macros/Scrap.Macs.s new file mode 100644 index 0000000..a75c5ea --- /dev/null +++ b/macros/Scrap.Macs.s @@ -0,0 +1,86 @@ +* Scrap manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_ScrapBootInit MAC + Tool $116 + <<< +_ScrapStartUp MAC + Tool $216 + <<< +_ScrapShutDown MAC + Tool $316 + <<< +~ScrapVersion MAC + PHA +_ScrapVersion MAC + Tool $416 + <<< +_ScrapReset MAC + Tool $516 + <<< +~ScrapStatus MAC + PHA +_ScrapStatus MAC + Tool $616 + <<< +_UnloadScrap MAC + Tool $916 + <<< +_LoadScrap MAC + Tool $A16 + <<< +_ZeroScrap MAC + Tool $B16 + <<< +~PutScrap MAC + PHL ]1 + PHWL ]2;]3 +_PutScrap MAC + Tool $C16 + <<< +~GetScrap MAC + PHLW ]1;]2 +_GetScrap MAC + Tool $D16 + <<< +~GetScrapHandle MAC + P2SW ]1 +_GetScrapHandle MAC + Tool $E16 + <<< +~GetScrapSize MAC + P2SW ]1 +_GetScrapSize MAC + Tool $F16 + <<< +~GetScrapPath MAC + PHS 2 +_GetScrapPath MAC + Tool $1016 + <<< +~SetScrapPath MAC + PHL ]1 +_SetScrapPath MAC + Tool $1116 + <<< +~GetScrapCount MAC + PHA +_GetScrapCount MAC + Tool $1216 + <<< +~GetScrapState MAC + PHA +_GetScrapState MAC + Tool $1316 + <<< +_GetIndScrap MAC + Tool $1416 + <<< +_ShowClipboard MAC + Tool $1516 + <<< + diff --git a/macros/Sound.Macs.s b/macros/Sound.Macs.s new file mode 100644 index 0000000..1923fff --- /dev/null +++ b/macros/Sound.Macs.s @@ -0,0 +1,111 @@ +* Sound manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_SoundBootInit MAC + Tool $108 + <<< +~SoundStartUp MAC + PHW ]1 +_SoundStartUp MAC + Tool $208 + <<< +_SoundShutDown MAC + Tool $308 + <<< +~SoundVersion MAC + PHA +_SoundVersion MAC + Tool $408 + <<< +_SoundReset MAC + Tool $508 + <<< +~SoundToolStatus MAC + PHA +_SoundToolStatus MAC + Tool $608 + <<< +~WriteRamBlock MAC + PHL ]1 + PxW ]2;]3 +_WriteRamBlock MAC + Tool $908 + <<< +~ReadRamBlock MAC + PHL ]1 + PxW ]2;]3 +_ReadRamBlock MAC + Tool $A08 + <<< +~GetTableAddress MAC + PHS 2 +_GetTableAddress MAC + Tool $B08 + <<< +~GetSoundVolume MAC + P1SW ]1 +_GetSoundVolume MAC + Tool $C08 + <<< +~SetSoundVolume MAC + PxW ]1;]2 +_SetSoundVolume MAC + Tool $D08 + <<< +~FFStartSound MAC + PHWL ]1;]2 +_FFStartSound MAC + Tool $E08 + <<< +~FFStopSound MAC + PHW ]1 +_FFStopSound MAC + Tool $F08 + <<< +~FFSoundStatus MAC + PHA +_FFSoundStatus MAC + Tool $1008 + <<< +~FFGeneratorStatus MAC + P1SW ]1 +_FFGeneratorStatus MAC + Tool $1108 + <<< +~SetSoundMIRQV MAC + PHL ]1 +_SetSoundMIRQV MAC + Tool $1208 + <<< +~SetUserSoundIRQV MAC + P2SL ]1 +_SetUserSoundIRQV MAC + Tool $1308 + <<< +~FFSoundDoneStatus MAC + P1SW ]1 +_FFSoundDoneStatus MAC + Tool $1408 + <<< +_FFSetUpSound MAC + Tool $1508 + <<< +_FFStartPlaying MAC + Tool $1608 + <<< +_SetDocReg MAC + Tool $1708 + <<< +_ReadDocReg MAC + Tool $1808 + <<< + +~qSoundStartUp MAC + NextDP ]1;$100 + Tool $208 + <<< + diff --git a/macros/Speech.Macs.s b/macros/Speech.Macs.s new file mode 100644 index 0000000..98cc85a --- /dev/null +++ b/macros/Speech.Macs.s @@ -0,0 +1,47 @@ +* +* Speech Toolkit tool calls +* + +_SpeechBootInit mac + Tool $0134 + <<< +_SpeechStartUp mac + Tool $0234 + <<< +_SpeechShutDown mac + Tool $0334 + <<< +_SpeechVersion mac + Tool $0434 + <<< +_SpeechReset mac + Tool $0534 + <<< +_SpeechStatus mac + Tool $0634 + <<< +_Parse mac + Tool $0934 + <<< +_DictInsert mac + Tool $0a34 + <<< +_DictDelete mac + Tool $0b34 + <<< +_DictDump mac + Tool $0c34 + <<< +_SetSayGlobals mac + Tool $0d34 + <<< +_DictInit mac + Tool $0e34 + <<< +_Say mac + Tool $0f34 + <<< +_Activate mac + Tool $1034 + <<< + diff --git a/macros/Std.Macs.s b/macros/Std.Macs.s new file mode 100644 index 0000000..2fc274d --- /dev/null +++ b/macros/Std.Macs.s @@ -0,0 +1,108 @@ +* Standard File Operations macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_SFBootInit MAC + Tool $117 + <<< +~SFStartUp MAC + PxW ]1;]2 +_SFStartUp MAC + Tool $217 + <<< +_SFShutDown MAC + Tool $317 + <<< +~SFVersion MAC + PHA +_SFVersion MAC + Tool $417 + <<< +_SFReset MAC + Tool $517 + <<< +~SFStatus MAC + PHA +_SFStatus MAC + Tool $617 + <<< +~SFGetFile MAC + PxW ]1;]2 + PxL ]3;]4;]5;]6 +_SFGetFile MAC + Tool $917 + <<< +~SFPutFile MAC + PxW ]1;]2 + PxL ]3;]4 + PHWL ]5;]6 +_SFPutFile MAC + Tool $A17 + <<< +~SFPGetFile MAC + PxW ]1;]2 + PxL ]3;]4;]5;]6 + PxL ]7;]8 +_SFPGetFile MAC + Tool $B17 + <<< +~SFPPutFile MAC + PxW ]1;]2 + PxL ]3;]4 + PHWL ]5;]6 + PxL ]7;]8 +_SFPPutFile MAC + Tool $C17 + <<< +~SFAllCaps MAC + PHW ]1 +_SFAllCaps MAC + Tool $D17 + <<< +~SFGetFile2 MAC + PxW ]1;]2;]3 + PxL ]4;]5;]6;]7 +_SFGetFile2 MAC + Tool $E17 + <<< +~SFPutFile2 MAC + PxW ]1;]2;]3 + PHLW ]4;]5 + PxL ]6;]7 +_SFPutFile2 MAC + Tool $F17 + <<< +_SFPGetFile2 MAC + Tool $1017 + <<< +_SFPPutFile2 MAC + Tool $1117 + <<< +~SFShowInvisible MAC + P1SW ]1 +_SFShowInvisible MAC + Tool $1217 + <<< +~SFReScan MAC + PxL ]1;]2 +_SFReScan MAC + Tool $1317 + <<< +~SFMultiGet2 MAC + PxW ]1;]2;]3 + PxL ]4;]5;]6;]7 +_SFMultiGet2 MAC + Tool $1417 + <<< +_SFPMultiGet2 MAC + Tool $1517 + <<< +~qSFStartUp MAC + PHW ]1 + NextDP ]2;$100 + Tool $217 + <<< + diff --git a/macros/Text.Macs.s b/macros/Text.Macs.s new file mode 100644 index 0000000..bf206a0 --- /dev/null +++ b/macros/Text.Macs.s @@ -0,0 +1,184 @@ +* Text tool macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_TextBootInit MAC + Tool $10C + <<< +_TextStartUp MAC + Tool $20C + <<< +_TextShutDown MAC + Tool $30C + <<< +~TextVersion MAC + PHA +_TextVersion MAC + Tool $40C + <<< +_TextReset MAC + Tool $50C + <<< +~TextStatus MAC + PHA +_TextStatus MAC + Tool $60C + <<< +~SetInGlobals MAC + PxW ]1;]2 +_SetInGlobals MAC + Tool $90C + <<< +~SetOutGlobals MAC + PxW ]1;]2 +_SetOutGlobals MAC + Tool $A0C + <<< +~SetErrGlobals MAC + PxW ]1;]2 +_SetErrGlobals MAC + Tool $B0C + <<< +~GetInGlobals MAC + PHS 2 +_GetInGlobals MAC + Tool $C0C + <<< +~GetOutGlobals MAC + PHS 2 +_GetOutGlobals MAC + Tool $D0C + <<< +~GetErrGlobals MAC + PHS 2 +_GetErrGlobals MAC + Tool $E0C + <<< +~SetInputDevice MAC + PHWL ]1;]2 +_SetInputDevice MAC + Tool $F0C + <<< +~SetOutputDevice MAC + PHWL ]1;]2 +_SetOutputDevice MAC + Tool $100C + <<< +~SetErrorDevice MAC + PHWL ]1;]2 +_SetErrorDevice MAC + Tool $110C + <<< +~GetInputDevice MAC + PHS 3 +_GetInputDevice MAC + Tool $120C + <<< +~GetOutputDevice MAC + PHS 3 +_GetOutputDevice MAC + Tool $130C + <<< +~GetErrorDevice MAC + PHS 3 +_GetErrorDevice MAC + Tool $140C + <<< +~InitTextDev MAC + PHW ]1 +_InitTextDev MAC + Tool $150C + <<< +~CtlTextDev MAC + PxW ]1;]2 +_CtlTextDev MAC + Tool $160C + <<< +~StatusTextDev MAC + PxW ]1;]2 +_StatusTextDev MAC + Tool $170C + <<< +~WriteChar MAC + PHW ]1 +_WriteChar MAC + Tool $180C + <<< +~ErrWriteChar MAC + PHW ]1 +_ErrWriteChar MAC + Tool $190C + <<< +~WriteLine MAC + PHL ]1 +_WriteLine MAC + Tool $1A0C + <<< +~ErrWriteLine MAC + PHL ]1 +_ErrWriteLine MAC + Tool $1B0C + <<< +~WriteString MAC + PHL ]1 +_WriteString MAC + Tool $1C0C + <<< +~ErrWriteString MAC + PHL ]1 +_ErrWriteString MAC + Tool $1D0C + <<< +~TextWriteBlock MAC + PHL ]1 + PxW ]2;]3 +_TextWriteBlock MAC + Tool $1E0C + <<< +~ErrWriteBlock MAC + PHL ]1 + PxW ]2;]3 +_ErrWriteBlock MAC + Tool $1F0C + <<< +~WriteCString MAC + PHL ]1 +_WriteCString MAC + Tool $200C + <<< +~ErrWriteCString MAC + PHL ]1 +_ErrWriteCString MAC + Tool $210C + <<< +~ReadChar MAC + P1SW ]1 +_ReadChar MAC + Tool $220C + <<< +~TextReadBlock MAC + PHL ]1 + PxW ]2;]3;]4 +_TextReadBlock MAC + Tool $230C + <<< +~ReadLine MAC + P1SL ]1 + PxW ]2;]3;]4 +_ReadLine MAC + Tool $240C + <<< + +PrintLn MAC ; print a line of text + pea ^text + pea text + ldx #$1A0C + jsl $E10000 + bra cont +text str ]1 +cont + <<< + diff --git a/macros/TextEdit.Macs.s b/macros/TextEdit.Macs.s new file mode 100644 index 0000000..68ed7a9 --- /dev/null +++ b/macros/TextEdit.Macs.s @@ -0,0 +1,199 @@ +* TextEdit macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_TEBootInit MAC + Tool $122 + <<< +~TEStartUp MAC + PxW ]1;]2 +_TEStartUp MAC + Tool $222 + <<< +_TEShutDown MAC + Tool $322 + <<< +~TEVersion MAC + PHA +_TEVersion MAC + Tool $422 + <<< +_TEReset MAC + Tool $522 + <<< +~TEStatus MAC + PHA +_TEStatus MAC + Tool $622 + <<< +~TENew MAC + P2SL ]1 +_TENew MAC + Tool $922 + <<< +~TEKill MAC + PHL ]1 +_TEKill MAC + Tool $A22 + <<< +~TESetText MAC + PHWL ]1;]2 + PHLW ]3;]4 + PxL ]5;]6 +_TESetText MAC + Tool $B22 + <<< +~TEGetText MAC + PHS 2 + PHWL ]1;]2 + PHLW ]3;]4 + PxL ]5;]6 +_TEGetText MAC + Tool $C22 + <<< +~TEGetTextInfo MAC + PHLW ]1;]2 + PHL ]3 +_TEGetTextInfo MAC + Tool $D22 + <<< +~TEIdle MAC + PHL ]1 +_TEIdle MAC + Tool $E22 + <<< +~TEActivate MAC + PHL ]1 +_TEActivate MAC + Tool $F22 + <<< +~TEDeactivate MAC + PHL ]1 +_TEDeactivate MAC + Tool $1022 + <<< +~TEClick MAC + PxL ]1;]2 +_TEClick MAC + Tool $1122 + <<< +~TEUpdate MAC + PHL ]1 +_TEUpdate MAC + Tool $1222 + <<< +~TEPaintText MAC + P2SL ]1 + PxL ]2;]3 + PHWL ]4;]5 +_TEPaintText MAC + Tool $1322 + <<< +~TEKey MAC + PxL ]1;]2 +_TEKey MAC + Tool $1422 + <<< +~TECut MAC + PHL ]1 +_TECut MAC + Tool $1622 + <<< +~TECopy MAC + PHL ]1 +_TECopy MAC + Tool $1722 + <<< +~TEPaste MAC + PHL ]1 +_TEPaste MAC + Tool $1822 + <<< +~TEClear MAC + PHL ]1 +_TEClear MAC + Tool $1922 + <<< +~TEInsert MAC + PHWL ]1;]2 + PHLW ]3;]4 + PxL ]5;]6 +_TEInsert MAC + Tool $1A22 + <<< +~TEReplace MAC + PHWL ]1;]2 + PHLW ]3;]4 + PxL ]5;]6 +_TEReplace MAC + Tool $1B22 + <<< +~TEGetSelection MAC + PxL ]1;]2;]3 +_TEGetSelection MAC + Tool $1C22 + <<< +~TESetSelection MAC + PxL ]1;]2;]3 +_TESetSelection MAC + Tool $1D22 + <<< +~TEGetSelectionStyle MAC + PHA + PxL ]1;]2;]3 +_TEGetSelectionStyle MAC + Tool $1E22 + <<< +~TEStyleChange MAC + PHW ]1 + PxL ]2;]3 +_TEStyleChange MAC + Tool $1F22 + <<< +~TEOffsetToPoint MAC + PxL ]1;]2;]3;]4 +_TEOffsetToPoint MAC + Tool $2022 + <<< +~TEPointToOffset MAC + PHS 2 + PxL ]1;]2;]3 +_TEPointToOffset MAC + Tool $2122 + <<< +~TEGetDefProc MAC + PHS 2 +_TEGetDefProc MAC + Tool $2222 + <<< +~TEGetRuler MAC + PHWL ]1;]2 + PHL ]3 +_TEGetRuler MAC + Tool $2322 + <<< +~TESetRuler MAC + PHW ]1 + PxL ]2;]3 +_TESetRuler MAC + Tool $2422 + <<< +~TEScroll MAC + PHW ]1 + PxL ]2;]3;]4 +_TEScroll MAC + Tool $2522 + <<< +_TEGetInternalProc MAC + Tool $2622 + <<< +_TEGetLastError MAC + Tool $2722 + <<< +_TECompactRecord MAC + Tool $2822 + <<< + diff --git a/macros/Tool219.Macs.s b/macros/Tool219.Macs.s new file mode 100644 index 0000000..d92fd8c --- /dev/null +++ b/macros/Tool219.Macs.s @@ -0,0 +1,86 @@ +* SoundSmith Tool +* FTA, 1991 + +~STStartUp mac + PHW ]1 +_STStartUp mac + Tool $02DB + <<< +_STShutDown mac + Tool $03DB + <<< +~STVersion mac + phd ; WordResult +_STVersion mac + Tool $04DB + <<< +_STReset mac + Tool $05DB + <<< +~STStatus mac + phd ; WordResult +STStatus mac + Tool $06DB + <<< +~STLoadOneMusic mac + PHL ]1 +_STLoadOneMusic mac + Tool $09DB + <<< +~STPlayMusic mac + PHW ]1 +_STPlayMusic mac + Tool $0ADB + <<< +_STStopMusic mac + Tool $0BDB + <<< +~STGetEOfMusic mac + phd ; WordResult +_STGetEOfMusic mac + Tool $0CDB + <<< +~STAddToBatch mac + PHLW ]1;]2 +_STAddToBatch mac + Toll $0DDB + <<< +~STSelectBatch mac + PHW ]1 +_STSelectBatch mac + Tool $0EDB + <<< +~STKillBatch mac + PHW ]1 +_STKillBatch mac + Tool $0FDB + <<< +~STGetPlayingMusic mac + phd ; WordResult +_STGetPlayingMusic mac + Tool $10DB + <<< +~STPlayBatch mac + PHL ]1 +_STPlayBatch mac + Tool $11DB + <<< +~STGetTrackVu mac + phd ;Long + phd ; Result +_STGetTrackVu mac + Tool $12DB + <<< +_STPauseMusic mac + Tool $13DB + <<< +_STContinueMusic mac + Tool $14DB + <<< +_STinternal15 mac + Tool $15DB + <<< +_STinternal16 mac + Tool $16DB + <<< + diff --git a/macros/Tool220.Macs.s b/macros/Tool220.Macs.s new file mode 100644 index 0000000..cf5e072 --- /dev/null +++ b/macros/Tool220.Macs.s @@ -0,0 +1,34 @@ +* NoiseTracker Tool +* FTA, 1992 + +_NTBootInit mac + Tool $01dc + <<< +_NTStartUp mac + Tool $02dc + <<< +_NTShutDown mac + Tool $03dc + <<< +_NTVersion mac + Tool $04dc + <<< +_NTReset mac + Tool $05dc + <<< +_NTStatus mac + Tool $06dc + <<< +_NTInitMusic mac + Tool $09dc + <<< +_NTLaunchMusic mac + Tool $0adc + <<< +_NTUpdateSound mac + Tool $0bdc + <<< +_NTStopMusic mac + Tool $0cdc + <<< + diff --git a/macros/Tool222.Macs.s b/macros/Tool222.Macs.s new file mode 100644 index 0000000..ff2bc6d --- /dev/null +++ b/macros/Tool222.Macs.s @@ -0,0 +1,101 @@ +* NinjaTrackerPlus Tool +* Ninjaforce, 2018 +* Brutal Deluxe, 2018 +* FTA, 1991 + +_NTPBootInit mac + Tool $01DE + <<< + +~NTPStartUp mac + PHW ]1 +_NTPStartUp mac + Tool $02DE + <<< + +_NTPShutDown mac + Tool $03DE + <<< + +~NTPVersion mac + phd ; WordResult +_NTPVersion mac + Tool $04DE + <<< + +_NTPReset mac + Tool $05DE + <<< + +~NTPStatus mac + phd ; WordResult +_NTPStatus mac + Tool $06DE + <<< + +~NTPLoadOneMusic mac + PHL ]1 +_NTPLoadOneMusic mac + Tool $09DE + <<< + +~NTPPlayMusic mac + PHW ]1 +_NTPPlayMusic mac + Tool $0ADE + <<< + +_NTPStopMusic mac + Tool $0BDE + <<< + +~NTPGetEOfMusic mac + phd ; WordResult +_NTPGetEOfMusic mac + Tool $0CDE + <<< + +~NTPAddToBatch mac + PHLW ]1;]2 +_NTPAddToBatch mac + Tool $0DDE + <<< + +~NTPSelectBatch mac + PHW ]1 +_NTPSelectBatch mac + Tool $0EDE + <<< + +~NTPKillBatch mac + PHW ]1 +_NTPKillBatch mac + Tool $0FDE + <<< + +~NTPGetPlayingMusic mac + phd ; WordResult +_NTPGetPlayingMusic mac + Tool $10DE + <<< + +~NTPPlayBatch mac + PHL ]1 +_NTPPlayBatch mac + Tool $11DE + <<< + +~NTPGetTrackVu mac + phd ;Long + phd ; Result +_NTPGetTrackVu mac + Tool $12DE + <<< + +_NTPPauseMusic mac + Tool $13DE + <<< + +_NTPContinueMusic mac + Tool $14DE + <<< diff --git a/macros/Util.Macs.s b/macros/Util.Macs.s new file mode 100644 index 0000000..0a685aa --- /dev/null +++ b/macros/Util.Macs.s @@ -0,0 +1,796 @@ +*================================================= +* Utility Macros - from Merlin disk +* by Dave Klimas, et al +* +* Copyright Apple Computer, Inc. 1986, 1987 +* and Roger Wagner Publishing, Inc. 1988 +* All Rights Reserved +*------------------------------------------------- + +PHWL MAC + PHW ]1 + PHL ]2 + <<< +PHLW MAC + PHL ]1 + PHW ]2 + <<< +PxW MAC + DO ]0/1 + PHW ]1 + DO ]0/2 + PHW ]2 + DO ]0/3 + PHW ]3 + DO ]0/4 + PHW ]4 + FIN + FIN + FIN + FIN + <<< +PxL MAC + DO ]0/1 + PHL ]1 + DO ]0/2 + PHL ]2 + DO ]0/3 + PHL ]3 + DO ]0/4 + PHL ]4 + FIN + FIN + FIN + FIN + <<< +P2SL MAC + PHA +P1SL MAC + PHA +PHL MAC + IF #=]1 + PEA ^]1 + ELSE + PHW ]1+2 + FIN + PHW ]1 + <<< +P2SW MAC + PHA +P1SW MAC + PHA +PHW MAC + IF #=]1 + PEA ]1 + ELSE + IF MX/2 + LDA ]1+1 + PHA + FIN + LDA ]1 + PHA + FIN + <<< +PushSpace MAC +PHS MAC + DO ]0 + LUP ]1 + PHA + --^ + ELSE + PHA + FIN + <<< + +******************************** + +Push4 MAC + PushLong #0 + PushLong #0 + <<< + +PushPtr MAC + PEA ^]1 + PEA ]1 + EOM + +PushLong MAC + IF #=]1 + PushWord #^]1 + ELSE + PushWord ]1+2 + FIN + PushWord ]1 + <<< + +PushWord MAC + IF #=]1 + PEA ]1 + ELSE + IF MX/2 + LDA ]1+1 + PHA + FIN + LDA ]1 + PHA + FIN + <<< + +PullLong MAC + DO ]0 + PullWord ]1 + PullWord ]1+2 + ELSE + PullWord + PullWord + FIN + <<< + +PullWord MAC + PLA + DO ]0 + STA ]1 + FIN + IF MX/2 + PLA + DO ]0 + STA ]1+1 + FIN + FIN + <<< + +MoveLong MAC + MoveWord ]1;]2 + MoveWord ]1+2;]2+2 + <<< + +MoveWord MAC + LDA ]1 + STA ]2 + IF MX/2 + LDA ]1+1 + STA ]2+1 + FIN + <<< + +MoveBlock MAC ;1st_byte;last_byte;dest + DO ]2/]1 + DO ]3/]1 + LDX #]2 + LDY #]3+]2-]1 + LDA #]2-]1 + MVP ]1,]3 + ELSE + LDX #]1 + LDY #]3 + LDA #]2-]1 + MVN ]1,]3 + FIN + ELSE + ERR 1 ;Last adrs < first adrs + FIN + <<< + +CmpLong MAC + LDA ]1 + CMP ]2 + IF #=]1 + LDA ^]1 + ELSE + LDA ]1+2 + FIN + IF #=]2 + SBC ^]2 + ELSE + SBC ]2+2 + FIN + <<< + +LONGM MAC +LONGACC MAC ;Assumes native mode + IF MX&2 ;If A is now short + REP %00100000 + FIN + <<< + +LONGX MAC +LONGXY MAC ;Assumes native mode + IF MX&1 ;If X is now short + REP %00010000 + FIN + <<< + +LONG MAC +LONGAX MAC ;Assumes native mode + IF MX ;If not now in full 16 + REP %00110000 + FIN + <<< + +SHORTM MAC +SHORTACC MAC ;Assumes native mode + IF MX&2 ;If A is now short, + ELSE ; ignore + SEP %00100000 + FIN + <<< + +SHORTX MAC +SHORTXY MAC ;Assumes native mode + IF MX&1 ;If X is now short, + ELSE ; ignore + SEP %00010000 + FIN + <<< + +SHORT MAC +SHORTAX MAC ;Assumes native mode + IF MX!%11 ;If not now in full 8 + SEP %00110000 + FIN + <<< + +LONGI MAC ; Duplicates APW function + LST OFF + DO ]1 ; If arg = 1 = "on" = make long + + IF MX-3/-1 ; If M is short and X is long +; Leave alone + FIN ; End of this test + + IF MX/3 ; If M is short and X is short + MX %10 ; Make X long, leave M short + FIN ; End of this test + + IF MX!3/3 ; If M is long and X is long + FIN ; Leave alone + + IF MX-2/-1 ; If M is long and X is short + MX %00 ; Make X long, leave M long + FIN ; End of this test + + ELSE ; If arg = 0 = "off" = make short + + IF MX/3 ; If M is short and X is short + ; Leave alone + FIN ; End of this test + + IF MX-3/-1 ; If M is short and X is long + MX %11 ; Make X short, leave M short + FIN ; End of this test + + IF MX-2/-1 ; If M is long and X is short + ; Leave alone + FIN ; End of this test + + + IF MX!3/3 ; If M is long and X is long + MX %01 ; Make X short, leave M long + FIN ; Leave alone + + FIN ; End of macro tests + + LST RTN + <<< + +LONGA MAC ; Duplicates APW function + LST OFF + DO ]1 ; If arg = 1 = "on" = make long + + IF MX-3/-1 ; If M is short and X is long + MX %00 ; Make M long, leave X long + FIN ; End of this test + + IF MX/3 ; If M is short and X is short + MX %01 ; Make M long, leave X short + FIN ; End of this test + + IF MX!3/3 ; If M is long and X is long + FIN ; Leave alone + + IF MX-2/-1 ; If M is long and X is short + ; Leave alone + FIN ; End of this test + + ELSE ; If arg = 0 = "off" = make short + + IF MX/3 ; If M is short and X is short + ; Leave alone + FIN ; End of this test + + IF MX-3/-1 ; If M is short and X is long + ; Leave alone + FIN ; End of this test + + IF MX-2/-1 ; If M is long and X is short + MX %11 ; Make M short, leave X short + FIN ; End of this test + + + IF MX!3/3 ; If M is long and X is long + MX %10 ; Make M short, leave X long + FIN ; Leave alone + + FIN ; End of macro tests + + LST RTN + <<< + +M65816 MAC + DO ]1 + XC + XC ; Full 65816 mode for assembler + MX %00 + ELSE + MX %11 ; 8 bit mode for assembler + FIN + <<< + +Expmac MAC ; Replace APW GEN function + DO ]1 + EXP ONLY ; Expand macros + ELSE + EXP OFF + FIN + <<< + +Tool MAC + LDX #]1 ; load tool call # + JSL $E10000 ; go to dispatcher + <<< + +************************************************** +* Auto-menu item macros * +* This is one alternative for defining a menu * +* item. It has the advantage of letting you * +* include specifiers for Bold, Italic, etc. * +************************************************** + +*------------------------------------------------- +* Syntax: +* ]mnum = 0 ; initialize menu # at startvalue-1 +* Menu ' Menu 1 ' +* +* (See Menu macro, defined later....) +* +* ]inum = 255 ; Menu item starts with #256 +* Item ' Choice 1 ';Kybd;'Bb';Check +* Ch1 = ]inum ; Set label Ch1 if somewhere else +* needs to use this item #. +* Item ' Choice 2 ';Disable;'';Kybd;'Cc' +* Item ' Choice 3 ';Divide;'' +* +* Menu ' Menu 2 ' +* +* Item ' Choice 4 ';Bold;'';Check +* Item ' Choice 5 ';Italic;'';Blank +* Item ' Choice 6 ';Underline';Kybd;'Dd' +* +* IMPORTANT: ALL items, except for Check and Blank, are followed by a second +* value. For the Kybd item, the ASCII characters follow in single quotes, Ex: +* Kybd;'Cc' (specifies Apple-C as an equivalent). +* All other items use a null 2nd value, as in: +* Italic;'' or Divide;'' etc. +* +* The variable ]inum MUST be initialized for the value of your first +* menu item MINUS 1 before using the first Item macro. +* +* Check or Blank, if used, MUST be the last item in the macro line. +* +* There can be up to three parameter pairs after the item name. +*------------------------------------------------- +* The point of all this is that rather than hard- +* code menu items values and subsequent references +* to that number when disabling menus, etc., this +* lets you add and delete menu items at will, +* and have labels like Ch1, etc. above, auto- +* matically set for the correct value during the +* assembly. +*------------------------------------------------- + +* Equates for Item macro: + +Bold = 'B' ; bold menu item +Disable = 'D' ; disabled menu item +Italic = 'I' ; italic menu item +Underline = 'U' ; underlined menu item +Divide = 'V' ; menu dividing line +ColorHi = 'X' ; color hilite menu item +Kybd = '*' ; keyboard menu equivalent +Check = $1243 ; menu item with checkmark +Blank = $2043 ; menu item with blank + +*------------------------------------------------- + +Item MAC ; Macro for creating a menu item + + ASC '--' + ASC ]1 ; Text of menu item + ASC '\H' + DA ]inum ; Menu item # + + DO ]0/2 ; Only if more items to do... (>2) + + DO ]2-Check-1/-1 ; Only if Check item + DA ]2 ; ]2 = Check + ELSE ; otherwise kybd char or null + DO ]2-Blank-1/-1 ; Only if Blank check item + DA ]2 ; ]2 = Blank + ELSE + DB ]2 ; Function char value + ASC ]3 ; ASCII argument, if any for Kybd + FIN + FIN + + FIN + + DO ]0/4 ; Only if more items to do... (>3) + + DO ]4-Check-1/-1 ; Only if Check item + DA ]4 ; ]4 = Check + ELSE ; otherwise kybd char or null + DO ]4-Blank-1/-1 ; Only if Blank check item + DA ]4 ; ]4 = Blank + ELSE + DB ]4 ; Function char value + ASC ]5 ; ASCII argument, if any for Kybd + FIN + FIN + + FIN + + DO ]0/6 ; Only if more items to do... (>5) + + DO ]6-Check-1/-1 ; Only if Check item + DA ]6 ; ]6 = Check + ELSE ; otherwise kybd char or null + DO ]6-Blank-1/-1 ; Only if Blank check item + DA ]6 ; ]6 = Blank + ELSE + DB ]6 ; Function char value + ASC ]7 ; ASCII argument, if any for Kybd + FIN + FIN + + FIN + + DB $00 ; End of menu item + +]inum = ]inum+1 + <<< + +************************************************** +* This is another alternative macro for both * +* menus and menu items. It is simpler, and * +* more compact, but not as versatile. * +************************************************** + +*=============================================== +* Variables ]mnum,]inum should be defined +* prior to using these MenuMaker macros. +* +* They both should be starting value-1 +* +* Syntax: +* +* ]mnum = 0 ; 1st menu number will be 1 +* ]inum = 255 ; 1st menu item number will be 256 +* +* Menu ' @';X ; Apple menu, color highlighting. +* +* MItem ' About... ' ; "About" menu item +* +* Menu ' Menu Title 1' ; (this will be menu number 2) +* +* MItem ' Choice 1 ' +* MItem ' Choice 2 ';'D*Cc' ; Disabled, kybd char: Cc +* ; Above will be menu item #'s 2&3 +* +* + + +Menu MAC + ASC '>>' + ASC ]1 + ASC '\H' + DA ]mnum + DO ]0>1 + ASC ]2 + FIN + DB 0 +]mnum = ]mnum+1 + <<< + +MItem MAC + ASC '--' + ASC ]1 + ASC '\H' + DA ]inum + DO ]0>1 + ASC ]2 + FIN + DB 0 +]inum = ]inum+1 + <<< + +*----------------------------------------------------- +* +* Native -- Processor is in LONG "native" mode. +* Native Long -- Processor is in LONG "native" mode. +* Native Short -- Processor is in SHORT "native" mode. +* + +Native MAC + CLC + XCE + IF 0=]0 ;If Native (Long) + LONGAX + FIN + + DO ]0 + IF L=]1 ;If Native Long + LONGAX + + FIN ;If Native Short only + FIN ; do CLC, XCE. + EOM + +*-------------------------------------------------------- +* +* Emulation -- Set Processor into "emulation" mode. +* + +Emulation MAC + SEC + XCE + EOM + +*----------------------------------------------------- +* +* WriteCh -- Print Character From Accumulator +* WriteCh ADDR -- Print Character At Label +* WriteCh ADDR,X -- Print Character At Label,X +* + +WriteCh MAC + DO ]0 + LDA ]1 + FIN + PHA + LDX #$180C + JSL $E10000 + EOM + +*----------------------------------------------------- +* +* ReadCh -- Get Keypress in Accumulator +* ReadCh ADDR -- Get Keypress in Label +* + +ReadCh MAC + PEA 0 + PEA 1 + LDX #$220C + JSL $E10000 + PLA + DO ]0 + STA ]1 + FIN + EOM + +*----------------------------------------------------- +* +* WriteLn "STRING" -- Print Literal String with CR. +* WriteLn ADDR -- Print String At Address with CR. +* WriteLn -- Print CR. +* + +WriteLn MAC + DO ]0 + WriteStr ]1 + FIN + WriteCh #$8D + EOM + +*----------------------------------------------------- +* +* WriteStr "STRING" -- Print Literal String. +* WriteStr ADDR -- Print String At Address. +* WriteStr -- Print String At A (Lo),Y (Hi). +* + +WriteStr MAC + IF 0=]0 ;If No Label + PHY + PHA + + ELSE + + IF "=]1 + PEA ^]String + PEA ]String + BRL ]Skip +]String STR ]1 +]Skip + ELSE + + IF '=]1 + PEA ^]String + PEA ]String + BRL ]Skip +]String STR ]1 +]Skip + ELSE + + PEA ^]1 + PEA ]1 + + FIN + FIN + FIN + LDX #$1C0C + JSL $E10000 + EOM + +*----------------------------------------------------- +* +* DrawStrHV 8;12;"STRING" Print Literal String on +* DrawStr 8;12;ADDR Super Hi-Res Screen. +* + +DrawStrHV MAC + HtabVtab ]1;]2 + DrawStr ]3 + <<< + +*----------------------------------------------------- +* +* DrawStr "STRING" -- Print Literal String. +* DrawStr ADDR -- Print String At Address. +* + +DrawStr MAC + IF "=]1 + PEA ^]String + PEA ]String + BRL ]Skip +]String STR ]1 +]Skip + ELSE + IF '=]1 + PEA ^]String + PEA ]String + BRL ]Skip +]String STR ]1 +]Skip + ELSE + PEA ^]1 + PEA ]1 + FIN + FIN + LDX #$A504 ;DrawString + JSL $E10000 + <<< + +*----------------------------------------------------- +* +* HtabVtab #8;#12 -- Position at Htab 8, Vtab 12. +* HtabVtab H;V on super hires screens. +* + +HtabVtab MAC + IF #=]1 + LDA ]1*8 + ELSE + LDA ]1 + ASL + ASL + ASL + FIN + PHA + IF #=]1 + LDA ]2*8 + ELSE + LDA ]2 + ASL + ASL + ASL + FIN + PHA + LDX #$3A04 ;MoveTo + JSL $E10000 + <<< + +*----------------------------------------------------- +* +* Deref MyHandle;MyPtr -- Uses zero page 0-3 to +* de-reference a handle. +* + +Deref MAC + LDA ]1 + LDX ]1+2 + STA 0 + STX 2 + LDA [0] + STA ]2 + LDY #2 + LDA [0],Y + STA ]2+2 + <<< + +*================================================== +* The MLI16 macro assumes the CALLDOS file from the +* SUBROUT.LIB is linked in. It provides an easy +* way to make MLI calls. Example syntax: +* +* MLI16 close;CLSPARMS +*-------------------------------------------------- + +MLI16 MAC ;Uses CALLDOS file in the + IF MX ; subroutine library + REP %00110000 ;Force full 16-bit mode, if + FIN ; not already there. + LDX #]1 ;Call code (use MLI.CODES) + LDA #]2 ;Low word of PARMS tbl adr + JSR CALLDOS ;Returns CS if an error + <<< + +*================================================= +* The following macros are APW-equivalents for +* compatibility with APW style listings. +* +* One difference between Merlin and APW here: Instead of +* using the syntax PULL1 ADDRESS;X, Merlin can take +* the raw statement PULL1 ADDRESS,X. +* + +PULL1 MAC + SEP #%00100000 + PLA + REP #%00100000 + DO ]0/1 ;If 1 parm + IF MX>0 + STA ]1 + FIN + IF MX=0 + STAL ]1 + FIN + FIN + <<< + +PULL3 MAC + SEP #%00100000 + PLA + STA ]1 + REP #%00100000 + PLA + STA ]1+1 + FIN + <<< + +PUSH1 MAC + SEP #%00100000 + IF ]0/1 ;if one parm + LDA ]1 + FIN + PHA + REP #%00100000 + <<< + +PUSH3 MAC + IF #=]1 + LDA #^]1 ;get two hi order bytes + PHA + PHB + LDA #<]1 + STA 1,S + ELSE + LDA ]1+1 + PHA + PHB + LDA ]1 + STA 1,S + FIN + <<< + diff --git a/macros/VGA.Macs.s b/macros/VGA.Macs.s new file mode 100644 index 0000000..84c1f30 --- /dev/null +++ b/macros/VGA.Macs.s @@ -0,0 +1,66 @@ +* +* Macros SecondSight +* +* (c) 1995, Brutal Deluxe +* + +_SSGetStatus MAC + jsl _xGetStatus + <<< + +_SSSetMode MAC + jsl _xSetMode + <<< + +_SSUploadData MAC + jsl _xUploadData + <<< + +_SSScrollScreen MAC + jsl _xScrollScreen + <<< + +_SSScreenOff MAC + jsl _xScreenOff + <<< + +_SSScreenOn MAC + jsl _xScreenOn + <<< + +_SSSetPalette MAC + jsl _xSetPalette + <<< + +_SSSetPaletteEntry MAC + jsl _xSetPaletteEntry + <<< + +_SSSetBorder MAC + jsl _xSetBorder + <<< + +_SSRunCode MAC + jsl _xRunCode + <<< + +_SSClearScreen MAC + jsl _xClearScreen + <<< + +_SSSetShadow MAC + jsl _xSetShadow + <<< + +_SSSetVGAReg MAC + jsl _xSetVGAReg + <<< + +_SSGetVGAReg MAC + jsl _xGetVGAReg + <<< + +_SSSetUserMode MAC + jsl _xSetUserMode + <<< + diff --git a/macros/Video.Macs.s b/macros/Video.Macs.s new file mode 100644 index 0000000..d8d1f8d --- /dev/null +++ b/macros/Video.Macs.s @@ -0,0 +1,89 @@ +* +* Video Overlay tool calls +* + +_VDBootInit mac + Tool $0121 + <<< +_VDStartUp mac + Tool $0221 + <<< +_VDShutDown mac + Tool $0321 + <<< +_VDVersion mac + Tool $0421 + <<< +_VDReset mac + Tool $0521 + <<< +_VDStatus mac + Tool $0621 + <<< +_VDInStatus mac + Tool $0921 + <<< +_VDInSetStd mac + Tool $0a21 + <<< +_VDInGetStd mac + Tool $0b21 + <<< +_VDInConvAdj mac + Tool $0c21 + <<< +_VDKeyControl mac + Tool $0d21 + <<< +_VDKeyStatus mac + Tool $0e21 + <<< +_VDKeySetKCol mac + Tool $0f21 + <<< +_VDKeyGetKRCol mac + Tool $1021 + <<< +_VDKeyGetKGCol mac + Tool $1121 + <<< +_VDKeyGetKBCol mac + Tool $1221 + <<< +_VDKeySetKDiss mac + Tool $1321 + <<< +_VDKeyGetKDiss mac + Tool $1421 + <<< +_VDKeySetNKDiss mac + Tool $1521 + <<< +_VDKeyGetNKDiss mac + Tool $1621 + <<< +_VDOutSetStd mac + Tool $1721 + <<< +_VDOutGetStd mac + Tool $1821 + <<< +_VDOutControl mac + Tool $1921 + <<< +_VDOutStatus mac + Tool $1a21 + <<< +_VDGetFeatures mac + Tool $1b21 + <<< +_VDInControl mac + Tool $1c21 + <<< +_VDGGControl mac + Tool $1d21 + <<< +_VDGGStatus mac + Tool $1e21 + <<< + diff --git a/macros/Window.Macs.s b/macros/Window.Macs.s new file mode 100644 index 0000000..589263a --- /dev/null +++ b/macros/Window.Macs.s @@ -0,0 +1,537 @@ +* Window Manager macros +* by Dave Klimas +; +; Copyright Apple Computer, Inc. 1986, 1987 +; and Roger Wagner Publishing, Inc. 1988 +; All Rights Reserved +; +_WindBootInit MAC + Tool $10E + <<< +~WindStartUp MAC + PHW ]1 +_WindStartUp MAC + Tool $20E + <<< +_WindShutDown MAC + Tool $30E + <<< +~WindVersion MAC + PHA +_WindVersion MAC + Tool $40E + <<< +_WindReset MAC + Tool $50E + <<< +~WindStatus MAC + PHA +_WindStatus MAC + Tool $60E + <<< +~NewWindow MAC + P2SL ]1 +_NewWindow MAC + Tool $90E + <<< +~CheckUpdate MAC + P1SL ]1 +_CheckUpdate MAC + Tool $A0E + <<< +~CloseWindow MAC + PHL ]1 +_CloseWindow MAC + Tool $B0E + <<< +~Desktop MAC + IF 2=]1 + IF 3=]1 + IF 4=]1 + PHS 2 + FIN + FIN + FIN + PHWL ]1;]2 +_Desktop MAC + Tool $C0E + <<< +~SetWTitle MAC + PxL ]1;]2 +_SetWTitle MAC + Tool $D0E + <<< +~GetWTitle MAC + P2SL ]1 +_GetWTitle MAC + Tool $E0E + <<< +~SetFrameColor MAC + PxL ]1;]2 +_SetFrameColor MAC + Tool $F0E + <<< +~GetFrameColor MAC + PxL ]1;]2 +_GetFrameColor MAC + Tool $100E + <<< +~SelectWindow MAC + PHL ]1 +_SelectWindow MAC + Tool $110E + <<< +~HideWindow MAC + PHL ]1 +_HideWindow MAC + Tool $120E + <<< +~ShowWindow MAC + PHL ]1 +_ShowWindow MAC + Tool $130E + <<< +~SendBehind MAC + PxL ]1;]2 +_SendBehind MAC + Tool $140E + <<< +~FrontWindow MAC + PHS 2 +_FrontWindow MAC + Tool $150E + <<< +~SetInfoDraw MAC + PxL ]1;]2 +_SetInfoDraw MAC + Tool $160E + <<< +~FindWindow MAC + P1SL ]1 + PxW ]2;]3 +_FindWindow MAC + Tool $170E + <<< +~TrackGoAway MAC + P1SW ]1 + PHWL ]2;]3 +_TrackGoAway MAC + Tool $180E + <<< +~MoveWindow MAC + PxW ]1;]2 + PHL ]3 +_MoveWindow MAC + Tool $190E + <<< +~DragWindow MAC + PxW ]1;]2;]3;]4 + PxL ]5;]6 +_DragWindow MAC + Tool $1A0E + <<< +~GrowWindow MAC + PHS 2 + PxW ]1;]2;]3;]4 + PHL ]5 +_GrowWindow MAC + Tool $1B0E + <<< +~SizeWindow MAC + PxW ]1;]2 + PHL ]3 +_SizeWindow MAC + Tool $1C0E + <<< +~TaskMaster MAC + PHA + PHWL ]1;]2 +_TaskMaster MAC + Tool $1D0E + <<< +~BeginUpdate MAC + PHL ]1 +_BeginUpdate MAC + Tool $1E0E + <<< +~EndUpdate MAC + PHL ]1 +_EndUpdate MAC + Tool $1F0E + <<< +~GetWMgrPort MAC + PHS 2 +_GetWMgrPort MAC + Tool $200E + <<< +~PinRect MAC + PHS 2 + PxW ]1;]2 + PHL ]3 +_PinRect MAC + Tool $210E + <<< +~HiliteWindow MAC + PHWL ]1;]2 +_HiliteWindow MAC + Tool $220E + <<< +~ShowHide MAC + PHWL ]1;]2 +_ShowHide MAC + Tool $230E + <<< +~BringToFront MAC + PHL ]1 +_BringToFront MAC + Tool $240E + <<< +_WindNewRes MAC + Tool $250E + <<< +~TrackZoom MAC + P1SW ]1 + PHWL ]2;]3 +_TrackZoom MAC + Tool $260E + <<< +~ZoomWindow MAC + PHL ]1 +_ZoomWindow MAC + Tool $270E + <<< +~SetWRefCon MAC + PxL ]1;]2 +_SetWRefCon MAC + Tool $280E + <<< +~GetWRefCon MAC + P2SL ]1 +_GetWRefCon MAC + Tool $290E + <<< +~GetNextWindow MAC + P2SL ]1 +_GetNextWindow MAC + Tool $2A0E + <<< +~GetWKind MAC + P1SL ]1 +_GetWKind MAC + Tool $2B0E + <<< +~SetWFrame MAC + PHWL ]1;]2 +_SetWFrame MAC + Tool $2D0E + <<< +~GetWFrame MAC + P1SL ]1 +_GetWFrame MAC + Tool $2C0E + <<< +~GetStructRgn MAC + P2SL ]1 +_GetStructRgn MAC + Tool $2E0E + <<< +~GetContentRgn MAC + P2SL ]1 +_GetContentRgn MAC + Tool $2F0E + <<< +~GetUpdateRgn MAC + P2SL ]1 +_GetUpdateRgn MAC + Tool $300E + <<< +~GetDefProc MAC + P2SL ]1 +_GetDefProc MAC + Tool $310E + <<< +~SetDefProc MAC + PxL ]1;]2 +_SetDefProc MAC + Tool $320E + <<< +~GetWControls MAC + P2SL ]1 +_GetWControls MAC + Tool $330E + <<< +~SetOriginMask MAC + PHWL ]1;]2 +_SetOriginMask MAC + Tool $340E + <<< +~GetInfoRefCon MAC + P2SL ]1 +_GetInfoRefCon MAC + Tool $350E + <<< +~SetInfoRefCon MAC + PxL ]1;]2 +_SetInfoRefCon MAC + Tool $360E + <<< +~GetZoomRect MAC + P2SL ]1 +_GetZoomRect MAC + Tool $370E + <<< +~SetZoomRect MAC + PxL ]1;]2 +_SetZoomRect MAC + Tool $380E + <<< +~RefreshDesktop MAC + PHL ]1 +_RefreshDesktop MAC + Tool $390E + <<< +~InvalRect MAC + PHL ]1 +_InvalRect MAC + Tool $3A0E + <<< +~InvalRgn MAC + PHL ]1 +_InvalRgn MAC + Tool $3B0E + <<< +~ValidRect MAC + PHL ]1 +_ValidRect MAC + Tool $3C0E + <<< +~ValidRgn MAC + PHL ]1 +_ValidRgn MAC + Tool $3D0E + <<< +~GetContentOrigin MAC + P2SL ]1 +_GetContentOrigin MAC + Tool $3E0E + <<< +~SetContentOrigin MAC + PxW ]1;]2 + PHL ]3 +_SetContentOrigin MAC + Tool $3F0E + <<< +~GetDataSize MAC + P2SL ]1 +_GetDataSize MAC + Tool $400E + <<< +~SetDataSize MAC + PxW ]1;]2 + PHL ]3 +_SetDataSize MAC + Tool $410E + <<< +~GetMaxGrow MAC + P2SL ]1 +_GetMaxGrow MAC + Tool $420E + <<< +~SetMaxGrow MAC + PxW ]1;]2 + PHL ]3 +_SetMaxGrow MAC + Tool $430E + <<< +~GetScroll MAC + P2SL ]1 +_GetScroll MAC + Tool $440E + <<< +~SetScroll MAC + PxW ]1;]2 + PHL ]3 +_SetScroll MAC + Tool $450E + <<< +~GetPage MAC + P2SL ]1 +_GetPage MAC + Tool $460E + <<< +~SetPage MAC + PxW ]1;]2 + PHL ]3 +_SetPage MAC + Tool $470E + <<< +~GetContentDraw MAC + P2SL ]1 +_GetContentDraw MAC + Tool $480E + <<< +~SetContentDraw MAC + PxL ]1;]2 +_SetContentDraw MAC + Tool $490E + <<< +~GetInfoDraw MAC + P2SL ]1 +_GetInfoDraw MAC + Tool $4A0E + <<< +~SetSysWindow MAC + PHL ]1 +_SetSysWindow MAC + Tool $4B0E + <<< +~GetSysWFlag MAC + P1SL ]1 +_GetSysWFlag MAC + Tool $4C0E + <<< +~StartDrawing MAC + PHL ]1 +_StartDrawing MAC + Tool $4D0E + <<< +~SetWindowIcons MAC + P2SL ]1 +_SetWindowIcons MAC + Tool $4E0E + <<< +~GetRectInfo MAC + PxL ]1;]2 +_GetRectInfo MAC + Tool $4F0E + <<< +~StartInfoDrawing MAC + PxL ]1;]2 +_StartInfoDrawing MAC + Tool $500E + <<< +_EndInfoDrawing MAC + Tool $510E + <<< +~GetFirstWindow MAC + PHS 2 +_GetFirstWindow MAC + Tool $520E + <<< +~WindDragRect MAC + P2SL ]1 + PHLW ]2;]3 + PHWL ]4;]5 + PxL ]6;]7 + PHW ]8 +_WindDragRect MAC + Tool $530E + <<< +_Private01 MAC + Tool $540E + <<< +~DrawInfoBar MAC + PHL ]1 +_DrawInfoBar MAC + Tool $550E + <<< +~WindowGlobal MAC + P1SW ]1 +_WindowGlobal MAC + Tool $560E + <<< +~SetContentOrigin2 MAC + PxW ]1;]2;]3 + PHL ]4 +_SetContentOrigin2 MAC + Tool $570E + <<< +~GetWindowMgrGlobals MAC + PHS 2 +_GetWindowMgrGlobals MAC + Tool $580E + <<< +~AlertWindow MAC + P1SW ]1 + PxL ]2;]3 +_AlertWindow MAC + Tool $590E + <<< +~StartFrameDrawing MAC + PHL ]1 +_StartFrameDrawing MAC + Tool $5A0E + <<< +_EndFrameDrawing MAC + Tool $5B0E + <<< +~ResizeWindow MAC + PHWL ]1;]2 + PHL ]3 +_ResizeWindow MAC + Tool $5C0E + <<< +_TaskMasterContent MAC ;private + Tool $5D0E + <<< +_TaskMasterKey MAC ;private + Tool $5E0E + <<< +~TaskMasterDA MAC + P1SW ]1 + PHL ]2 +_TaskMasterDA MAC + Tool $5F0E + <<< +~CompileText MAC + P2SW ]1 + PxL ]2;]3 + PHW ]4 +_CompileText MAC + Tool $600E + <<< +~NewWindow2 MAC + PHS 2 + PxL ]1;]2;]3;]4 + PHWL ]5;]6 + PHW ]7 +_NewWindow2 MAC + Tool $610E + <<< +~ErrorWindow MAC + P1SW ]1 + PHLW ]2;]3 +_ErrorWindow MAC + Tool $620E + <<< +_GetAuxWindInfo MAC + Tool $630E + <<< +_DoModalWindow MAC + Tool $640E + <<< +_MWGetCtlPart MAC + Tool $650E + <<< +_MWSetMenuProc MAC + Tool $660E + <<< +_MWStdDrawProc MAC + Tool $670E + <<< +_MWSetUpEditMenu MAC + Tool $680E + <<< +_FindCursorCtl MAC + Tool $690E + <<< +_ResizeInfoBar MAC + Tool $6A0E + <<< +_HandleDiskInsert MAC + Tool $6B0E + <<< +_UpdateWindow MAC + Tool $6C0E + <<< + diff --git a/opcodes.cpp b/opcodes.cpp index d4d13de..0438501 100644 --- a/opcodes.cpp +++ b/opcodes.cpp @@ -1,5 +1,4 @@ -#include "asm.h" -#include "psuedo.h" +#include "app.h" #define CLASS T65816Asm @@ -41,7 +40,7 @@ int CLASS::doXC(MerlinLine &line, TSymbol &sym) std::string s; int res = 0; - if (options.isMerlin()) // in merlin8 mode we don't support XC psuedoop + if (qoptions.isMerlin()) // in merlin8 mode we don't support XC psuedoop { if (line.errorcode == 0) // don't replace other errors { @@ -73,6 +72,7 @@ int CLASS::doMX(MerlinLine &line, TSymbol &sym) if (cpumode < MODE_65816) { line.setError(errIncompatibleOpcode); + return(-1); } else { @@ -178,7 +178,7 @@ int CLASS::doMVN(MerlinLine &line, TSymbol &sym) uint8_t op; UNUSED(sym); - if (line.addressmode == syn_bm) + if (line.addressmode == syn_params) { res = 3; if (pass > 0) @@ -212,7 +212,7 @@ int CLASS::doMVN(MerlinLine &line, TSymbol &sym) setOpcode(line, op); // these bytes are the two bank registers - if (options.isMerlin32() && (v<256)) + if (qoptions.isMerlin32() && (v<256)) //if (((line.syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32) && (v<256)) { // merlin32 uses the low byte of the two operands @@ -313,7 +313,6 @@ int CLASS::doNoPattern(MerlinLine &line, TSymbol &sym) int CLASS::doAddress(MerlinLine &line, TSymbol &sym) { - // this routine uses the 'opcode' specifed in the sym.opcode field. // it also adds the number of bytes stored in the sym.stype field after doing an evaluation int res, i; @@ -324,7 +323,8 @@ int CLASS::doAddress(MerlinLine &line, TSymbol &sym) //if (isMerlin816()) //{ //} - switch(line.expr_shift) + //switch(line.expr_shift) + switch(line.shiftchar) { case '^': line.expr_value=(line.expr_value>>16)&0xFFFF; @@ -800,7 +800,7 @@ out: if (err) { line.setError(errBadAddressMode); - printf("bad address mode %d\n",line.addressmode); + //printf("bad address mode %d\n",line.addressmode); op = 0x00; res = 0; bytelen = 0; @@ -892,7 +892,7 @@ int CLASS::doBYTE(MerlinLine & line, TSymbol & sym) // SGQ merlin32 apparently tracks XCE instructions when tracking MX status // who knows how they determine this. I am assuming the NEXT instruction // after a SEC/CLC instruction must be an XCE - if (options.isMerlin32()) + if (qoptions.isMerlin32()) { if (sym.opcode == 0x38) // SEC { @@ -947,8 +947,8 @@ void CLASS::insertOpcodes(void) pushopcode("=", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doEQU)); pushopcode("EQU", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doEQU)); pushopcode("END", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doEND)); - pushopcode("MX", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doMX)); - pushopcode("XC", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doXC)); + pushopcode("MX", P_MX, OP_PSUEDO, OPHANDLER(&CLASS::doMX)); + pushopcode("XC", P_XC, OP_PSUEDO, OPHANDLER(&CLASS::doXC)); pushopcode("EXT", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); pushopcode("ENT", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doPSEUDO)); diff --git a/parms.json b/parms.json index 74c8c07..f72a929 100644 --- a/parms.json +++ b/parms.json @@ -29,7 +29,8 @@ }, { "8": "object", - "volume": "0/merlin.2mg", + "volume": "0/qasm.2mg", + "name": "qasm", "size": "800K", "format": "prodos", "fileformat": "2mg" diff --git a/psuedo.cpp b/psuedo.cpp index fe1df23..e50af85 100644 --- a/psuedo.cpp +++ b/psuedo.cpp @@ -1,5 +1,4 @@ -#include "psuedo.h" -#include "eval.h" +#include "app.h" #define CLASS TPsuedoOp @@ -39,7 +38,7 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) eval.allowMX = true; // allow the built in MX symbol int64_t eval_value = 0; - uint8_t shift; + //uint8_t shift; uint32_t result32; int res = 0; int err = 0; @@ -68,9 +67,9 @@ int CLASS::doDO(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) goto out; } - shift = 0; + //shift = 0; eval_value = 0; - int x = eval.evaluate(line.operand_expr, eval_value, shift); + int x = eval.evaluate(line.operand_expr, eval_value); if (x < 0) { @@ -221,7 +220,7 @@ int CLASS::doLUP(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) TEvaluator eval(a); int64_t eval_value = 0; - uint8_t shift; + //uint8_t shift; int lidx, len; int res = 0; int err = 0; @@ -235,9 +234,9 @@ int CLASS::doLUP(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) if (len >= 0) { - shift = 0; + //shift = 0; eval_value = 0; - int x = eval.evaluate(line.operand_expr, eval_value, shift); + int x = eval.evaluate(line.operand_expr, eval_value); a.LUPstack.push(a.curLUP); @@ -384,7 +383,7 @@ int CLASS::doDATA(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) //printf("DFB TOK : |%s|\n", expr.c_str()); int64_t eval_value = 0; - uint8_t shift; + //uint8_t shift; int r; uint8_t b; @@ -395,10 +394,10 @@ int CLASS::doDATA(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) expr[0] = ' '; expr = Poco::trim(expr); } - shift = 0; + //shift = 0; eval_value = 0; //printf("DFB EVAL: |%s|\n", expr.c_str()); - r = eval.evaluate(expr, eval_value, shift); + r = eval.evaluate(expr, eval_value); if (r < 0) { //printf("error %d\n",r); @@ -407,7 +406,7 @@ int CLASS::doDATA(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) line.setError(errBadEvaluation); } } - eval_value = (uint64_t)doShift((uint32_t)eval_value, shift); + //eval_value = (uint64_t)doShift((uint32_t)eval_value); } outct += wordsize; @@ -450,7 +449,7 @@ int CLASS::doDS(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) TEvaluator eval(a); int64_t eval_value = 0; - uint8_t shift; + //uint8_t shift; line.eval_result = 0; // since this is an data p-op, clear the global 'bad operand' flag line.flags |= FLAG_FORCEADDRPRINT; @@ -477,15 +476,15 @@ int CLASS::doDS(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) else { - shift = 0; + //shift = 0; eval_value = 0; - int x = eval.evaluate(s, eval_value, shift); + int x = eval.evaluate(s, eval_value); if (x < 0) { line.setError(errBadOperand); goto out; } - eval_value = (uint64_t)doShift((uint32_t)eval_value, shift); + //eval_value = (uint64_t)doShift((uint32_t)eval_value); datact = eval_value & 0xFFFF; if (datact < 0) { @@ -497,15 +496,15 @@ int CLASS::doDS(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) else if (ct == 1) { - shift = 0; + //shift = 0; eval_value = 0; - int x = eval.evaluate(s, eval_value, shift); + int x = eval.evaluate(s, eval_value); if (x < 0) { line.setError(errBadOperand); goto out; } - eval_value = (uint64_t)doShift((uint32_t)eval_value, shift); + //eval_value = (uint64_t)doShift((uint32_t)eval_value, shift); fill = eval_value & 0xFF; } else if (ct > 1) @@ -982,7 +981,7 @@ int CLASS::doASC(T65816Asm &a, MerlinLine &line, TSymbol &opinfo) b |= orval; } - if ((line.options->isMerlin32()) || (line.options->isMerlin16plus())) + if ((line.qoptions->isMerlin32()) || (line.qoptions->isMerlin16plus())) { // invert last byte of total bytes out diff --git a/psuedo.h b/psuedo.h index ea656b0..5e812ef 100644 --- a/psuedo.h +++ b/psuedo.h @@ -1,5 +1,4 @@ #pragma once -#include "asm.h" #define CLASS TPsuedoOp @@ -25,6 +24,8 @@ enum P_USR, P_PAU, P_CHK, + P_MX, + P_XC, P_MAX }; diff --git a/qasm.cpp b/qasm.cpp index 8a5e97e..a508768 100644 --- a/qasm.cpp +++ b/qasm.cpp @@ -1,9 +1,27 @@ #include "app.h" -#include "asm.h" -#ifdef CIDERPRESS -#include "cider.h" -#endif +ConfigOptions qoptions; + +//#define XX printf +//#undef printf +int myprintf(const char *format, ...) +{ + int res=0; + va_list arg; + char buff[1024]; + + va_start(arg,format); + + buff[0]=0; + res=vsprintf(buff,format,arg); + string v=buff; + //LOG_DEBUG << v; + //printf("%s",buff); + return(res); +} +//#define printf XX + +#undef CLASS #define CLASS PAL_APPCLASS // return a pointer to the actual Application class @@ -26,6 +44,9 @@ programOption PAL::appOptions[] = { "type", "t", "enforce syntax/features/bugs of other assembler [qasm, merlin8, merlin16, merlin16plus, merlin32, orca, apw, mpw, lisa, ca65]", "", false, false}, { "quiet", "q", "print as little as possible, equivalent to lst off in the assembler ('lst' opcodes will be ignored)", "", false, true}, { "list", "l", "force assembly listing ('lst' opcodes will be ignored)", "", false, true}, + { "no-list", "nl", "force assembly listing off ('lst' opcodes will be ignored)", "", false, true}, + { "symbols", "sym", "show symbol table after assembly", "", false, true}, + { "color", "c", "colorize the output", "", false, true}, { "settings", "s", "show the working settings/options", "", false, true}, @@ -91,8 +112,8 @@ int CLASS::runCommandLineApp(void) string syn; bool settings; int res = -1; - ConfigOptions options; + qoptions.init(); utils=new QUtils(); startdirectory = Poco::Path::current(); @@ -121,10 +142,10 @@ int CLASS::runCommandLineApp(void) } //printf("apppath: |%s|\n",appPath.c_str()); - options.ReadFile(Poco::Path::config()+"/parms.json",false); - options.ReadFile(appPath+"/parms.json",true); - options.ReadFile(Poco::Path::configHome()+"/parms.json",false); - options.ReadFile(Poco::Path::current()+"/parms.json",false); + qoptions.ReadFile(Poco::Path::config()+"/parms.json",false); + qoptions.ReadFile(appPath+"/parms.json",true); + qoptions.ReadFile(Poco::Path::configHome()+"/parms.json",false); + qoptions.ReadFile(Poco::Path::current()+"/parms.json",false); syn="QASM"; @@ -137,21 +158,21 @@ int CLASS::runCommandLineApp(void) syn=Poco::toUpper(syn); // if they overrode the syntax on the command line, use it syn=Poco::trim(syn); - if (!options.supportedLanguage(syn)) + if (!qoptions.supportedLanguage(syn)) { printf("Unsupported Language Type\n"); return(-1); } - syn=options.convertLanguage(syn); + syn=qoptions.convertLanguage(syn); if (settings) { - int x=options.printDefaults(syn); + int x=qoptions.printDefaults(syn); return(x); } language=syn; - options.setLanguage(syn,true); + qoptions.setLanguage(syn,true); if (isDebug()>0) { @@ -228,7 +249,7 @@ int CLASS::runCommandLineApp(void) { format_flags=CONVERT_TEST; } - options.format_flags=format_flags; + qoptions.format_flags=format_flags; cmd=toks[0]; } } @@ -237,7 +258,7 @@ int CLASS::runCommandLineApp(void) if (cmd == "FORMAT") { res = 0; - t = new TMerlinConverter(options); + t = new TMerlinConverter(qoptions); //t=NULL; if (t != NULL) { @@ -272,7 +293,7 @@ int CLASS::runCommandLineApp(void) else if (cmd == "ASM") { int x; - t = new T65816Asm(options); + t = new T65816Asm(qoptions); if (t != NULL) { try @@ -309,7 +330,7 @@ int CLASS::runCommandLineApp(void) else if (cmd == "SCRIPT") { res = 0; - t = new CiderPress(options); + t = new CiderPress(qoptions); if (t!=NULL) { try diff --git a/qasm.h b/qasm.h index 2a9c160..525a9d9 100644 --- a/qasm.h +++ b/qasm.h @@ -1,13 +1,42 @@ #pragma once -#include +//#include "" +// if this file is called app.h...it is a link o qasm.h +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include "app.h" #include "qoptions.h" +#include "qasm.h" +extern ConfigOptions qoptions; + +#include "asm.h" #include "util.h" +#include "eval.h" +#include "psuedo.h" +#ifdef CIDERPRESS +#include "cider.h" +#include "DiskImg.h" +#endif + + + //#include #ifndef UNUSED @@ -17,6 +46,10 @@ #define CLASS PAL_APPCLASS using namespace PAL_NAMESPACE; +//#define printf myprintf + +extern int myprintf(const char *, ...); + class CLASS : public PAL_BASEAPP { protected: diff --git a/qoptions.h b/qoptions.h index 7db75d0..46aa0c6 100644 --- a/qoptions.h +++ b/qoptions.h @@ -46,8 +46,9 @@ enum syn_dil, // [expr] 9 syn_absx, // expr,x 10 syn_absy, // expr,y 11 - syn_bm, // block move 12 + syn_params, // multiple/comma separated 12 syn_abs, // expr 13 + syn_data, syn_MAX }; @@ -102,17 +103,22 @@ public: CLASS() { language=""; + } + + ~CLASS() + { + clear(); + } + + void init() + { setEnvironment(); clear(); setDefaults(); setLanguage("QASM",true); setCurrent(); } - ~CLASS() - { - clear(); - } - + void clear() { if (config!=NULL) @@ -680,18 +686,20 @@ public: string addrModeEnglish(int mode) { - string res=""; + string res="----"; switch(mode) { case syn_err: res="error"; break; case syn_none: - res=""; break; case syn_implied: res="impl"; break; + case syn_data: + res="data"; + break; case syn_s: res="dp,s"; break; @@ -699,7 +707,7 @@ public: res="(dp,s),y"; break; case syn_imm: - res="#imme"; + res="#imm"; break; case syn_diix: res="(dp,x)"; @@ -722,16 +730,20 @@ public: case syn_absy: res="abs,y"; break; - case syn_bm: - res="blkmv"; + case syn_params: + res="params"; break; case syn_abs: res="abs"; break; default: - res="unknown"; + res="BAD"; break; } + while(res.length()<8) + { + res=res+" "; + } return(res); } diff --git a/single.sh b/single.sh index 5ac9c8b..1af0191 100755 --- a/single.sh +++ b/single.sh @@ -9,7 +9,7 @@ cp testdata/$FNAME.S /tmp cd /tmp OUTNAME=/tmp/compare.txt -merlin32 -V ${FNAME}.S >/dev/null +merlin32 -V ${FNAME}.S cat ${FNAME}_Output.txt >OUTNAME cat ${FNAME}_Output.txt diff --git a/test.s b/test.s index f2686b4..a8621fc 100644 --- a/test.s +++ b/test.s @@ -1,101 +1,6 @@ - lst off -* [QASM] SYNTAX MERLIN16 -* [QASM] Filetype $06 -* [QASM] AuxType $2000 -* [QASM] Volume TESTASM test.2mg 800K prodos 2mg -* [QASM] copyto TESTASM :SOURCE:${FILE}.bin - - - - xc off - xc - xc - -ZP equ $00 - org $2000 - - lda <$fff0 ;zp - lda >$fff0 ;ABS (lo word) - lda ^$fff0 ;ABS (hi word) - lda |$fff0 ;ABS (long in 65816 mode) - lda <$FFF0+$FFFF - - lda <$fff0+24 ;zp - lda >$fff0+24 ;ABS (lo word) - lda ^$fff0+24 ;ABS (hi word) - lda |$fff0+24 ;ABS (long in 65816 mode) - ldal $fff0+24 ;ABS (long in 65816 mode) - lda: $fff0+24 ;ABS (long in 65816 mode) - lda: $00 - - mx %11 - lda #<$fff0 ;zp - lda #>$fff0 ;ABS (lo word) - lda #^$fff0 ;ABS (hi word) - lda #<$FFF0+$FFFF - lda #>$FFF0+$FFFF - lda #^$FFF0+$FFFF - - mx %00 - lda #<$fff0 ;zp - lda #>$fff0 ;ABS (lo word) - lda #^$fff0 ;ABS (hi word) - lda #<$FFF0+$FFFF - lda #>$FFF0+$FFFF - lda #^$FFF0+$FFFF - - ora ($00) - lda ($00) - bit: $FFFE,X - ror: $FFFE,X - ora #ZP -begin - ;]m equ * - lda begin - ;lda ]m - -_mymac mac -]mac1 lda ]mac1 - ldal ]1 - ldal ]2 - eom - -_ascmac mac - asc ]1,]2,8D - eom - ;var 'one';'two';'three' -justlable ;line with just a lable -start -another lda #$00 ;line with everything - lda #$00 ;line with opcode, operand comment - nop ;line with just opcode - _mymac *;1 - _mymac *;2 - ;_ascmac 'hello';'there' - - ;lup 2 - ;]m equ * - ;nop - ;lda ]m - ;bra ]m - ;--^ - -]1 nop - nop - ;bra ]1 - - ;typ $06 - db 255 -]DPNOP equ $80 - lda ]DPNOP - jsr DPCODE - rts - org $0080 -DPCODE nop - lda DPCODE - lda |DPCODE - lda >DPCODE - - lst - chk + + org $1234 +ABS nop + DFB $FF,#ABS + lst off diff --git a/testdata/3000-addresses.S b/testdata/3000-addresses.S index 79c630a..a4c9bea 100644 --- a/testdata/3000-addresses.S +++ b/testdata/3000-addresses.S @@ -10,8 +10,13 @@ long equ $020304 mx %00 start nop - pea ^start + pea #^start + pea #start + pea ^start pea start + lda #^start + lda start + lda ^start mvn bank02,bank03 mvp bank03,bank02 lda dp @@ -25,4 +30,6 @@ start nop lda #^long lda #long + lst + chk lst off diff --git a/testdata/3006-pea.S b/testdata/3006-pea.S index 14bc02e..faa2256 100644 --- a/testdata/3006-pea.S +++ b/testdata/3006-pea.S @@ -1,39 +1,42 @@ * verify pea doesn't have address mode errors with quoted strings - pea ',' - pea ';' - pea ' ' - pea '[' - pea ']' - pea '(' - pea ')' + pea ',' + pea ';' + pea ' ' + pea '[' + pea ']' + pea '(' + pea ')' - pea #',' - pea #';' - pea #' ' - pea #'[' - pea #']' - pea #'(' - pea #')' + pea #',' + pea #';' + pea #' ' + pea #'[' + pea #']' + pea #'(' + pea #')' - pea "," - pea ";" - pea " " - pea "[" - pea "]" - pea "(" - pea ")" + pea "," + pea ";" + pea " " + pea "[" + pea "]" + pea "(" + pea ")" - pea #"," - pea #";" - pea #" " - pea #"[" - pea #"]" - pea #"(" - pea #")" + pea #"," + pea #";" + pea #" " + pea #"[" + pea #"]" + pea #"(" + pea #")" - pea '"' - pea "'" - pea #'"' - pea #"'" + pea '"' + pea "'" + pea #'"' + pea #"'" + lst + chk ;*QASM_CHK* + lst off diff --git a/util.cpp b/util.cpp index 6c8b9e2..92a23ff 100644 --- a/util.cpp +++ b/util.cpp @@ -1,5 +1,5 @@ #define UTIL_CPP -#include +#include "app.h" #undef CLASS #define CLASS QUtils diff --git a/util.h b/util.h index c22d584..e1d7e0f 100644 --- a/util.h +++ b/util.h @@ -1,5 +1,4 @@ #pragma once -#include class QUtils {