sovereignx/asm/macros.s

96 lines
2 KiB
ArmAsm
Raw Normal View History

2015-10-08 08:21:20 +01:00
.macro include_range start, end
.incbin "base_emerald.gba", \start, \end - \start
.endm
.macro arm_func_start name
.align 2, 0
.global \name
.arm
.type \name, %function
.endm
.macro arm_func_end name
.size \name, .-\name
.endm
.macro thumb_func_start name
.align 2, 0
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro non_word_aligned_thumb_func_start name
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro thumb_func_end name
.size \name, .-\name
.endm
.macro window_template bg_id, x, y, width, height, palette, vram_tile_offset
.byte \bg_id
.byte \x
.byte \y
.byte \width
.byte \height
.byte \palette
.2byte \vram_tile_offset
.endm
2015-10-07 14:48:45 +01:00
2015-10-08 02:24:21 +01:00
.macro glyph_width_func font_id, func
2015-10-07 14:48:45 +01:00
.4byte \font_id
.4byte \func
.endm
.macro keypad_icon tile_offset, width, height
.2byte \tile_offset
.byte \width
.byte \height
.endm
.macro font_info func, max_glyph_width, glyph_height, glyph_spacing, line_spacing, text_color, shadow_color, bg_color
.4byte \func
.byte \max_glyph_width
.byte \glyph_height
.byte \glyph_spacing
.byte \line_spacing
2015-10-10 11:12:48 +01:00
.byte \text_color << 4 ; low nybble seems unused
2015-10-07 14:48:45 +01:00
.byte (\shadow_color << 4) | \bg_color
2015-10-10 11:12:48 +01:00
.2byte 0 ; padding
2015-10-09 08:43:11 +01:00
.endm
2015-10-12 01:59:52 +01:00
.macro pokedex_entry category_name, height, width, text_pointer, pokemon_scale, pokemon_offset, trainer_scale, trainer_offset
.charmapstr "\category_name", 12
.2byte \height ; in decimeters
.2byte \width ; in hectograms
.4byte \text_pointer
.2byte 0 ; unused
.2byte \pokemon_scale
.2byte \pokemon_offset
.2byte \trainer_scale
.2byte \trainer_offset
.2byte 0 ; padding
.endm
2015-10-12 21:08:49 +01:00
.macro base_stats hp, attack, defense, speed, sp_attack, sp_defense
.byte \hp
.byte \attack
.byte \defense
.byte \speed
.byte \sp_attack
.byte \sp_defense
.endm
.macro ev_yield hp, attack, defense, speed, sp_attack, sp_defense
.2byte (\sp_defense << 10) | (\sp_attack << 8) | (\speed << 6) | (\defense << 4) | (\attack << 2) | \hp
.endm
2015-10-13 00:14:45 +01:00
.macro level_up_move level, move
.2byte (\level << 9) | \move
.endm