Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ kaiseki.doc ]
- この資料は、そると が個人的に解析した結果です。
- この結果は僕個人で調べた物なので、決してシャープ、ハドソン、その他関
- 係がありそうな会社、各種団体などには問い合わせないで下さい。:-)
- 何か疑問に思ったこと、知りたいこと等がありましたら、僕に聞いてくださ
- い。できる限りの範囲でお答えしたいと思います。
- この資料はPDDとします。
- § Definition of terms
- ○ label_no The order of when external reference or registration of the common label
- ○ Section number
- Numbers denoted with * from SXhas。
- fc* rcommon Common label area
- fd* rlcommon Common label area
- fe common Common label area
- ff xref External reference or external label definition
- 00 abs Constant
- 01 text Address of text section
- 02 data Address of data section
- 03 bss Address of BSS
- 04 stack Address of BSS
- 05* rdata Address of data section
- 06* rbss Address of BSS
- 07* rstack Address of BSS
- 08* rldata Address of data section
- 09* rlbss Address of BSS
- 0a* rlstack Address of BSS
- ○ Added object command
- 47 {fe-ff} : label no.w ( dc.b label )*
- Commands with the last '*' in this manner, it is a thing that has been added in as v2.00.
- (Why, did you that there is no such meaning? > Hudson)
- § Object file commands
- 00 00 ( end )
- Always at the end of the file
- 10 (size.b - 1) : data (size_byte) : even ( dc.b ??,??,....,?? )
- Constant or instruction does not depend on the address.
- If longer than 256 bytes are split.
- 20 sect.b : 0.l ( change section )
- Change the section.
- This corresponds to sections such as assembler directive '.text', '.data'
- 30 00 : size.l ( ds.b size.l )
- Reserve memory.
- Equivalent to '.ds.b' directive of the assembler.
- In case of '.text' or '.data' the linker will fill the range with 00
- 43 {fc-ff} : label no.w ( dc.b label )
- 47 {fe-ff} : label no.w ( dc.b label )*
- 41 {fc-ff} : label no.w ( dc.w label )
- 45 {fe-ff} : label no.w ( dc.w label )*
- 42 {fc-ff} : label no.w ( dc.l label )
- 46 {fc-ff} : label no.w ( dc.l label )
- Converts the value of the label of the external reference to
- the address of the program to write the desired value.
- Other than long-word, value must be a constant.
- An error will result if the value exceeds the following ranges.
- byte -$80~$ff
- word -$8000~$ffff
- long -$80000000~$ffffffff
- 43 {fc-ff} は、同じ動作をするコマンドです。他も同様です。
- adr-adr2 will be treated as a constant.
- 47, 45 Generated when you assemble code like the following.
- (as v2.00 only)
- ----------------------------------------------------------------------------
- .xref data_pos
- move.w data_pos(a0),d0 * 45 ff
- move.w data_pos(a0,d1),d0 * 47 ff
- ----------------------------------------------------------------------------
- 43 sect.b : adr.l ( dc.b sect:adr )
- 41 sect.b : adr.l ( dc.w sect:adr )
- 42 sect.b : adr.l ( dc.l sect:adr )
- 46 sect.b : adr.l ( dc.l sect:adr )
- Converts the address in each area to the address in the program.
- Must be a constant, except long-word
- adr-adr2 will be treated as a constant.
- 40 {fc-fe} : label_no.w ( dc.b 0,label )
- Converts the value of the label of external reference to the address of the program
- to write the desired value.
- Error will result if the value is not a constant or exceeds the range $80-$ff.
- Will generate this code if you assemble source like the following.
- ----------------------------------------------------------------------------
- .xref test_bit
- btst.b #test_bit,(a0)
- ----------------------------------------------------------------------------
- 40 sect.b : adr.l ( dc.b 0,sect:adr )
- Always error。
- (If the base address not specified?)
- 53 {fc-ff} : label no.w : num.l ( dc.b label+num )
- 57 {fe-ff} : label no.w : num.l ( dc.b label+num )*
- 51 {fc-ff} : label no.w : num.l ( dc.w label+num )
- 55 {fe-ff} : label no.w : num.l ( dc.w label+num )*
- 52 {fc-ff} : label no.w : num.l ( dc.l label+num )
- 56 {fc-ff} : label no.w : num.l ( dc.l label+num )
- Similar to 4x but uses offset.
- 53 sect.b : adr.l : num.l ( dc.b sect:adr+num )
- 51 sect.b : adr.l : num.l ( dc.w sect:adr+num )
- 52 sect.b : adr.l : num.l ( dc.l sect:adr+num )
- 56 sect.b : adr.l : num.l ( dc.l sect:adr+num )
- Similar to 4x but uses offset.
- 65 sect.b : adr.l : label no.w ( dc.w label-sect:adr )
- 69 sect.b : adr.l : label no.w ( dc.w label-sect:adr )*
- It writes the value obtained by subtracting the adr from the address of the label.
- Error will result if the value is not a constant or exceeds the range $8000-$7fff.
- Will generate this code if you assemble source like the following.
- ----------------------------------------------------------------------------
- .xref function
- bsr function
- ----------------------------------------------------------------------------
- 80 {fc-ff} : label no.w ( push label )*
- 80 00 : num.l ( push num )
- 80 sect.b : adr.l ( push sect:adr )
- Pushes the respective value to the stack.
- 93 00 ( dc.b (sp) : sp++ )
- 91 00 ( dc.w (sp) : sp++ )
- 92 00 ( dc.l (sp) : sp++ )
- 96 00 ( dc.l (sp) : sp++ )
- Pop the value off the beginning of the stack.
- Error occurs when value written exceeds the range. (?)
- Must be a constant, except long-word.
- 90 00 ( dc.b 0,(sp) : sp++ )
- Remove the value from the beginning of the stack.
- Error will result if value is not a constant or exceeds range $80-$ff.
- 99 00 ( dc.w (sp) : sp++ )
- Remove the value from the beginning of the stack.
- Error will result if value is not a constant or exceeds range $8000-$7fff.
- a0 01 ( (sp) = -(sp) )
- a0 02 ( (sp) = (sp) )
- a0 03 ( (sp) = .not.(sp) )
- a0 04 ( (sp) = .high.(sp) )
- a0 05 ( (sp) = .low.(sp) )
- a0 06 ( (sp) = .highw.(sp) )
- a0 07 ( (sp) = .loww.(sp) )
- a0 09 ( (sp+1) = (sp+1) * (sp) : sp++ )
- a0 0a ( (sp+1) = (sp+1) / (sp) : sp++ )
- a0 0b ( (sp+1) = (sp+1) % (sp) : sp++ )
- a0 0c ( (sp+1) = (sp+1) .shr. (sp) : sp++ )
- a0 0d ( (sp+1) = (sp+1) .shl. (sp) : sp++ )
- a0 0e ( (sp+1) = (sp+1) .asr. (sp) : sp++ )
- a0 0f ( (sp+1) = (sp+1) - (sp) : sp++ )
- a0 10 ( (sp+1) = (sp+1) + (sp) : sp++ )
- a0 11 ( (sp+1) = (sp+1) .eq. (sp) : sp++ )
- a0 12 ( (sp+1) = (sp+1) .ne. (sp) : sp++ )
- a0 13 ( (sp+1) = (sp+1) .lt. (sp) : sp++ )
- a0 14 ( (sp+1) = (sp+1) .le. (sp) : sp++ )
- a0 15 ( (sp+1) = (sp+1) .gt. (sp) : sp++ )
- a0 16 ( (sp+1) = (sp+1) .ge. (sp) : sp++ )
- a0 17 ( (sp+1) = (sp+1) .slt. (sp) : sp++ )
- a0 18 ( (sp+1) = (sp+1) .sle. (sp) : sp++ )
- a0 19 ( (sp+1) = (sp+1) .sgt. (sp) : sp++ )
- a0 1a ( (sp+1) = (sp+1) .sge. (sp) : sp++ )
- a0 1b ( (sp+1) = (sp+1) .and. (sp) : sp++ )
- a0 1c ( (sp+1) = (sp+1) .xor. (sp) : sp++ )
- a0 1d ( (sp+1) = (sp+1) .or. (sp) : sp++ )
- Operation is performed on the stack. Other than 'add' and 'sub' can not be constant.
- b2 00 : abs : label : 0 : even ( xdef label = abs )
- b2 sect.b : adr.l : label : 0 : even ( xdef label = sect:adr )
- b2 {fc-fe} : size.l : label : 0 : even ( comm label, size )
- b2 ff : label no.l : label : 0 : even ( xref label )
- b0 ff : label no.l : label : 0 : even ( xref label )
- Definition of the label.
- c0 sect.b : sect_size.l : sect_name : 0 : even ( header )
- Header at the top of the object file
- d0 00 : file_size.l : size.l : file_name : 0 : even ( file_name )
- File name the object is stored in.
- It is necessary that is not the same as the original file name.
- e0 00 : sect.w : start_adr.l ( start_adr )
- Specify the execution address of the program.
- If not specified, the beginning of the program is regarded as the execution address.
- If there are two or more, the last one is used.
- e0 01 : file_name : 0 : even ( request )
- Requests the incorporation of object files. It does not search the path.
- It is the same as the request of the assembler.
- It does not matter how much nesting there is and it is ignored if it is already included.
- § Format of the object file
- In each object file, commands are arranged in the following order.
- d0 00 : file_size.l : file name : 0 : even
- c0 01 : text_size.l : 'text' : 0 : even
- c0 02 : data_size.l : 'data' : 0 : even
- c0 03 : bss_size.l : 'bss' : 0 : even
- c0 04 : stack_size.l : 'stack' : 0 : even
- e0 ??
- .
- .
- e0 ??
- b? ??
- .
- .
- b? ??
- [other commands]
- 00 00
- § Archive file format
- In the case of '.a'
- D1 00 00 00 00 02 Header
- --------------------------------
- +00 object_name + '\0'
- +18 object_size
- +1c object_file_date
- +20 object_file
- +?? object_image
- +??
- -------------------------------- Repeated
- In the case of '.l'
- -- header --
- +000000 00 68 ID
- +000002 lib name
- +00001a lib size
- +000020 00 00 00 40 header size
- +000024 obj info. size
- +000028 label info. pos
- +00002c label info. size
- +000030 label name info. pos
- +000034 lanel name info. size
- -- obj info. --
- +000000 obj name
- +000018 label info. pos
- +00001c obj image pos
- +000020 obj image size
- +000024 obj file date
- +00002c reserved
- .
- .
- +00002f
- (-snip-)
- § Executable file format
- [header]
- +00 48 55 00 00 00 00 00 00 'HU'
- +08 exec address
- +0c text section size
- +10 data section size
- +14 bss+common+stack section size
- +18 offset_data size
- +1c symbol_data size
- +20 SCD line number table size
- +24 SCD information size
- +28 SCD name table size
- +2c reserved
- +40 code, data
- +??
- +?? offset_data
- +??
- +?? symbol_data
- +??
- +?? SCD line number table size
- +??
- +?? SCD information size
- +??
- +?? SCD name table size
- +??
- § Offset data format
- Offset data is the location information of the necessary information to allocate at load-time. (??)
- 詳しくはXファイルをみてもらえれば判ると思います。(手抜き)
- For more details, we will see if Moraere look at the X-Files. (Omitted)
- offset.w $00001 < offset< $10000
- 0001 offset.l $10000 <= offset
- ※ offsetは、前のオフセットデータのアドレスからどれだけずれているかを示
- すもので奇数になることはありえません。
- offset is not unlikely that an odd number in an
- indication whether the shifted much from the
- address of the previous offset data.
- § Label data format
- type address label_name 0 even
- .
- .
- type address label_name 0 even
- type
- 0003 common
- 0200 abs, rdata, rbss, rstack, rldata, rlbss, rlstack
- 0201 text
- 0202 data
- 0203 bss
- 0204 stack
- (eof)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement