mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
dump scripting macros into script_macros.asm
This commit is contained in:
parent
f61e028871
commit
cb1a372d75
@ -1,3 +1,5 @@
|
||||
INCLUDE "script_macros.asm"
|
||||
|
||||
; macro for putting a byte then a word
|
||||
dbw: MACRO
|
||||
db \1
|
||||
|
@ -1526,7 +1526,10 @@ class Command:
|
||||
|
||||
def to_asm(self):
|
||||
#start with the rgbasm macro name for this command
|
||||
output = self.macro_name
|
||||
output = ""
|
||||
if self.macro_name[0].isdigit():
|
||||
output += "_"
|
||||
output += self.macro_name
|
||||
#return if there are no params
|
||||
if len(self.param_types.keys()) == 0: return output
|
||||
#first one will have no prefixing comma
|
||||
@ -1835,6 +1838,31 @@ def create_command_classes(debug=False):
|
||||
return klasses
|
||||
command_classes = create_command_classes()
|
||||
|
||||
def generate_macros(filename="../script_macros.asm"):
|
||||
"""generates all macros based on commands
|
||||
this is dumped into script_macros.asm"""
|
||||
output = "; This file is generated by generate_macros.\n"
|
||||
for command in command_classes:
|
||||
output += "\n"
|
||||
if command.macro_name[0].isdigit():
|
||||
output += "_"
|
||||
output += command.macro_name + ": MACRO\n"
|
||||
output += spacing + "db $%.2x\n"%(command.id)
|
||||
current_param = 1
|
||||
for (index, each) in command.param_types.items():
|
||||
if issubclass(each["class"], SingleByteParam):
|
||||
output += spacing + "db \\" + str(current_param) + "\n"
|
||||
elif issubclass(each["class"], MultiByteParam):
|
||||
output += spacing + "dw \\" + str(current_param) + "\n"
|
||||
current_param += 1
|
||||
output += spacing + "ENDM\n"
|
||||
|
||||
fh = open(filename, "w")
|
||||
fh.write(output)
|
||||
fh.close()
|
||||
|
||||
return output
|
||||
|
||||
#use this to keep track of commands without pksv names
|
||||
pksv_no_names = {}
|
||||
def pretty_print_pksv_no_names():
|
||||
|
857
script_macros.asm
Normal file
857
script_macros.asm
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user