Added new folder & file for the .data section. Also decompiled menu_caution_loop

This commit is contained in:
David Benepe
2020-07-16 02:52:53 -05:00
parent 09ce035927
commit a73991f52e
18 changed files with 16769 additions and 526 deletions
+32 -2
View File
@@ -9,6 +9,7 @@ LD_NAME = 'dkr.ld'
ASM_DIR = './asm'
SRC_DIR = './src'
ASSETS_S_FILENAME = './asm/assets/assets.s'
ASSETS_UCODE_S_FILENAME = './asm/assets/ucode.s'
ASSETS_DIR = './assets/us_1.0'
ASSETS_START = 0x0D8200
@@ -49,6 +50,8 @@ class LD:
self.gen_line('romPos = 0x0;')
self.gen_boot_section()
self.gen_main_section()
self.gen_ucode_section()
self.gen_data_section()
self.gen_assets_section()
self.gen_discard()
self.gen_close_block()
@@ -71,6 +74,22 @@ class LD:
self.gen_line('romPos += SIZEOF(.main);')
self.gen_newline()
def gen_ucode_section(self):
self.gen_line('.ucode 0 : AT(romPos)')
self.gen_open_block()
self.gen_line('build/asm/assets/ucode.o(.text);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.ucode);')
self.gen_newline()
def gen_data_section(self):
self.gen_line('.main_data 0x80000400 : AT(romPos) SUBALIGN(16)')
self.gen_open_block()
self.gen_line('build/data/dkr.data.o(.data);')
self.gen_close_block()
self.gen_line('romPos += SIZEOF(.main_data);')
self.gen_newline()
def gen_assets_section(self):
self.gen_line('.assets 0 : AT(romPos)')
self.gen_open_block()
@@ -161,6 +180,9 @@ class LD:
if matches is None:
raise Exception('Invalid filename: \"' + filename + '"')
matchedGroups = matches.groups()
isMicrocode = False
if matchedGroups[0].startswith('ucode/ucode_'):
isMicrocode = True
fileExtension = matchedGroups[3]
fileProperties = matchedGroups[1].split('.')
ramAddress = fileProperties[0]
@@ -170,7 +192,7 @@ class LD:
outFileExtension = '.bin'
outFilename = 'build/' + matchedGroups[0] + '.' + matchedGroups[1] + outFileExtension
if int(ramAddress, 16) >= ASSETS_START:
assetFiles.append((outFilename, ramAddress, fileExtension))
assetFiles.append((outFilename, ramAddress, fileExtension, isMicrocode))
assetFiles.sort(key = lambda x: x[1]) # Sort tuples by RAM address
return assetFiles
@@ -178,6 +200,7 @@ class LD:
assets = self.get_asset_files()
assetsText = '# This file was generated by generate_ld.py\n\n'
assetsText += '.macro .incbinaligned filename\n .balign 16\n .incbin "\\filename"\n.endm\n\n'
assetsUCodeText = '# This file was generated by generate_ld.py\n\n'
prevAssetMadeAlignment = False
for asset in assets:
if 'lut' in asset[0]:
@@ -186,7 +209,11 @@ class LD:
if prevAssetMadeAlignment:
assetsText += '.incbinaligned "./' + asset[0] + '"\n'
else:
assetsText += '.incbin "./' + asset[0] + '"\n'
if asset[3]:
assetsUCodeText += '.incbin "./' + asset[0] + '"\n'
else:
assetsText += '.incbin "./' + asset[0] + '"\n'
if asset[2] == '.png' or asset[2] == '.cbin' or 'lut' in asset[0]: # Make sure that compressed data ends on a 16-byte boundary
#assetsText += '.balign 16\n'
prevAssetMadeAlignment = True
@@ -194,6 +221,9 @@ class LD:
prevAssetMadeAlignment = False
with open(ASSETS_S_FILENAME, "w") as assetsFile:
assetsFile.write(assetsText)
with open(ASSETS_UCODE_S_FILENAME, "w") as assetsFile:
assetsFile.write(assetsUCodeText)
with open(LD_NAME, 'w') as ldFile: