?login_element?

Subversion Repositories NedoOS

Rev

Rev 129 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  
  3.   SjASMPlus Z80 Cross Compiler
  4.  
  5.   This is modified sources of SjASM by Aprisobal - aprisobal@tut.by
  6.  
  7.   Copyright (c) 2006 Sjoerd Mastijn
  8.  
  9.   This software is provided 'as-is', without any express or implied warranty.
  10.   In no event will the authors be held liable for any damages arising from the
  11.   use of this software.
  12.  
  13.   Permission is granted to anyone to use this software for any purpose,
  14.   including commercial applications, and to alter it and redistribute it freely,
  15.   subject to the following restrictions:
  16.  
  17.   1. The origin of this software must not be misrepresented; you must not claim
  18.          that you wrote the original software. If you use this software in a product,
  19.          an acknowledgment in the product documentation would be appreciated but is
  20.          not required.
  21.  
  22.   2. Altered source versions must be plainly marked as such, and must not be
  23.          misrepresented as being the original software.
  24.  
  25.   3. This notice may not be removed or altered from any source distribution.
  26.  
  27. */
  28.  
  29. // sjio.h
  30.  
  31. /**
  32.  * Error types:
  33.  * ALL = will try to display in every pass
  34.  * FATAL = terminates assembler
  35.  * EARLY = displays only during early phase (pass 1+2)
  36.  * PASS3 = normal error message level for code-gen pass (pass 3)
  37.  * IF_FIRST = normal code-gen error, but will display only if it is first error on the current line
  38.  * SUPPRESS = will suppress further errors (PASS3+IF_FIRST+ALL) for current line, except FATAL
  39.  * */
  40. enum EStatus { ALL, FATAL, EARLY, PASS3, IF_FIRST, SUPPRESS };
  41. enum EWStatus { W_ALL, W_EARLY, W_PASS3 };
  42. enum EReturn { END, ELSE, ENDIF, ENDTEXTAREA, ENDM };
  43.  
  44. extern int ListAddress;
  45.  
  46. #define OUTPUT_TRUNCATE 0
  47. #define OUTPUT_REWIND 1
  48. #define OUTPUT_APPEND 2
  49.  
  50. extern FILE* FP_Input;
  51.  
  52. char* FilenameExtPos(char* filename, const char* initWithName = nullptr, size_t initNameMaxLength = 0);
  53. const char* FilenameBasePos(const char* fullname);
  54. void ConstructDefaultFilename(char* dest, size_t dest_size, const char* ext, bool checkIfDestIsEmpty = true);
  55. void OpenDest(int mode = OUTPUT_TRUNCATE);
  56. void NewDest(char* newfilename, int mode = OUTPUT_TRUNCATE);
  57. int FileExists(char* filename);
  58. void Error(const char* message, const char* badValueMessage = NULL, EStatus type = PASS3);
  59. void ErrorInt(const char* message, aint badValue, EStatus type = PASS3);
  60. void ErrorOOM();                // out of memory
  61. void Warning(const char* message, const char* badValueMessage = NULL, EWStatus type = W_PASS3);
  62. FILE* GetListingFile();
  63. void ListFile(bool showAsSkipped = false);
  64. void ListSilentOrExternalEmits();
  65. void CheckRamLimitExceeded();
  66. void EmitByte(int byte);
  67. void EmitWord(int word);
  68. void EmitBytes(const int* bytes);
  69. void EmitWords(int* words);
  70. void EmitBlock(aint byte, aint len, bool preserveDeviceMemory = false, int emitMaxToListing = 4);
  71. bool DidEmitByte();             // returns true if some byte was emitted since last call to this function
  72. void OpenFile(const char* nfilename, bool systemPathsBeforeCurrent = false, stdin_log_t* fStdinLog = nullptr);
  73. void IncludeFile(const char* nfilename, bool systemPathsBeforeCurrent);
  74. void Close();
  75. void OpenList();
  76.  
  77. void OpenUnrealList();
  78. void ReadBufLine(bool Parse = true, bool SplitByColon = true);
  79. void CloseDest();
  80. void CloseTapFile();
  81. void OpenTapFile(char * tapename, int flagbyte);
  82. void PrintHex(char* & dest, aint value, int nibbles);
  83. void PrintHex32(char* & dest, aint value);
  84. void PrintHexAlt(char* & dest, aint value);
  85. char* GetPath(const char* fname, char** filenamebegin = NULL, bool systemPathsBeforeCurrent = false);
  86.  
  87. /**
  88.  * @brief Includes bytes of particular file into output (and virtual device memory).
  89.  *
  90.  * @param fname file name to open (include paths will be searched, order depends on syntax "" vs <>)
  91.  * @param offset positive: bytes to skip / negative: bytes to rewind back from end
  92.  * @param length positive: bytes to include / negative: bytes to skip from end / INT_MAX: all remaining
  93.  */
  94. void BinIncFile(char* fname, int offset = 0, int length = INT_MAX);
  95.  
  96. int SaveRAM(FILE*, int, int);
  97. unsigned char MemGetByte(unsigned int address);
  98. unsigned int MemGetWord(unsigned int address);
  99. int SaveBinary(char* fname, int start, int length);
  100. bool SaveDeviceMemory(FILE* file, const size_t start, const size_t length);
  101. bool SaveDeviceMemory(const char* fname, const size_t start, const size_t length);
  102. int SaveHobeta(char* fname, char* fhobname, int start, int length);
  103. int ReadLineNoMacro(bool SplitByColon = true);
  104. int ReadLine(bool SplitByColon = true);
  105. EReturn ReadFile();
  106. EReturn SkipFile();
  107. void SeekDest(long, int);
  108. int ReadFileToCStringsList(CStringsList*& f, const char* end);
  109. void WriteExp(char* n, aint v);
  110.  
  111. /////// source-level-debugging support by Ckirby
  112. bool IsSldExportActive();
  113. void OpenSld();
  114. void CloseSld();
  115. void WriteToSldFile(int pageNum, int value, char type = 'T', const char* symbol = nullptr);
  116.  
  117. /////// Breakpoints list (for different emulators)
  118. enum EBreakpointsFile { BPSF_UNREAL, BPSF_ZESARUX };
  119. void OpenBreakpointsFile(const char* filename, const EBreakpointsFile type);
  120. void WriteBreakpoint(const aint val);
  121.  
  122. //eof sjio.h
  123.  
  124.