Implement more of the shim, it can assemble the test file sort of master
authorNick Downing <nick@ndcode.org>
Sat, 18 Jun 2022 06:55:53 +0000 (16:55 +1000)
committerNick Downing <nick@ndcode.org>
Sat, 18 Jun 2022 06:55:53 +0000 (16:55 +1000)
17 files changed:
aslcop8/codecop8.c
aslcop8/lcop8.h
aslcop8/lcop8mch.c
aslcop8/lcop8pst.c
aslcop8/o.sh [new file with mode: 0755]
aslcop8/tcop8.asm
aslshim/asmdef.c
aslshim/asmerr.c
aslshim/asmpars.c
aslshim/asmsub.c
aslshim/bpemu.c
aslshim/cpulist.c
aslshim/errmsg.c
aslshim/intpseudo.c
aslshim/natpseudo.c
aslshim/strutil.c
asxmak/linux/build/makefile

index e3a9a68..0a2bbf7 100644 (file)
@@ -669,6 +669,12 @@ static void DeinitFields(void)
 
 static void MakeCode_COP8(void)
 {
+ fprintf(stderr, "MakeCode_COP8()\n");
+ fprintf(stderr, "OpPart \"%s\"\n", OpPart.str.p_str);
+ fprintf(stderr, "ArgStr");
+ for (int i = 1; i <= ArgCnt; ++i)
+   fprintf(stderr, " \"%s\"", ArgStr[i].str.p_str);
+ fprintf(stderr, "\n");
   CodeLen = 0; DontPrint = False;
 
   /* zu ignorierendes */
index 47352ed..2704ff6 100644 (file)
 #define S_ACC 51\r
 #define S_ACCMEM 52\r
 #define S_BIT 53\r
-#define S_CPU 54\r
-#define S_DRSZ 55\r
-#define S_FIXED 56\r
-#define S_IFBNE 57\r
-#define S_IFEQ 58\r
-#define S_IFNE 59\r
-#define S_JMPL_JSRL 60\r
-#define S_JMP_JSR 61\r
-#define S_JP 62\r
-#define S_LD 63\r
-#define S_X 64\r
+#define S_DRSZ 54\r
+#define S_FIXED 55\r
+#define S_IFBNE 56\r
+#define S_IFEQ 57\r
+#define S_IFNE 58\r
+#define S_JMPL_JSRL 59\r
+#define S_JMP_JSR 60\r
+#define S_JP 61\r
+#define S_LD 62\r
+#define S_X 63\r
 \r
 /*\r
- * Other\r
+ * CPU Types\r
  */\r
-//#define      S_FLAG  70\r
+#define        S_CPU   64\r
+\r
+/*\r
+ * Processor Types (S_CPU)\r
+ */\r
+#define        X_COP87L84 0\r
 \r
 /*\r
  * Registers.\r
index 902ebf5..2dd3803 100644 (file)
  * Kent, Ohio  44240\r
  */\r
 \r
+#include <ctype.h>\r
+#include <stdbool.h>\r
 #include "asxxxx.h"\r
 #include "lcop8.h"\r
 \r
 // asl includes\r
+#include "stdinc.h"\r
 #include "asmdef.h"\r
+#include "asmitree.h"\r
 #include "codecop8.h"\r
+#include "codevars.h"\r
+#include "strutil.h"\r
 \r
 char   *cpu    = "asl-cop8";\r
 char   *dsft   = "asm";\r
 \r
+// see as.c SplitLine()\r
+static void adjust_copy_comp(tStrComp *p_comp, const char *p_src, size_t newsz)\r
+{\r
+       if (newsz + 1 > p_comp->str.capacity)\r
+               as_dynstr_realloc(&p_comp->str, as_dynstr_roundup_len(newsz));\r
+       p_comp->Pos.Len = strmemcpy(\r
+               p_comp->str.p_str,\r
+               p_comp->str.capacity,\r
+               p_src,\r
+               newsz\r
+       );\r
+}\r
+\r
 /*\r
  * Process machine ops.\r
  */\r
@@ -40,7 +59,38 @@ machine(mp)
 struct mne *mp;\r
 {\r
 #if 1\r
- abort();\r
+       char *op = mp->m_id;\r
+       if (*op == '.')\r
+               return; //++op;\r
+       adjust_copy_comp(&OpPart, op, strlen(op));\r
+       for (char *p = OpPart.str.p_str; *p; ++p)\r
+               *p = toupper(*p);\r
+\r
+       ArgCnt = 0;\r
+       char c = getnb();\r
+       while (c) {\r
+               char *start = ip - 1;\r
+               char *end = ip - 1;\r
+               while (c && c != ',') {\r
+                       end = ip;\r
+                       c = getnb();\r
+               }\r
+               AppendArg(end - start + 1);\r
+               ArgStr[ArgCnt].Pos.Len = strmemcpy(\r
+                       ArgStr[ArgCnt].str.p_str,\r
+                       ArgStr[ArgCnt].str.capacity,\r
+                       start,\r
+                       end - start\r
+               );\r
+               for (char *p = ArgStr[ArgCnt].str.p_str; *p; ++p)\r
+                       *p = toupper(*p);\r
+               if (c == ',')\r
+                       c = getnb(); // improve this\r
+       }\r
+\r
+       MakeCode();\r
+       for (int i = 0; i < CodeLen; ++i)\r
+               outab(BAsmCode[i]);\r
 #else\r
        unsigned op, rd, rs;\r
        struct expr e;\r
@@ -151,6 +201,10 @@ minit()
         * Byte Order\r
         */\r
        hilo = 0;\r
-       asmdef_init();\r
-       codecop8_init();\r
+       static bool inited = false;\r
+       if (!inited) {\r
+               inited = true;\r
+               asmdef_init();\r
+               codecop8_init();\r
+       }\r
 }\r
index 8d3a0c3..fa980d1 100644 (file)
@@ -228,6 +228,10 @@ struct     mne     mne[] = {
 \r
     {  NULL,   ".mdelete",     S_MACRO,        0,      O_MDEL  },\r
 \r
+       /* Machines */\r
+\r
+    {  NULL,   ".cop87l84",    S_CPU,          0,      X_COP87L84 },\r
+\r
        /* 8080/8085 */\r
 \r
     //{        NULL,   "b",            S_REG,          0,      B       },\r
@@ -268,6 +272,5 @@ struct      mne     mne[] = {
     {  NULL,   "subc",         S_ACCMEM,       0,      0x81    },\r
     {  NULL,   "xor",          S_ACCMEM,       0,      0x86    },\r
     {  NULL,   "ifgt",         S_ACCMEM,       0,      0x83    },\r
-    {  NULL,   "rbit",         S_BIT,          0,      0x68    },\r
-    {  NULL,   "cop87l84",     S_CPU,          S_EOL,  0/*switchto_cop8*/      },\r
+    {  NULL,   "rbit",         S_BIT,          S_EOL,  0x68    },\r
 };\r
diff --git a/aslcop8/o.sh b/aslcop8/o.sh
new file mode 100755 (executable)
index 0000000..3cef2c7
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#sudo sh -c "echo core >/proc/sys/kernel/core_pattern"
+(
+  cd .. && \
+  mkdir --parents asxmak/linux/exe && \
+  make -C asxmak/linux/build aslcop8 aslink
+) && \
+../asxmak/linux/build/aslcop8 -l tcop8.asm
+#gdb ../asxmak/linux/build/aslcop8 core
index ab9ba88..a6a7366 100644 (file)
@@ -1,8 +1,10 @@
-        cpu     cop87l84
+        ;cpu     cop87l84
+       .cop87l84
 
-        macexp  off
+        ;macexp  off
 
-        include regcop8.inc
+        ;include regcop8.inc
+        .include regcop8.inc
 
         nop
         ret
         drsz    r12
         drsz    r8
 
-reg     sfr     10
-
-        addr    1,2,3,4,5
-        addrw   1,2,3,4,5
-        byte    1,2,3,4,5
-        word    1,2,3,4,5
-        dsb     20
-        dsw     20
-        fb      10,20
-        fw      10,20
+;reg     sfr     10
+;
+;        addr    1,2,3,4,5
+;        addrw   1,2,3,4,5
+;        byte    1,2,3,4,5
+;        word    1,2,3,4,5
+;        dsb     20
+;        dsw     20
+;        fb      10,20
+;        fw      10,20
 
 
index ddd7dbf..bf35902 100644 (file)
@@ -320,9 +320,6 @@ int SetMaxCodeLen(LongWord NewMaxCodeLen)
 
 void AppendArg(size_t ReqSize)
 {
-#if 1
- abort();
-#else
   if (ArgCnt >= ArgCntMax)
     WrXError(ErrNum_InternalError, "MaxArgCnt");
   ++ArgCnt;
@@ -343,7 +340,6 @@ void AppendArg(size_t ReqSize)
     if (as_dynstr_realloc(&ArgStr[ArgCnt].str, as_dynstr_roundup_len(ReqSize)))
       WrXError(ErrNum_InternalError, "out of memory");
   }
-#endif
 }
 
 /*!------------------------------------------------------------------------
index b509b05..b4b2f55 100644 (file)
@@ -884,7 +884,7 @@ void WrStrErrorPos(tErrorNum Num, const struct sStrComp *pStrComp)
 void WrError(tErrorNum Num)
 {
 #if 1
abort();
 fprintf(stderr, "WrError() %d\n", Num);
 #else
   WrXErrorPos(Num, NULL, NULL);
 #endif
index fc18a43..4628b25 100644 (file)
@@ -8,6 +8,8 @@
 /*                                                                           */
 /*****************************************************************************/
 
+#include "asxxxx.h" // Nick
+
 #include "stdinc.h"
 #include <string.h>
 #include <ctype.h>
@@ -1948,7 +1950,10 @@ void EvalExpression(const char *pExpr, TempResult *pErg)
 LargeInt EvalStrIntExpressionWithResult(const tStrComp *pComp, IntType Type, tEvalResult *pResult)
 {
 #if 1
- abort();
+  ip = pComp->str.p_str;
+  memset(pResult, 0, sizeof(tEvalResult));
+  pResult->OK = True;
+  return absexpr();
 #else
   TempResult t;
   LargeInt Result = -1;
@@ -2032,7 +2037,10 @@ func_exit:
 LargeInt EvalStrIntExpressionWithFlags(const tStrComp *pComp, IntType Type, Boolean *pResult, tSymbolFlags *pFlags)
 {
 #if 1
- abort();
+  ip = pComp->str.p_str;
+  *pResult = True;
+  *pFlags = 0;
+  return absexpr();
 #else
   tEvalResult EvalResult;
   LargeInt Result = EvalStrIntExpressionWithResult(pComp, Type, &EvalResult);
@@ -2047,7 +2055,9 @@ LargeInt EvalStrIntExpressionWithFlags(const tStrComp *pComp, IntType Type, Bool
 LargeInt EvalStrIntExpression(const tStrComp *pComp, IntType Type, Boolean *pResult)
 {
 #if 1
- abort();
+  ip = pComp->str.p_str;
+  *pResult = True;
+  return absexpr();
 #else
   tEvalResult EvalResult;
   LargeInt Result = EvalStrIntExpressionWithResult(pComp, Type, &EvalResult);
@@ -2060,7 +2070,10 @@ LargeInt EvalStrIntExpression(const tStrComp *pComp, IntType Type, Boolean *pRes
 LargeInt EvalStrIntExpressionOffsWithResult(const tStrComp *pExpr, int Offset, IntType Type, tEvalResult *pResult)
 {
 #if 1
- abort();
+  ip = pExpr->str.p_str;
+  memset(pResult, 0, sizeof(tEvalResult));
+  pResult->OK = True;
+  return absexpr();
 #else
   if (Offset)
   {
@@ -2092,7 +2105,9 @@ LargeInt EvalStrIntExpressionOffsWithFlags(const tStrComp *pComp, int Offset, In
 LargeInt EvalStrIntExpressionOffs(const tStrComp *pComp, int Offset, IntType Type, Boolean *pResult)
 {
 #if 1
- abort();
+  ip = pComp->str.p_str;
+  *pResult = True;
+  return absexpr();
 #else
   tEvalResult EvalResult;
   LargeInt Result = EvalStrIntExpressionOffsWithResult(pComp, Offset, Type, &EvalResult);
index fcb1f7e..87a09fc 100644 (file)
@@ -8,6 +8,7 @@
 /*                                                                           */
 /*****************************************************************************/
 
+#include "asxxxx.h" // Nick
 
 #include "stdinc.h"
 #include <string.h>
@@ -1326,7 +1327,7 @@ LargeWord ProgCounter(void)
 LargeWord EProgCounter(void)
 {
 #if 1
abort();
 return dot.s_addr;
 #else
   return PCs[ActPC] + Phases[ActPC];
 #endif
@@ -1362,7 +1363,7 @@ Word ListGran(void)
 void ChkSpace(Byte AddrSpace, unsigned AddrSpaceMask)
 {
 #if 1
abort();
fprintf(stderr, "ChkSpace()\n");
 #else
   AddrSpaceMask &= ~(1 << AddrSpace);
 
index 91f398b..f440b83 100644 (file)
@@ -276,56 +276,32 @@ long FileSize(FILE *file)
 
 Byte Lo(Word inp)
 {
-#if 1
- abort();
-#else
   return (inp & 0xff);
-#endif
 }
 
 Byte Hi(Word inp)
 {
-#if 1
- abort();
-#else
   return ((inp >> 8) & 0xff);
-#endif
 }
 
 unsigned LoWord(LongWord Src)
 {
-#if 1
- abort();
-#else
   return (Src & 0xffff);
-#endif
 }
 
 unsigned HiWord(LongWord Src)
 {
-#if 1
- abort();
-#else
   return ((Src >> 16) & 0xffff);
-#endif
 }
 
 unsigned long LoDWord(LargeWord Src)
 {
-#if 1
- abort();
-#else
   return Src & 0xfffffffful;
-#endif
 }
 
 Boolean Odd(int inp)
 {
-#if 1
- abort();
-#else
   return ((inp & 1) == 1);
-#endif
 }
 
 Boolean DirScan(char *Mask, charcallback callback)
index 4bcdb4b..77d959c 100644 (file)
@@ -89,6 +89,7 @@ static void FreeNoUserProc(void *pUserData)
 CPUVar AddCPUWithArgs(const char *NewName, tCPUSwitchProc Switcher, const tCPUArg *pArgs)
 {
 #if 1
+ printf("AddCPUWithArgs() %s\n", NewName);
  static bool flag = false;
  assert(!flag);
  flag = true;
index 89e273a..033855f 100644 (file)
@@ -8,6 +8,7 @@
 /*                                                                           */
 /*****************************************************************************/
 
+#include <assert.h> // Nick
 #include <stdlib.h> // Nick
 #include <string.h>
 #include <stdarg.h>
 #include "as.rsc"
 #include "errmsg.h"
 
+// Nick
+char *getmessage(int n) {
+  fprintf(stderr, "getmessage() %d\n", n);
+  abort();
+}
+
 static tErrorNum GetDefaultCPUErrorNum(tErrorNum ThisNum)
 {
 #if 1
@@ -119,9 +126,6 @@ Boolean ChkRangeWarnPos(LargeInt Value, LargeInt Min, LargeInt Max, const tStrCo
 
 Boolean ChkArgCntExtPos(int ThisCnt, int MinCnt, int MaxCnt, const struct sLineComp *pComp)
 {
-#if 1
- abort();
-#else
   if ((ThisCnt < MinCnt) || (ThisCnt > MaxCnt))
   {
     char Str[100];
@@ -147,7 +151,6 @@ Boolean ChkArgCntExtPos(int ThisCnt, int MinCnt, int MaxCnt, const struct sLineC
   }
   else
     return True;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -606,14 +609,10 @@ int ChkExactCPUMaskExt(Word CPUMask, CPUVar FirstCPU, tErrorNum ErrorNum)
 
 Boolean ChkSamePage(LargeWord CurrAddr, LargeWord DestAddr, unsigned PageBits, tSymbolFlags DestFlags)
 {
-#if 1
- abort();
-#else
   LargeWord Mask = ~((1ul << PageBits) - 1);
   Boolean Result = ((CurrAddr & Mask) == (DestAddr & Mask))
                 || mFirstPassUnknownOrQuestionable(DestFlags);
   if (!Result)
     WrError(ErrNum_TargOnDiffPage);
   return Result;
-#endif
 }
index 6878a01..3a4124c 100644 (file)
@@ -1662,7 +1662,7 @@ void DecodeIntelDS(Word Code)
 Boolean DecodeIntelPseudo(Boolean BigEndian)
 {
 #if 1
abort();
return False;
 #else
   static PInstTable InstTables[2] = { NULL, NULL };
   int Idx = !!BigEndian;
index b68f301..9489a34 100644 (file)
@@ -102,7 +102,7 @@ static void DecodeFx(Word Shift)
 Boolean DecodeNatPseudo(void)
 {
 #if 1
abort();
return False;
 #else
   static PInstTable InstTable = NULL;
 
index df4d1fe..3cafd68 100644 (file)
@@ -26,9 +26,6 @@ char SplitByteCharacter;    /* output large numbers per-byte with given split ch
 
 const char *Blanks(int cnt)
 {
-#if 1
- abort();
-#else
   static const char *BlkStr = "                                                                                                           ";
   static int BlkStrLen = 0;
 
@@ -41,7 +38,6 @@ const char *Blanks(int cnt)
     cnt = BlkStrLen;
 
   return BlkStr + (BlkStrLen - cnt);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -59,9 +55,6 @@ const char *Blanks(int cnt)
 
 char *SysStringCore(char *pDest, char *pDestCurr, LargeWord Num, int System, int Stellen, char StartCharacter)
 {
-#if 1
- abort();
-#else
   LargeWord Digit;
 
   do
@@ -78,14 +71,10 @@ char *SysStringCore(char *pDest, char *pDestCurr, LargeWord Num, int System, int
   }
   while ((Stellen > 0) || Num);
   return pDestCurr;
-#endif
 }
 
 int SysString(char *pDest, size_t DestSize, LargeWord Num, int System, int Stellen, Boolean ForceLeadZero, char StartCharacter, char SplitCharacter)
 {
-#if 1
- abort();
-#else
   int Len = 0;
   char *pDestCurr, *pDestNext;
 
@@ -145,7 +134,6 @@ int SysString(char *pDest, size_t DestSize, LargeWord Num, int System, int Stell
   if (pDestCurr != pDest)
     strmov(pDest, pDestCurr);
   return Len;
-#endif
 }
 
 /*---------------------------------------------------------------------------*/
@@ -153,9 +141,6 @@ int SysString(char *pDest, size_t DestSize, LargeWord Num, int System, int Stell
 
 char *as_strdup(const char *s)
 {
-#if 1
- abort();
-#else
   char *ptr;
 
   if (!s)
@@ -171,7 +156,6 @@ char *as_strdup(const char *s)
   if (ptr != 0)
     strcpy(ptr, s);
   return ptr;
-#endif
 }
 /*---------------------------------------------------------------------------*/
 /* ...so is snprintf... */
@@ -194,9 +178,6 @@ typedef struct
 
 static void ResetFormatContext(tFormatContext *pContext)
 {
-#if 1
- abort();
-#else
   int z;
 
   for (z = 0; z < 3; z++)
@@ -213,7 +194,6 @@ static void ResetFormatContext(tFormatContext *pContext)
   pContext->LeftAlign =
   pContext->AddPlus =
   pContext->ForceUpper = False;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -226,9 +206,6 @@ static void ResetFormatContext(tFormatContext *pContext)
 
 static size_t limit_minus_one(dest_format_context_t *p_dest_ctx, size_t cnt)
 {
-#if 1
- abort();
-#else
   /* anyway still enough space? */
 
   if (p_dest_ctx->dest_remlen > cnt)
@@ -259,7 +236,6 @@ static size_t limit_minus_one(dest_format_context_t *p_dest_ctx, size_t cnt)
 
   else
     return (cnt >= p_dest_ctx->dest_remlen) ? p_dest_ctx->dest_remlen - 1 : cnt;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -273,9 +249,6 @@ static size_t limit_minus_one(dest_format_context_t *p_dest_ctx, size_t cnt)
 
 static size_t append_pad(dest_format_context_t *p_dest_ctx, char src, size_t cnt)
 {
-#if 1
- abort();
-#else
   cnt = limit_minus_one(p_dest_ctx, cnt);
 
   if (cnt > 0)
@@ -285,15 +258,11 @@ static size_t append_pad(dest_format_context_t *p_dest_ctx, char src, size_t cnt
     p_dest_ctx->dest_remlen -= cnt;
   }
   return cnt;
-#endif
 }
 
 #if 0
 static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Boolean TruncateTrailingZeros, char FormatType)
 {
-#if 1
- abort();
-#else
   int DecPt;
   int Sign, Result = 0;
   char *pBuf, *pEnd, *pRun;
@@ -329,14 +298,10 @@ static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Bo
   Result = pRun - pDest;
   Result += as_snprintf(pRun, DestSize - Result, "e%+02d", DecPt - 1);
   return Result;
-#endif
 }
 #else
 static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Boolean TruncateTrailingZeros, char FormatType)
 {
-#if 1
- abort();
-#else
   char Format[10];
 
   (void)DestSize;
@@ -345,7 +310,6 @@ static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Bo
   Format[4] = (HexStartCharacter == 'a') ? FormatType : toupper(FormatType);
   sprintf(pDest, Format, Digits, Src);
   return strlen(pDest);
-#endif
 }
 #endif
 
@@ -361,9 +325,6 @@ static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Bo
 
 static size_t append(dest_format_context_t *p_dest_ctx, const char *p_src, size_t cnt, tFormatContext *pFormatContext)
 {
-#if 1
- abort();
-#else
   size_t pad_len, result = 0;
 
   pad_len = (pFormatContext->Arg[0] > (int)cnt) ? pFormatContext->Arg[0] - cnt : 0;
@@ -386,7 +347,6 @@ static size_t append(dest_format_context_t *p_dest_ctx, const char *p_src, size_
     ResetFormatContext(pFormatContext);
 
   return result + cnt;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -400,9 +360,6 @@ static size_t append(dest_format_context_t *p_dest_ctx, const char *p_src, size_
 
 static int vsprcatf_core(dest_format_context_t *p_dest_ctx, const char *pFormat, va_list ap)
 {
-#if 1
- abort();
-#else
   const char *pFormatStart = pFormat;
   int Result = 0;
   size_t OrigLen = strlen(p_dest_ctx->p_dest);
@@ -580,7 +537,6 @@ static int vsprcatf_core(dest_format_context_t *p_dest_ctx, const char *pFormat,
   if (p_dest_ctx->dest_remlen > 0)
     *(p_dest_ctx->p_dest++) = '\0';
   return Result;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -594,16 +550,12 @@ static int vsprcatf_core(dest_format_context_t *p_dest_ctx, const char *pFormat,
 
 int as_vsdprcatf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
 {
-#if 1
- abort();
-#else
   dest_format_context_t ctx;
 
   ctx.p_dest = p_dest->p_str;
   ctx.dest_remlen = p_dest->capacity;
   ctx.p_dynstr = p_dest;
   return vsprcatf_core(&ctx, pFormat, ap);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -617,13 +569,9 @@ int as_vsdprcatf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
 
 int as_vsdprintf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
 {
-#if 1
- abort();
-#else
   if (p_dest->capacity > 0)
     p_dest->p_str[0] = '\0';
   return as_vsdprcatf(p_dest, pFormat, ap);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -637,9 +585,6 @@ int as_vsdprintf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
 
 int as_sdprcatf(as_dynstr_t *p_dest, const char *pFormat, ...)
 {
-#if 1
- abort();
-#else
   va_list ap;
   int ret;
 
@@ -647,7 +592,6 @@ int as_sdprcatf(as_dynstr_t *p_dest, const char *pFormat, ...)
   ret = as_vsdprcatf(p_dest, pFormat, ap);
   va_end(ap);
   return ret;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -661,9 +605,6 @@ int as_sdprcatf(as_dynstr_t *p_dest, const char *pFormat, ...)
 
 int as_sdprintf(as_dynstr_t *p_dest, const char *pFormat, ...)
 {
-#if 1
- abort();
-#else
   va_list ap;
   int ret;
 
@@ -671,7 +612,6 @@ int as_sdprintf(as_dynstr_t *p_dest, const char *pFormat, ...)
   ret = as_vsdprintf(p_dest, pFormat, ap);
   va_end(ap);
   return ret;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -686,9 +626,6 @@ int as_sdprintf(as_dynstr_t *p_dest, const char *pFormat, ...)
 
 int as_vsnprcatf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
 {
-#if 1
- abort();
-#else
   dest_format_context_t ctx;
 
   if (DestSize == sizeof(char*))
@@ -701,7 +638,6 @@ int as_vsnprcatf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
   ctx.dest_remlen = DestSize;
   ctx.p_dynstr = NULL;
   return vsprcatf_core(&ctx, pFormat, ap);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -716,13 +652,9 @@ int as_vsnprcatf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
 
 int as_vsnprintf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
 {
-#if 1
- abort();
-#else
   if (DestSize > 0)
     *pDest = '\0';
   return as_vsnprcatf(pDest, DestSize, pFormat, ap);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -737,9 +669,6 @@ int as_vsnprintf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
 
 int as_snprintf(char *pDest, size_t DestSize, const char *pFormat, ...)
 {
-#if 1
- abort();
-#else
   va_list ap;
   int Result;
 
@@ -749,7 +678,6 @@ int as_snprintf(char *pDest, size_t DestSize, const char *pFormat, ...)
   Result = as_vsnprcatf(pDest, DestSize, pFormat, ap);
   va_end(ap);
   return Result;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -764,9 +692,6 @@ int as_snprintf(char *pDest, size_t DestSize, const char *pFormat, ...)
 
 int as_snprcatf(char *pDest, size_t DestSize, const char *pFormat, ...)
 {
-#if 1
- abort();
-#else
   va_list ap;
   int Result;
 
@@ -774,14 +699,10 @@ int as_snprcatf(char *pDest, size_t DestSize, const char *pFormat, ...)
   Result = as_vsnprcatf(pDest, DestSize, pFormat, ap);
   va_end(ap);
   return Result;
-#endif
 }
 
 int as_strcasecmp(const char *src1, const char *src2)
 {
-#if 1
- abort();
-#else
   if (!src1)
     src1 = "";
   if (!src2)
@@ -794,14 +715,10 @@ int as_strcasecmp(const char *src1, const char *src2)
     src2++;
   }
   return ((int) tolower(*src1)) - ((int) tolower(*src2));
-#endif
-}
+}      
 
 int as_strncasecmp(const char *src1, const char *src2, size_t len)
 {
-#if 1
- abort();
-#else
   if (!src1)
     src1 = "";
   if (!src2)
@@ -816,15 +733,11 @@ int as_strncasecmp(const char *src1, const char *src2, size_t len)
     src2++;
   }
   return ((int) tolower(*src1)) - ((int) tolower(*src2));
-#endif
-}
+}      
 
 #ifdef NEEDS_STRSTR
 char *strstr(const char *haystack, const char *needle)
 {
-#if 1
- abort();
-#else
   int lh = strlen(haystack), ln = strlen(needle);
   int z;
   char *p;
@@ -833,7 +746,6 @@ char *strstr(const char *haystack, const char *needle)
     if (strncmp(p = haystack + z, needle, ln) == 0)
       return p;
   return NULL;
-#endif
 }
 #endif
 
@@ -847,16 +759,12 @@ char *strstr(const char *haystack, const char *needle)
 
 char *strrmultchr(const char *haystack, const char *needles)
 {
-#if 1
- abort();
-#else
   const char *pPos;
 
   for (pPos = haystack + strlen(haystack) - 1; pPos >= haystack; pPos--)
     if (strchr(needles, *pPos))
       return (char*)pPos;
   return NULL;
-#endif
 }
 
 /*---------------------------------------------------------------------------*/
@@ -864,9 +772,6 @@ char *strrmultchr(const char *haystack, const char *needles)
 
 size_t strmaxcpy(char *dest, const char *src, size_t Max)
 {
-#if 1
- abort();
-#else
   size_t cnt = strlen(src);
 
   /* leave room for terminating NUL */
@@ -878,7 +783,6 @@ size_t strmaxcpy(char *dest, const char *src, size_t Max)
   memcpy(dest, src, cnt);
   dest[cnt] = '\0';
   return cnt;
-#endif
 }
 
 /*---------------------------------------------------------------------------*/
@@ -886,9 +790,6 @@ size_t strmaxcpy(char *dest, const char *src, size_t Max)
 
 size_t strmaxcat(char *Dest, const char *Src, size_t MaxLen)
 {
-#if 1
- abort();
-#else
   int TLen = strlen(Src);
   size_t DLen = strlen(Dest);
 
@@ -902,17 +803,12 @@ size_t strmaxcat(char *Dest, const char *Src, size_t MaxLen)
   }
   else
     return DLen;
-#endif
 }
 
 void strprep(char *Dest, const char *Src)
 {
-#if 1
- abort();
-#else
   memmove(Dest + strlen(Src), Dest, strlen(Dest) + 1);
   memmove(Dest, Src, strlen(Src));
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -925,9 +821,6 @@ void strprep(char *Dest, const char *Src)
 
 void strmaxprep(char *p_dest, const char *p_src, size_t max_len)
 {
-#if 1
- abort();
-#else
   size_t src_len = strlen(p_src),
          dest_len = strlen(p_dest);
 
@@ -936,7 +829,6 @@ void strmaxprep(char *p_dest, const char *p_src, size_t max_len)
     src_len = max_len - dest_len - 1;
   memmove(p_dest + src_len, p_dest, dest_len + 1);
   memmove(p_dest, p_src, src_len);
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -949,9 +841,6 @@ void strmaxprep(char *p_dest, const char *p_src, size_t max_len)
 
 void strmaxprep2(char *p_dest, const char *p_src, size_t max_len)
 {
-#if 1
- abort();
-#else
   size_t src_len = strlen(p_src),
          dest_len = strlen(p_dest);
 
@@ -963,24 +852,16 @@ void strmaxprep2(char *p_dest, const char *p_src, size_t max_len)
     dest_len = max_len - 1;
   memmove(p_dest + src_len, p_dest, dest_len + 1);
   memmove(p_dest, p_src, src_len);
-#endif
 }
 
 void strins(char *Dest, const char *Src, int Pos)
 {
-#if 1
- abort();
-#else
   memmove(Dest + Pos + strlen(Src), Dest + Pos, strlen(Dest) + 1 - Pos);
   memmove(Dest + Pos, Src, strlen(Src));
-#endif
 }
 
 void strmaxins(char *Dest, const char *Src, int Pos, size_t MaxLen)
 {
-#if 1
- abort();
-#else
   size_t RLen;
 
   RLen = strlen(Src);
@@ -988,15 +869,11 @@ void strmaxins(char *Dest, const char *Src, int Pos, size_t MaxLen)
     RLen = MaxLen - strlen(Dest);
   memmove(Dest + Pos + RLen, Dest + Pos, strlen(Dest) + 1 - Pos);
   memmove(Dest + Pos, Src, RLen);
-#endif
 }
 
 int strlencmp(const char *pStr1, unsigned Str1Len,
               const char *pStr2, unsigned Str2Len)
 {
-#if 1
- abort();
-#else
   const char *p1, *p2, *p1End, *p2End;
   int Diff;
 
@@ -1009,14 +886,10 @@ int strlencmp(const char *pStr1, unsigned Str1Len,
       return Diff;
   }
   return ((int)Str1Len) - ((int)Str2Len);
-#endif
 }
 
 unsigned fstrlenprint(FILE *pFile, const char *pStr, unsigned StrLen)
 {
-#if 1
- abort();
-#else
   unsigned Result = 0;
   const char *pRun, *pEnd;
 
@@ -1033,21 +906,16 @@ unsigned fstrlenprint(FILE *pFile, const char *pStr, unsigned StrLen)
     }
 
   return Result;
-#endif
 }
 
 size_t as_strnlen(const char *pStr, size_t MaxLen)
 {
-#if 1
- abort();
-#else
   size_t Res = 0;
 
   for (; (MaxLen > 0); MaxLen--, pStr++, Res++)
     if (!*pStr)
       break;
   return Res;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -1064,9 +932,6 @@ size_t as_strnlen(const char *pStr, size_t MaxLen)
 
 int strreplace(char *pHaystack, const char *pFrom, const char *pTo, size_t ToMaxLen, size_t HaystackSize)
 {
-#if 1
- abort();
-#else
   int HaystackLen = -1, FromLen = -1, ToLen = -1, Count = 0;
   int HeadLen, TailLen;
   char *pSearch, *pPos;
@@ -1125,7 +990,6 @@ int strreplace(char *pHaystack, const char *pFrom, const char *pTo, size_t ToMax
 
     Count++;
   }
-#endif
 }
 
 /*---------------------------------------------------------------------------*/
@@ -1133,9 +997,6 @@ int strreplace(char *pHaystack, const char *pFrom, const char *pTo, size_t ToMax
 
 void ReadLn(FILE *Datei, char *Zeile)
 {
-#if 1
- abort();
-#else
   char *ptr;
   int l;
 
@@ -1150,16 +1011,12 @@ void ReadLn(FILE *Datei, char *Zeile)
     Zeile[--l] = '\0';
   if ((l > 0) && (Zeile[l - 1] == 26))
     Zeile[--l] = '\0';
-#endif
 }
 
 #if 0
 
 static void dump(const char *pLine, unsigned Cnt)
 {
-#if 1
- abort();
-#else
   unsigned z;
 
   fputc('\n', stderr);
@@ -1170,7 +1027,6 @@ static void dump(const char *pLine, unsigned Cnt)
       fputc('\n', stderr);
   }
   fputc('\n', stderr);
-#endif
 }
 
 #endif
@@ -1185,9 +1041,6 @@ static void dump(const char *pLine, unsigned Cnt)
 
 size_t ReadLnCont(FILE *Datei, as_dynstr_t *p_line)
 {
-#if 1
- abort();
-#else
   char *ptr, *pDest;
   size_t l, Count, LineCount;
   Boolean Terminated;
@@ -1251,7 +1104,6 @@ size_t ReadLnCont(FILE *Datei, as_dynstr_t *p_line)
   }
 
   return LineCount;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -1264,9 +1116,6 @@ size_t ReadLnCont(FILE *Datei, as_dynstr_t *p_line)
 
 int DigitVal(char ch, int Base)
 {
-#if 1
- abort();
-#else
   int Result;
 
   /* Ziffern 0..9 ergeben selbiges */
@@ -1290,7 +1139,6 @@ int DigitVal(char ch, int Base)
     Result = -1;
 
   return (Result >= Base) ? -1 : Result;
-#endif
 }
 
 /*--------------------------------------------------------------------*/
@@ -1301,9 +1149,6 @@ int DigitVal(char ch, int Base)
 
 LargeInt ConstLongInt(const char *inp, Boolean *pErr, LongInt Base)
 {
-#if 1
- abort();
-#else
   static const char Prefixes[4] = { '$', '@', '%', '\0' }; /* die moeglichen Zahlensysteme */
   static const char Postfixes[4] = { 'H', 'O', '\0', '\0' };
   static const LongInt Bases[3] = { 16, 8, 2 };            /* die dazugehoerigen Basen */
@@ -1385,7 +1230,6 @@ LargeInt ConstLongInt(const char *inp, Boolean *pErr, LongInt Base)
   }
 
   return erg;
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1393,9 +1237,6 @@ LargeInt ConstLongInt(const char *inp, Boolean *pErr, LongInt Base)
 
 void KillBlanks(char *s)
 {
-#if 1
- abort();
-#else
   char *z, *dest;
   Boolean InSgl = False, InDbl = False, ThisEscaped = False, NextEscaped = False;
 
@@ -1422,14 +1263,10 @@ void KillBlanks(char *s)
       *dest++ = *z;
   }
   *dest = '\0';
-#endif
 }
 
 int CopyNoBlanks(char *pDest, const char *pSrc, size_t MaxLen)
 {
-#if 1
- abort();
-#else
   const char *pSrcRun;
   char *pDestRun = pDest;
   size_t Cnt = 0;
@@ -1470,7 +1307,6 @@ int CopyNoBlanks(char *pDest, const char *pSrc, size_t MaxLen)
   *pDestRun = '\0';
 
   return Cnt;
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1478,9 +1314,6 @@ int CopyNoBlanks(char *pDest, const char *pSrc, size_t MaxLen)
 
 int KillPrefBlanks(char *s)
 {
-#if 1
- abort();
-#else
   char *z = s;
 
   while ((*z != '\0') && as_isspace(*z))
@@ -1488,7 +1321,6 @@ int KillPrefBlanks(char *s)
   if (z != s)
     strmov(s, z);
   return z - s;
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1496,9 +1328,6 @@ int KillPrefBlanks(char *s)
 
 int KillPostBlanks(char *s)
 {
-#if 1
- abort();
-#else
   char *z = s + strlen(s) - 1;
   int count = 0;
 
@@ -1508,20 +1337,15 @@ int KillPostBlanks(char *s)
     count++;
   }
   return count;
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
 
 int strqcmp(const char *s1, const char *s2)
 {
-#if 1
- abort();
-#else
   int erg = (*s1) - (*s2);
 
   return (erg != 0) ? erg : strcmp(s1, s2);
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1531,12 +1355,8 @@ int strqcmp(const char *s1, const char *s2)
 
 char *strmov(char *pDest, const char *pSrc)
 {
-#if 1
- abort();
-#else
   memmove(pDest, pSrc, strlen(pSrc) + 1);
   return pDest;
-#endif
 }
 
 #ifdef __GNUC__
@@ -1546,9 +1366,6 @@ char *strmov(char *pDest, const char *pSrc)
 #endif
 char *strcpy(char *pDest, const char *pSrc)
 {
-#if 1
- abort();
-#else
   int l = strlen(pSrc) + 1;
   int Overlap = 0;
 
@@ -1575,7 +1392,6 @@ char *strcpy(char *pDest, const char *pSrc)
   }
 
   return strmov(pDest, pSrc);
-#endif
 }
 
 #endif
@@ -1592,24 +1408,17 @@ char *strcpy(char *pDest, const char *pSrc)
 
 int strmemcpy(char *pDest, size_t DestSize, const char *pSrc, size_t SrcLen)
 {
-#if 1
- abort();
-#else
   if (DestSize < SrcLen + 1)
     SrcLen = DestSize - 1;
   memmove(pDest, pSrc, SrcLen);
   pDest[SrcLen] = '\0';
   return SrcLen;
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
 
 char *ParenthPos(char *pHaystack, char Needle)
 {
-#if 1
- abort();
-#else
   char *pRun;
   int Level = 0;
 
@@ -1631,7 +1440,6 @@ char *ParenthPos(char *pHaystack, char Needle)
     }
   }
   return NULL;
-#endif
 }
 
 /*!------------------------------------------------------------------------
@@ -1643,20 +1451,12 @@ char *ParenthPos(char *pHaystack, char Needle)
 
 char TabCompressed(char in)
 {
-#if 1
- abort();
-#else
   return (in == '\t') ? ' ' : (as_isprint(in) ? in : '*');
-#endif
 }
 
 /*--------------------------------------------------------------------------*/
 
 void strutil_init(void)
 {
-#if 1
- abort();
-#else
   HexStartCharacter = 'A';
-#endif
 }
index 6bf55d4..77c2f6c 100644 (file)
@@ -338,9 +338,9 @@ ASXXSRC =   $(addprefix $(SRCASX),$(ASXX))
 $(ASXXSRC):    $(SRCMISC)alloc.h $(SRCASX)asxxxx.h\r
 \r
 \r
-LSHIM =        asmdef.c asmerr.c asmitree.c asmpars.c asmsub.c bpemu.c codevars.c \\r
-       cpulist.c dynstr.c errmsg.c intformat.c intpseudo.c natpseudo.c \\r
-       strcomp.c strutil.c\r
+LSHIM =        asmdef.o asmerr.o asmitree.o asmpars.o asmsub.o bpemu.o codevars.o \\r
+       cpulist.o dynstr.o errmsg.o intformat.o intpseudo.o natpseudo.o \\r
+       strcomp.o strutil.o\r
 \r
 LSHIMSRC =     $(addprefix $(SRCLSHIM),$(LSHIM))\r
 \r