diff --git a/code6805.c b/code6805.c index b89161e..9630e3b 100644 --- a/code6805.c +++ b/code6805.c @@ -393,6 +393,8 @@ BEGIN if (DecodePseudo()) return; + if (DecodeTimexPseudo(True)) return; + if (DecodeMotoPseudo(True)) return; /* Anweisungen ohne Argument */ diff --git a/codepseudo.c b/codepseudo.c index 8d474de..817cc93 100644 --- a/codepseudo.c +++ b/codepseudo.c @@ -639,6 +639,68 @@ BEGIN END END + static void DecodeWRD(Word Index) +BEGIN + int z; + Boolean OK; + TempResult t; + LongInt Rep,z2; + + if (ArgCnt==0) WrError(1110); + else + BEGIN + z=1; OK=True; + do + BEGIN + KillBlanks(ArgStr[z]); + OK=CutRep(ArgStr[z],&Rep); + if (OK) + BEGIN + EvalExpression(ArgStr[z],&t); + switch (t.Typ) + BEGIN + case TempInt: + if (NOT RangeCheck(t.Contents.Int,Int16)) + BEGIN + WrError(1320); OK=False; + END + else if (CodeLen+(2*Rep)>MaxCodeLen) + BEGIN + WrError(1920); OK=False; + END + else + for (z2=0; z2': + return 0x28; + case '%': + return 0x29; + case '&': + return 0x2a; + case '\'': + return 0x2b; + case '(': + return 0x2c; + case ')': + return 0x2d; + case '*': + return 0x2e; + case '+': + return 0x2f; + case ',': + return 0x30; + case '-': + return 0x31; + case '.': + return 0x32; + case '/': + return 0x33; + case ':': + return 0x34; + case '\\': + return 0x35; + case '=': + return 0x37; + case '?': + return 0x39; + case '_': + return 0x3a; + default: + WrError(1320); + CodeLen=0; + fprintf (stderr, "Cannot encode %c in 'timex' encoding\n", c); + } +} + + +static void timex_translate_buf(unsigned char *c, size_t l) +{ + for (;l;c++,l--) + *c = timex_translate(*c); +} + + + static void DecodeTIMEX(Word Index) +BEGIN + int z; + Boolean OK; + TempResult t; + LongInt Rep,z2; + + if (ArgCnt==0) WrError(1110); + else + BEGIN + z=1; OK=True; + do + BEGIN + KillBlanks(ArgStr[z]); + OK=CutRep(ArgStr[z],&Rep); + if (OK) + BEGIN + EvalExpression(ArgStr[z],&t); + switch (t.Typ) + BEGIN + case TempInt: + if (NOT RangeCheck(t.Contents.Int,Int8)) + BEGIN + WrError(1320); OK=False; + END + else if (CodeLen+Rep>MaxCodeLen) + BEGIN + WrError(1920); OK=False; + END + else + BEGIN + memset(BAsmCode+CodeLen,t.Contents.Int,Rep); + timex_translate_buf(BAsmCode+CodeLen,Rep); + CodeLen+=Rep; + END + break; + case TempFloat: + WrError(1135); OK=False; + break; + case TempString: + TranslateString(t.Contents.Ascii); + if (CodeLen+Rep*strlen(t.Contents.Ascii)>MaxCodeLen) + BEGIN + WrError(1920); OK=False; + END + else for (z2=0; z2MaxCodeLen) + BEGIN + WrError(1920); OK=False; + END + else + BEGIN + memset(BAsmCode+CodeLen,t.Contents.Int,Rep); + timex6_translate_buf(BAsmCode+CodeLen,Rep); + CodeLen+=Rep; + END + break; + case TempFloat: + WrError(1135); OK=False; + break; + case TempString: + TranslateString(t.Contents.Ascii); + if (CodeLen+Rep*strlen(t.Contents.Ascii)>MaxCodeLen) + BEGIN + WrError(1920); OK=False; + END + else for (z2=0; z2>2,bpos=(Pos&3)*4; diff --git a/codepseudo.h b/codepseudo.h index 0ffbfe8..fc164a7 100644 --- a/codepseudo.h +++ b/codepseudo.h @@ -24,6 +24,8 @@ extern void ConvertDec(Double F, Word *w); extern Boolean DecodeIntelPseudo(Boolean Turn); +extern Boolean DecodeTimexPseudo(Boolean Turn); + extern Boolean DecodeMotoPseudo(Boolean Turn); extern void AddMoto16PseudoONOFF(void);