Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

  1. /* code6809.c */
  2. /*****************************************************************************/
  3. /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
  4. /*                                                                           */
  5. /* AS-Portierung                                                             */
  6. /*                                                                           */
  7. /* Code Generator 6809/6309                                                  */
  8. /*                                                                           */
  9. /*****************************************************************************/
  10.  
  11. #include "stdinc.h"
  12. #include <ctype.h>
  13. #include <string.h>
  14.  
  15. #include "nls.h"
  16. #include "strutil.h"
  17. #include "bpemu.h"
  18.  
  19. #include "asmdef.h"
  20. #include "asmpars.h"
  21. #include "asmsub.h"
  22. #include "asmallg.h"
  23. #include "asmitree.h"
  24. #include "codepseudo.h"
  25. #include "motpseudo.h"
  26. #include "intpseudo.h"
  27. #include "codevars.h"
  28. #include "errmsg.h"
  29. #include "cmdarg.h"
  30.  
  31. #include "code6809.h"
  32.  
  33. #define plain_base_mode_sym_name "PLAINBASE"
  34. #define plain_base_mode_cmd_name "PLAINBASE"
  35.  
  36. typedef struct
  37. {
  38.   char *Name;
  39.   Word Code;
  40.   CPUVar MinCPU;
  41. } BaseOrder;
  42.  
  43. typedef struct
  44. {
  45.   char *Name;
  46.   Word Code;
  47.   Boolean Inv;
  48.   CPUVar MinCPU;
  49. } FlagOrder;
  50.  
  51. typedef struct
  52. {
  53.   char *Name;
  54.   Word Code8;
  55.   Word Code16;
  56.   CPUVar MinCPU;
  57. } RelOrder;
  58.  
  59. typedef struct
  60. {
  61.   char *Name;
  62.   Word Code;
  63.   tSymbolSize OpSize;
  64.   Boolean MayImm;
  65.   CPUVar MinCPU;
  66. } ALUOrder;
  67.  
  68. typedef enum
  69. {
  70.   e_adr_mode_none = -1,
  71.   e_adr_mode_imm = 1,
  72.   e_adr_mode_dir = 2,
  73.   e_adr_mode_ind = 3,
  74.   e_adr_mode_ext = 4
  75. } adr_mode_t;
  76.  
  77. #define adr_mode_mask_imm (1 << e_adr_mode_imm)
  78. #define adr_mode_mask_dir (1 << e_adr_mode_dir)
  79. #define adr_mode_mask_ind (1 << e_adr_mode_ind)
  80. #define adr_mode_mask_ext (1 << e_adr_mode_ext)
  81. #define adr_mode_mask_no_imm (adr_mode_mask_dir | adr_mode_mask_ind | adr_mode_mask_ext)
  82. #define adr_mode_mask_all (adr_mode_mask_imm | adr_mode_mask_no_imm)
  83.  
  84. typedef struct
  85. {
  86.   adr_mode_t mode;
  87.   int cnt;
  88.   Byte vals[5];
  89. } adr_vals_t;
  90.  
  91. #define StackRegCnt 12
  92. static char StackRegNames[StackRegCnt][4] =
  93. {
  94.   "CCR",  "A",  "B","DPR",  "X",  "Y","S/U", "PC", "CC", "DP",  "S",  "D"
  95. };
  96. static Byte StackRegMasks[StackRegCnt] =
  97. {
  98.   0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x08, 0x40, 0x06
  99. };
  100.  
  101. static const char FlagChars[] = "CVZNIHFE";
  102.  
  103. static LongInt DPRValue;
  104.  
  105. static Boolean target_used,
  106.                plain_base_mode,
  107.                def_plain_base_mode,
  108.                def_plain_base_mode_set;
  109.  
  110. static BaseOrder  *FixedOrders;
  111. static RelOrder   *RelOrders;
  112. static ALUOrder   *ALUOrders;
  113. static BaseOrder *RMWOrders;
  114. static FlagOrder *FlagOrders;
  115. static BaseOrder *LEAOrders;
  116. static BaseOrder *ImmOrders;
  117.  
  118. static CPUVar CPU6809, CPU6309;
  119.  
  120. /*-------------------------------------------------------------------------*/
  121.  
  122. static Boolean CodeReg(char *ChIn, Byte *erg)
  123. {
  124.   static char Regs[5] = "XYUS", *p;
  125.  
  126.   if (strlen(ChIn) != 1)
  127.     return False;
  128.   else
  129.   {
  130.     p = strchr(Regs, as_toupper(*ChIn));
  131.     if (!p)
  132.       return False;
  133.     *erg = p - Regs;
  134.     return True;
  135.   }
  136. }
  137.  
  138. static unsigned ChkZero(const char *s, Byte *Erg)
  139. {
  140.   if (*s == '>')
  141.   {
  142.     *Erg = 1;
  143.     return 1;
  144.   }
  145.   else if (*s == '<')
  146.   {
  147.     if (1[s] == '<')
  148.     {
  149.       *Erg = 3;
  150.       return 2;
  151.     }
  152.     else
  153.     {
  154.       *Erg = 2;
  155.       return 1;
  156.     }
  157.   }
  158.   else
  159.   {
  160.     *Erg = 0;
  161.     return 0;
  162.   }
  163. }
  164.  
  165. static Boolean MayShort(Integer Arg)
  166. {
  167.   return ((Arg >= -128) && (Arg < 127));
  168. }
  169.  
  170. static Boolean IsZeroOrEmpty(const tStrComp *pArg)
  171. {
  172.   Boolean OK;
  173.   LongInt Value;
  174.  
  175.   if (!*pArg->str.p_str)
  176.     return True;
  177.   Value = EvalStrIntExpression(pArg, Int32, &OK);
  178.   return OK && !Value;
  179. }
  180.  
  181. static void reset_adr_vals(adr_vals_t *p_vals)
  182. {
  183.   p_vals->mode = e_adr_mode_none;
  184.   p_vals->cnt = 0;
  185. }
  186.  
  187. static Boolean check_plain_base_arg(int adr_arg_cnt, const tStrComp *p_start_arg)
  188. {
  189.   switch (adr_arg_cnt)
  190.   {
  191.     case 1:
  192.       if (!plain_base_mode)
  193.         WrStrErrorPos(ErrNum_WrongArgCnt, p_start_arg);
  194.       return plain_base_mode;
  195.     case 2:
  196.     {
  197.       Boolean ret = IsZeroOrEmpty(p_start_arg);
  198.       if (!ret)
  199.         WrStrErrorPos(ErrNum_InvAddrMode, p_start_arg);
  200.       return ret;
  201.     }
  202.     default:
  203.       WrError(ErrNum_WrongArgCnt);
  204.       return False;
  205.   }
  206. }
  207.  
  208. static adr_mode_t DecodeAdr(int ArgStartIdx, int ArgEndIdx,
  209.                             unsigned OpcodeLen, tSymbolSize op_size,
  210.                             unsigned mode_mask, adr_vals_t *p_vals)
  211. {
  212.   tStrComp *pStartArg, *pEndArg, IndirComps[2];
  213.   String temp;
  214.   LongInt AdrLong;
  215.   Word AdrWord;
  216.   Boolean IndFlag, OK;
  217.   Byte EReg, ZeroMode;
  218.   char *p;
  219.   unsigned Offset;
  220.   Integer AdrInt;
  221.   int AdrArgCnt = ArgEndIdx - ArgStartIdx + 1;
  222.   const Boolean allow_6309 = (MomCPU >= CPU6309);
  223.  
  224.   reset_adr_vals(p_vals);
  225.   pStartArg = &ArgStr[ArgStartIdx];
  226.   pEndArg = &ArgStr[ArgEndIdx];
  227.  
  228.   /* immediate */
  229.  
  230.   if ((*pStartArg->str.p_str == '#') && (AdrArgCnt == 1))
  231.   {
  232.     switch (op_size)
  233.     {
  234.       case eSymbolSize32Bit:
  235.         AdrLong = EvalStrIntExpressionOffs(pStartArg, 1, Int32, &OK);
  236.         if (OK)
  237.         {
  238.           p_vals->vals[0] = Lo(AdrLong >> 24);
  239.           p_vals->vals[1] = Lo(AdrLong >> 16);
  240.           p_vals->vals[2] = Lo(AdrLong >>  8);
  241.           p_vals->vals[3] = Lo(AdrLong);
  242.           p_vals->cnt = 4;
  243.         }
  244.         break;
  245.       case eSymbolSize16Bit:
  246.         AdrWord = EvalStrIntExpressionOffs(pStartArg, 1, Int16, &OK);
  247.         if (OK)
  248.         {
  249.           p_vals->vals[0] = Hi(AdrWord);
  250.           p_vals->vals[1] = Lo(AdrWord);
  251.           p_vals->cnt = 2;
  252.         }
  253.         break;
  254.       case eSymbolSize8Bit:
  255.         p_vals->vals[0] = EvalStrIntExpressionOffs(pStartArg, 1, Int8, &OK);
  256.         if (OK)
  257.           p_vals->cnt = 1;
  258.         break;
  259.       default:
  260.         OK = False;
  261.         break;
  262.     }
  263.     if (OK)
  264.       p_vals->mode = e_adr_mode_imm;
  265.     goto chk_mode;
  266.   }
  267.  
  268.   /* indirekter Ausdruck ? */
  269.  
  270.   if ((*pStartArg->str.p_str == '[') && (pStartArg->str.p_str[strlen(pStartArg->str.p_str) - 1] == ']'))
  271.   {
  272.     tStrComp Arg, Remainder;
  273.  
  274.     IndFlag = True;
  275.     StrCompRefRight(&Arg, pStartArg, 1);
  276.     StrCompShorten(&Arg, 1);
  277.     AdrArgCnt = 0;
  278.     do
  279.     {
  280.       p = QuotPos(Arg.str.p_str, ',');
  281.       if (p)
  282.         StrCompSplitRef(&IndirComps[AdrArgCnt], &Remainder, &Arg, p);
  283.       else
  284.         IndirComps[AdrArgCnt] = Arg;
  285.       KillPrefBlanksStrCompRef(&IndirComps[AdrArgCnt]);
  286.       KillPostBlanksStrComp(&IndirComps[AdrArgCnt]);
  287.       AdrArgCnt++;
  288.       if (p)
  289.         Arg = Remainder;
  290.     }
  291.     while (p && (AdrArgCnt < 2));
  292.     pStartArg = &IndirComps[0];
  293.     pEndArg = &IndirComps[AdrArgCnt - 1];
  294.   }
  295.   else
  296.     IndFlag = False;
  297.  
  298.   /* Predekrement ? */
  299.  
  300.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (strlen(pEndArg->str.p_str) == 2) && (*pEndArg->str.p_str == '-') && (CodeReg(pEndArg->str.p_str + 1, &EReg)))
  301.   {
  302.     if (check_plain_base_arg(AdrArgCnt, pStartArg))
  303.     {
  304.       p_vals->cnt = 1;
  305.       p_vals->vals[0] = 0x82 + (EReg << 5) + (Ord(IndFlag) << 4);
  306.       p_vals->mode = e_adr_mode_ind;
  307.     }
  308.     goto chk_mode;
  309.   }
  310.  
  311.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (strlen(pEndArg->str.p_str) == 3) && (!strncmp(pEndArg->str.p_str, "--", 2)) && (CodeReg(pEndArg->str.p_str + 2, &EReg)))
  312.   {
  313.     if (check_plain_base_arg(AdrArgCnt, pStartArg))
  314.     {
  315.       p_vals->cnt = 1;
  316.       p_vals->vals[0] = 0x83 + (EReg << 5) + (Ord(IndFlag) << 4);
  317.       p_vals->mode = e_adr_mode_ind;
  318.     }
  319.     goto chk_mode;
  320.   }
  321.  
  322.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (!as_strcasecmp(pEndArg->str.p_str, "--W")))
  323.   {
  324.     if (!check_plain_base_arg(AdrArgCnt, pStartArg));
  325.     else if (!allow_6309) WrError(ErrNum_AddrModeNotSupported);
  326.     else
  327.     {
  328.       p_vals->cnt = 1;
  329.       p_vals->vals[0] = 0xef + Ord(IndFlag);
  330.       p_vals->mode = e_adr_mode_ind;
  331.     }
  332.     goto chk_mode;
  333.   }
  334.  
  335.   /* Postinkrement ? */
  336.  
  337.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (strlen(pEndArg->str.p_str) == 2) && (pEndArg->str.p_str[1] == '+'))
  338.   {
  339.     temp[0] = *pEndArg->str.p_str;
  340.     temp[1] = '\0';
  341.     if (CodeReg(temp, &EReg))
  342.     {
  343.       if (check_plain_base_arg(AdrArgCnt, pStartArg))
  344.       {
  345.         p_vals->cnt = 1;
  346.         p_vals->vals[0] = 0x80 + (EReg << 5) + (Ord(IndFlag) << 4);
  347.         p_vals->mode = e_adr_mode_ind;
  348.       }
  349.       goto chk_mode;
  350.     }
  351.   }
  352.  
  353.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (strlen(pEndArg->str.p_str) == 3) && (!strncmp(pEndArg->str.p_str + 1, "++", 2)))
  354.   {
  355.     temp[0] = *pEndArg->str.p_str;
  356.     temp[1] = '\0';
  357.     if (CodeReg(temp, &EReg))
  358.     {
  359.       if (check_plain_base_arg(AdrArgCnt, pStartArg))
  360.       {
  361.         p_vals->cnt = 1;
  362.         p_vals->vals[0] = 0x81 + (EReg << 5) + (Ord(IndFlag) << 4);
  363.         p_vals->mode = e_adr_mode_ind;
  364.       }
  365.       goto chk_mode;
  366.     }
  367.   }
  368.  
  369.   if ((AdrArgCnt >= 1) && (AdrArgCnt <= 2) && (!as_strcasecmp(pEndArg->str.p_str, "W++")))
  370.   {
  371.     if (!check_plain_base_arg(AdrArgCnt, pStartArg));
  372.     else if (!allow_6309) WrError(ErrNum_AddrModeNotSupported);
  373.     else
  374.     {
  375.       p_vals->cnt = 1;
  376.       p_vals->vals[0] = 0xcf + Ord(IndFlag);
  377.       p_vals->mode = e_adr_mode_ind;
  378.     }
  379.     goto chk_mode;
  380.   }
  381.  
  382.   /* 16-Bit-Register (mit Index) ? */
  383.  
  384.   if ((AdrArgCnt <= 2) && (AdrArgCnt >= 1) && (CodeReg(pEndArg->str.p_str, &EReg)))
  385.   {
  386.     p_vals->vals[0] = (EReg << 5) + (Ord(IndFlag) << 4);
  387.  
  388.     /* nur 16-Bit-Register */
  389.  
  390.     if (AdrArgCnt == 1)
  391.     {
  392.       if (!plain_base_mode) WrStrErrorPos(ErrNum_WrongArgCnt, pEndArg);
  393.       else
  394.       {
  395.         p_vals->cnt = 1;
  396.         p_vals->vals[0] += 0x84;
  397.         p_vals->mode = e_adr_mode_ind;
  398.       }
  399.       goto chk_mode;
  400.     }
  401.  
  402.     /* mit Index */
  403.  
  404.     if (!as_strcasecmp(pStartArg->str.p_str, "A"))
  405.     {
  406.       p_vals->cnt = 1;
  407.       p_vals->vals[0] += 0x86;
  408.       p_vals->mode = e_adr_mode_ind;
  409.       goto chk_mode;
  410.     }
  411.     if (!as_strcasecmp(pStartArg->str.p_str, "B"))
  412.     {
  413.       p_vals->cnt = 1;
  414.       p_vals->vals[0] += 0x85;
  415.       p_vals->mode = e_adr_mode_ind;
  416.       goto chk_mode;
  417.     }
  418.     if (!as_strcasecmp(pStartArg->str.p_str, "D"))
  419.     {
  420.       p_vals->cnt = 1;
  421.       p_vals->vals[0] += 0x8b;
  422.       p_vals->mode = e_adr_mode_ind;
  423.       goto chk_mode;
  424.     }
  425.     if ((!as_strcasecmp(pStartArg->str.p_str, "E")) && allow_6309)
  426.     {
  427.       p_vals->cnt = 1;
  428.       p_vals->vals[0] += 0x87;
  429.       p_vals->mode = e_adr_mode_ind;
  430.       goto chk_mode;
  431.     }
  432.     if ((!as_strcasecmp(pStartArg->str.p_str, "F")) && allow_6309)
  433.     {
  434.       p_vals->cnt = 1;
  435.       p_vals->vals[0] += 0x8a;
  436.       p_vals->mode = e_adr_mode_ind;
  437.       goto chk_mode;
  438.     }
  439.     if ((!as_strcasecmp(pStartArg->str.p_str, "W")) && allow_6309)
  440.     {
  441.       p_vals->cnt = 1;
  442.       p_vals->vals[0] += 0x8e;
  443.       p_vals->mode = e_adr_mode_ind;
  444.       goto chk_mode;
  445.     }
  446.  
  447.     /* Displacement auswerten */
  448.  
  449.     Offset = ChkZero(pStartArg->str.p_str, &ZeroMode);
  450.     if (!pStartArg->str.p_str[0])
  451.     {
  452.       AdrInt = 0;
  453.       OK = True;
  454.     }
  455.     else if (ZeroMode > 1)
  456.     {
  457.       tSymbolFlags Flags;
  458.  
  459.       AdrInt = EvalStrIntExpressionOffsWithFlags(pStartArg, Offset, Int8, &OK, &Flags);
  460.       if (mFirstPassUnknown(Flags) && (ZeroMode == 3))
  461.         AdrInt &= 0x0f;
  462.     }
  463.     else
  464.       AdrInt = EvalStrIntExpressionOffs(pStartArg, Offset, Int16, &OK);
  465.     if (!OK)
  466.       goto chk_mode;
  467.  
  468.     /* Displacement 0 ? */
  469.  
  470.     if ((ZeroMode == 0) && (AdrInt == 0))
  471.     {
  472.       p_vals->cnt = 1;
  473.       p_vals->vals[0] += 0x84;
  474.       p_vals->mode = e_adr_mode_ind;
  475.       goto chk_mode;
  476.     }
  477.  
  478.     /* 5-Bit-Displacement */
  479.  
  480.     else if ((ZeroMode == 3) || ((ZeroMode == 0) && (!IndFlag) && (AdrInt >= -16) && (AdrInt <= 15)))
  481.     {
  482.       if ((AdrInt < -16) || (AdrInt > 15)) WrError(ErrNum_NoShortAddr);
  483.       else if (IndFlag) WrError(ErrNum_InvAddrMode);
  484.       else
  485.       {
  486.         p_vals->mode = e_adr_mode_ind;
  487.         p_vals->cnt = 1;
  488.         p_vals->vals[0] += AdrInt & 0x1f;
  489.       }
  490.       goto chk_mode;
  491.     }
  492.  
  493.     /* 8-Bit-Displacement */
  494.  
  495.     else if ((ZeroMode == 2) || ((ZeroMode == 0) && (MayShort(AdrInt))))
  496.     {
  497.       if (!MayShort(AdrInt)) WrError(ErrNum_NoShortAddr);
  498.       else
  499.       {
  500.         p_vals->mode = e_adr_mode_ind;
  501.         p_vals->cnt = 2;
  502.         p_vals->vals[0] += 0x88;
  503.         p_vals->vals[1] = Lo(AdrInt);
  504.       }
  505.       goto chk_mode;
  506.     }
  507.  
  508.     /* 16-Bit-Displacement */
  509.  
  510.     else
  511.     {
  512.       p_vals->mode = e_adr_mode_ind;
  513.       p_vals->cnt = 3;
  514.       p_vals->vals[0] += 0x89;
  515.       p_vals->vals[1] = Hi(AdrInt);
  516.       p_vals->vals[2] = Lo(AdrInt);
  517.       goto chk_mode;
  518.     }
  519.   }
  520.  
  521.   if ((AdrArgCnt <= 2) && (AdrArgCnt >= 1) && allow_6309 && (!as_strcasecmp(pEndArg->str.p_str, "W")))
  522.   {
  523.     p_vals->vals[0] = 0x8f + Ord(IndFlag);
  524.  
  525.     /* nur W-Register */
  526.  
  527.     if (AdrArgCnt == 1)
  528.     {
  529.       if (!plain_base_mode) WrStrErrorPos(ErrNum_WrongArgCnt, pEndArg);
  530.       else
  531.       {
  532.         p_vals->cnt = 1;
  533.         p_vals->mode = e_adr_mode_ind;
  534.       }
  535.       goto chk_mode;
  536.     }
  537.  
  538.     /* Displacement auswerten */
  539.  
  540.     Offset = ChkZero(pStartArg->str.p_str, &ZeroMode);
  541.     if (pStartArg->str.p_str[0])
  542.       AdrInt = EvalStrIntExpressionOffs(pStartArg, Offset, Int16, &OK);
  543.     else
  544.     {
  545.       AdrInt = 0;
  546.       OK = True;
  547.     }
  548.  
  549.     /* Displacement 0 ? */
  550.  
  551.     if ((ZeroMode == 0) && (AdrInt == 0))
  552.     {
  553.       p_vals->cnt = 1;
  554.       p_vals->mode = e_adr_mode_ind;
  555.       goto chk_mode;
  556.     }
  557.  
  558.     /* 16-Bit-Displacement */
  559.  
  560.     else
  561.     {
  562.       p_vals->mode = e_adr_mode_ind;
  563.       p_vals->cnt = 3;
  564.       p_vals->vals[0] += 0x20;
  565.       p_vals->vals[1] = Hi(AdrInt);
  566.       p_vals->vals[2] = Lo(AdrInt);
  567.       goto chk_mode;
  568.     }
  569.   }
  570.  
  571.   /* PC-relativ ? */
  572.  
  573.   if ((AdrArgCnt == 2) && (!as_strcasecmp(pEndArg->str.p_str, "PCR") || !as_strcasecmp(pEndArg->str.p_str, "PC")))
  574.   {
  575.     p_vals->vals[0] = Ord(IndFlag) << 4;
  576.     Offset = ChkZero(pStartArg->str.p_str, &ZeroMode);
  577.     AdrInt = EvalStrIntExpressionOffs(pStartArg, Offset, Int16, &OK);
  578.     if (OK)
  579.     {
  580.       AdrInt -= EProgCounter() + 2 + OpcodeLen;
  581.  
  582.       if (ZeroMode == 3) WrError(ErrNum_InvAddrMode);
  583.  
  584.       else if ((ZeroMode == 2) || ((ZeroMode == 0) && MayShort(AdrInt)))
  585.       {
  586.         if (!MayShort(AdrInt)) WrError(ErrNum_OverRange);
  587.         else
  588.         {
  589.           p_vals->cnt = 2;
  590.           p_vals->vals[0] += 0x8c;
  591.           p_vals->vals[1] = Lo(AdrInt);
  592.           p_vals->mode = e_adr_mode_ind;
  593.         }
  594.       }
  595.  
  596.       else
  597.       {
  598.         AdrInt--;
  599.         p_vals->cnt = 3;
  600.         p_vals->vals[0] += 0x8d;
  601.         p_vals->vals[1] = Hi(AdrInt);
  602.         p_vals->vals[2] = Lo(AdrInt);
  603.         p_vals->mode = e_adr_mode_ind;
  604.       }
  605.     }
  606.     goto chk_mode;
  607.   }
  608.  
  609.   if (AdrArgCnt == 1)
  610.   {
  611.     tSymbolFlags Flags;
  612.  
  613.     Offset = ChkZero(pStartArg->str.p_str, &ZeroMode);
  614.     AdrInt = EvalStrIntExpressionOffsWithFlags(pStartArg, Offset, Int16, &OK, &Flags);
  615.     if (mFirstPassUnknown(Flags) && (ZeroMode == 2))
  616.       AdrInt = (AdrInt & 0xff) | (DPRValue << 8);
  617.  
  618.     if (OK)
  619.     {
  620.       if (ZeroMode == 3) WrError(ErrNum_InvAddrMode);
  621.  
  622.       else if ((ZeroMode == 2) || ((ZeroMode == 0) && (Hi(AdrInt) == DPRValue) && (!IndFlag)))
  623.       {
  624.         if (IndFlag) WrError(ErrNum_NoIndir);
  625.         else if (Hi(AdrInt) != DPRValue) WrError(ErrNum_NoShortAddr);
  626.         else
  627.         {
  628.           p_vals->cnt = 1;
  629.           p_vals->mode = e_adr_mode_dir;
  630.           p_vals->vals[0] = Lo(AdrInt);
  631.         }
  632.       }
  633.  
  634.       else
  635.       {
  636.         if (IndFlag)
  637.         {
  638.           p_vals->mode = e_adr_mode_ind;
  639.           p_vals->cnt = 3;
  640.           p_vals->vals[0] = 0x9f;
  641.           p_vals->vals[1] = Hi(AdrInt);
  642.           p_vals->vals[2] = Lo(AdrInt);
  643.         }
  644.         else
  645.         {
  646.           p_vals->mode = e_adr_mode_ext;
  647.           p_vals->cnt = 2;
  648.           p_vals->vals[0] = Hi(AdrInt);
  649.           p_vals->vals[1] = Lo(AdrInt);
  650.         }
  651.       }
  652.     }
  653.     goto chk_mode;
  654.   }
  655.  
  656.   if (p_vals->mode == e_adr_mode_none)
  657.     WrError(ErrNum_InvAddrMode);
  658.  
  659. chk_mode:
  660.   if ((p_vals->mode != e_adr_mode_none) && !((mode_mask >> p_vals->mode) & 1))
  661.   {
  662.     WrError(ErrNum_InvAddrMode);
  663.     reset_adr_vals(p_vals);
  664.   }
  665.   return p_vals->mode;
  666. }
  667.  
  668. static Boolean CodeCPUReg(const char *Asc, Byte *Erg)
  669. {
  670. #define RegCnt (sizeof(RegNames) / sizeof(*RegNames))
  671.   static const char RegNames[][4] =
  672.   {
  673.     "D", "X", "Y", "U", "S", "SP", "PC", "W", "V", "A", "B", "CCR", "DPR", "CC", "DP", "Z", "E", "F"
  674.   };
  675.   static const Byte RegVals[RegCnt] =
  676.   {
  677.     0  , 1  , 2  , 3  , 4  , 4   , 5   , 6  , 7  , 8  , 9  , 10   , 11   , 10  , 11  , 13 , 14 , 15
  678.    };
  679.  
  680.   unsigned z;
  681.   String Asc_N;
  682.  
  683.   strmaxcpy(Asc_N, Asc, STRINGSIZE); NLS_UpString(Asc_N); Asc = Asc_N;
  684.  
  685.   for (z = 0; z < RegCnt; z++)
  686.     if (!strcmp(Asc, RegNames[z]))
  687.     {
  688.       if (((RegVals[z] & 6) == 6) && !ChkMinCPUExt(CPU6309, ErrNum_AddrModeNotSupported));
  689.       else
  690.       {
  691.         *Erg = RegVals[z];
  692.         return True;
  693.       }
  694.     }
  695.   return False;
  696. }
  697.  
  698. static void SplitIncDec(char *s, int *Erg)
  699. {
  700.   int l = strlen(s);
  701.  
  702.   if (l == 0)
  703.     *Erg = 0;
  704.   else if (s[l - 1] == '+')
  705.   {
  706.     s[l - 1] = '\0';
  707.     *Erg = 1;
  708.   }
  709.   else if (s[l - 1] == '-')
  710.   {
  711.     s[l - 1] = '\0';
  712.     *Erg = -1;
  713.   }
  714.   else
  715.     *Erg = 0;
  716. }
  717.  
  718. static Boolean SplitBit(tStrComp *pArg, int *Erg)
  719. {
  720.   char *p;
  721.   Boolean OK;
  722.   tStrComp BitArg;
  723.  
  724.   p = QuotPos(pArg->str.p_str, '.');
  725.   if (!p)
  726.   {
  727.     WrError(ErrNum_InvBitPos);
  728.     return False;
  729.   }
  730.   StrCompSplitRef(pArg, &BitArg, pArg, p);
  731.   *Erg = EvalStrIntExpression(&BitArg, UInt3, &OK);
  732.   if (!OK)
  733.     return False;
  734.   *p = '\0';
  735.   return True;
  736. }
  737.  
  738. static void append_adr_vals(const adr_vals_t *p_vals)
  739. {
  740.   memcpy(&BAsmCode[CodeLen], p_vals->vals, p_vals->cnt);
  741.   CodeLen += p_vals->cnt;
  742. }
  743.  
  744. /*-------------------------------------------------------------------------*/
  745.  
  746. /* Anweisungen ohne Argument */
  747.  
  748. static void DecodeFixed(Word Index)
  749. {
  750.   const BaseOrder *pOrder = FixedOrders + Index;
  751.  
  752.   if (!ChkArgCnt(0, 0));
  753.   else if (!ChkMinCPU(pOrder->MinCPU));
  754.   else if (Hi(pOrder->Code) == 0)
  755.   {
  756.     BAsmCode[0] = Lo(pOrder->Code);
  757.     CodeLen = 1;
  758.   }
  759.   else
  760.   {
  761.     BAsmCode[0] = Hi(pOrder->Code);
  762.     BAsmCode[1] = Lo(pOrder->Code);
  763.     CodeLen = 2;
  764.   }
  765. }
  766.  
  767. /* Specials... */
  768.  
  769. static void DecodeSWI(Word Code)
  770. {
  771.   UNUSED(Code);
  772.  
  773.   if (ArgCnt == 0)
  774.   {
  775.     BAsmCode[0] = 0x3f;
  776.     CodeLen = 1;
  777.   }
  778.   else if (ChkArgCnt(1, 1))
  779.   {
  780.     Boolean OK;
  781.     tSymbolFlags Flags;
  782.     Byte Num;
  783.  
  784.     Num = EvalStrIntExpressionWithFlags(&ArgStr[1], UInt2, &OK, &Flags);
  785.     if (OK && mFirstPassUnknown(Flags) && (Num < 2))
  786.       Num = 2;
  787.     if (OK && ChkRange(Num, 2, 3))
  788.     {
  789.       BAsmCode[0] = 0x10 | (Num & 1);
  790.       BAsmCode[1] = 0x3f;
  791.       CodeLen = 2;
  792.     }
  793.   }
  794. }
  795.  
  796. /* relative Spruenge */
  797.  
  798. static void DecodeRel(Word Index)
  799. {
  800.   Boolean LongFlag = (Index & 0x8000) || False;
  801.   const RelOrder *pOrder = RelOrders + (Index & 0x7fff);
  802.  
  803.   if (ChkArgCnt(1, 1))
  804.   {
  805.     Boolean ExtFlag = (LongFlag) && (Hi(pOrder->Code16) != 0), OK;
  806.     tSymbolFlags Flags;
  807.     Integer AdrInt = EvalStrIntExpressionWithFlags(&ArgStr[1], UInt16, &OK, &Flags);
  808.  
  809.     if (OK)
  810.     {
  811.       AdrInt -= EProgCounter() + 2 + Ord(LongFlag) + Ord(ExtFlag);
  812.       if (!mSymbolQuestionable(Flags) && !LongFlag && ((AdrInt < -128) || (AdrInt > 127))) WrError(ErrNum_JmpDistTooBig);
  813.       else
  814.       {
  815.         CodeLen = 1 + Ord(ExtFlag);
  816.         if (LongFlag)
  817.         {
  818.           if (ExtFlag)
  819.           {
  820.             BAsmCode[0] = Hi(pOrder->Code16);
  821.             BAsmCode[1] = Lo(pOrder->Code16);
  822.           }
  823.           else
  824.             BAsmCode[0] = Lo(pOrder->Code16);
  825.         }
  826.         else
  827.           BAsmCode[0] = Lo(pOrder->Code8);
  828.         if (LongFlag)
  829.         {
  830.           BAsmCode[CodeLen] = Hi(AdrInt);
  831.           BAsmCode[CodeLen + 1] = Lo(AdrInt);
  832.           CodeLen += 2;
  833.         }
  834.         else
  835.         {
  836.           BAsmCode[CodeLen] = Lo(AdrInt);
  837.           CodeLen++;
  838.         }
  839.       }
  840.     }
  841.   }
  842. }
  843.  
  844. /* ALU-Operationen */
  845.  
  846. static void DecodeALU(Word Index)
  847. {
  848.   const ALUOrder *pOrder = ALUOrders + Index;
  849.  
  850.   if (ChkArgCnt(1, 2)
  851.    && ChkMinCPU(pOrder->MinCPU))
  852.   {
  853.     adr_vals_t vals;
  854.  
  855.     if (DecodeAdr(1, ArgCnt, 1 + !!Hi(pOrder->Code), pOrder->OpSize, pOrder->MayImm ? adr_mode_mask_all : adr_mode_mask_no_imm, &vals) != e_adr_mode_none)
  856.     {
  857.       if (Hi(pOrder->Code))
  858.         BAsmCode[CodeLen++] = Hi(pOrder->Code);
  859.       BAsmCode[CodeLen++] = Lo(pOrder->Code) + ((vals.mode - 1) << 4);
  860.       append_adr_vals(&vals);
  861.     }
  862.   }
  863. }
  864.  
  865. static void DecodeLDQ(Word Index)
  866. {
  867.   UNUSED(Index);
  868.  
  869.   if (ChkArgCnt(1, 2)
  870.    && ChkMinCPU(CPU6309))
  871.   {
  872.     adr_vals_t vals;
  873.  
  874.     if (DecodeAdr(1, ArgCnt, 2, eSymbolSize32Bit, adr_mode_mask_all, &vals) == e_adr_mode_imm)
  875.     {
  876.       BAsmCode[CodeLen++] = 0xcd;
  877.       append_adr_vals(&vals);
  878.     }
  879.     else
  880.     {
  881.       BAsmCode[CodeLen++] = 0x10;
  882.       BAsmCode[CodeLen++] = 0xcc + ((vals.mode - 1) << 4);
  883.       append_adr_vals(&vals);
  884.     }
  885.   }
  886. }
  887.  
  888. /* Read-Modify-Write-Operationen */
  889.  
  890. static void DecodeRMW(Word Index)
  891. {
  892.   const BaseOrder *pOrder = RMWOrders + Index;
  893.  
  894.   if (ChkArgCnt(1, 2)
  895.    && ChkMinCPU(pOrder->MinCPU))
  896.   {
  897.     adr_vals_t vals;
  898.  
  899.     switch (DecodeAdr(1, ArgCnt, 1, eSymbolSizeUnknown, adr_mode_mask_no_imm, &vals))
  900.     {
  901.       case e_adr_mode_dir:
  902.         BAsmCode[CodeLen++] = pOrder->Code;
  903.         goto append;
  904.       case e_adr_mode_ind:
  905.         BAsmCode[CodeLen++] = pOrder->Code + 0x60;
  906.         goto append;
  907.       case e_adr_mode_ext:
  908.         BAsmCode[CodeLen++] = pOrder->Code + 0x70;
  909.         goto append;
  910.       append:
  911.         append_adr_vals(&vals);
  912.         break;
  913.       default:
  914.         return;
  915.     }
  916.   }
  917. }
  918.  
  919. /* Anweisungen mit Flag-Operand */
  920.  
  921. static void DecodeFlag(Word Index)
  922. {
  923.   const FlagOrder *pOrder = FlagOrders + Index;
  924.   Boolean OK;
  925.   const char *p;
  926.   int z2, z3;
  927.  
  928.   if (ChkArgCnt(1, ArgCntMax))
  929.   {
  930.     OK = True;
  931.     BAsmCode[1] = (pOrder->Inv) ? 0xff : 0x00;
  932.     for (z2 = 1; z2 <= ArgCnt; z2++)
  933.       if (OK)
  934.       {
  935.         p = (strlen(ArgStr[z2].str.p_str) == 1) ? strchr(FlagChars, as_toupper(*ArgStr[z2].str.p_str)) : NULL;
  936.         if (p)
  937.         {
  938.           z3 = p - FlagChars;
  939.           if (pOrder->Inv)
  940.             BAsmCode[1] &= (0xff ^ (1 << z3));
  941.           else
  942.             BAsmCode[1] |= (1 << z3);
  943.         }
  944.         else if (*ArgStr[z2].str.p_str != '#')
  945.         {
  946.           WrError(ErrNum_OnlyImmAddr);
  947.           OK = False;
  948.         }
  949.         else
  950.         {
  951.           BAsmCode[2] = EvalStrIntExpressionOffs(&ArgStr[z2], 1, Int8, &OK);
  952.           if (OK)
  953.           {
  954.             if (pOrder->Inv)
  955.               BAsmCode[1] &= BAsmCode[2];
  956.             else
  957.               BAsmCode[1] |= BAsmCode[2];
  958.           }
  959.         }
  960.       }
  961.     if (OK)
  962.     {
  963.       CodeLen = 2;
  964.       BAsmCode[0] = pOrder->Code;
  965.     }
  966.   }
  967. }
  968.  
  969. /* Bit-Befehle */
  970.  
  971. static void DecodeImm(Word Index)
  972. {
  973.   const BaseOrder *pOrder = ImmOrders + Index;
  974.  
  975.   if (!ChkArgCnt(2, 3));
  976.   else if (!ChkMinCPU(pOrder->MinCPU));
  977.   else if (*ArgStr[1].str.p_str != '#') WrError(ErrNum_OnlyImmAddr);
  978.   else
  979.   {
  980.     Boolean OK;
  981.  
  982.     BAsmCode[1] = EvalStrIntExpressionOffs(&ArgStr[1], 1, Int8, &OK);
  983.     if (OK)
  984.     {
  985.       adr_vals_t vals;
  986.  
  987.       switch (DecodeAdr(2, ArgCnt, 2, eSymbolSizeUnknown, adr_mode_mask_no_imm, &vals))
  988.       {
  989.         case e_adr_mode_dir:
  990.           BAsmCode[0] = pOrder->Code;
  991.           goto append;
  992.         case e_adr_mode_ext:
  993.           BAsmCode[0] = pOrder->Code + 0x70;
  994.           goto append;
  995.         case e_adr_mode_ind:
  996.           BAsmCode[0] = pOrder->Code + 0x60;
  997.           goto append;
  998.         append:
  999.           CodeLen = 2;
  1000.           append_adr_vals(&vals);
  1001.           break;
  1002.         default:
  1003.           return;
  1004.       }
  1005.     }
  1006.   }
  1007. }
  1008.  
  1009. static void DecodeBit(Word Code)
  1010. {
  1011.   int z2, z3;
  1012.  
  1013.   if (ChkArgCnt(2, 2)
  1014.    && ChkMinCPU(CPU6309)
  1015.    && SplitBit(&ArgStr[1], &z2) && SplitBit(&ArgStr[2], &z3))
  1016.   {
  1017.     if (!CodeCPUReg(ArgStr[1].str.p_str, BAsmCode + 2)) WrError(ErrNum_InvRegName);
  1018.     else if ((BAsmCode[2] < 8) || (BAsmCode[2] > 11)) WrError(ErrNum_InvRegName);
  1019.     else
  1020.     {
  1021.       adr_vals_t vals;
  1022.  
  1023.       if (DecodeAdr(2, 2, 3, eSymbolSizeUnknown, adr_mode_mask_dir, &vals) != e_adr_mode_none)
  1024.       {
  1025.         BAsmCode[2] -= 7;
  1026.         if (BAsmCode[2] == 3)
  1027.           BAsmCode[2] = 0;
  1028.         BAsmCode[0] = 0x11;
  1029.         BAsmCode[1] = 0x30 + Code;
  1030.         BAsmCode[2] = (BAsmCode[2] << 6) + (z3 << 3) + z2;
  1031.         BAsmCode[3] = vals.vals[0];
  1032.         CodeLen = 4;
  1033.       }
  1034.     }
  1035.   }
  1036. }
  1037.  
  1038. /* Register-Register-Operationen */
  1039.  
  1040. void DecodeTFR_TFM_EXG_6809(Word code, Boolean allow_inc_dec, reg_decoder_6809_t reg_decoder, Boolean reverse)
  1041. {
  1042.   if (ChkArgCnt(2, 2))
  1043.   {
  1044.     int Inc1, Inc2;
  1045.  
  1046.     SplitIncDec(ArgStr[1].str.p_str, &Inc1);
  1047.     SplitIncDec(ArgStr[2].str.p_str, &Inc2);
  1048.     if ((Inc1 != 0) || (Inc2 != 0))
  1049.     {
  1050.       if (!allow_inc_dec) WrError(ErrNum_InvAddrMode);
  1051.       else if (!reg_decoder(ArgStr[1].str.p_str, BAsmCode + 3) || (BAsmCode[3] > 4)) WrStrErrorPos(ErrNum_InvRegName, &ArgStr[1]);
  1052.       else if (!reg_decoder(ArgStr[2].str.p_str, BAsmCode + 2) || (BAsmCode[2] > 4)) WrStrErrorPos(ErrNum_InvRegName, &ArgStr[2]);
  1053.       else
  1054.       {
  1055.         BAsmCode[0] = 0x11;
  1056.         BAsmCode[1] = 0;
  1057.         if (reverse)
  1058.           BAsmCode[2] = (BAsmCode[2] << 4) | (BAsmCode[3] & 0x0f);
  1059.         else
  1060.           BAsmCode[2] |= BAsmCode[3] << 4;
  1061.         if ((Inc1 == 1) && (Inc2 == 1))
  1062.           BAsmCode[1] = 0x38;
  1063.         else if ((Inc1 == -1) && (Inc2 == -1))
  1064.           BAsmCode[1] = 0x39;
  1065.         else if ((Inc1 ==  1) && (Inc2 ==  0))
  1066.           BAsmCode[1] = 0x3a;
  1067.         else if ((Inc1 ==  0) && (Inc2 ==  1))
  1068.           BAsmCode[1] = 0x3b;
  1069.         if (BAsmCode[1] == 0) WrError(ErrNum_InvAddrMode);
  1070.         else
  1071.           CodeLen = 3;
  1072.       }
  1073.     }
  1074.     else if (Memo("TFM")) WrError(ErrNum_InvAddrMode);
  1075.     else if (!reg_decoder(ArgStr[1].str.p_str, BAsmCode + 2)) WrError(ErrNum_InvRegName);
  1076.     else if (!reg_decoder(ArgStr[2].str.p_str, BAsmCode + 1)) WrError(ErrNum_InvRegName);
  1077.     else if ((BAsmCode[1] != 13) && (BAsmCode[2] != 13) /* Z Register compatible to all other registers */
  1078.           && (((BAsmCode[1] ^ BAsmCode[2]) & 0x08) != 0)) WrError(ErrNum_ConfOpSizes);
  1079.     else
  1080.     {
  1081.       CodeLen = 2;
  1082.       BAsmCode[0] = code;
  1083.       if (reverse)
  1084.         BAsmCode[1] = (BAsmCode[1] << 4) | (BAsmCode[2] & 0x0f);
  1085.       else
  1086.         BAsmCode[1] |= BAsmCode[2] << 4;
  1087.     }
  1088.   }
  1089. }
  1090.  
  1091. static void DecodeTFR_TFM(Word code)
  1092. {
  1093.   DecodeTFR_TFM_EXG_6809(code, MomCPU == CPU6309, CodeCPUReg, False);
  1094. }
  1095.  
  1096. static void DecodeEXG(Word code)
  1097. {
  1098.   DecodeTFR_TFM_EXG_6809(code, False, CodeCPUReg, False);
  1099. }
  1100.  
  1101. static void DecodeALU2(Word Code)
  1102. {
  1103.   if (!ChkArgCnt(2, 2));
  1104.   else if (!CodeCPUReg(ArgStr[1].str.p_str, &BAsmCode[3])) WrError(ErrNum_InvRegName);
  1105.   else if (!CodeCPUReg(ArgStr[2].str.p_str, &BAsmCode[2])) WrError(ErrNum_InvRegName);
  1106.   else if ((BAsmCode[2] != 13) && (BAsmCode[3] != 13) /* Z Register compatible to all other registers */
  1107.         && (((BAsmCode[2] ^ BAsmCode[3]) & 0x08) != 0)) WrError(ErrNum_ConfOpSizes);
  1108.   else
  1109.   {
  1110.     CodeLen = 3;
  1111.     BAsmCode[0] = 0x10;
  1112.     BAsmCode[1] = 0x30 + Code;
  1113.     BAsmCode[2] += BAsmCode[3] << 4;
  1114.   }
  1115. }
  1116.  
  1117. /* Berechnung effektiver Adressen */
  1118.  
  1119. static void DecodeLEA(Word Index)
  1120. {
  1121.   const BaseOrder *pOrder = LEAOrders + Index;
  1122.  
  1123.   if (ChkArgCnt(1, 2))
  1124.   {
  1125.     adr_vals_t vals;
  1126.  
  1127.     if (DecodeAdr(1, ArgCnt, 1, eSymbolSizeUnknown, adr_mode_mask_ind, &vals) != e_adr_mode_none)
  1128.     {
  1129.       BAsmCode[CodeLen++] = pOrder->Code;
  1130.       append_adr_vals(&vals);
  1131.     }
  1132.   }
  1133. }
  1134.  
  1135. /* Push/Pull */
  1136.  
  1137. void DecodeStack_6809(Word code)
  1138. {
  1139.   Boolean OK = True, Extent = False;
  1140.   int z2, z3;
  1141.   Boolean has_w = !!Hi(code);
  1142.  
  1143.   BAsmCode[1] = 0;
  1144.  
  1145.   /* S oder U einsetzen, entsprechend Opcode */
  1146.  
  1147.   *StackRegNames[StackRegCnt - 2] = OpPart.str.p_str[strlen(OpPart.str.p_str) - 1] ^ ('S' ^ 'U');
  1148.   for (z2 = 1; z2 <= ArgCnt; z2++)
  1149.     if (OK)
  1150.     {
  1151.       if (!as_strcasecmp(ArgStr[z2].str.p_str, "W"))
  1152.       {
  1153.         if (!has_w)
  1154.           OK = False;
  1155.         else if (ArgCnt != 1)
  1156.         {
  1157.           WrError(ErrNum_InAccReg);
  1158.           OK = False;
  1159.         }
  1160.         else
  1161.           Extent = True;
  1162.       }
  1163.       else
  1164.       {
  1165.         for (z3 = 0; z3 < StackRegCnt; z3++)
  1166.           if (!as_strcasecmp(ArgStr[z2].str.p_str, StackRegNames[z3]))
  1167.           {
  1168.             BAsmCode[1] |= StackRegMasks[z3];
  1169.             break;
  1170.           }
  1171.         if (z3 >= StackRegCnt)
  1172.         {
  1173.           if (!as_strcasecmp(ArgStr[z2].str.p_str, "ALL"))
  1174.             BAsmCode[1] = 0xff;
  1175.           else if (*ArgStr[z2].str.p_str != '#') OK = False;
  1176.           else
  1177.           {
  1178.             BAsmCode[2] = EvalStrIntExpressionOffs(&ArgStr[z2], 1, Int8, &OK);
  1179.             if (OK)
  1180.               BAsmCode[1] |= BAsmCode[2];
  1181.           }
  1182.         }
  1183.       }
  1184.     }
  1185.   if (OK)
  1186.   {
  1187.     if (Extent)
  1188.     {
  1189.       CodeLen = 2;
  1190.       BAsmCode[0] = 0x10;
  1191.       BAsmCode[1] = Lo(code) + 4;
  1192.     }
  1193.     else
  1194.     {
  1195.       CodeLen = 2;
  1196.       BAsmCode[0] = code;
  1197.     }
  1198.   }
  1199.   else
  1200.     WrStrErrorPos(ErrNum_InvRegName, &ArgStr[z2 - 1]);
  1201. }
  1202.  
  1203. static void DecodeBITMD_LDMD(Word Code)
  1204. {
  1205.   if (!ChkArgCnt(1, 1));
  1206.   else if (!ChkMinCPU(CPU6309));
  1207.   else if (*ArgStr[1].str.p_str != '#') WrError(ErrNum_OnlyImmAddr);
  1208.   else
  1209.   {
  1210.     Boolean OK;
  1211.  
  1212.     BAsmCode[2] = EvalStrIntExpressionOffs(&ArgStr[1], 1,Int8, &OK);
  1213.     if (OK)
  1214.     {
  1215.       BAsmCode[0] = 0x11;
  1216.       BAsmCode[1] = Code;
  1217.       CodeLen = 3;
  1218.     }
  1219.   }
  1220. }
  1221.  
  1222. /*-------------------------------------------------------------------------*/
  1223. /* Erzeugung/Aufloesung Codetabellen */
  1224.  
  1225. static void AddFixed(const char *NName, Word NCode, CPUVar NCPU)
  1226. {
  1227.   order_array_rsv_end(FixedOrders, BaseOrder);
  1228.   FixedOrders[InstrZ].Code = NCode;
  1229.   FixedOrders[InstrZ].MinCPU = NCPU;
  1230.   AddInstTable(InstTable, NName, InstrZ++, DecodeFixed);
  1231. }
  1232.  
  1233. static void AddRel(const char *NName, Word NCode8, Word NCode16)
  1234. {
  1235.   char LongName[30];
  1236.  
  1237.   order_array_rsv_end(RelOrders, RelOrder);
  1238.   RelOrders[InstrZ].Code8 = NCode8;
  1239.   RelOrders[InstrZ].Code16 = NCode16;
  1240.   AddInstTable(InstTable, NName, InstrZ, DecodeRel);
  1241.   as_snprintf(LongName, sizeof(LongName), "L%s", NName);
  1242.   AddInstTable(InstTable, LongName, InstrZ | 0x8000, DecodeRel);
  1243.   InstrZ++;
  1244. }
  1245.  
  1246. static void AddALU(const char *NName, Word NCode, tSymbolSize NSize, Boolean NImm, CPUVar NCPU)
  1247. {
  1248.   order_array_rsv_end(ALUOrders, ALUOrder);
  1249.   ALUOrders[InstrZ].Code = NCode;
  1250.   ALUOrders[InstrZ].OpSize = NSize;
  1251.   ALUOrders[InstrZ].MayImm = NImm;
  1252.   ALUOrders[InstrZ].MinCPU = NCPU;
  1253.   AddInstTable(InstTable, NName, InstrZ++, DecodeALU);
  1254. }
  1255.  
  1256. static void AddALU2(const char *NName)
  1257. {
  1258.   char RName[30];
  1259.  
  1260.   AddInstTable(InstTable, NName, InstrZ, DecodeALU2);
  1261.   as_snprintf(RName, sizeof(RName), "%sR", NName);
  1262.   AddInstTable(InstTable, RName, InstrZ, DecodeALU2);
  1263.   InstrZ++;
  1264. }
  1265.  
  1266. static void AddRMW(const char *NName, Word NCode, CPUVar NCPU)
  1267. {
  1268.   order_array_rsv_end(RMWOrders, BaseOrder);
  1269.   RMWOrders[InstrZ].Code = NCode;
  1270.   RMWOrders[InstrZ].MinCPU = NCPU;
  1271.   AddInstTable(InstTable, NName, InstrZ++, DecodeRMW);
  1272. }
  1273.  
  1274. static void AddFlag(const char *NName, Word NCode, Boolean NInv, CPUVar NCPU)
  1275. {
  1276.   order_array_rsv_end(FlagOrders, FlagOrder);
  1277.   FlagOrders[InstrZ].Code = NCode;
  1278.   FlagOrders[InstrZ].Inv = NInv;
  1279.   FlagOrders[InstrZ].MinCPU = NCPU;
  1280.   AddInstTable(InstTable, NName, InstrZ++, DecodeFlag);
  1281. }
  1282.  
  1283. static void AddLEA(const char *NName, Word NCode, CPUVar NCPU)
  1284. {
  1285.   order_array_rsv_end(LEAOrders, BaseOrder);
  1286.   LEAOrders[InstrZ].Code = NCode;
  1287.   LEAOrders[InstrZ].MinCPU = NCPU;
  1288.   AddInstTable(InstTable, NName, InstrZ++, DecodeLEA);
  1289. }
  1290.  
  1291. static void AddImm(const char *NName, Word NCode, CPUVar NCPU)
  1292. {
  1293.   order_array_rsv_end(ImmOrders, BaseOrder);
  1294.   ImmOrders[InstrZ].Code = NCode;
  1295.   ImmOrders[InstrZ].MinCPU = NCPU;
  1296.   AddInstTable(InstTable, NName, InstrZ++, DecodeImm);
  1297. }
  1298.  
  1299. static void InitFields(void)
  1300. {
  1301.   InstTable = CreateInstTable(307);
  1302.   SetDynamicInstTable(InstTable);
  1303.  
  1304.   add_null_pseudo(InstTable);
  1305.  
  1306.   AddInstTable(InstTable, "SWI", 0, DecodeSWI);
  1307.   AddInstTable(InstTable, "LDQ", 0, DecodeLDQ);
  1308.   AddInstTable(InstTable, "TFR", 0x1f, DecodeTFR_TFM);
  1309.   AddInstTable(InstTable, "TFM", 0x1138, DecodeTFR_TFM);
  1310.   AddInstTable(InstTable, "EXG", 0x1e, DecodeEXG);
  1311.   AddInstTable(InstTable, "BITMD", 0x3c, DecodeBITMD_LDMD);
  1312.   AddInstTable(InstTable, "LDMD", 0x3d, DecodeBITMD_LDMD);
  1313.  
  1314.   InstrZ = 0;
  1315.   AddFixed("NOP"  , 0x0012, CPU6809); AddFixed("SYNC" , 0x0013, CPU6809);
  1316.   AddFixed("DAA"  , 0x0019, CPU6809); AddFixed("SEX"  , 0x001d, CPU6809);
  1317.   AddFixed("RTS"  , 0x0039, CPU6809); AddFixed("ABX"  , 0x003a, CPU6809);
  1318.   AddFixed("RTI"  , 0x003b, CPU6809); AddFixed("MUL"  , 0x003d, CPU6809);
  1319.   AddFixed("SWI2" , 0x103f, CPU6809); AddFixed("SWI3" , 0x113f, CPU6809);
  1320.   AddFixed("NEGA" , 0x0040, CPU6809); AddFixed("COMA" , 0x0043, CPU6809);
  1321.   AddFixed("LSRA" , 0x0044, CPU6809); AddFixed("RORA" , 0x0046, CPU6809);
  1322.   AddFixed("ASRA" , 0x0047, CPU6809); AddFixed("ASLA" , 0x0048, CPU6809);
  1323.   AddFixed("LSLA" , 0x0048, CPU6809); AddFixed("ROLA" , 0x0049, CPU6809);
  1324.   AddFixed("DECA" , 0x004a, CPU6809); AddFixed("INCA" , 0x004c, CPU6809);
  1325.   AddFixed("TSTA" , 0x004d, CPU6809); AddFixed("CLRA" , 0x004f, CPU6809);
  1326.   AddFixed("NEGB" , 0x0050, CPU6809); AddFixed("COMB" , 0x0053, CPU6809);
  1327.   AddFixed("LSRB" , 0x0054, CPU6809); AddFixed("RORB" , 0x0056, CPU6809);
  1328.   AddFixed("ASRB" , 0x0057, CPU6809); AddFixed("ASLB" , 0x0058, CPU6809);
  1329.   AddFixed("LSLB" , 0x0058, CPU6809); AddFixed("ROLB" , 0x0059, CPU6809);
  1330.   AddFixed("DECB" , 0x005a, CPU6809); AddFixed("INCB" , 0x005c, CPU6809);
  1331.   AddFixed("TSTB" , 0x005d, CPU6809); AddFixed("CLRB" , 0x005f, CPU6809);
  1332.   AddFixed("PSHSW", 0x1038, CPU6309); AddFixed("PULSW", 0x1039, CPU6309);
  1333.   AddFixed("PSHUW", 0x103a, CPU6309); AddFixed("PULUW", 0x103b, CPU6309);
  1334.   AddFixed("SEXW" , 0x0014, CPU6309); AddFixed("NEGD" , 0x1040, CPU6309);
  1335.   AddFixed("COMD" , 0x1043, CPU6309); AddFixed("LSRD" , 0x1044, CPU6309);
  1336.   AddFixed("RORD" , 0x1046, CPU6309); AddFixed("ASRD" , 0x1047, CPU6309);
  1337.   AddFixed("ASLD" , 0x1048, CPU6309); AddFixed("LSLD" , 0x1048, CPU6309);
  1338.   AddFixed("ROLD" , 0x1049, CPU6309); AddFixed("DECD" , 0x104a, CPU6309);
  1339.   AddFixed("INCD" , 0x104c, CPU6309); AddFixed("TSTD" , 0x104d, CPU6309);
  1340.   AddFixed("CLRD" , 0x104f, CPU6309); AddFixed("COMW" , 0x1053, CPU6309);
  1341.   AddFixed("LSRW" , 0x1054, CPU6309); AddFixed("RORW" , 0x1056, CPU6309);
  1342.   AddFixed("ROLW" , 0x1059, CPU6309); AddFixed("DECW" , 0x105a, CPU6309);
  1343.   AddFixed("INCW" , 0x105c, CPU6309); AddFixed("TSTW" , 0x105d, CPU6309);
  1344.   AddFixed("CLRW" , 0x105f, CPU6309); AddFixed("COME" , 0x1143, CPU6309);
  1345.   AddFixed("DECE" , 0x114a, CPU6309); AddFixed("INCE" , 0x114c, CPU6309);
  1346.   AddFixed("TSTE" , 0x114d, CPU6309); AddFixed("CLRE" , 0x114f, CPU6309);
  1347.   AddFixed("COMF" , 0x1153, CPU6309); AddFixed("DECF" , 0x115a, CPU6309);
  1348.   AddFixed("INCF" , 0x115c, CPU6309); AddFixed("TSTF" , 0x115d, CPU6309);
  1349.   AddFixed("CLRF" , 0x115f, CPU6309); AddFixed("CLRS" , 0x1fd4, CPU6309);
  1350.   AddFixed("CLRV" , 0x1fd7, CPU6309); AddFixed("CLRX" , 0x1fd1, CPU6309);
  1351.   AddFixed("CLRY" , 0x1fd2, CPU6309);
  1352.  
  1353.   InstrZ = 0;
  1354.   AddRel("BRA", 0x0020, 0x0016); AddRel("BRN", 0x0021, 0x1021);
  1355.   AddRel("BHI", 0x0022, 0x1022); AddRel("BLS", 0x0023, 0x1023);
  1356.   AddRel("BHS", 0x0024, 0x1024); AddRel("BCC", 0x0024, 0x1024);
  1357.   AddRel("BLO", 0x0025, 0x1025); AddRel("BCS", 0x0025, 0x1025);
  1358.   AddRel("BNE", 0x0026, 0x1026); AddRel("BEQ", 0x0027, 0x1027);
  1359.   AddRel("BVC", 0x0028, 0x1028); AddRel("BVS", 0x0029, 0x1029);
  1360.   AddRel("BPL", 0x002a, 0x102a); AddRel("BMI", 0x002b, 0x102b);
  1361.   AddRel("BGE", 0x002c, 0x102c); AddRel("BLT", 0x002d, 0x102d);
  1362.   AddRel("BGT", 0x002e, 0x102e); AddRel("BLE", 0x002f, 0x102f);
  1363.   AddRel("BSR", 0x008d, 0x0017);
  1364.  
  1365.   InstrZ = 0;
  1366.   AddALU("LDA" , 0x0086, eSymbolSize8Bit , True , CPU6809);
  1367.   AddALU("STA" , 0x0087, eSymbolSize8Bit , False, CPU6809);
  1368.   AddALU("CMPA", 0x0081, eSymbolSize8Bit , True , CPU6809);
  1369.   AddALU("ADDA", 0x008b, eSymbolSize8Bit , True , CPU6809);
  1370.   AddALU("ADCA", 0x0089, eSymbolSize8Bit , True , CPU6809);
  1371.   AddALU("SUBA", 0x0080, eSymbolSize8Bit , True , CPU6809);
  1372.   AddALU("SBCA", 0x0082, eSymbolSize8Bit , True , CPU6809);
  1373.   AddALU("ANDA", 0x0084, eSymbolSize8Bit , True , CPU6809);
  1374.   AddALU("ORA" , 0x008a, eSymbolSize8Bit , True , CPU6809);
  1375.   AddALU("EORA", 0x0088, eSymbolSize8Bit , True , CPU6809);
  1376.   AddALU("BITA", 0x0085, eSymbolSize8Bit , True , CPU6809);
  1377.  
  1378.   AddALU("LDB" , 0x00c6, eSymbolSize8Bit , True , CPU6809);
  1379.   AddALU("STB" , 0x00c7, eSymbolSize8Bit , False, CPU6809);
  1380.   AddALU("CMPB", 0x00c1, eSymbolSize8Bit , True , CPU6809);
  1381.   AddALU("ADDB", 0x00cb, eSymbolSize8Bit , True , CPU6809);
  1382.   AddALU("ADCB", 0x00c9, eSymbolSize8Bit , True , CPU6809);
  1383.   AddALU("SUBB", 0x00c0, eSymbolSize8Bit , True , CPU6809);
  1384.   AddALU("SBCB", 0x00c2, eSymbolSize8Bit , True , CPU6809);
  1385.   AddALU("ANDB", 0x00c4, eSymbolSize8Bit , True , CPU6809);
  1386.   AddALU("ORB" , 0x00ca, eSymbolSize8Bit , True , CPU6809);
  1387.   AddALU("EORB", 0x00c8, eSymbolSize8Bit , True , CPU6809);
  1388.   AddALU("BITB", 0x00c5, eSymbolSize8Bit , True , CPU6809);
  1389.  
  1390.   AddALU("LDD" , 0x00cc, eSymbolSize16Bit, True , CPU6809);
  1391.   AddALU("STD" , 0x00cd, eSymbolSize16Bit, False, CPU6809);
  1392.   AddALU("CMPD", 0x1083, eSymbolSize16Bit, True , CPU6809);
  1393.   AddALU("ADDD", 0x00c3, eSymbolSize16Bit, True , CPU6809);
  1394.   AddALU("ADCD", 0x1089, eSymbolSize16Bit, True , CPU6309);
  1395.   AddALU("SUBD", 0x0083, eSymbolSize16Bit, True , CPU6809);
  1396.   AddALU("SBCD", 0x1082, eSymbolSize16Bit, True , CPU6309);
  1397.   AddALU("MULD", 0x118f, eSymbolSize16Bit, True , CPU6309);
  1398.   AddALU("DIVD", 0x118d, eSymbolSize8Bit , True , CPU6309);
  1399.   AddALU("ANDD", 0x1084, eSymbolSize16Bit, True , CPU6309);
  1400.   AddALU("ORD" , 0x108a, eSymbolSize16Bit, True , CPU6309);
  1401.   AddALU("EORD", 0x1088, eSymbolSize16Bit, True , CPU6309);
  1402.   AddALU("BITD", 0x1085, eSymbolSize16Bit, True , CPU6309);
  1403.  
  1404.   AddALU("LDW" , 0x1086, eSymbolSize16Bit, True , CPU6309);
  1405.   AddALU("STW" , 0x1087, eSymbolSize16Bit, False, CPU6309);
  1406.   AddALU("CMPW", 0x1081, eSymbolSize16Bit, True , CPU6309);
  1407.   AddALU("ADDW", 0x108b, eSymbolSize16Bit, True , CPU6309);
  1408.   AddALU("SUBW", 0x1080, eSymbolSize16Bit, True , CPU6309);
  1409.  
  1410.   AddALU("STQ" , 0x10cd, eSymbolSize16Bit, True , CPU6309);
  1411.   AddALU("DIVQ", 0x118e, eSymbolSize16Bit, True , CPU6309);
  1412.  
  1413.   AddALU("LDE" , 0x1186, eSymbolSize8Bit , True , CPU6309);
  1414.   AddALU("STE" , 0x1187, eSymbolSize8Bit , False, CPU6309);
  1415.   AddALU("CMPE", 0x1181, eSymbolSize8Bit , True , CPU6309);
  1416.   AddALU("ADDE", 0x118b, eSymbolSize8Bit , True , CPU6309);
  1417.   AddALU("SUBE", 0x1180, eSymbolSize8Bit , True , CPU6309);
  1418.  
  1419.   AddALU("LDF" , 0x11c6, eSymbolSize8Bit , True , CPU6309);
  1420.   AddALU("STF" , 0x11c7, eSymbolSize8Bit , False, CPU6309);
  1421.   AddALU("CMPF", 0x11c1, eSymbolSize8Bit , True , CPU6309);
  1422.   AddALU("ADDF", 0x11cb, eSymbolSize8Bit , True , CPU6309);
  1423.   AddALU("SUBF", 0x11c0, eSymbolSize8Bit , True , CPU6309);
  1424.  
  1425.   AddALU("LDX" , 0x008e, eSymbolSize16Bit, True , CPU6809);
  1426.   AddALU("STX" , 0x008f, eSymbolSize16Bit, False, CPU6809);
  1427.   AddALU("CMPX", 0x008c, eSymbolSize16Bit, True , CPU6809);
  1428.  
  1429.   AddALU("LDY" , 0x108e, eSymbolSize16Bit, True , CPU6809);
  1430.   AddALU("STY" , 0x108f, eSymbolSize16Bit, False, CPU6809);
  1431.   AddALU("CMPY", 0x108c, eSymbolSize16Bit, True , CPU6809);
  1432.  
  1433.   AddALU("LDU" , 0x00ce, eSymbolSize16Bit, True , CPU6809);
  1434.   AddALU("STU" , 0x00cf, eSymbolSize16Bit, False, CPU6809);
  1435.   AddALU("CMPU", 0x1183, eSymbolSize16Bit, True , CPU6809);
  1436.  
  1437.   AddALU("LDS" , 0x10ce, eSymbolSize16Bit, True , CPU6809);
  1438.   AddALU("STS" , 0x10cf, eSymbolSize16Bit, False, CPU6809);
  1439.   AddALU("CMPS", 0x118c, eSymbolSize16Bit, True , CPU6809);
  1440.  
  1441.   AddALU("JSR" , 0x008d, eSymbolSize16Bit, False, CPU6809);
  1442.  
  1443.   InstrZ = 0;
  1444.   AddALU2("ADD"); AddALU2("ADC");
  1445.   AddALU2("SUB"); AddALU2("SBC");
  1446.   AddALU2("AND"); AddALU2("OR" );
  1447.   AddALU2("EOR"); AddALU2("CMP");
  1448.  
  1449.   InstrZ = 0;
  1450.   AddRMW("NEG", 0x00, CPU6809);
  1451.   AddRMW("COM", 0x03, CPU6809);
  1452.   AddRMW("LSR", 0x04, CPU6809);
  1453.   AddRMW("ROR", 0x06, CPU6809);
  1454.   AddRMW("ASR", 0x07, CPU6809);
  1455.   AddRMW("ASL", 0x08, CPU6809);
  1456.   AddRMW("LSL", 0x08, CPU6809);
  1457.   AddRMW("ROL", 0x09, CPU6809);
  1458.   AddRMW("DEC", 0x0a, CPU6809);
  1459.   AddRMW("INC", 0x0c, CPU6809);
  1460.   AddRMW("TST", 0x0d, CPU6809);
  1461.   AddRMW("JMP", 0x0e, CPU6809);
  1462.   AddRMW("CLR", 0x0f, CPU6809);
  1463.  
  1464.   InstrZ = 0;
  1465.   AddFlag("CWAI" , 0x3c, True , CPU6809);
  1466.   AddFlag("ANDCC", 0x1c, True , CPU6809);
  1467.   AddFlag("ORCC" , 0x1a, False, CPU6809);
  1468.  
  1469.   InstrZ = 0;
  1470.   AddLEA("LEAX", 0x30, CPU6809);
  1471.   AddLEA("LEAY", 0x31, CPU6809);
  1472.   AddLEA("LEAS", 0x32, CPU6809);
  1473.   AddLEA("LEAU", 0x33, CPU6809);
  1474.  
  1475.   InstrZ = 0;
  1476.   AddImm("AIM", 0x02, CPU6309);
  1477.   AddImm("OIM", 0x01, CPU6309);
  1478.   AddImm("EIM", 0x05, CPU6309);
  1479.   AddImm("TIM", 0x0b, CPU6309);
  1480.  
  1481.   AddInstTable(InstTable, "PSHS", 0x34 | ((MomCPU == CPU6309) ? 0x100 : 0), DecodeStack_6809);
  1482.   AddInstTable(InstTable, "PULS", 0x35 | ((MomCPU == CPU6309) ? 0x100 : 0), DecodeStack_6809);
  1483.   AddInstTable(InstTable, "PSHU", 0x36 | ((MomCPU == CPU6309) ? 0x100 : 0), DecodeStack_6809);
  1484.   AddInstTable(InstTable, "PULU", 0x37 | ((MomCPU == CPU6309) ? 0x100 : 0), DecodeStack_6809);
  1485.  
  1486.   InstrZ = 0;
  1487.   AddInstTable(InstTable, "BAND" , InstrZ++, DecodeBit);
  1488.   AddInstTable(InstTable, "BIAND", InstrZ++, DecodeBit);
  1489.   AddInstTable(InstTable, "BOR"  , InstrZ++, DecodeBit);
  1490.   AddInstTable(InstTable, "BIOR" , InstrZ++, DecodeBit);
  1491.   AddInstTable(InstTable, "BEOR" , InstrZ++, DecodeBit);
  1492.   AddInstTable(InstTable, "BIEOR", InstrZ++, DecodeBit);
  1493.   AddInstTable(InstTable, "LDBT" , InstrZ++, DecodeBit);
  1494.   AddInstTable(InstTable, "STBT" , InstrZ++, DecodeBit);
  1495.  
  1496.   add_moto8_pseudo(InstTable, e_moto_pseudo_flags_be);
  1497.   AddMoto16Pseudo(InstTable, e_moto_pseudo_flags_be);
  1498.   AddInstTable(InstTable, "DB", eIntPseudoFlag_BigEndian | eIntPseudoFlag_AllowInt | eIntPseudoFlag_AllowString | eIntPseudoFlag_MotoRep, DecodeIntelDB);
  1499.   AddInstTable(InstTable, "DW", eIntPseudoFlag_BigEndian | eIntPseudoFlag_AllowInt | eIntPseudoFlag_AllowString | eIntPseudoFlag_MotoRep, DecodeIntelDW);
  1500. }
  1501.  
  1502. static void DeinitFields(void)
  1503. {
  1504.   DestroyInstTable(InstTable);
  1505.   order_array_free(FixedOrders);
  1506.   order_array_free(RelOrders);
  1507.   order_array_free(ALUOrders);
  1508.   order_array_free(RMWOrders);
  1509.   order_array_free(FlagOrders);
  1510.   order_array_free(LEAOrders);
  1511.   order_array_free(ImmOrders);
  1512. }
  1513.  
  1514. /*-------------------------------------------------------------------------*/
  1515.  
  1516. static Boolean DecodeAttrPart_6809(void)
  1517. {
  1518.   if (strlen(AttrPart.str.p_str) > 1)
  1519.   {
  1520.     WrStrErrorPos(ErrNum_UndefAttr, &AttrPart);
  1521.     return False;
  1522.   }
  1523.  
  1524.   /* deduce operand size No size is zero-length string -> '\0' */
  1525.  
  1526.   return DecodeMoto16AttrSize(*AttrPart.str.p_str, &AttrPartOpSize[0], False);
  1527. }
  1528.  
  1529. static void MakeCode_6809(void)
  1530. {
  1531.   if (AttrPartOpSize[0] == eSymbolSizeUnknown)
  1532.     AttrPartOpSize[0] = eSymbolSize8Bit;
  1533.  
  1534.   if (!LookupInstTable(InstTable, OpPart.str.p_str))
  1535.     WrStrErrorPos(ErrNum_UnknownInstruction, &OpPart);
  1536. }
  1537.  
  1538. static void InitCode_6809(void)
  1539. {
  1540.   DPRValue = 0;
  1541.   target_used = False;
  1542. }
  1543.  
  1544. static Boolean IsDef_6809(void)
  1545. {
  1546.   return False;
  1547. }
  1548.  
  1549. static void SwitchTo_6809(void)
  1550. {
  1551. #define ASSUME09Count (sizeof(ASSUME09s) / sizeof(*ASSUME09s))
  1552.   static const ASSUMERec ASSUME09s[] =
  1553.   {
  1554.     { "DPR", &DPRValue, 0, 0xff, 0x100, NULL }
  1555.   };
  1556.  
  1557.   TurnWords = False;
  1558.   SetIntConstMode(eIntConstModeMoto);
  1559.  
  1560.   PCSymbol = "*";
  1561.   HeaderID = 0x63;
  1562.   NOPCode = 0x12;
  1563.   DivideChars = ",";
  1564.   HasAttrs = True;
  1565.   AttrChars = ".";
  1566.  
  1567.   ValidSegs = (1 << SegCode);
  1568.   Grans[SegCode] = 1; ListGrans[SegCode] = 1; SegInits[SegCode] = 0;
  1569.   SegLimits[SegCode] = 0xffff;
  1570.  
  1571.   DecodeAttrPart = DecodeAttrPart_6809;
  1572.   MakeCode = MakeCode_6809;
  1573.   IsDef = IsDef_6809;
  1574.  
  1575.   SwitchFrom = DeinitFields;
  1576.   InitFields();
  1577.   AddMoto16PseudoONOFF(False);
  1578.   if (!target_used)
  1579.     SetFlag(&plain_base_mode, plain_base_mode_sym_name, def_plain_base_mode_set ? def_plain_base_mode : False);
  1580.   AddONOFF(plain_base_mode_cmd_name, &plain_base_mode, plain_base_mode_sym_name, False);
  1581.   target_used = True;
  1582.  
  1583.   pASSUMERecs = ASSUME09s;
  1584.   ASSUMERecCnt = ASSUME09Count;
  1585. }
  1586.  
  1587. static as_cmd_result_t cmd_plain_base(Boolean negate, const char *p_arg)
  1588. {
  1589.   UNUSED(p_arg);
  1590.   def_plain_base_mode = !negate;
  1591.   def_plain_base_mode_set = True;
  1592.   return e_cmd_ok;
  1593. }
  1594.  
  1595. static const as_cmd_rec_t onoff_params[] =
  1596. {
  1597.   { plain_base_mode_cmd_name, cmd_plain_base }
  1598. };
  1599.  
  1600. void code6809_init(void)
  1601. {
  1602.   CPU6809 = AddCPU("6809", SwitchTo_6809);
  1603.   CPU6309 = AddCPU("6309", SwitchTo_6809);
  1604.  
  1605.   as_cmd_register(onoff_params, as_array_size(onoff_params));
  1606.   AddInitPassProc(InitCode_6809);
  1607. }
  1608.