summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/arm7_rom.s6
-rw-r--r--asm/filenametable.s4
-rw-r--r--asm/gap1.s4
-rw-r--r--asm/gap2.s4
-rw-r--r--asm/rom3.s4
-rw-r--r--asm/rom_header.s151
-rw-r--r--ld_script.txt25
7 files changed, 139 insertions, 59 deletions
diff --git a/asm/arm7_rom.s b/asm/arm7_rom.s
new file mode 100644
index 00000000..1a02882d
--- /dev/null
+++ b/asm/arm7_rom.s
@@ -0,0 +1,6 @@
+/* arm7_rom.s TODO: Disassemble */
+
+ .section .text
+ .global Entry_ARM7
+Entry_ARM7:
+ .incbin "baserom.nds", 0x30D000, 0x2931C
diff --git a/asm/filenametable.s b/asm/filenametable.s
new file mode 100644
index 00000000..0ebb43f8
--- /dev/null
+++ b/asm/filenametable.s
@@ -0,0 +1,4 @@
+ .text
+ .global FileNameTable
+FileNameTable:
+ .incbin "baserom.nds", 0x336400, 0x3cc9c00 @0x157F
diff --git a/asm/gap1.s b/asm/gap1.s
new file mode 100644
index 00000000..b71ccde3
--- /dev/null
+++ b/asm/gap1.s
@@ -0,0 +1,4 @@
+ .section .text
+ .rept 0x1E0
+ .byte 0xFF
+ .endr
diff --git a/asm/gap2.s b/asm/gap2.s
new file mode 100644
index 00000000..4af77b6d
--- /dev/null
+++ b/asm/gap2.s
@@ -0,0 +1,4 @@
+ .text
+ .rept 0x336400-0x33631c
+ .byte 255
+ .endr
diff --git a/asm/rom3.s b/asm/rom3.s
index ddb524ba..9bbb7b7a 100644
--- a/asm/rom3.s
+++ b/asm/rom3.s
@@ -1,5 +1,5 @@
/* rom3.s TODO: Disassemble */
-.section .text
+ .section .text
-.incbin "baserom.nds", 0x10B724, 0x3EF48DC
+ .incbin "baserom.nds", 0x10B724, 0x2016FC
diff --git a/asm/rom_header.s b/asm/rom_header.s
index 2dc62ad5..9b63d7e5 100644
--- a/asm/rom_header.s
+++ b/asm/rom_header.s
@@ -1,115 +1,152 @@
/* ROM HEADER for Pokemon Diamond (US) */
-.section .text
+ .section .text
-.balign 4
+ .balign 4
+ .global GameTitle
GameTitle:
-.asciz "POKEMON D"
+ .asciz "POKEMON D"
-.balign 4
+ .balign 4
+ .global GameCode
GameCode:
-.ascii "ADAE"
+ .ascii "ADAE"
+ .global MakerCode
MakerCode:
-.ascii "01"
+ .ascii "01"
+ .global UnitCode
UnitCode:
-.byte 0
+ .byte 0
+ .global DeviceType
DeviceType:
-.byte 0
+ .byte 0
+ .global DeviceCapacity
DeviceCapacity:
-.byte 9
+ .byte 9
/*reserved*/
-.space 9
+ .space 9
+ .global RomVersion
RomVersion:
-.byte 5
+ .byte 5
/*reserved*/
-.space 1
+ .space 1
+ .global ARM9ROMOffset
ARM9ROMOffset:
-.word _arm9SegmentRomStart
+ .word _arm9SegmentRomStart
+ .global ARM9EntryAddress
ARM9EntryAddress:
-.word Entry
+ .word Entry
+ .global ARM9RAMAddress
ARM9RAMAddress:
-.word _arm9SegmentStart
+ .word _arm9SegmentStart
+ .global ARM9CodeSize
ARM9CodeSize:
-.word _arm9SegmentSize
+ .word _arm9SegmentSize
+ .global ARM7ROMOffset
ARM7ROMOffset:
-.word 0x0030D000
+ .word _arm7SegmentRomStart
+ .global ARM7EntryAddress
ARM7EntryAddress:
-.word 0x02380000
+ .word Entry_ARM7
+ .global ARM7RAMAddress
ARM7RAMAddress:
-.word 0x02380000
+ .word _arm7SegmentStart
+ .global ARM7CodeSize
ARM7CodeSize:
-.word 0x0002931C
+ .word _arm7SegmentSize
+ .global FileNameTableOffset
FileNameTableOffset:
-.word 0x00336400
+ .word _FileNameTableSegmentRomStart
+ .global FileNameTableSize
FileNameTableSize:
-.word 0x0000157F
+ .word 0x0000157F
+ .global FATOffset
FATOffset:
-.word 0x00337A00
+ .word 0x00337A00
+ .global FATSize
FATSize:
-.word 0x00000B20
+ .word 0x00000B20
+ .global ARM9OverlayOffset
ARM9OverlayOffset:
-.word 0x0010B800
+ .word 0x0010B800
+ .global ARM9OverlaySize
ARM9OverlaySize:
-.word 0x00000AE0
+ .word 0x00000AE0
+ .global ARM7OverlayOffset
ARM7OverlayOffset:
-.word 0x00000000
+ .word 0x00000000
+ .global ARM7OverlaySize
ARM7OverlaySize:
-.word 0x00000000
+ .word 0x00000000
+ .global ROMControlInfo1
ROMControlInfo1:
-.word 0x00416657
+ .word 0x00416657
+ .global ROMControlInfo2
ROMControlInfo2:
-.word 0x081808F8
+ .word 0x081808F8
+ .global IconTitleOffset
IconTitleOffset:
-.word 0x00338600
+ .word 0x00338600
+ .global SecureAreaCC
SecureAreaCC:
-.short 0x5931
+ .short 0x5931
+ .global ROMControlInfo3
ROMControlInfo3:
-.short 0x0D7E
+ .short 0x0D7E
+ .global ARM9AutoLoadHook
ARM9AutoLoadHook:
-.word 0x02000A74
+ .word 0x02000A74
+ .global ARM7AutoLoadHook
ARM7AutoLoadHook:
-.word 0x02380158
+ .word 0x02380158
+ .global SecureAreaDisable
SecureAreaDisable:
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .global ApplicationEndOffset
ApplicationEndOffset:
-.word 0x03A55EC0
+ .word 0x03A55EC0
+ .global ROMHeaderSize
ROMHeaderSize:
-.word 0x00004000
+ .word 0x00004000
/* should be 36 bytes here but again theres stuff here. TODO: Identify */
-.byte 0x68, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-.byte 0x00, 0x00, 0x00, 0x00
+ .byte 0x68, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ .byte 0x00, 0x00, 0x00, 0x00
+ .global PassMeAutobootDetect
PassMeAutobootDetect:
-.word 0x00000000
+ .word 0x00000000
/* reserved */
-.space 16
+ .space 16
+ .global NintendoLogo
NintendoLogo:
-.byte 0x24, 0xFF, 0xAE, 0x51, 0x69, 0x9A, 0xA2, 0x21, 0x3D, 0x84, 0x82, 0x0A, 0x84, 0xE4, 0x09, 0xAD
-.byte 0x11, 0x24, 0x8B, 0x98, 0xC0, 0x81, 0x7F, 0x21, 0xA3, 0x52, 0xBE, 0x19, 0x93, 0x09, 0xCE, 0x20
-.byte 0x10, 0x46, 0x4A, 0x4A, 0xF8, 0x27, 0x31, 0xEC, 0x58, 0xC7, 0xE8, 0x33, 0x82, 0xE3, 0xCE, 0xBF
-.byte 0x85, 0xF4, 0xDF, 0x94, 0xCE, 0x4B, 0x09, 0xC1, 0x94, 0x56, 0x8A, 0xC0, 0x13, 0x72, 0xA7, 0xFC
-.byte 0x9F, 0x84, 0x4D, 0x73, 0xA3, 0xCA, 0x9A, 0x61, 0x58, 0x97, 0xA3, 0x27, 0xFC, 0x03, 0x98, 0x76
-.byte 0x23, 0x1D, 0xC7, 0x61, 0x03, 0x04, 0xAE, 0x56, 0xBF, 0x38, 0x84, 0x00, 0x40, 0xA7, 0x0E, 0xFD
-.byte 0xFF, 0x52, 0xFE, 0x03, 0x6F, 0x95, 0x30, 0xF1, 0x97, 0xFB, 0xC0, 0x85, 0x60, 0xD6, 0x80, 0x25
-.byte 0xA9, 0x63, 0xBE, 0x03, 0x01, 0x4E, 0x38, 0xE2, 0xF9, 0xA2, 0x34, 0xFF, 0xBB, 0x3E, 0x03, 0x44
-.byte 0x78, 0x00, 0x90, 0xCB, 0x88, 0x11, 0x3A, 0x94, 0x65, 0xC0, 0x7C, 0x63, 0x87, 0xF0, 0x3C, 0xAF
-.byte 0xD6, 0x25, 0xE4, 0x8B, 0x38, 0x0A, 0xAC, 0x72, 0x21, 0xD4, 0xF8, 0x07
+ .byte 0x24, 0xFF, 0xAE, 0x51, 0x69, 0x9A, 0xA2, 0x21, 0x3D, 0x84, 0x82, 0x0A, 0x84, 0xE4, 0x09, 0xAD
+ .byte 0x11, 0x24, 0x8B, 0x98, 0xC0, 0x81, 0x7F, 0x21, 0xA3, 0x52, 0xBE, 0x19, 0x93, 0x09, 0xCE, 0x20
+ .byte 0x10, 0x46, 0x4A, 0x4A, 0xF8, 0x27, 0x31, 0xEC, 0x58, 0xC7, 0xE8, 0x33, 0x82, 0xE3, 0xCE, 0xBF
+ .byte 0x85, 0xF4, 0xDF, 0x94, 0xCE, 0x4B, 0x09, 0xC1, 0x94, 0x56, 0x8A, 0xC0, 0x13, 0x72, 0xA7, 0xFC
+ .byte 0x9F, 0x84, 0x4D, 0x73, 0xA3, 0xCA, 0x9A, 0x61, 0x58, 0x97, 0xA3, 0x27, 0xFC, 0x03, 0x98, 0x76
+ .byte 0x23, 0x1D, 0xC7, 0x61, 0x03, 0x04, 0xAE, 0x56, 0xBF, 0x38, 0x84, 0x00, 0x40, 0xA7, 0x0E, 0xFD
+ .byte 0xFF, 0x52, 0xFE, 0x03, 0x6F, 0x95, 0x30, 0xF1, 0x97, 0xFB, 0xC0, 0x85, 0x60, 0xD6, 0x80, 0x25
+ .byte 0xA9, 0x63, 0xBE, 0x03, 0x01, 0x4E, 0x38, 0xE2, 0xF9, 0xA2, 0x34, 0xFF, 0xBB, 0x3E, 0x03, 0x44
+ .byte 0x78, 0x00, 0x90, 0xCB, 0x88, 0x11, 0x3A, 0x94, 0x65, 0xC0, 0x7C, 0x63, 0x87, 0xF0, 0x3C, 0xAF
+ .byte 0xD6, 0x25, 0xE4, 0x8B, 0x38, 0x0A, 0xAC, 0x72, 0x21, 0xD4, 0xF8, 0x07
+ .global LogoCRC
LogoCRC:
-.short 0xCF56
+ .short 0xCF56
+ .global HeaderCRC
HeaderCRC:
-.short 0xCA37
+ .short 0xCA37
/* reserved */
-.global __startup
+ .global __startup
__startup:
-.space 160 /* hack so it builds */
+ .space 160 /* hack so it builds */
diff --git a/ld_script.txt b/ld_script.txt
index ff0b1b18..4d20c18e 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -36,4 +36,29 @@ SECTIONS {
build/asm/rom3.o(.text);
}
END_SEG(rom3)
+
+ BEGIN_SEG(gap1, 0x2000000 + SIZEOF(rom3) + SIZEOF(arm9))
+ {
+ build/asm/gap1.o(.text);
+ }
+ END_SEG(gap1)
+
+ BEGIN_SEG(arm7, 0x02380000)
+ {
+ build/asm/arm7_rom.o(.text);
+ }
+ END_SEG(arm7)
+
+ BEGIN_SEG(gap2, 0x02380000 + SIZEOF(arm7))
+ {
+ build/asm/gap2.o(.text)
+ }
+ END_SEG(gap2)
+
+ . = 0x336400;
+ BEGIN_SEG(FileNameTable, 0x02400000)
+ {
+ build/asm/filenametable.o(.text);
+ }
+ END_SEG(FileNameTable)
}