wswan:guide:elf_quirks
This is an old revision of the document!
WonderSwan ELF quirks
The ELF format created by Wonderful has some quirks, owing both to the non-upstream binutils fork used and to the specifics of the ROM format itself.
In general, gcc-ia16 ELF files follow the 32-bit x86 ELF format.
Address space
ELF addresses 0x80000000 - 0xFFFFFFFF
correspond to ROM addresses.
31 bit 0
---- ---- ---- ---- ---- ---- ---- ----
1bbb bbbb bbbb cccc cccc cccc cccc cccc
||| |||| |||| |||| |||| |||| |||| ||||
||| |||| |||| ++++-++++-++++-++++-++++- CPU address (bits 0-19)
+++-++++-++++-------------------------- ROM bank (bits 30-20)
Corresponds to banks 000 - 7FF (128 MB maximum)
The last ROM bank uses addresses FFFxxxxx
ELF addresses 0x00000000 - 0x0000FFFF
correspond to IRAM addresses.
31 bit 0
---- ---- ---- ---- ---- ---- ---- ----
0000 0000 0000 0000 cccc cccc cccc cccc
|||| |||| |||| ||||
++++-++++-++++-++++- IRAM address (bits 0-15)
ELF addresses 0x00010000 - 0x0001FFFF
currently correspond to SRAM addresses, but this may be changed in a future version (to support >64KB SRAM), so please don't rely on it.
wswan/guide/elf_quirks.1726996602.txt.gz · Last modified: 2024/09/22 09:16 by asie