diff --git a/src/libsrc/uthernet.pla b/src/libsrc/uthernet.pla index 4b5e067..a21eff3 100644 --- a/src/libsrc/uthernet.pla +++ b/src/libsrc/uthernet.pla @@ -11,10 +11,10 @@ end // // Uthernet register offsets // -const TXDATA = $00 -const RXDATA = $00 -const TXCMD = $04 -const TXLEN = $06 +const TX_DATA = $00 +const RX_DATA = $00 +const TX_CMD = $04 +const TX_LEN = $06 const INT_STATUS = $08 const PREG_INDEX = $0A const PREG_DATA = $0C @@ -214,13 +214,13 @@ end // Identify Uthernet card and initialize // for slot = $90 to $F0 step $10 - if (peekiow(slot+TXCMD) & $CC3F) == $09 + if (peekiow(slot+TX_CMD) & $CC3F) == $09 pokeiow(slot+PREG_INDEX, 0) if peekiow(slot+PREG_DATA) == $630E pokepreg($0114, $40) // RESET rxdata_hi = slot + 1 - txcmd = slot + TXCMD - txlen = slot + TXLEN + txcmd = slot + TX_CMD + txlen = slot + TX_LEN isq = slot + INT_STATUS pregidx = slot + PREG_INDEX pregdata = slot + PREG_DATA diff --git a/src/toolsrc/codegen.c b/src/toolsrc/codegen.c index f007f1d..4060438 100755 --- a/src/toolsrc/codegen.c +++ b/src/toolsrc/codegen.c @@ -45,7 +45,7 @@ int id_match(char *name, int len, char *id) if (len > 16) len = 16; while (len--) { - if (name[len] != id[1 + len]) + if (toupper(name[len]) != id[1 + len]) return (0); } return (1); @@ -94,7 +94,7 @@ int idconst_add(char *name, int len, int value) idconst_name[consts][0] = len; if (len > ID_LEN) len = ID_LEN; while (len--) - idconst_name[consts][1 + len] = name[len]; + idconst_name[consts][1 + len] = toupper(name[len]); idconst_value[consts] = value; consts++; return (1); @@ -123,7 +123,7 @@ int idlocal_add(char *name, int len, int type, int size) idlocal_name[locals][0] = len; if (len > ID_LEN) len = ID_LEN; while (len--) - idlocal_name[locals][1 + len] = name[len]; + idlocal_name[locals][1 + len] = toupper(name[len]); idlocal_type[locals] = type | LOCAL_TYPE; idlocal_offset[locals] = localsize; localsize += size; @@ -153,7 +153,7 @@ int idglobal_add(char *name, int len, int type, int size) idglobal_name[globals][0] = len; if (len > ID_LEN) len = ID_LEN; while (len--) - idglobal_name[globals][1 + len] = name[len]; + idglobal_name[globals][1 + len] = toupper(name[len]); idglobal_type[globals] = type; if (!(type & EXTERN_TYPE)) { @@ -205,7 +205,7 @@ int idfunc_add(char *name, int len, int type, int tag) idglobal_name[globals][0] = len; if (len > ID_LEN) len = ID_LEN; while (len--) - idglobal_name[globals][1 + len] = name[len]; + idglobal_name[globals][1 + len] = toupper(name[len]); idglobal_type[globals] = type; idglobal_tag[globals++] = tag; if (type & EXTERN_TYPE) diff --git a/src/toolsrc/codegen.pla b/src/toolsrc/codegen.pla index 28b5312..6259e98 100644 --- a/src/toolsrc/codegen.pla +++ b/src/toolsrc/codegen.pla @@ -803,11 +803,11 @@ def writeheader(refnum) loop ^moddep = 0 // Terminate dependency list len = moddep - 1 - @header - modfix = len + MODADDR - codebuff // Convert generated address into module adress + modfix = len + RELADDR - codebuff // Convert generated address into module adress header:0 = len + codeptr - codebuff // sizeof header+data+bytecode header:2 = $DA7F // Magic # header:4 = modsysflags // Module SYSFLAGS - header:6 = len + MODADDR + datasize // Byte code offset + header:6 = len + RELADDR + datasize // Byte code offset header:8 = def_cnt // DEFinition count header:10 = entrypoint + modfix // Init entrypoint fileio:write(refnum, @header, len + 2) @@ -907,12 +907,12 @@ end // def writemodule(refnum)#0 word hdrlen, esd, esdlen, modfix, modadj, modofst, fixups, updtptr - + // // Write module header // hdrlen = writeheader(refnum) - modfix = hdrlen + MODADDR + modfix = hdrlen + RELADDR modofst = hdrlen - codebuff // // Adjust internal fixups for header size diff --git a/src/toolsrc/lex.c b/src/toolsrc/lex.c index cf7f09e..66dbb3e 100755 --- a/src/toolsrc/lex.c +++ b/src/toolsrc/lex.c @@ -410,11 +410,6 @@ t_token scan(void) scantoken = TERNARY_TOKEN; scanpos += 2; } - else - { - scantoken = TERNARY_TOKEN; - scanpos++; - } break; default: /* diff --git a/src/toolsrc/lex.pla b/src/toolsrc/lex.pla index 233e5c4..4be8219 100644 --- a/src/toolsrc/lex.pla +++ b/src/toolsrc/lex.pla @@ -1,31 +1,31 @@ // // Lexical anaylzer // -def isalpha(c) - if c >= 'A' and c <= 'Z' - return TRUE - elsif c >= 'a' and c <= 'z' - return TRUE - elsif c == '_' - return TRUE - fin - return FALSE -end -def isnum(c) - return c >= '0' and c <= '9' -end -def isalphanum(c) - if c >= 'A' and c <= 'Z' - return TRUE - elsif c >= 'a' and c <= 'z' - return TRUE - elsif c >= '0' and c <= '9' - return TRUE - elsif c == '_' - return TRUE - fin - return FALSE -end +//def isalpha(c) +// if c >= 'A' and c <= 'Z' +// return TRUE +// //elsif c >= 'a' and c <= 'z' +// // return TRUE +// elsif c == '_' +// return TRUE +// fin +// return FALSE +//end +//def isnum(c) +// return c >= '0' and c <= '9' +//end +//def isalphanum(c) +// if c >= 'A' and c <= 'Z' +// return TRUE +// //elsif c >= 'a' and c <= 'z' +// // return TRUE +// elsif c >= '0' and c <= '9' +// return TRUE +// elsif c == '_' +// return TRUE +// fin +// return FALSE +//end def keymatch byte i, keypos word chrptr @@ -37,7 +37,7 @@ def keymatch chrptr = tknptr - 1 while keywrds[keypos] == tknlen for i = 1 to tknlen - if toupper(^(chrptr + i)) <> keywrds[keypos + i] + if ^(chrptr + i) <> keywrds[keypos + i] break fin next @@ -51,7 +51,7 @@ end def scannum word num num = 0 - + if ^scanptr == '$' repeat scanptr++ @@ -84,17 +84,21 @@ def scan scanptr++ loop tknptr = scanptr - scanchr = ^scanptr + scanchr = toupper(^scanptr) // // Scan for token based on first character // - if isalpha(scanchr) + //if isalpha(scanchr) + if (scanchr >= 'A' and scanchr <= 'Z') or (scanchr == '_') // // ID, either variable name or reserved word // repeat + ^scanptr = scanchr scanptr++ - until not isalphanum(^scanptr) + scanchr = toupper(^scanptr) + //until not isalphanum(scanchr) + until not ((scanchr >= 'A' and scanchr <= 'Z') or (scanchr >= '0' and scanchr <= '9' ) or (scanchr == '_')) tknlen = scanptr - tknptr token = keymatch elsif scanchr >= '0' and scanchr <= '9' // isnum() @@ -143,10 +147,13 @@ def scan scanptr++ when ^scanptr is 'n' + is 'N' constval = $0D; break is 'r' + is 'R' constval = $0A; break is 't' + is 'T' constval = $09; break otherwise constval = scannum @@ -172,10 +179,13 @@ def scan scanptr++ when ^scanptr is 'n' + is 'N' ^strconstptr = $0D; break is 'r' + is 'R' ^strconstptr = $0A; break is 't' + is 'T' ^strconstptr = $09; break otherwise ^strconstptr = scannum @@ -272,9 +282,6 @@ def scan if ^(scanptr + 1) == '?' token = TERNARY_TKN; scanptr = scanptr + 2 - else - token = TERNARY_TKN; - scanptr++ fin break is 0 diff --git a/src/toolsrc/parse.pla b/src/toolsrc/parse.pla index 423ed19..ce9644b 100644 --- a/src/toolsrc/parse.pla +++ b/src/toolsrc/parse.pla @@ -82,7 +82,7 @@ end def parse_constterm word val byte size, type - + when scan is OPEN_PAREN_TKN push_val(parse_constexpr) @@ -227,12 +227,12 @@ def parse_list#2 until token <> COMMA_TKN return listseq, listdepth end -def parse_value(codeseq, rvalue)#2 +def parse_value(codeseq, r_val)#2 byte cfnparms, cfnvals, stackdepth, operation word deref, type, optos, idptr, value, const_offset word uopseq, valseq, idxseq - deref = rvalue + deref = r_val optos = opsp type = 0 value = 0 @@ -253,7 +253,7 @@ def parse_value(codeseq, rvalue)#2 is LOGIC_NOT_TKN uopseq = gen_uop(uopseq, token); is ADD_TKN - if not rvalue; exit_err(ERR_INVAL|ERR_SYNTAX); fin + if not r_val; exit_err(ERR_INVAL|ERR_SYNTAX); fin break is BPTR_TKN is WPTR_TKN @@ -307,12 +307,12 @@ def parse_value(codeseq, rvalue)#2 deref-- break is DROP_TKN - if rvalue; exit_err(ERR_INVAL|ERR_STATE); fin + if r_val; exit_err(ERR_INVAL|ERR_STATE); fin codeseq = gen_op(codeseq, DROP_CODE) scan return codeseq, 0 // Special case return is LAMBDA_TKN - if not rvalue; return codeseq, 0; fin // Lambdas can't be LVALUES + if not r_val; return codeseq, 0; fin // Lambdas can't be LVALUES value = parse_lambda valseq = gen_opglbl(NULL, GADDR_CODE, value, 0) deref-- @@ -444,7 +444,7 @@ def parse_value(codeseq, rvalue)#2 // // Resolve outstanding dereference pointer loads // - while deref > rvalue + while deref > r_val if type & FUNC_TYPE if cfnparms; exit_err(ERR_MISS|ERR_ID); fin valseq = gen_op(valseq, ICAL_CODE) @@ -478,7 +478,7 @@ def parse_value(codeseq, rvalue)#2 // // Wrap up LVALUE store // - if not rvalue + if not r_val if type & (BYTE_TYPE | BPTR_TYPE) valseq = gen_op(valseq, SB_CODE) elsif type & (WORD_TYPE | WPTR_TYPE) diff --git a/src/toolsrc/plasm.pla b/src/toolsrc/plasm.pla index ce95bb4..2ebbe5d 100644 --- a/src/toolsrc/plasm.pla +++ b/src/toolsrc/plasm.pla @@ -256,7 +256,7 @@ predef emit_pending_seq#0 // // Module relocation base address // -const MODADDR = $1000 +const RELADDR = $1000 // // Exports for optimizer module // diff --git a/src/vmsrc/a1cmd.pla b/src/vmsrc/a1cmd.pla index eed3cdf..c522e96 100755 --- a/src/vmsrc/a1cmd.pla +++ b/src/vmsrc/a1cmd.pla @@ -1,4 +1,4 @@ -const MODADDR = $1000 +const RELADDR = $1000 const inbuff = $200 const freemem = $0006 // @@ -792,7 +792,7 @@ def loadmod(mod)#1 memcpy(@header, heap, 128) modsize = header:0 moddep = @header.1 - defofst = modsize + MODADDR + defofst = modsize + RELADDR init = 0 if rdlen > 4 and heap=>2 == $DA7F // DAVE+1 = magic number :-) // @@ -841,7 +841,7 @@ def loadmod(mod)#1 // Apply all fixups and symbol import/export. // modfix = modaddr - modfix - modofst = modfix - MODADDR + modofst = modfix - RELADDR modend = modaddr + modsize bytecode = defofst + modofst defofst = bytecode - defofst diff --git a/src/vmsrc/cmd.pla b/src/vmsrc/cmd.pla index c9acb86..5315023 100755 --- a/src/vmsrc/cmd.pla +++ b/src/vmsrc/cmd.pla @@ -1,7 +1,7 @@ const MACHID = $BF98 const iobuffer = $0800 const databuff = $2000 -const MODADDR = $1000 +const RELADDR = $1000 const symtbl = $0C00 const freemem = $0006 const getlnbuf = $01FF @@ -935,7 +935,7 @@ def loadmod(mod)#1 rdlen = read(refnum, @header, 128) modsize = header:0 moddep = @header.1 - defofst = modsize + MODADDR + defofst = modsize + RELADDR init = 0 if rdlen > 4 and header:2 == $DA7F // DAVE+1 = magic number :-) // @@ -999,7 +999,7 @@ def loadmod(mod)#1 // Apply all fixups and symbol import/export. // modfix = modaddr - modfix - modofst = modfix - MODADDR + modofst = modfix - RELADDR modend = modaddr + modsize bytecode = defofst + modofst rld = modend // Re-Locatable Directory diff --git a/src/vmsrc/soscmd.pla b/src/vmsrc/soscmd.pla index f5b6c10..dba35f5 100755 --- a/src/vmsrc/soscmd.pla +++ b/src/vmsrc/soscmd.pla @@ -1,5 +1,5 @@ const membank = $FFEF -const MODADDR = $1000 +const RELADDR = $1000 // // System flags: memory allocator screen holes. // @@ -81,7 +81,7 @@ byte sextstr[] = "SEXT" byte divmodstr[] = "DIVMOD" byte loadstr[] = "MODLOAD" byte execstr[] = "MODEXEC" -byte modadrstr[] = "MODADDR" +byte modadrstr[] = "RELADDR" byte prefix[] // Overlay with exported symbols table word exports[] = @sysmodstr, @version word = @sysstr, @syscall @@ -1007,7 +1007,7 @@ def loadmod(mod)#1 rdlen = read(refnum, @header, 128) modsize = header:0 moddep = @header.1 - defofst = modsize + MODADDR + defofst = modsize + RELADDR init = 0 if rdlen > 4 and header:2 == $DA7F // DAVE+1 = magic number :-) // @@ -1073,7 +1073,7 @@ def loadmod(mod)#1 // Apply all fixups and symbol import/export. // modfix = modaddr - modfix - modofst = modfix - MODADDR + modofst = modfix - RELADDR modend = modaddr + modsize bytecode = defofst + modofst rld = modend // Re-Locatable Directory