  - name: makerom
    type: code
    start: 0x0
    subsegments:
      - {start: 0x0, type: header, name: header}
      - {start: 0x40, type: textbin, name: ipl3}
      - {start: 0x1000, type: asm, vram: 0x80000400, name: entry}

  - name: main
    type: code
    dir: main
    start: 0x1050
    vram: 0x80000450
    bss_size: 0x9B1F0
    subsegments:
    # Microcode
      - [0x01050, textbin, rspboot]
      - [0x01120, textbin, aspmain]
      - [0x02010, textbin, f3dex]

    # Nintendo libraries
      - [0x03440, c, sys_joybus]
      - [0x03A80, c, sys_lib]
      - [0x041D0, c, sys_lights]
      - [0x04650, c, sys_main]
      - [0x05A20, c, sys_math]
      - [0x06280, c, sys_matrix]
      - [0x07B20, c, sys_memory]
      - [0x07B60, c, sys_timer]
      - [0x07D30, c, sys_save]
      - [0x07FC0, c, sys_fault]

      - [0x08CC0, c, audio_synthesis]
      - [0x0C870, c, audio_heap]
      - [0x0F0A0, c, audio_load]
      - [0x12490, c, audio_playback]
      - [0x14000, c, audio_effects]
      - [0x14AA0, c, audio_seqplayer]
      - [0x17650, c, audio_general]
      - [0x1EB50, c, audio_thread]

      - [0x1FA60, c, sys_1FA60] # May be blanked out osDriveRomInit
      - [0x1FA70, hasm, sys_mio0]
      - [0x1FB10, hasm, sys_rdramcheck]
      - [0x1FBC0, textbin, sys_alt_ipl3]
      - [0x205E0, c, sys_sprintf]
      - [0x206B0, c, sys_math64]
      - [0x20A60, hasm, sys_fp_text]

    # Libultra
      - [0x20BC0, c, ../libultra/io/controller]
      - [0x20F80, c, ../libultra/io/contreaddata]
      - [0x211E0, c, ../libultra/os/recvmesg]
      - [0x21320, c, ../libultra/os/sendmesg]
      - [0x21470, c, ../libultra/io/contquery]
      - [0x21520, c, ../libultra/io/motor]
      - [0x21B40, c, ../libultra/gu/perspective]
      - [0x21DD0, c, ../libultra/gu/lookat]
      - [0x22100, c, ../libultra/gu/ortho]
      - [0x222C0, hasm, ../libultra/os/invalicache]
      - [0x22340, hasm, ../libultra/os/invaldcache]
      - [0x223F0, c, ../libultra/io/pidma]
      - [0x22500, c, ../libultra/io/viblack]
      - [0x22570, hasm, ../libultra/os/writebackdcacheall]
      - [0x225A0, c, ../libultra/io/viswapbuf]
      - [0x225F0, c, ../libultra/io/virepeatline]
      - [0x22660, hasm, ../libultra/os/parameter]
      - [0x226C0, c, ../libultra/io/visetmode]
      - [0x22730, c, ../libultra/io/visetspecial]
      - [0x228F0, c, ../libultra/os/createmesgqueue]
      - [0x22920, c, ../libultra/os/seteventmesg]
      - [0x22990, c, ../libultra/io/visetevent]
      - [0x22A00, c, ../libultra/io/sptaskyielded]
      - [0x22A80, c, ../libultra/io/sptaskyield]
      - [0x22AA0, c, ../libultra/io/sptask]
      - [0x22D90, c, ../libultra/io/dpsetstat]
      - [0x22DA0, c, ../libultra/os/createthread]
      - [0x22EF0, c, ../libultra/os/startthread]
      - [0x23040, c, ../libultra/io/vimgr]
      - [0x233A0, c, ../libultra/io/pimgr]
      - [0x23680, c, ../libultra/os/setthreadpri]
      - [0x23760, c, ../libultra/os/initialize]
      - [0x23C00, c, ../libultra/os/gettime]
      - [0x23C90, c, ../libultra/gu/sinf]
      - [0x23E50, c, ../libultra/gu/cosf]
      - [0x23FC0, c, ../libultra/gu/sqrtf]
      - [0x23FD0, c, ../libultra/os/settimer]
      - [0x240B0, c, ../libultra/io/conteepread]
      - [0x243B0, c, ../libultra/io/conteepwrite]
      - [0x24890, c, ../libultra/libc/ll]
      - [0x24B50, c, ../libultra/io/conteepprobe]
      - [0x24BC0, c, ../libultra/libc/string]
      - [0x24C60, c, ../libultra/libc/xprintf]
      - [0x25920, c, ../libultra/os/settime]
      - [0x25950, c, ../libultra/os/getactivequeue]
      - [0x25960, c, ../libultra/io/aisetfreq]
      - [0x25AC0, c, ../libultra/io/cartrominit]
      - [0x25BB0, c, ../libultra/io/epidma]
      - [0x25C90, c, ../libultra/io/aigetlen]
      - [0x25CA0, c, ../libultra/io/aisetnextbuf]
      - [0x25D50, hasm, ../libultra/os/getcount]
      - [0x25D60, c, ../libultra/io/sirawdma]
      - [0x25E10, c, ../libultra/io/siacs]
      - [0x25ED0, hasm, ../libultra/os/interrupt]
      - [0x25F10, c, ../libultra/os/thread]
      - [0x25F50, hasm, ../libultra/os/exceptasm]
      - [0x26CD0, c, ../libultra/io/pfsisplug]
      - [0x27040, c, ../libultra/io/crc]
      - [0x271C0, c, ../libultra/io/contramwrite]
      - [0x27540, c, ../libultra/io/contramread]
      - [0x278D0, c, ../libultra/gu/mtxutil]
      - [0x27B40, c, ../libultra/os/jammesg]
      - [0x27C90, c, ../libultra/io/pigetcmdq]
      - [0x27CC0, c, ../libultra/io/vi]
      - [0x27E00, c, ../libultra/io/spgetstat]
      - [0x27E10, c, ../libultra/io/spsetstat]
      - [0x27E20, hasm, ../libultra/libc/bcopy]
      - [0x28130, c, ../libultra/os/virtualtophysical]
      - [0x281B0, hasm, ../libultra/os/writebackdcache]
      - [0x28230, c, ../libultra/io/spsetpc]
      - [0x28270, c, ../libultra/io/sprawdma]
      - [0x28300, c, ../libultra/io/sp]
      - [0x28330, c, ../libultra/os/timerintr]
      - [0x28800, c, ../libultra/os/getthreadpri]
      - [0x28820, c, ../libultra/io/vigetcurrcontext]
      - [0x28830, c, ../libultra/io/viswapcontext]
      - [0x28B90, c, ../libultra/io/leodiskinit]
      - [0x28C90, c, ../libultra/io/piacs]
      - [0x28D50, c, ../libultra/io/pirawdma]
      - [0x28E30, c, ../libultra/io/epirawdma]
      - [0x29060, c, ../libultra/io/devmgr]
      - [0x294F0, c, ../libultra/os/rdbsend]
      - [0x297B0, hasm, ../libultra/os/setsr]
      - [0x297C0, hasm, ../libultra/os/getsr]
      - [0x297D0, hasm, ../libultra/os/setfpccsr]
      - [0x297E0, c, ../libultra/io/sirawread]
      - [0x29830, c, ../libultra/io/sirawwrite]
      - [0x29880, hasm, ../libultra/os/maptlbrdb]
      - [0x298E0, c, ../libultra/io/pirawread]
      - [0x29940, hasm, ../libultra/libc/bzero]
      - [0x299E0, c, ../libultra/libc/xlitob]
      - [0x29C80, c, ../libultra/libc/xldtob]
      - [0x2A740, c, ../libultra/io/ai]
      - [0x2A770, c, ../libultra/io/si]
      - [0x2A7A0, c, ../libultra/debug/kdebugserver]
      - [0x2AAB0, c, ../libultra/host/readhost]
      - [0x2AB80, c, ../libultra/rmon/rmonsio]
      - [0x2AD80, c, ../libultra/os/initrdb]
      - [0x2AE10, c, ../libultra/io/leointerrupt]
      - [0x2B690, hasm, ../libultra/os/setintmask]
      - [0x2B730, c, ../libultra/os/destroythread]
      - [0x2B830, c, ../libultra/io/pfsgetstatus]
      - [0x2B940, hasm, ../libultra/os/probetlb]
      - [0x2BA00, hasm, ../libultra/os/setcompare]
      - [0x2BA10, c, ../libultra/os/resetglobalintmask]
      - [0x2BA70, c, ../libultra/io/epirawwrite]
      - [0x2BAC0, c, ../libultra/io/epirawread]
      - [0x2BB10, c, ../libultra/os/setglobalintmask]
      - [0x2BB60, c, ../libultra/os/yieldthread]
      - [0x2BBB0, c, ../libultra/libc/ldiv]
      - [0x2BD40, hasm, ../libultra/os/getcause]
      - [0x2BD50, c, ../libultra/rmon/rmoncmds]
      - [0x2BDF0, c, ../libultra/rmon/rmonmem]
      - [0x2C700, c, ../libultra/rmon/rmontask]
      - [0x2D170, c, ../libultra/rmon/rmonmisc]
      - [0x2D300, c, ../libultra/rmon/rmonregs]
      - [0x2DF00, c, ../libultra/rmon/rmonbrk]
      - [0x2E9E0, c, ../libultra/rmon/rmonmain]
      - [0x2EDE0, c, ../libultra/io/sprawwrite]
      - [0x2EE30, c, ../libultra/io/sprawread]
      - [0x2EE80, c, ../libultra/os/stopthread]
      - [0x2EF40, hasm, ../libultra/rmon/rmonrcp]

    # Game engine
      - [0x2EFE0, c, fox_360]
      - [0x36930, c, fox_beam]
      - [0x3E6F0, c, fox_bg]
      - [0x43AC0, c, fox_boss]
      - [0x43E80, c, fox_tank]
      - [0x496C0, c, fox_demo]
      - [0x52730, c, fox_display]
      - [0x59780, c, fox_load]
      - [0x5A0F0, c, fox_edata]
      - [0x5A2C0, c, fox_edisplay]
      - [0x61B30, c, fox_enmy]
      - [0x6B3B0, c, fox_enmy2]
      - [0x77E40, c, fox_effect]
      - [0x84F70, c, fox_fade]
      - [0x852F0, c, fox_852F0]
      - [0x85530, c, fox_hud]
      - [0x97F80, c, fox_97F80]
      - [0x9A580, c, fox_std_lib]
      - [0xA24B0, c, fox_game]
      - [0xA4290, c, fox_A4290]
      - [0xA48A0, c, fox_A48A0]
      - [0xA4B50, c, fox_play]
      - [0xB99D0, c, fox_rcp]
      - [0xBB360, c, fox_radio]
      - [0xBD0B0, c, fox_reset]
      - [0xBD360, c, fox_versus]
      - [0xC3430, c, fox_message]
      - [0xC3BB0, c, fox_save]

      # DATA - Microcode
      - [0xC3EE0, data, aspmain]
      - [0xC4210, .data, audiotables]
      - [0xC49D0, data, f3dex]

      # DATA - Nintendo Libraries
      - [0xC51D0, .data, sys_main]
      - [0xC51E0, .data, sys_math]
      - [0xC5220, .data, sys_matrix]
      - [0xC52F0, .data, sys_fault]
      - [0xC54D0, .data, audio_synthesis]
      - [0xC55B0, .data, audio_heap]
      - [0xC5B50, .data, audio_load]
      - [0xC6120, .data, audio_playback] # could be C6110?
      - [0xC6500, .data, audio_effects]
      - [0xC6520, .data, audio_seqplayer]
      - [0xC68E0, .data, audio_general]
      - [0xC80D0, .data, audio_context]
      - [0xC8850, .data, audio_thread]
      - [0xC8880, .data, sys_sprintf]

      # DATA - Libultra
      - [0xC88C0, .data, ../libultra/io/controller]
      - [0xC88D0, .data, ../libultra/vimodes/vimodentsclan1]
      - [0xC8920, .data, ../libultra/vimodes/vimodepallan1]
      - [0xC8970, .data, ../libultra/vimodes/vimodempallan1]
      - [0xC89DC, .data, ../libultra/io/vimgr]
      - [0xC89E0, .data, ../libultra/io/pimgr]
      - [0xC8A10, .data, ../libultra/os/initialize]
      - [0xC8A30, .data, ../libultra/libc/xprintf]
      - [0xC8A80, .data, ../libultra/io/aisetnextbuf]
      - [0xC8A90, .data, ../libultra/io/siacs]
      - [0xC8AA0, .data, ../libultra/os/thread]
      - [0xC8AC0, data, ../libultra/os/exceptasm]
      - [0xC8AE0, .data, ../libultra/io/vi]
      - [0xC8B50, .data, ../libultra/os/timerintr]
      - [0xC8B60, .data, ../libultra/io/piacs]
      - [0xC8B70, .data, ../libultra/os/rdbsend]
      - [0xC8B80, .data, ../libultra/libc/xlitob]
      - [0xC8BB0, .data, ../libultra/debug/kdebugserver]
      - [0xC8BC0, .data, ../libultra/host/readhost]
      - [0xC8BD0, .data, ../libultra/rmon/rmoncmds]
      - [0xC8CB0, .data, ../libultra/rmon/rmonmain]

      # RODATA - Nintendo Libraries
      - [0xC8CC0, .rodata, sys_math]
      - [0xC8D10, .rodata, sys_matrix]
      - [0xC8D20, .rodata, sys_save]
      - [0xC8E40, .rodata, sys_fault]
      - [0xC9220, .rodata, audio_synthesis]
      - [0xC9260, .rodata, audio_heap]
      - [0xC9280, .rodata, audio_load]
      - [0xC92C0, .rodata, audio_playback]
      - [0xC92EC, .rodata, audio_effects]
      - [0xC9320, .rodata, audio_seqplayer]
      - [0xC99D0, .rodata, audio_general]
      - [0xC9CF0, .rodata, audio_thread]
      - [0xC9F10, .rodata, sys_math64]

      # RODATA - Libultra
      - [0xC9F30, .rodata, ../libultra/gu/perspective]
      - [0xC9F40, .rodata, ../libultra/gu/sinf]
      - [0xC9F90, .rodata, ../libultra/gu/cosf]
      - [0xC9FE0, .rodata, ../libultra/libc/xprintf]
      - [0xCA0E0, rodata, ../libultra/os/exceptasm]
      - [0xCA150, .rodata, ../libultra/io/devmgr]
      - [0xCA170, rodata, ../libultra/gu/libm_vals]
      - [0xCA180, .rodata, ../libultra/libc/xldtob]
      - [0xCA1E0, rodata, ../libultra/os/setintmask]
      - [0xCA260, .rodata, ../libultra/rmon/rmonmem]
      - [0xCA330, .rodata, ../libultra/rmon/rmontask]
      - [0xCA3D0, .rodata, ../libultra/rmon/rmonmisc]
      - [0xCA400, .rodata, ../libultra/rmon/rmonregs]
      - [0xCA480, .rodata, ../libultra/rmon/rmonbrk]
      - [0xCA650,  rodata, ../libultra/rmon/rmonrcp]

      # DATA - game engine
      - [0xCA690, .data, fox_360]
      - [0xCA7C0, .data, fox_beam]
      - [0xCA830, .data, fox_bg]
      - [0xCAA90, .data, fox_boss]
      - [0xCAB00, .data, fox_tank]
      - [0xCAB60, .data, fox_demo]
      - [0xCAE20, .data, fox_display]
      - [0xCAFB0, .data, fox_load]
      - [0xCCA70, .data, fox_edata]
      - [0xD0570, .data, fox_edisplay]
      - [0xD09A0, .data, fox_enmy]
      - [0xD0B80, .data, fox_enmy2]
      - [0xD20E0, .data, fox_effect]
      - [0xD2570, .data, fox_hud]
      - [0xD31D0, .data, fox_std_lib]
      - [0xD3460, .data, fox_game]
      - [0xD3520, .data, fox_A4290]
      - [0xD3B50, .data, fox_play]
      - [0xD3D80, .data, fox_context]
      - [0xD3DB0, .data, fox_rcp]
      - [0xD5670, .data, fox_radio]
      - [0xD5680, .data, fox_reset]
      - [0xD5690, .data, fox_versus]
      - [0xD5910, .data, fox_save]

      # RODATA - game engine
      - [0xD5A10, .rodata, fox_360]
      - [0xD5CF0, .rodata, fox_beam]
      - [0xD5F90, .rodata, fox_bg]
      - [0xD61D0, .rodata, fox_boss]
      - [0xD61F0, .rodata, fox_tank]
      - [0xD6350, .rodata, fox_demo]
      - [0xD69A0, .rodata, fox_display]
      - [0xD6BA0, .rodata, fox_load]
      - [0xD6C20, .rodata, fox_edisplay]
      - [0xD6FD0, .rodata, fox_enmy]
      - [0xD7650, .rodata, fox_enmy2]
      - [0xD7E30, .rodata, fox_effect]
      - [0xD82F0, .rodata, fox_fade]
      - [0xD8320, .rodata, fox_hud]
      - [0xD8DE0, .rodata, fox_97F80]
      - [0xD8DF0, .rodata, fox_std_lib]
      - [0xD8E50, .rodata, fox_game]
      - [0xD8ED0, .rodata, fox_A4290]
      - [0xD8EE0, .rodata, fox_A48A0]
      - [0xD8EF0, .rodata, fox_play]
      - [0xD97F0, .rodata, fox_radio]
      - [0xD9E50, .rodata, fox_versus]
      - [0xD9F60, .rodata, fox_message]
      - [0xDA030, .rodata, fox_save]

      # Common assets
      - [0xDA0A0, .data, gfx_data]
      - [0xDC710, .data, wave_samples]
      - [0xDD330, .data, note_data]

      # Nintendo Library bss
      - { start: 0xDE480, type: .bss, vram: 0x800DD880, name: sys_joybus }
      - { type: .bss, vram: 0x800DDAA0, name:  sys_main }
      - { type: .bss, vram: 0x8013B3A0, name: sys_math }
      - { type: .bss, vram: 0x8013B3C0, name: sys_matrix }
      - { type: .bss, vram: 0x8013C3D0, name: sys_memory }
      - { type: .bss, vram: 0x80144BE0, name: sys_timer }
      - { type: .bss, vram: 0x80144F60, name: sys_save }
      - { type: .bss, vram: 0x80145360, name: sys_fault }
      - { type: .bss, vram: 0x80145D40, name: audio_synthesis }
      - { type: .bss, vram: 0x80146D80, name: audio_heap }
      - { type: .bss, vram: 0x80146D90, name: audio_load }
      - { type: .bss, vram: 0x80146E60, name: audio_general }
      - { type: .bss, vram: 0x8014BA40, name: audio_context }
      - { type: .bss, vram: 0x80155DA0, name: audio_thread }

      # Libultra bss
      - { type: .bss, vram: 0x80156620, name: ../libultra/io/controller }
      - { type: .bss, vram: 0x801566B0, name: ../libultra/io/motor }
      - { type: .bss, vram: 0x801568F0, name: ../libultra/os/seteventmesg }
      - { type: .bss, vram: 0x801569B0, name: ../libultra/io/sptask }
      - { type: .bss, vram: 0x801569F0, name: ../libultra/io/vimgr }
      - { type: .bss, vram: 0x80157C10, name: ../libultra/io/pimgr }
      - { type: .bss, vram: 0x801593D0, name: ../libultra/os/initialize }
      - { type: .bss, vram: 0x801593E0, name: ../libultra/io/conteepread }
      - { type: .bss, vram: 0x80159420, name: ../libultra/io/cartrominit }
      - { type: .bss, vram: 0x801594A0, name: ../libultra/io/siacs }
      - { type: .bss, vram: 0x801594C0, name: ../libultra/io/pfsisplug }
      - { type: .bss, vram: 0x80159500, name: ../libultra/os/timerintr }
      - { type: .bss, vram: 0x80159560, name: ../libultra/io/leodiskinit }
      - { type: .bss, vram: 0x801595E0, name: ../libultra/io/piacs }
      - { type: .bss, vram: 0x80159600, name: ../libultra/debug/kdebugserver }
      - { type: .bss, vram: 0x801597C0, name: ../libultra/host/readhost }
      - { type: .bss, vram: 0x801597F0, name: ../libultra/rmon/rmonsio }
      - { type: .bss, vram: 0x8015A010, name: ../libultra/os/initrdb }
      - { type: .bss, vram: 0x8015A030, name: ../libultra/io/leointerrupt }
      - { type: .bss, vram: 0x8015B030, name: ../libultra/rmon/rmonmem }
      - { type: .bss, vram: 0x8015B130, name: ../libultra/rmon/rmonmisc }
      - { type: .bss, vram: 0x8015F350, name: ../libultra/rmon/rmonregs }
      - { type: .bss, vram: 0x8015F370, name: ../libultra/rmon/rmonbrk }
      - { type: .bss, vram: 0x8015F480, name: ../libultra/rmon/rmonmain }

      # Game engine bss
      - { type: .bss, vram: 0x8015F900, name: fox_360 }
      - { type: .bss, vram: 0x8015F950, name: fox_beam }
      - { type: .bss, vram: 0x8015F960, name: fox_bg }
      - { type: .bss, vram: 0x801613A0, name: fox_boss }
      - { type: .bss, vram: 0x801613B0, name: fox_display }
      - { type: .bss, vram: 0x801615D0, name: fox_edisplay }
      - { type: .bss, vram: 0x80161670, name: fox_enmy }
      - { type: .bss, vram: 0x80161690, name: fox_enmy2 }
      - { type: .bss, vram: 0x801616A0, name: fox_hud }
      - { type: .bss, vram: 0x80161950, name: fox_97F80 }
      - { type: .bss, vram: 0x801619A0, name: fox_std_lib }
      - { type: .bss, vram: 0x80161A10, name: fox_game }
      - { type: .bss, vram: 0x80161A50, name: fox_play }
      - { type: .bss, vram: 0x80161A70, name: fox_context}
      - { type: .bss, vram: 0x80178580, name: fox_rcp }
      - { type: .bss, vram: 0x80178720, name: fox_radio }
      - { type: .bss, vram: 0x80178750, name: fox_versus }
      - { type: .bss, vram: 0x80178870, name: fox_save }

  - name: dma_table
    type: code
    dir: main
    start: 0xDE480
    vram: 0x80178A70
    follows_vram: main
    subsegments:
     - [0xDE480, .data, dmatable]
