Advertisement
luckytyphlosion

--agbasm-help v2

Jun 3rd, 2021
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.39 KB | None | 0 0
  1.  
  2. --agbasm enable all agbasm features except --agbasm-debug
  3.  
  4. --agbasm-debug FILE
  5. enable agbasm debug info. Outputs miscellaneous debugging print
  6. statements to the specified file. ("printf debugging")
  7.  
  8. --agbasm-colonless-labels
  9. enable agbasm colonless labels. This allows defining labels
  10. without a colon at the end if the label is in column
  11. zero and ends with a newline (after optional whitespace).
  12. If the label does not end with a newline, then an error is
  13. thrown and the label is assumed to be a statement.
  14.  
  15. --agbasm-colon-defined-global-labels
  16. enable agbasm colon defined global labels. This allows setting
  17. a label as global on definition by following the label name
  18. with two colons, as opposed to one (e.g. `label::').
  19.  
  20. --agbasm-local-labels
  21. enable agbasm local labels. These are like dollar local
  22. labels (as in they go out of scope when a non-local label
  23. is defined), but are not limited to a number as the label
  24. name. An agbasm local label is prefixed (and thus defined)
  25. with `.'. Internally, an agbasm local label is actually
  26. just a concatenation of the most recently defined
  27. non-local label and the local label (including the prefix).
  28. This gives us a safe way to canonicalize local label names
  29. so that they can be exported for debug information. This
  30. also means that local labels can be referenced outside
  31. of their scope by using the canonicalized label name.
  32. Note that agbasm local labels are NOT local symbols by
  33. default.
  34.  
  35. --agbasm-multiline-macros
  36. enable agbasm multiline macros. This allows the use of
  37. a macro to span across multiple lines, by placing a `['
  38. after the macro name, and then placing a `]' once all
  39. macro arguments have been defined, e.g.
  40.  
  41. my_macro [
  42. arg_1=FOO,
  43. arg_2=BAR
  44. ]
  45.  
  46. In a multiline macro, the equal sign used in assigning
  47. keyword arguments can substituted with a colon (`:'). Note
  48. that there cannot be whitespace before the colon, but
  49. there can be whitespace after the colon (this behavior also
  50. exists in unmodified gas with the equal sign).
  51.  
  52. The opening character (`[') must be defined before any
  53. macro arguments are specified. Arguments can be defined
  54. on the same line as the opening character with optional
  55. whitespace in-between the opening character and the starting
  56. argument, e.g.:
  57.  
  58. my_macro [arg_1=FOO,
  59. arg_2=BAR
  60. ]
  61.  
  62. The closing character (`]') can be defined in one of
  63. two ways:
  64. - After the last argument, a comma is placed (to indicate
  65. the end of the argument), followed by optional whitespace
  66. and then the closing character, e.g.:
  67.  
  68. my_macro [
  69. FOO, ]
  70.  
  71. - On a single line by itself (supposedly after the last
  72. argument has been defined) with no non-whitespace characters
  73. before or after it, e.g.:
  74.  
  75. my_macro [
  76. FOO
  77. ]
  78.  
  79. Note that the first method **requires** a comma before the
  80. closing character, while the second method does not require
  81. the closing character. This is due to the inherent design
  82. of how macro arguments are parsed, which may be explained
  83. here in the future.
  84.  
  85. A comma should be inserted after the last argument for each
  86. line (except as mentioned above in the second closing character
  87. method), otherwise a warning is generated. It is
  88. recommended to not ignore these warnings as they can
  89. be an indicator of a missing closing character, as most
  90. directives do not end with a comma.
  91.  
  92. --agbasm-charmap
  93. enable agbasm charmap. This allows specifying characters in
  94. strings to map to custom values, as opposed to the values of
  95. the encoding used. The .charmap macro is used to specify a
  96. mapping. For example:
  97.  
  98. .charmap "A", 0x20
  99. .string "A"
  100.  
  101. will output a value of 0x20. Input patterns for .charmap are
  102. not restricted to a single byte, rather, the input
  103. pattern can be as long as possible. The way that input patterns
  104. are detected is that it will try to find the longest defined
  105. pattern at the current point in the string. For example:
  106.  
  107. .charmap "d", 1
  108. .charmap "o", 2
  109. .charmap "n", 3
  110. .charmap "'", 4
  111. .charmap "t", 5
  112. .charmap "'t", 6
  113. .string "don't"
  114.  
  115. would output `1, 2, 3, 6', instead of `1, 2, 3, 4, 5'.
  116. A more complex example:
  117.  
  118. .charmap "B", 1
  119. .charmap "A", 2
  120. .charmap "N", 3
  121. .charmap "BAN", 4
  122. .charmap "BANANA", 5
  123. .charmap "ANA", 6
  124. .string "BANAN"
  125. would output `4, 2, 3'.
  126.  
  127. The size of the output value for a .charmap can be longer than one byte.
  128. There are two ways to do this. The first is to specify a list of bytes
  129. as the output values. For example:
  130.  
  131. .charmap "C", 0x20, 0x21, 0x22
  132. .string "C"
  133.  
  134. will output `0x20, 0x21, 0x22'. The second is to specify a single value
  135. which can be at most 4 bytes long. This value is interpreted as variable
  136. width, as in leading zeroes are ignored. For example, if the value is less
  137. than 0x100, only one byte is output. If the value is less than 0x10000,
  138. only two bytes are output. If the value less than 0x1000000, only three bytes
  139. are output, otherwise, four bytes are output. The bytes output are big-endian
  140. regardless of the endianness of the system, as this is merely a convenience
  141. method for the first method. The output value can be up to seven bytes long.
  142. Zero as any of the bytes of an output value is acceptable.
  143.  
  144. As .string is now used for agbasm charmap, .ascizN directives have been
  145. created to replicate the behavior of the original .stringN directives.
  146. .ascizN directives are not enabled if agbasm charmap is not enabled.
  147.  
  148. Internally, agbasm charmaps are represented as a tree structure. They have
  149. been designed to have O(n) performance when parsing a string, while being
  150. as memory efficient as possible: A .charmap entry with n characters would
  151. take up 256*n + 8 bytes for the worst case on a 64-bit machine.
  152. The way the above "BANAN" example would be parsed would be approximately
  153. - Recognize B as a potential match and save it as the
  154. last match
  155. - Parse BA, has no match
  156. - Recognize BAN as a potential match and save it
  157. - Parse BANA, has no match
  158. - Parse BANAN, has no match
  159. - Reached end of string, output the value of the last match
  160. which is `BAN', and set the input pointer to the end of the
  161. last match, which is after 'BAN`
  162. - Recognize A as a potential patch and save it
  163. - Parse AN, has no match
  164. - Reached end of string, output the value of `A' and set the
  165. input pointer to the end of `A'
  166. - Recognize N as a potential match and save it
  167. - Reached end of string, output the value of `N' and stop
  168. parsing
  169.  
  170. --agbasm-no-gba-thumb-after-label-disasm-fix
  171. When viewing an .elf file in no$gba's disassembler, if one or more
  172. Thumb opcodes exist in memory, and a label is declared after the
  173. Thumb opcodes, no$gba will interpret subsequent Thumb opcodes after
  174. the label as arm, even though the opcodes afterwards are Thumb. This
  175. is due to (presumably) how no$gba reads the elf file to determine which
  176. opcodes are thumb and which opcodes are arm. What presumably happens is
  177. that no$gba reads the elf's symbol table. Within the symbol table, there
  178. are also special mapping symbols, which indicate whether data at the
  179. address of the mapping symbol is a sequence of ARM opcodes ($a), a
  180. sequence of Thumb opcodes ($t), or a sequence of data items ($d). For
  181. example, if there is a $t symbol with address 0x8000000, this tells no$gba
  182. that address 0x8000000 is the start of a sequence of Thumb opcodes, and
  183. thus no$gba's disassembler will output Thumb opcodes until it encounters
  184. another mapping symbol. However, if a symbol that is not a mapping symbol
  185. is encountered, no$gba will switch to outputting arm opcodes by default.
  186. This becomes an issue as when a function emits a label, any code after
  187. the label will be viewed incorrectly as ARM opcodes in no$gba's
  188. disassembler. This flag aims to workaround this behavior, by having
  189. the assembler clobber the current mapping state, so that it will
  190. output another mapping symbol after the label, and thus no$gba will
  191. output the correct type of data in the disassembler after a label.
  192.  
  193. --agbasm-help show this message and exit
  194.  
  195.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement