Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.90 KB | None | 0 0
  1. [ kaiseki.doc ]
  2.  
  3. この資料は、そると が個人的に解析した結果です。
  4.  
  5. この結果は僕個人で調べた物なので、決してシャープ、ハドソン、その他関
  6. 係がありそうな会社、各種団体などには問い合わせないで下さい。:-)
  7.  
  8. 何か疑問に思ったこと、知りたいこと等がありましたら、僕に聞いてくださ
  9. い。できる限りの範囲でお答えしたいと思います。
  10.  
  11. この資料はPDDとします。
  12.  
  13.  
  14. § Definition of terms
  15.  
  16. ○ label_no The order of when external reference or registration of the common label
  17.  
  18. ○ Section number
  19.  
  20. Numbers denoted with * from SXhas。
  21.  
  22. fc* rcommon Common label area
  23. fd* rlcommon Common label area
  24. fe common Common label area
  25. ff xref External reference or external label definition
  26. 00 abs Constant
  27. 01 text Address of text section
  28. 02 data Address of data section
  29. 03 bss Address of BSS
  30. 04 stack Address of BSS
  31. 05* rdata Address of data section
  32. 06* rbss Address of BSS
  33. 07* rstack Address of BSS
  34. 08* rldata Address of data section
  35. 09* rlbss Address of BSS
  36. 0a* rlstack Address of BSS
  37.  
  38. ○ Added object command
  39.  
  40. 47 {fe-ff} : label no.w ( dc.b label )*
  41.  
  42. Commands with the last '*' in this manner, it is a thing that has been added in as v2.00.
  43. (Why, did you that there is no such meaning? > Hudson)
  44.  
  45.  
  46. § Object file commands
  47.  
  48.  
  49. 00 00 ( end )
  50.  
  51. Always at the end of the file
  52.  
  53.  
  54. 10 (size.b - 1) : data (size_byte) : even ( dc.b ??,??,....,?? )
  55.  
  56. Constant or instruction does not depend on the address.
  57. If longer than 256 bytes are split.
  58.  
  59.  
  60. 20 sect.b : 0.l ( change section )
  61.  
  62. Change the section.
  63. This corresponds to sections such as assembler directive '.text', '.data'
  64.  
  65.  
  66. 30 00 : size.l ( ds.b size.l )
  67.  
  68. Reserve memory.
  69. Equivalent to '.ds.b' directive of the assembler.
  70.  
  71. In case of '.text' or '.data' the linker will fill the range with 00
  72.  
  73.  
  74. 43 {fc-ff} : label no.w ( dc.b label )
  75. 47 {fe-ff} : label no.w ( dc.b label )*
  76. 41 {fc-ff} : label no.w ( dc.w label )
  77. 45 {fe-ff} : label no.w ( dc.w label )*
  78. 42 {fc-ff} : label no.w ( dc.l label )
  79. 46 {fc-ff} : label no.w ( dc.l label )
  80.  
  81. Converts the value of the label of the external reference to
  82. the address of the program to write the desired value.
  83.  
  84. Other than long-word, value must be a constant.
  85.  
  86. An error will result if the value exceeds the following ranges.
  87. byte -$80~$ff
  88. word -$8000~$ffff
  89. long -$80000000~$ffffffff
  90.  
  91. 43 {fc-ff} は、同じ動作をするコマンドです。他も同様です。
  92. adr-adr2 will be treated as a constant.
  93.  
  94. 47, 45 Generated when you assemble code like the following.
  95. (as v2.00 only)
  96. ----------------------------------------------------------------------------
  97. .xref data_pos
  98.  
  99. move.w data_pos(a0),d0 * 45 ff
  100. move.w data_pos(a0,d1),d0 * 47 ff
  101. ----------------------------------------------------------------------------
  102.  
  103.  
  104. 43 sect.b : adr.l ( dc.b sect:adr )
  105. 41 sect.b : adr.l ( dc.w sect:adr )
  106. 42 sect.b : adr.l ( dc.l sect:adr )
  107. 46 sect.b : adr.l ( dc.l sect:adr )
  108.  
  109. Converts the address in each area to the address in the program.
  110.  
  111. Must be a constant, except long-word
  112.  
  113. adr-adr2 will be treated as a constant.
  114.  
  115.  
  116. 40 {fc-fe} : label_no.w ( dc.b 0,label )
  117.  
  118. Converts the value of the label of external reference to the address of the program
  119. to write the desired value.
  120.  
  121. Error will result if the value is not a constant or exceeds the range $80-$ff.
  122.  
  123. Will generate this code if you assemble source like the following.
  124. ----------------------------------------------------------------------------
  125. .xref test_bit
  126.  
  127. btst.b #test_bit,(a0)
  128. ----------------------------------------------------------------------------
  129.  
  130.  
  131. 40 sect.b : adr.l ( dc.b 0,sect:adr )
  132.  
  133. Always error。
  134. (If the base address not specified?)
  135.  
  136.  
  137. 53 {fc-ff} : label no.w : num.l ( dc.b label+num )
  138. 57 {fe-ff} : label no.w : num.l ( dc.b label+num )*
  139. 51 {fc-ff} : label no.w : num.l ( dc.w label+num )
  140. 55 {fe-ff} : label no.w : num.l ( dc.w label+num )*
  141. 52 {fc-ff} : label no.w : num.l ( dc.l label+num )
  142. 56 {fc-ff} : label no.w : num.l ( dc.l label+num )
  143.  
  144. Similar to 4x but uses offset.
  145.  
  146.  
  147. 53 sect.b : adr.l : num.l ( dc.b sect:adr+num )
  148. 51 sect.b : adr.l : num.l ( dc.w sect:adr+num )
  149. 52 sect.b : adr.l : num.l ( dc.l sect:adr+num )
  150. 56 sect.b : adr.l : num.l ( dc.l sect:adr+num )
  151.  
  152. Similar to 4x but uses offset.
  153.  
  154.  
  155. 65 sect.b : adr.l : label no.w ( dc.w label-sect:adr )
  156. 69 sect.b : adr.l : label no.w ( dc.w label-sect:adr )*
  157.  
  158. It writes the value obtained by subtracting the adr from the address of the label.
  159.  
  160. Error will result if the value is not a constant or exceeds the range $8000-$7fff.
  161.  
  162. Will generate this code if you assemble source like the following.
  163. ----------------------------------------------------------------------------
  164. .xref function
  165.  
  166. bsr function
  167. ----------------------------------------------------------------------------
  168.  
  169.  
  170. 80 {fc-ff} : label no.w ( push label )*
  171. 80 00 : num.l ( push num )
  172. 80 sect.b : adr.l ( push sect:adr )
  173.  
  174. Pushes the respective value to the stack.
  175.  
  176.  
  177. 93 00 ( dc.b (sp) : sp++ )
  178. 91 00 ( dc.w (sp) : sp++ )
  179. 92 00 ( dc.l (sp) : sp++ )
  180. 96 00 ( dc.l (sp) : sp++ )
  181.  
  182. Pop the value off the beginning of the stack.
  183.  
  184. Error occurs when value written exceeds the range. (?)
  185. Must be a constant, except long-word.
  186.  
  187.  
  188. 90 00 ( dc.b 0,(sp) : sp++ )
  189.  
  190. Remove the value from the beginning of the stack.
  191.  
  192. Error will result if value is not a constant or exceeds range $80-$ff.
  193.  
  194.  
  195. 99 00 ( dc.w (sp) : sp++ )
  196.  
  197. Remove the value from the beginning of the stack.
  198.  
  199. Error will result if value is not a constant or exceeds range $8000-$7fff.
  200.  
  201.  
  202. a0 01 ( (sp) = -(sp) )
  203. a0 02 ( (sp) = (sp) )
  204. a0 03 ( (sp) = .not.(sp) )
  205. a0 04 ( (sp) = .high.(sp) )
  206. a0 05 ( (sp) = .low.(sp) )
  207. a0 06 ( (sp) = .highw.(sp) )
  208. a0 07 ( (sp) = .loww.(sp) )
  209.  
  210. a0 09 ( (sp+1) = (sp+1) * (sp) : sp++ )
  211. a0 0a ( (sp+1) = (sp+1) / (sp) : sp++ )
  212. a0 0b ( (sp+1) = (sp+1) % (sp) : sp++ )
  213. a0 0c ( (sp+1) = (sp+1) .shr. (sp) : sp++ )
  214. a0 0d ( (sp+1) = (sp+1) .shl. (sp) : sp++ )
  215. a0 0e ( (sp+1) = (sp+1) .asr. (sp) : sp++ )
  216. a0 0f ( (sp+1) = (sp+1) - (sp) : sp++ )
  217. a0 10 ( (sp+1) = (sp+1) + (sp) : sp++ )
  218. a0 11 ( (sp+1) = (sp+1) .eq. (sp) : sp++ )
  219. a0 12 ( (sp+1) = (sp+1) .ne. (sp) : sp++ )
  220. a0 13 ( (sp+1) = (sp+1) .lt. (sp) : sp++ )
  221. a0 14 ( (sp+1) = (sp+1) .le. (sp) : sp++ )
  222. a0 15 ( (sp+1) = (sp+1) .gt. (sp) : sp++ )
  223. a0 16 ( (sp+1) = (sp+1) .ge. (sp) : sp++ )
  224. a0 17 ( (sp+1) = (sp+1) .slt. (sp) : sp++ )
  225. a0 18 ( (sp+1) = (sp+1) .sle. (sp) : sp++ )
  226. a0 19 ( (sp+1) = (sp+1) .sgt. (sp) : sp++ )
  227. a0 1a ( (sp+1) = (sp+1) .sge. (sp) : sp++ )
  228. a0 1b ( (sp+1) = (sp+1) .and. (sp) : sp++ )
  229. a0 1c ( (sp+1) = (sp+1) .xor. (sp) : sp++ )
  230. a0 1d ( (sp+1) = (sp+1) .or. (sp) : sp++ )
  231.  
  232. Operation is performed on the stack. Other than 'add' and 'sub' can not be constant.
  233.  
  234.  
  235. b2 00 : abs : label : 0 : even ( xdef label = abs )
  236. b2 sect.b : adr.l : label : 0 : even ( xdef label = sect:adr )
  237. b2 {fc-fe} : size.l : label : 0 : even ( comm label, size )
  238. b2 ff : label no.l : label : 0 : even ( xref label )
  239. b0 ff : label no.l : label : 0 : even ( xref label )
  240.  
  241. Definition of the label.
  242.  
  243.  
  244. c0 sect.b : sect_size.l : sect_name : 0 : even ( header )
  245.  
  246. Header at the top of the object file
  247.  
  248.  
  249. d0 00 : file_size.l : size.l : file_name : 0 : even ( file_name )
  250.  
  251. File name the object is stored in.
  252. It is necessary that is not the same as the original file name.
  253.  
  254.  
  255. e0 00 : sect.w : start_adr.l ( start_adr )
  256.  
  257. Specify the execution address of the program.
  258. If not specified, the beginning of the program is regarded as the execution address.
  259.  
  260. If there are two or more, the last one is used.
  261.  
  262.  
  263. e0 01 : file_name : 0 : even ( request )
  264.  
  265. Requests the incorporation of object files. It does not search the path.
  266. It is the same as the request of the assembler.
  267.  
  268. It does not matter how much nesting there is and it is ignored if it is already included.
  269.  
  270.  
  271. § Format of the object file
  272.  
  273. In each object file, commands are arranged in the following order.
  274.  
  275. d0 00 : file_size.l : file name : 0 : even
  276. c0 01 : text_size.l : 'text' : 0 : even
  277. c0 02 : data_size.l : 'data' : 0 : even
  278. c0 03 : bss_size.l : 'bss' : 0 : even
  279. c0 04 : stack_size.l : 'stack' : 0 : even
  280. e0 ??
  281. .
  282. .
  283. e0 ??
  284. b? ??
  285. .
  286. .
  287. b? ??
  288.  
  289. [other commands]
  290.  
  291. 00 00
  292.  
  293. § Archive file format
  294.  
  295. In the case of '.a'
  296.  
  297. D1 00 00 00 00 02 Header
  298. --------------------------------
  299. +00 object_name + '\0'
  300. +18 object_size
  301. +1c object_file_date
  302. +20 object_file
  303. +?? object_image
  304. +??
  305. -------------------------------- Repeated
  306.  
  307.  
  308. In the case of '.l'
  309.  
  310. -- header --
  311. +000000 00 68 ID
  312. +000002 lib name
  313. +00001a lib size
  314. +000020 00 00 00 40 header size
  315. +000024 obj info. size
  316. +000028 label info. pos
  317. +00002c label info. size
  318. +000030 label name info. pos
  319. +000034 lanel name info. size
  320.  
  321. -- obj info. --
  322. +000000 obj name
  323. +000018 label info. pos
  324. +00001c obj image pos
  325. +000020 obj image size
  326. +000024 obj file date
  327. +00002c reserved
  328. .
  329. .
  330. +00002f
  331.  
  332. (-snip-)
  333.  
  334.  
  335. § Executable file format
  336.  
  337. [header]
  338. +00 48 55 00 00 00 00 00 00 'HU'
  339. +08 exec address
  340. +0c text section size
  341. +10 data section size
  342. +14 bss+common+stack section size
  343. +18 offset_data size
  344. +1c symbol_data size
  345. +20 SCD line number table size
  346. +24 SCD information size
  347. +28 SCD name table size
  348. +2c reserved
  349.  
  350. +40 code, data
  351. +??
  352. +?? offset_data
  353. +??
  354. +?? symbol_data
  355. +??
  356. +?? SCD line number table size
  357. +??
  358. +?? SCD information size
  359. +??
  360. +?? SCD name table size
  361. +??
  362.  
  363.  
  364. § Offset data format
  365.  
  366. Offset data is the location information of the necessary information to allocate at load-time. (??)
  367.  
  368. 詳しくはXファイルをみてもらえれば判ると思います。(手抜き)
  369. For more details, we will see if Moraere look at the X-Files. (Omitted)
  370.  
  371. offset.w $00001 < offset< $10000
  372. 0001 offset.l $10000 <= offset
  373.  
  374. ※ offsetは、前のオフセットデータのアドレスからどれだけずれているかを示
  375. すもので奇数になることはありえません。
  376. offset is not unlikely that an odd number in an
  377. indication whether the shifted much from the
  378. address of the previous offset data.
  379.  
  380.  
  381. § Label data format
  382.  
  383. type address label_name 0 even
  384. .
  385. .
  386. type address label_name 0 even
  387.  
  388. type
  389. 0003 common
  390. 0200 abs, rdata, rbss, rstack, rldata, rlbss, rlstack
  391. 0201 text
  392. 0202 data
  393. 0203 bss
  394. 0204 stack
  395.  
  396. (eof)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement