Subversion Repositories pentevo

Rev

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

  1. #ifndef _ASMDEF_H
  2. #define _ASMDEF_H
  3. /* asmdef.h */
  4. /*****************************************************************************/
  5. /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
  6. /*                                                                           */
  7. /* AS-Portierung                                                             */
  8. /*                                                                           */
  9. /* global benutzte Variablen und Definitionen                                */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. #include <stddef.h>
  14. #include <stdio.h>
  15.  
  16. #include "chunks.h"
  17. #include "fileformat.h"
  18. #include "dynstr.h"
  19. #include "intformat.h"
  20. #include "strcomp.h"
  21. #include "lstmacroexp.h"
  22. #include "cpulist.h"
  23. #include "tempresult.h"
  24. #include "addrspace.h"
  25. #include "chartrans.h"
  26.  
  27. typedef struct _TCrossRef
  28. {
  29.   struct _TCrossRef *Next;
  30.   Byte FileNum;
  31.   LongInt LineNum;
  32.   Integer OccNum;
  33. } TCrossRef,*PCrossRef;
  34.  
  35.  
  36. typedef struct _TPatchEntry
  37. {
  38.   struct _TPatchEntry *Next;
  39.   LargeWord Address;
  40.   char *Ref;
  41.   Word len;
  42.   LongWord RelocType;
  43. } TPatchEntry, *PPatchEntry;
  44.  
  45. typedef struct _TExportEntry
  46. {
  47.   struct _TExportEntry *Next;
  48.   char *Name;
  49.   Word len;
  50.   LongWord Flags;
  51.   LargeWord Value;
  52. } TExportEntry, *PExportEntry;
  53.  
  54. typedef enum
  55. {
  56.   DebugNone,
  57.   DebugMAP,
  58.   DebugAOUT,
  59.   DebugCOFF,
  60.   DebugELF,
  61.   DebugAtmel,
  62.   DebugNoICE
  63. } DebugType;
  64.  
  65. #define Char_NUL 0
  66. #define Char_BEL '\a'
  67. #define Char_BS '\b'
  68. #define Char_HT 9
  69. #define Char_LF '\n'
  70. #define Char_FF 12
  71. #define Char_CR 13
  72. #define Char_ESC 27
  73.  
  74. #define ListMask_FormFeed         (1 << 0)
  75. #define ListMask_SymbolList       (1 << 1)
  76. #define ListMask_MacroList        (1 << 2)
  77. #define ListMask_FunctionList     (1 << 3)
  78. #define ListMask_LineNums         (1 << 4)
  79. #define ListMask_DefineList       (1 << 5)
  80. #define ListMask_RegDefList       (1 << 6)
  81. #define ListMask_Codepages        (1 << 7)
  82. #define ListMask_StructList       (1 << 8)
  83.  
  84. extern char SrcSuffix[],IncSuffix[],PrgSuffix[],LstSuffix[],
  85.             MacSuffix[],PreSuffix[],LogSuffix[],MapSuffix[],
  86.             OBJSuffix[];
  87.  
  88. #define MomCPUName       "MOMCPU"     /* mom. Prozessortyp */
  89. #define MomCPUIdentName  "MOMCPUNAME" /* mom. Prozessortyp */
  90. #define MomFPUIdentName  "MOMFPUNAME" /* mom. Koprozessortyp */
  91. #define MomPMMUIdentName  "MOMPMMUNAME" /* mom. MMU-Typ */
  92. #define DoPaddingName    "PADDING"    /* Padding an */
  93. #define PackingName      "PACKING"    /* gepackte Ablage an */
  94. #define ListOnName       "LISTON"     /* Listing an/aus */
  95. #define RelaxedName      "RELAXED"    /* alle Zahlenschreibweisen zugelassen */
  96. #define BranchExtName    "BRANCHEXT"  /* Spruenge autom. verlaengern */
  97. #define FlagTrueName     "TRUE"       /* Flagkonstanten */
  98. #define FlagFalseName    "FALSE"
  99. #define PiName           "CONSTPI"    /* Zahl Pi */
  100. #define DateName         "DATE"       /* Datum & Zeit */
  101. #define TimeName         "TIME"
  102. #define VerName          "VERSION"    /* speichert Versionsnummer */
  103. #define CaseSensName     "CASESENSITIVE" /* zeigt Gross/Kleinunterscheidung an */
  104. #define Has64Name        "HAS64"         /* arbeitet Parser mit 64-Bit-Integers ? */
  105. #define ArchName         "ARCHITECTURE"  /* Zielarchitektur von AS */
  106. #define AttrName         "ATTRIBUTE"  /* Attributansprache in Makros */
  107. #define LabelName        "__LABEL__"  /* Labelansprache in Makros */
  108. #define ArgCName         "ARGCOUNT"   /* Argumentzahlansprache in Makros */
  109. #define AllArgName       "ALLARGS"    /* Ansprache Argumentliste in Makros */
  110. #define DefStackName     "DEFSTACK"   /* Default-Stack */
  111. #define NestMaxName      "NESTMAX"    /* max. nesting level of a macro */
  112. #define DottedStructsName "DOTTEDSTRUCTS" /* struct elements by default with . */
  113.  
  114. extern const char *EnvName;
  115.  
  116. /* This results from the tokenized representation of macro arguments
  117.    in macro bodys: (31*16) - 4 for special arguments: */
  118.  
  119. #define ArgCntMax 476
  120.  
  121. #define ChapMax 4
  122.  
  123. #define AscOfs '0'
  124.  
  125. #define MaxCodeLen_Ini 256
  126. #define MaxCodeLen_Max 65535
  127. extern LongWord MaxCodeLen;
  128.  
  129. #define DEF_NESTMAX 256
  130.  
  131. #define LOCSYMSIGHT 3       /* max. sight for nameless temporary symbols */
  132.  
  133. typedef void (*SimpProc)(
  134. #ifdef __PROTOS__
  135. void
  136. #endif
  137. );
  138.  
  139. typedef void (*DissectBitProc)(
  140. #ifdef __PROTOS__
  141. char *pDest, size_t DestSize, LargeWord Inp
  142. #endif
  143. );
  144.  
  145. typedef Boolean (*tQualifyQuoteFnc)(const char *pStart, const char *pQuotePos);
  146.  
  147. typedef Word WordField[6];          /* fuer Zahlenumwandlung */
  148. typedef struct _TTransTable
  149. {
  150.   struct _TTransTable *Next;
  151.   char *Name;
  152.   as_chartrans_table_t *p_table;
  153. } TTransTable, *PTransTable;
  154.  
  155. typedef struct _TSaveState
  156. {
  157.   struct _TSaveState *Next;
  158.   CPUVar SaveCPU;
  159.   char *pSaveCPUArgs;
  160.   as_addrspace_t SavePC;
  161.   Byte SaveListOn;
  162.   tLstMacroExp SaveLstMacroExp;
  163.   tLstMacroExpMod SaveLstMacroExpModDefault,
  164.                   SaveLstMacroExpModOverride;
  165.   PTransTable SaveTransTable;
  166.   Integer SaveEnumSegment;
  167.   LongInt SaveEnumCurrentValue, SaveEnumIncrement;
  168. } TSaveState,*PSaveState;
  169.  
  170. typedef struct _TForwardSymbol
  171. {
  172.   struct _TForwardSymbol *Next;
  173.   StringPtr Name;
  174.   LongInt DestSection;
  175.   StringPtr pErrorPos;
  176. } TForwardSymbol, *PForwardSymbol;
  177.  
  178. typedef struct _TSaveSection
  179. {
  180.   struct _TSaveSection *Next;
  181.   PForwardSymbol LocSyms, GlobSyms, ExportSyms;
  182.   LongInt Handle;
  183. } TSaveSection, *PSaveSection;
  184.  
  185. typedef struct sSavePhase
  186. {
  187.   struct sSavePhase *pNext;
  188.   LargeWord SaveValue;
  189. } tSavePhase;
  190.  
  191. typedef struct _TDefinement
  192. {
  193.   struct _TDefinement *Next;
  194.   StringPtr TransFrom, TransTo;
  195.   Byte Compiled[256];
  196. } TDefinement, *PDefinement;
  197.  
  198. typedef struct _ASSUMERec
  199. {
  200.   const char *Name;
  201.   LongInt *Dest;
  202.   LongInt Min,Max;
  203.   LongInt NothingVal;
  204.   void (*pPostProc)(void);
  205. } ASSUMERec;
  206.  
  207. extern StringPtr SourceFile;
  208.  
  209. extern StringPtr CursUp;
  210.  
  211. extern LargeWord *PCs;
  212. extern Boolean RelSegs;
  213. extern LargeWord StartAdr;
  214. extern LargeWord AfterBSRAddr;
  215. extern Boolean StartAdrPresent;
  216. extern LargeWord *Phases;
  217. extern Word Grans[SegCountPlusStruct];
  218. extern Word ListGrans[SegCountPlusStruct];
  219. extern ChunkList SegChunks[SegCountPlusStruct];
  220. extern as_addrspace_t ActPC;
  221. extern Boolean PCsUsed[SegCountPlusStruct];
  222. extern LargeWord *SegInits;
  223. extern LargeWord *SegLimits;
  224. extern LongInt ValidSegs;
  225. extern Boolean ENDOccured;
  226. extern Boolean Retracted;
  227. extern Boolean ListToStdout,ListToNull;
  228.  
  229. extern unsigned ASSUMERecCnt;
  230. extern const ASSUMERec *pASSUMERecs;
  231. extern void (*pASSUMEOverride)(void);
  232.  
  233. extern Integer PassNo;
  234. extern Integer JmpErrors;
  235. extern Boolean ThrowErrors;
  236. extern Boolean Repass;
  237. extern Byte MaxSymPass;
  238. extern Byte ShareMode;
  239. extern DebugType DebugMode;
  240. extern Word NoICEMask;
  241. extern Byte ListMode;
  242. extern Byte ListOn;
  243. extern Integer MaxIncludeLevel;
  244. extern Boolean MakeUseList;
  245. extern Boolean MakeCrossList;
  246. extern Boolean MakeSectionList;
  247. extern Boolean MakeIncludeList;
  248. extern Boolean DefRelaxedMode;
  249. extern Word ListMask;
  250. extern ShortInt ExtendErrors;
  251. extern Integer EnumSegment;
  252. extern LongInt EnumIncrement, EnumCurrentValue;
  253. extern LongWord MaxErrors;
  254.  
  255. extern LongInt MomSectionHandle;
  256. extern PSaveSection SectionStack;
  257. extern tSavePhase *pPhaseStacks[SegCount];
  258.  
  259. extern tSymbolSize AttrPartOpSize[2];
  260. extern LongInt CodeLen;
  261. extern Byte *BAsmCode;
  262. extern Word *WAsmCode;
  263. extern LongWord *DAsmCode;
  264.  
  265. extern Boolean DontPrint;
  266. extern Word ActListGran;
  267.  
  268. extern Boolean NumericErrors;
  269. extern Boolean CodeOutput;
  270. extern Boolean MacProOutput;
  271. extern Boolean MacroOutput;
  272. extern Boolean HardRanges;
  273. extern const char *DivideChars;
  274. extern Boolean HasAttrs;
  275. extern const char *AttrChars;
  276. extern Boolean MsgIfRepass;
  277. extern Integer PassNoForMessage;
  278. extern Boolean CaseSensitive;
  279. extern LongInt NestMax;
  280. extern Boolean GNUErrors;
  281.  
  282. extern FILE *PrgFile;
  283.  
  284. extern StringPtr ErrorPath,ErrorName;
  285. extern StringPtr OutName;
  286. extern Integer CurrIncludeLevel;
  287. extern StringPtr CurrFileName;
  288. extern LongInt CurrLine;
  289. extern LongInt LineSum;
  290. extern LongInt MacLineSum;
  291.  
  292. extern LongInt NOPCode;
  293. extern Boolean TurnWords;
  294. extern Byte HeaderID;
  295. extern const char *PCSymbol;
  296. extern tIntConstMode IntConstMode;
  297. extern Boolean IntConstModeIBMNoTerm;
  298. extern Boolean (*SetIsOccupiedFnc)(void),
  299.                (*SaveIsOccupiedFnc)(void),
  300.                (*RestoreIsOccupiedFnc)(void);
  301. extern Boolean SwitchIsOccupied, PageIsOccupied, ShiftIsOccupied;
  302. extern Boolean multi_char_le;
  303. extern Boolean (*DecodeAttrPart)(void);
  304. extern void (*MakeCode)(void);
  305. extern Boolean (*ChkPC)(LargeWord Addr);
  306. extern Boolean (*IsDef)(void);
  307. extern void (*SwitchFrom)(void);
  308. extern void (*InternSymbol)(char *Asc, TempResult *Erg);
  309. extern DissectBitProc DissectBit;
  310. extern DissectRegProc DissectReg;
  311. extern tQualifyQuoteFnc QualifyQuote;
  312.  
  313. extern StringPtr IncludeList;
  314. extern Integer IncDepth, NextIncDepth, MaxIncDepth;
  315. extern FILE *ErrorFile;
  316. extern FILE *LstFile;
  317. extern FILE *ShareFile;
  318. extern FILE *MacProFile;
  319. extern FILE *MacroFile;
  320. extern Boolean InMacroFlag;
  321. extern StringPtr LstName, MacroName, MacProName;
  322. extern tLstMacroExp DoLst, NextDoLst;
  323. extern StringPtr ShareName;
  324. extern CPUVar MomCPU, MomVirtCPU;
  325. extern StringPtr MomCPUArgs;
  326. extern char DefCPU[20];
  327. extern char MomCPUIdent[20],
  328.             MomFPUIdent[20],
  329.             MomPMMUIdent[20];
  330.  
  331. extern int OutRadixBase, ListRadixBase;
  332. extern Boolean ListPCZeroPad;
  333. extern const char *pCommentLeadIn;
  334.  
  335. extern tStrComp *ArgStr;
  336. extern tStrComp LabPart, CommPart, ArgPart, OpPart, AttrPart;
  337. extern char AttrSplit;
  338. extern Boolean oppart_leading_dot;
  339. extern int ArgCnt;
  340. extern as_dynstr_t OneLine;
  341. #ifdef PROFILE_MEMO
  342. extern unsigned NumMemo;
  343. extern unsigned long NumMemoSum, NumMemoCnt;
  344. #endif
  345.  
  346. #define forallargs(pArg, cond) \
  347.         for (pArg = ArgStr + 1; (cond) && (pArg <= ArgStr + ArgCnt); pArg++)
  348.  
  349. extern Byte LstCounter;
  350. extern Word PageCounter[ChapMax+1];
  351. extern Byte ChapDepth;
  352. extern StringPtr ListLine;
  353. extern Byte PageLength, PageWidth;
  354. extern tLstMacroExpMod LstMacroExpModOverride, LstMacroExpModDefault;
  355. extern Boolean DottedStructs;
  356. extern StringPtr PrtInitString;
  357. extern StringPtr PrtExitString;
  358. extern StringPtr PrtTitleString;
  359.  
  360. extern Byte StopfZahl;
  361.  
  362. extern Boolean SuppWarns;
  363.  
  364. extern PTransTable TransTables, CurrTransTable;
  365.  
  366. extern PDefinement FirstDefine;
  367.  
  368. extern PSaveState FirstSaveState;
  369.  
  370. extern Boolean MakeDebug;
  371. extern FILE *Debug;
  372.  
  373. extern Boolean WasIF, WasMACRO;
  374.  
  375. extern void AsmDefInit(void);
  376.  
  377. extern void NullProc(void);
  378.  
  379. extern int SetMaxCodeLen(LongWord NewMaxCodeLen);
  380.  
  381. extern void Default_InternSymbol(char *Asc, TempResult *Erg);
  382.  
  383. extern void Default_DissectBit(char *pDest, size_t DestSize, LargeWord BitSpec);
  384.  
  385. extern void AppendArg(size_t ReqSize);
  386. extern void InsertArg(int Index, size_t ReqSize);
  387.  
  388. extern Boolean memo_set_pseudo(void);
  389. extern Boolean is_set_pseudo(void);
  390. extern Boolean is_save_pseudo(void);
  391. extern Boolean is_restore_pseudo(void);
  392. extern Boolean memo_switch_pseudo(void);
  393. extern Boolean memo_shift_pseudo(void);
  394. extern Boolean is_page_pseudo(void);
  395.  
  396. extern void free_forward_symbol(PForwardSymbol p_symbol);
  397.  
  398. extern void asmdef_init(void);
  399. #endif /* _ASMDEF_H */
  400.