Skip to content

retrokp/hunkfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HunkFile

Rust library to read and write Amiga Hunk File format.

The reader and writer supports various hunk files: executables (load files), object files (.o), static link libraries (.lib), shared libraries (.library or .device), keymaps, fonts, etc.

Read the library docs for details.

Examples

Few examples showing how to use the library.

Reading a hunk file block by block.

> cargo run --example read-blocks testfiles/sasc/main
filename: testfiles/sasc/main
- Header block (1011 / 0x3f3):
    Resident libraries: []
    Memory segments, total: 3, first: 0, last: 2:
        1304 bytes, memory type: any
        308 bytes, memory type: any
        24 bytes, memory type: chip
- Code block (1001 / 0x3e9), size: 1304 bytes, 326 longwords, memory type: any
- Reloc32 block (1004 / 0x3ec):
    Base address hunk #0, 1 offsets: [1226]
    Base address hunk #1, 2 offsets: [20, 10]
    Base address hunk #2, 2 offsets: [658, 644]
- End block (1010 / 0x3f2)
- Data block (1002 / 0x3ea), size: 92 bytes, 23 longwords, memory type: any
- Reloc32 block (1004 / 0x3ec):
    Base address hunk #0, 2 offsets: [56, 36]
    Base address hunk #1, 2 offsets: [86, 40]
- End block (1010 / 0x3f2)
- Data block (1002 / 0x3ea), size: 24 bytes, 6 longwords, memory type: chip
- End block (1010 / 0x3f2)

Reading a hunk file in a more structured way.

> cargo run --example read-hunkfile testfiles/sasc/main
filename: testfiles/sasc/main
Executable (load file):
Header:
  Resident libraries: []
  Memory segments, total: 3, first: 0, last: 2:
    1304 bytes, memory type: any
    308 bytes, memory type: any
    24 bytes, memory type: chip

Hunk #0, blocks:

  Code block (1001 / 0x3e9), size: 1304 bytes, 326 longwords, memory type: any

  Reloc32 block (1004 / 0x3ec):
    Base address hunk #0, 1 offsets: [1226]
    Base address hunk #1, 2 offsets: [20, 10]
    Base address hunk #2, 2 offsets: [658, 644]

Hunk #1, blocks:

  Data block (1002 / 0x3ea), size: 92 bytes, 23 longwords, memory type: any

  Reloc32 block (1004 / 0x3ec):
    Base address hunk #0, 2 offsets: [56, 36]
    Base address hunk #1, 2 offsets: [86, 40]

Hunk #2, blocks:

  Data block (1002 / 0x3ea), size: 24 bytes, 6 longwords, memory type: chip

References

  • AmigaDOS Technical Reference Manual 3rd Edition (book)
  • AMIGA ROM Kernel Reference Manual: AmigaDos (book)
  • Hunk File Format

License

Licensed under 0BSD license.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

About

Rust library to read and write Amiga Hunk File format

Topics

Resources

License

Stars

Watchers

Forks

Contributors