?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download

  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. enum EReturn { END, ELSE, ENDIF, ENDTEXTAREA, ENDM, ELSEIF };
  32.  
  33. extern int ListAddress;
  34. extern std::vector<const char*> archivedFileNames;      // archive of all files opened (also includes!) (fullname!)
  35.  
  36. constexpr int BYTES_END_MARKER = -1;
  37. constexpr int INSTRUCTION_START_MARKER = -2;
  38.  
  39. #define OUTPUT_TRUNCATE 0
  40. #define OUTPUT_REWIND 1
  41. #define OUTPUT_APPEND 2
  42.  
  43. const char* ArchiveFilename(const char* fullpathname);  // returns permanent C-string pointer to the fullpathname
  44. void ReleaseArchivedFilenames();        // does release all archived filenames, making all pointers invalid
  45. char* FilenameExtPos(char* filename, const char* initWithName = nullptr, size_t initNameMaxLength = 0);
  46. const char* FilenameBasePos(const char* fullname);
  47. void ConstructDefaultFilename(char* dest, size_t dest_size, const char* ext, bool checkIfDestIsEmpty = true);
  48. void OpenDest(int mode = OUTPUT_TRUNCATE);
  49. void NewDest(const char* newfilename, int mode = OUTPUT_TRUNCATE);
  50. bool FileExists(const char* filename);
  51. FILE* GetListingFile();
  52. void ListFile(bool showAsSkipped = false);
  53. void ListSilentOrExternalEmits();
  54. void CheckRamLimitExceeded();
  55. void resolveRelocationAndSmartSmc(const aint immediateOffset, Relocation::EType minType = Relocation::REGULAR);
  56. void EmitByte(int byte, bool isInstructionStart = false);
  57. void EmitWord(int word, bool isInstructionStart = false);
  58. void EmitBytes(const int* bytes, bool isInstructionStart = false);
  59. void EmitWords(const int* words, bool isInstructionStart = false);
  60. void EmitBlock(aint byte, aint len, bool preserveDeviceMemory = false, int emitMaxToListing = 4);
  61. bool DidEmitByte();             // returns true if some byte was emitted since last call to this function
  62. void OpenFile(const char* nfilename, bool systemPathsBeforeCurrent = false, stdin_log_t* fStdinLog = nullptr);
  63. void IncludeFile(const char* nfilename, bool systemPathsBeforeCurrent);
  64. void Close();
  65. void OpenList();
  66.  
  67. void OpenUnrealList();
  68. void ReadBufLine(bool Parse = true, bool SplitByColon = true);
  69. void CloseDest();
  70. void CloseTapFile();
  71. void OpenTapFile(const char * tapename, int flagbyte);
  72. void PrintHex(char* & dest, aint value, int nibbles);
  73. void PrintHex32(char* & dest, aint value);
  74. void PrintHexAlt(char* & dest, aint value);
  75. char* GetPath(const char* fname, char** filenamebegin = NULL, bool systemPathsBeforeCurrent = false);
  76.  
  77. /**
  78.  * @brief Includes bytes of particular file into output (and virtual device memory).
  79.  *
  80.  * @param fname file name to open (include paths will be searched, order depends on syntax "" vs <>)
  81.  * @param offset positive: bytes to skip / negative: bytes to rewind back from end
  82.  * @param length positive: bytes to include / negative: bytes to skip from end / INT_MAX: all remaining
  83.  */
  84. void BinIncFile(const char* fname, aint offset = 0, aint length = INT_MAX);
  85.  
  86. int SaveRAM(FILE*, int, int);
  87. unsigned char MemGetByte(unsigned int address);
  88. unsigned int MemGetWord(unsigned int address);
  89. int SaveBinary(const char* fname, aint start, aint length);
  90. int SaveBinary3dos(const char* fname, aint start, aint length, byte type, word w2, word w3);
  91. int SaveBinaryAmsdos(const char* fname, aint start, aint length, word start_adr = 0, byte type = 2);
  92. bool SaveDeviceMemory(FILE* file, const size_t start, const size_t length);
  93. bool SaveDeviceMemory(const char* fname, const size_t start, const size_t length);
  94. int SaveHobeta(const char* fname, const char* fhobname, aint start, aint length);
  95. int ReadLineNoMacro(bool SplitByColon = true);
  96. int ReadLine(bool SplitByColon = true);
  97. EReturn ReadFile();
  98. EReturn SkipFile();
  99. void SeekDest(long, int);
  100. int ReadFileToCStringsList(CStringsList*& f, const char* end);
  101. void WriteLabelEquValue(const char* name, aint value, FILE* f);
  102. void WriteExp(const char* n, aint v);
  103.  
  104. /////// source-level-debugging support by Ckirby
  105. bool IsSldExportActive();
  106. void OpenSld();
  107. void CloseSld();
  108. void WriteToSldFile(int pageNum, int value, char type = 'T', const char* symbol = nullptr);
  109. void SldAddCommentKeyword(const char* keyword);
  110. void SldTrackComments();
  111.  
  112. /////// Breakpoints list (for different emulators)
  113. enum EBreakpointsFile { BPSF_UNREAL, BPSF_ZESARUX };
  114. void OpenBreakpointsFile(const char* filename, const EBreakpointsFile type);
  115. void WriteBreakpoint(const aint val);
  116.  
  117. //eof sjio.h
  118.