2017-03-29 05:19:51 +01:00
|
|
|
.gba
|
|
|
|
.open "m12.gba",0x8000000
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
// Relocation hacks
|
|
|
|
//==============================================================================
|
|
|
|
|
2015-04-01 16:26:54 +01:00
|
|
|
// Move the weird box font from 0xFCE6C
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B3274 :: dw m2_font_relocate
|
2015-03-13 23:09:31 +00:00
|
|
|
|
2017-03-07 22:12:52 +00:00
|
|
|
|
2015-03-13 23:09:31 +00:00
|
|
|
//==============================================================================
|
|
|
|
// Font hacks
|
|
|
|
//==============================================================================
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x8AFED84 :: .incbin "m2-mainfont1-empty.bin"
|
|
|
|
.org 0x8B0F424 :: .incbin "m2-mainfont2-empty.bin"
|
|
|
|
.org 0x8B13424 :: .incbin "m2-mainfont3-empty.bin"
|
|
|
|
.org 0x8B088A4 :: .incbin "m2-shifted-cursor.bin"
|
2017-04-16 04:40:23 +01:00
|
|
|
.org 0x8B03384 :: .incbin "m2-header-bg.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
// Greek letters
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x8B1B907 :: db 0x8B // alpha
|
|
|
|
.org 0x8B1B90A :: db 0x8C // beta
|
|
|
|
.org 0x8B1B90D :: db 0x8D // gamma
|
|
|
|
.org 0x8B1B910 :: db 0x8E // sigma
|
|
|
|
.org 0x8B1B913 :: db 0x8F // omega
|
2015-03-13 23:09:31 +00:00
|
|
|
|
2017-03-09 06:04:02 +00:00
|
|
|
|
2017-03-07 22:12:52 +00:00
|
|
|
//==============================================================================
|
|
|
|
// VWF hacks
|
|
|
|
//==============================================================================
|
2017-02-25 00:29:19 +00:00
|
|
|
|
2017-03-09 18:16:37 +00:00
|
|
|
// 32- to 16-bit access change for window flags
|
2017-04-03 03:12:18 +01:00
|
|
|
.org 0x80BE16A :: strh r2,[r4]
|
|
|
|
.org 0x80BE1FA :: strh r2,[r6]
|
|
|
|
.org 0x80BE222 :: strh r6,[r1]
|
2017-03-09 06:04:02 +00:00
|
|
|
|
2017-03-17 15:50:45 +00:00
|
|
|
// PSI class window size
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B7820
|
|
|
|
mov r1,4
|
|
|
|
mov r2,1
|
|
|
|
mov r3,6
|
2017-03-17 15:50:45 +00:00
|
|
|
|
2017-03-14 04:06:36 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 00:32:11 +00:00
|
|
|
// C0A5C hacks (status window)
|
2017-03-14 04:06:36 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.include "m2-status-initial.asm"
|
|
|
|
.include "m2-status-switch.asm"
|
2017-03-14 04:06:36 +00:00
|
|
|
|
2017-03-17 00:32:11 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// BAC18 hacks (status window switching)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80BACFC :: bl bac18_redraw_status
|
|
|
|
.org 0x80BADE6 :: bl bac18_redraw_status
|
|
|
|
.org 0x80BACEE :: bl bac18_clear_psi
|
|
|
|
.org 0x80BADC8
|
|
|
|
bl bac18_check_button
|
|
|
|
b 0x80BADD8
|
2017-03-17 00:32:11 +00:00
|
|
|
|
2017-03-18 01:22:35 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// BAEF8 hacks (equip window)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Erase offense change
|
2017-04-03 14:56:18 +01:00
|
|
|
.macro erase_offense
|
|
|
|
mov r0,0xC
|
|
|
|
mov r1,0xB
|
|
|
|
mov r2,4
|
|
|
|
bl print_blankstr
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
.macro erase_defense
|
|
|
|
mov r0,0xC
|
|
|
|
mov r1,0xD
|
|
|
|
mov r2,4
|
|
|
|
bl print_blankstr
|
|
|
|
.endmacro
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80BB216 :: erase_offense
|
|
|
|
.org 0x80BB38C :: erase_offense
|
|
|
|
.org 0x80BB4C6 :: erase_offense
|
|
|
|
.org 0x80BB5FC :: erase_offense
|
|
|
|
.org 0x80BBAAE :: erase_offense
|
|
|
|
.org 0x80BBBF6 :: erase_offense
|
|
|
|
.org 0x80BBD54 :: erase_offense
|
2017-03-18 01:22:35 +00:00
|
|
|
|
|
|
|
// Erase defense change
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80BB226 :: erase_defense
|
|
|
|
.org 0x80BBABE :: erase_defense
|
|
|
|
.org 0x80BBC06 :: erase_defense
|
|
|
|
.org 0x80BBD64 :: erase_defense
|
2017-03-18 01:22:35 +00:00
|
|
|
|
|
|
|
// Erase offense/defense after changing equipment
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80BB3E2 :: bl baef8_reequip_erase
|
|
|
|
.org 0x80BB518 :: bl baef8_reequip_erase
|
|
|
|
.org 0x80BBB12 :: bl baef8_reequip_erase
|
|
|
|
.org 0x80BBC70 :: bl baef8_reequip_erase
|
2017-03-18 01:22:35 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2017-04-06 06:39:11 +01:00
|
|
|
// BF858 hacks (goods window)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Skip the tile-by-tile nonsense and use existing string printing subs
|
|
|
|
.org 0x80BFB08 :: mov r4,r0 :: nop
|
|
|
|
.org 0x80BFB10 :: b 0x80BFB34
|
|
|
|
|
|
|
|
.org 0x80BFB34
|
|
|
|
// Only render on button press
|
|
|
|
ldr r0,=0x3002504 // for some reason 3002500 is already cleared when opening the window,
|
|
|
|
// but 3002504 seems to be a copy of what it used to be?
|
|
|
|
ldrb r0,[r0]
|
|
|
|
cmp r0,0
|
|
|
|
beq 0x80BFB84
|
|
|
|
// Check for equip
|
|
|
|
ldrh r0,[r7,0x3C]
|
|
|
|
add r0,r8
|
|
|
|
add r0,1
|
|
|
|
lsl r0,r0,0x18
|
|
|
|
lsr r0,r0,0x18
|
|
|
|
bl 0x80BC670
|
|
|
|
mov r3,0
|
|
|
|
lsl r0,r0,0x18
|
|
|
|
lsr r0,r0,0x18
|
|
|
|
cmp r0,1
|
|
|
|
bne @@noequip
|
|
|
|
mov r3,1
|
|
|
|
@@noequip:
|
|
|
|
lsl r2,r5,15
|
|
|
|
lsr r2,r2,31
|
|
|
|
mov r0,11
|
|
|
|
mul r2,r0
|
|
|
|
add r2,1
|
|
|
|
add r2,r2,r3 // r2 = X tile, 1 or 12 depending on the column (+1 if equipped)
|
|
|
|
lsr r3,r5,17 // r3 = Y tile
|
|
|
|
add sp,-4 // Need to push a 0 for the call to m2_printstr
|
|
|
|
mov r0,0
|
|
|
|
str r0,[sp]
|
|
|
|
mov r0,r7 // Window pointer
|
|
|
|
mov r1,r4 // String pointer
|
|
|
|
bl 0x80C9634 // m2_printstr
|
|
|
|
add sp,4
|
|
|
|
b 0x80BFB84 // Skip the remaining nonsense
|
|
|
|
.pool
|
|
|
|
|
|
|
|
// Skip the blank tile drawing after item names
|
|
|
|
.org 0x80BFBDA :: b 0x80BFBFA
|
|
|
|
|
2017-04-15 17:50:32 +01:00
|
|
|
// Only use as many tiles as needed in the tilemap for name headers
|
|
|
|
.org 0x80BFA52 :: bl bf858_name_header :: b 0x80BFA86
|
|
|
|
|
2017-04-06 06:39:11 +01:00
|
|
|
//---------------------------------------------------------
|
2017-03-18 01:22:35 +00:00
|
|
|
// C5500 hacks (equip window switching)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Clear offense/defense changes when moving cursor
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C5AA2 :: bl c5500_clear_up
|
|
|
|
.org 0x80C5B12 :: bl c5500_clear_down
|
2017-03-18 01:22:35 +00:00
|
|
|
|
|
|
|
// Don't draw equip icon
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C5A1A :: nop
|
|
|
|
.org 0x80C5A28 :: nop
|
2017-03-18 01:22:35 +00:00
|
|
|
|
2017-03-12 22:55:21 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// C1FBC hacks (PSI window)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C203E :: mov r1,0x14 // new PSI name entry length
|
|
|
|
.org 0x80C21B4 :: mov r1,0x14
|
|
|
|
.org 0x80C224A :: mov r1,0x14
|
|
|
|
.org 0x80C229E :: mov r1,0x14
|
2017-03-12 22:55:21 +00:00
|
|
|
|
2017-03-17 00:42:25 +00:00
|
|
|
// Draw PSI Rockin
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C2192
|
2017-03-17 00:42:25 +00:00
|
|
|
mov r2,r8
|
2017-04-03 03:12:18 +01:00
|
|
|
str r2,[sp]
|
2017-03-29 05:19:51 +01:00
|
|
|
mov r2,0xFD
|
|
|
|
lsl r2,r2,1
|
2017-03-17 00:42:25 +00:00
|
|
|
add r0,r6,r2
|
2017-03-29 05:19:51 +01:00
|
|
|
mov r1,0x71
|
|
|
|
mov r2,8
|
|
|
|
bl print_string
|
2017-03-17 00:42:25 +00:00
|
|
|
|
2017-03-25 22:54:09 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// C239C hacks (print PSI name)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C23AA :: lsr r2,r2,0xD // tiles-to-pixels
|
|
|
|
.org 0x80C23AE :: lsr r6,r3,0xD // tiles-to-pixels
|
|
|
|
.org 0x80C23CE :: bl c239c_print_psi :: nop :: nop :: nop
|
|
|
|
.org 0x80C23DA :: add r4,17 // pixel width of "PSI "
|
|
|
|
.org 0x80C23F0 :: bl print_string_hlight_pixels // print rockin'
|
|
|
|
.org 0x80C2402 :: mov r0,3 :: lsl r0,r0,0x10 // pixel width of space
|
|
|
|
.org 0x80C242E :: mov r0,0x14 // new PSI name entry length
|
|
|
|
.org 0x80C2448
|
|
|
|
bl print_string_hlight_pixels // print PSI name
|
|
|
|
mov r2,r1 // record X width
|
|
|
|
add r2,3 // add a space
|
|
|
|
.org 0x80C2468 :: bl print_string_hlight_pixels
|
2017-03-25 22:54:09 +00:00
|
|
|
|
2017-03-13 17:53:12 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// C438C hacks (PSI window cursor movement)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C4580 :: bl c438c_moveup
|
|
|
|
.org 0x80C4642 :: bl c438c_movedown
|
|
|
|
.org 0x80C4768 :: bl c438c_moveright
|
|
|
|
.org 0x80C48B2 :: bl c438c_moveleft
|
2017-03-13 17:53:12 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// PSI target window hacks
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// PSI target length hack
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B8B12 :: mov r0,0x14
|
|
|
|
.org 0x80C24EE :: mov r1,0x14
|
2017-03-13 17:53:12 +00:00
|
|
|
|
|
|
|
// Fix PSI target offset calculation
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B8B08
|
|
|
|
mov r1,100
|
2017-03-13 17:53:12 +00:00
|
|
|
mul r1,r2
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
|
|
|
// Make PP cost use correct number values
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA732
|
|
|
|
add r1,0x60
|
2017-03-13 17:53:12 +00:00
|
|
|
|
|
|
|
// Make PP cost use the correct space value if there's only one digit
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA712
|
|
|
|
mov r0,0x50
|
2017-03-13 17:53:12 +00:00
|
|
|
|
2017-03-18 16:47:40 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// B8BBC hacks (PSI window)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Redraw main menu when exiting PSI target window
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B8E3A :: bl b8bbc_redraw_menu_2to1
|
2017-03-18 17:38:32 +00:00
|
|
|
|
|
|
|
// Redraw main menu when entering PSI target window
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80B8CF8 :: bl b8bbc_redraw_menu_13to2 // 1 to 2
|
|
|
|
.org 0x80B920C :: bl b8bbc_redraw_menu_13to2 // 3 to 2
|
2017-03-18 16:47:40 +00:00
|
|
|
|
2017-03-11 04:43:04 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-11 18:30:08 +00:00
|
|
|
// C4B2C hacks (Equip window render)
|
2017-03-11 04:43:04 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Start equipment at the 6th tile instead of 5th
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C4C96 :: mov r2,6 // Weapon
|
|
|
|
.org 0x80C4D1C :: mov r2,6 // Body
|
|
|
|
.org 0x80C4DA4 :: mov r2,6 // Arms
|
|
|
|
.org 0x80C4E2C :: mov r2,6 // Other
|
2017-03-11 04:43:04 +00:00
|
|
|
|
|
|
|
// Only render (None) if necessary
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C4C0C
|
|
|
|
bl c4b2c_skip_nones
|
|
|
|
b 0x80C4C58
|
2017-03-11 04:43:04 +00:00
|
|
|
|
2017-03-11 04:52:22 +00:00
|
|
|
// Don't render equip symbols
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C4CD0 :: nop
|
|
|
|
.org 0x80C4CDE :: nop
|
|
|
|
.org 0x80C4D58 :: nop
|
|
|
|
.org 0x80C4D66 :: nop
|
|
|
|
.org 0x80C4DE0 :: nop
|
|
|
|
.org 0x80C4DEE :: nop
|
|
|
|
.org 0x80C4E68 :: nop
|
|
|
|
.org 0x80C4E76 :: nop
|
2017-03-11 04:52:22 +00:00
|
|
|
|
2017-03-11 18:30:08 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// C4B2C hacks (Equip window loop)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C4F80 :: bl c4b2c_clear_left
|
|
|
|
.org 0x80C4F84 :: bl c4b2c_clear_right
|
2017-03-11 18:30:08 +00:00
|
|
|
|
2017-03-09 18:16:37 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 04:55:47 +00:00
|
|
|
// C980C hacks (main character printing)
|
2017-03-09 18:16:37 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-18 21:10:45 +00:00
|
|
|
// Reset pixel X during scroll
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9858 :: bl c980c_resetx_newline
|
|
|
|
.org 0x80C9BF0 :: bl c980c_resetx_scroll
|
|
|
|
.org 0x80C9D18 :: bl c980c_resetx_newline
|
|
|
|
.org 0x80CA336 :: bl c980c_resetx_newline
|
2017-03-18 21:10:45 +00:00
|
|
|
|
2017-03-13 17:53:55 +00:00
|
|
|
// Reset pixel X during a newline
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9CC4
|
|
|
|
bl c980c_resetx_newline
|
2017-03-13 17:53:55 +00:00
|
|
|
|
2017-03-18 21:10:45 +00:00
|
|
|
// Other reset X
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9D62 :: bl c980c_resetx_other
|
|
|
|
.org 0x80C9D76 :: bl c980c_resetx_other2
|
|
|
|
.org 0x80C9EEC :: bl c980c_resetx_other3
|
|
|
|
.org 0x80C9F34 :: bl c980c_resetx_other3
|
|
|
|
.org 0x80CA204 :: bl c980c_resetx_other4
|
|
|
|
.org 0x80CA274 :: bl c980c_resetx_other4
|
|
|
|
.org 0x80CA30E :: bl c980c_resetx_newline
|
2017-03-18 21:10:45 +00:00
|
|
|
|
2017-04-06 06:38:59 +01:00
|
|
|
// Disable newline if the text overflows
|
|
|
|
.org 0x80CA2FA :: nop
|
|
|
|
|
2017-03-09 18:16:37 +00:00
|
|
|
// Custom codes check
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA2BC
|
|
|
|
bl c980c_custom_codes
|
2017-03-09 18:16:37 +00:00
|
|
|
|
2017-03-13 17:53:55 +00:00
|
|
|
// Reset pixel X when redrawing the window
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA2E6
|
|
|
|
bl c980c_resetx
|
2017-03-09 18:16:37 +00:00
|
|
|
|
|
|
|
// Welding entry
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA448
|
|
|
|
bl c980c_weld_entry
|
|
|
|
b 0x80CA46C
|
2017-03-09 18:16:37 +00:00
|
|
|
|
|
|
|
// Disable X coordinate incrementing
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA48E
|
2017-03-09 18:16:37 +00:00
|
|
|
nop
|
|
|
|
|
2017-03-14 04:05:02 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 04:55:47 +00:00
|
|
|
// C8FFC hacks (main string printing)
|
2017-03-14 04:05:02 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Custom codes check
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C90A2
|
|
|
|
bl c8ffc_custom_codes
|
2017-03-14 04:05:02 +00:00
|
|
|
|
|
|
|
// Welding entry
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9114
|
|
|
|
bl c8ffc_weld_entry
|
|
|
|
b 0x80C9144
|
2017-03-14 04:05:02 +00:00
|
|
|
|
|
|
|
// Integer-to-char changes
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA67C :: mov r3,0x50 // space
|
|
|
|
.org 0x80CA69C :: mov r2,0x60 // zero
|
|
|
|
.org 0x80CA78A :: mov r0,0x60 // zero
|
|
|
|
.org 0x80CA7AC :: mov r2,0x69 // nine
|
|
|
|
.org 0x80CA7EC :: sub r1,0xA0
|
2017-03-14 04:05:02 +00:00
|
|
|
|
2017-03-10 23:40:47 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 04:55:47 +00:00
|
|
|
// C87D0 hacks (draw blank window)
|
2017-03-10 23:40:47 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-12 21:45:21 +00:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C87DC
|
|
|
|
bl c87d0_clear_entry
|
2017-03-10 23:40:47 +00:00
|
|
|
|
2017-03-11 04:41:45 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 04:55:47 +00:00
|
|
|
// C9634 hacks (string printing)
|
2017-03-11 04:41:45 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C967E
|
|
|
|
bl c9634_resetx
|
2017-03-11 04:41:45 +00:00
|
|
|
|
2017-03-12 21:45:21 +00:00
|
|
|
//---------------------------------------------------------
|
2017-03-17 04:55:47 +00:00
|
|
|
// C96F0 hacks (string printing with highlight)
|
2017-03-12 21:45:21 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9714
|
|
|
|
lsl r3,r3,1 // change from row coords to tile coords
|
|
|
|
ldrh r1,[r0,0x22]
|
2017-03-12 21:45:21 +00:00
|
|
|
add r1,r1,r2
|
2017-03-29 05:19:51 +01:00
|
|
|
lsl r1,r1,3 // r1 = tile_x * 8
|
|
|
|
ldrh r2,[r0,0x24]
|
2017-03-12 21:45:21 +00:00
|
|
|
add r2,r2,r3
|
2017-03-29 05:19:51 +01:00
|
|
|
lsl r2,r2,3 // r2 = tile_y * 8
|
2017-03-12 21:45:21 +00:00
|
|
|
mov r0,r6
|
2017-03-29 05:19:51 +01:00
|
|
|
bl print_string
|
2017-04-11 07:12:33 +01:00
|
|
|
lsl r0,r0,16
|
|
|
|
lsr r7,r0,16
|
2017-03-29 05:19:51 +01:00
|
|
|
b 0x80C9788
|
2017-02-25 00:29:19 +00:00
|
|
|
|
2017-03-18 21:11:19 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// CA4BC hacks (scroll text)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80CA55E :: bl ca4bc_erase_tile_short
|
|
|
|
.org 0x80CA60E :: bl ca4bc_copy_tile_up
|
|
|
|
.org 0x80CA626 :: bl ca4bc_erase_tile
|
2017-03-18 21:11:19 +00:00
|
|
|
|
2017-04-15 17:50:32 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// CAB90 hacks (print window header string)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-04-16 04:38:32 +01:00
|
|
|
.org 0x80CAB90 :: push {lr} :: bl print_window_header_string :: pop {pc}
|
2017-04-15 17:50:32 +01:00
|
|
|
|
2017-03-13 17:54:08 +00:00
|
|
|
//---------------------------------------------------------
|
2017-04-15 17:50:16 +01:00
|
|
|
// CABF8 hacks (print checkerboard string)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
.org 0x80CABF8 :: push {r4-r7,lr}
|
|
|
|
.org 0x80CAC0C
|
|
|
|
mov r7,0
|
|
|
|
add sp,-4
|
|
|
|
b @@print_checkerboard_check
|
|
|
|
|
|
|
|
@@print_checkerboard_skip:
|
|
|
|
add r4,1
|
|
|
|
|
|
|
|
@@print_checkerboard_loop:
|
|
|
|
ldrb r0,[r4]
|
|
|
|
sub r0,0x50
|
|
|
|
mov r1,r5
|
|
|
|
add r2,r6,1
|
|
|
|
mov r3,6
|
|
|
|
str r3,[sp]
|
|
|
|
mov r3,3
|
|
|
|
bl print_character_to_ram
|
|
|
|
add r6,r0,r6
|
|
|
|
add r7,1
|
|
|
|
add r4,1
|
|
|
|
|
|
|
|
@@print_checkerboard_check:
|
|
|
|
ldrb r0,[r4,1]
|
|
|
|
cmp r0,0xFF
|
|
|
|
bne @@print_checkerboard_loop
|
|
|
|
ldrb r0,[r4]
|
|
|
|
cmp r0,0
|
|
|
|
bne @@print_checkerboard_skip
|
|
|
|
|
|
|
|
add r0,r6,7
|
|
|
|
lsr r0,r0,3 // number of tiles used
|
|
|
|
add sp,4
|
|
|
|
pop {r4-r7,pc}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2017-03-13 17:54:08 +00:00
|
|
|
// D2E94 hacks (print party character name)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D2F24
|
2017-03-13 17:54:08 +00:00
|
|
|
mov r1,r6
|
|
|
|
mov r2,r7
|
|
|
|
mov r0,r4
|
2017-03-29 05:19:51 +01:00
|
|
|
bl weld_entry
|
|
|
|
b 0x80D2F52
|
2017-03-13 17:54:08 +00:00
|
|
|
|
|
|
|
// Disable X increment
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D2F5A :: nop
|
2017-03-13 17:54:08 +00:00
|
|
|
|
2017-03-27 06:26:15 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// D2FA0 hacks (print item)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D3044
|
2017-03-27 06:26:15 +01:00
|
|
|
mov r0,r4
|
|
|
|
mov r1,r6
|
2017-03-29 05:19:51 +01:00
|
|
|
bl weld_entry
|
|
|
|
b 0x80D3072
|
2017-03-27 06:26:15 +01:00
|
|
|
|
|
|
|
// Disable X increment
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D307A :: nop
|
2017-03-27 06:26:15 +01:00
|
|
|
|
2017-03-22 20:47:34 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// D30C4 hacks (print number)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D314A
|
2017-03-22 20:47:34 +00:00
|
|
|
mov r0,r5
|
|
|
|
mov r1,r7
|
2017-03-29 05:19:51 +01:00
|
|
|
bl weld_entry
|
|
|
|
b 0x80D3178
|
2017-03-22 20:47:34 +00:00
|
|
|
|
|
|
|
// Disable X increment
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D3180 :: nop
|
2017-03-22 20:47:34 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// D332C hacks (print name)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D34E8
|
2017-03-22 20:47:34 +00:00
|
|
|
mov r0,r5
|
|
|
|
mov r1,r4
|
2017-03-29 05:19:51 +01:00
|
|
|
bl weld_entry
|
|
|
|
b 0x80D3514
|
2017-03-22 20:47:34 +00:00
|
|
|
|
|
|
|
// Disable X increment
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D351A :: nop
|
2017-03-22 20:47:34 +00:00
|
|
|
|
2017-04-03 03:13:06 +01:00
|
|
|
// Don't print [1E 20] after the name if there are multiple people
|
|
|
|
.org 0x80D3418 :: b 0x80D348C
|
|
|
|
|
2017-03-18 18:43:57 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// D3934 hacks (print PSI name)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D39BA :: mov r0,0x14 // PSI name length
|
2017-03-18 18:43:57 +00:00
|
|
|
|
|
|
|
// Weld entry
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D39E2
|
2017-03-18 18:43:57 +00:00
|
|
|
mov r0,r4
|
|
|
|
mov r1,r5
|
2017-03-29 05:19:51 +01:00
|
|
|
bl weld_entry
|
|
|
|
b 0x80D3A14
|
2017-03-18 18:43:57 +00:00
|
|
|
|
|
|
|
// Print a space before the Greek letter
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80D39D4 :: bl d3934_print_space
|
2017-03-13 17:54:08 +00:00
|
|
|
|
2017-03-25 21:08:00 +00:00
|
|
|
// Battle command hacks
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x8B1F4C8 :: db 0x11 // Extend command window width two tiles (Normal)
|
|
|
|
.org 0x8B1F4CC :: db 0x16 // Extend command window width two tiles (Paula paralyzed leader)
|
|
|
|
.org 0x80D7A56 :: mov r1,4 // Move PSI class window left one tile
|
|
|
|
.org 0x80D7A5A :: mov r3,6 // Extend PSI class window width one tile
|
|
|
|
.org 0x80DC038 :: add r5,0x30 // String address calculation
|
|
|
|
.org 0x80DC0A8 :: add r1,0x60 // String address calculation
|
2017-03-25 21:05:59 +00:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DC27C :: lsl r1,r2,4 :: nop // String address calculation
|
|
|
|
.org 0x80DC2AC :: lsl r1,r2,4 :: nop // String address calculation
|
2017-03-23 04:59:32 +00:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DCC36 :: mov r2,2 // "to X" position
|
|
|
|
.org 0x80DCCE0 :: mov r2,2 // "to the Front Row" position
|
2017-03-26 00:31:29 +00:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80E079E :: bl e06ec_clear_window
|
|
|
|
.org 0x80E0888 :: bl e06ec_redraw_psi
|
|
|
|
.org 0x80E0A16 :: bl e06ec_redraw_bash_psi
|
2017-03-25 21:08:00 +00:00
|
|
|
|
2017-03-26 19:13:51 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// BD918 hacks (battle setup)
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
// Longest enemy name is 24 letters + 2 for the end code, for 26 total
|
|
|
|
// We might have "The " later on, so make that 30
|
|
|
|
// " and its cohorts" makes that 46
|
|
|
|
// Let's round it to a nice 64: we need to allocate that many bytes for user
|
|
|
|
// and target strings on the heap. The game only allocates 16 each.
|
2017-03-26 20:16:09 +01:00
|
|
|
// Goal: allocate an extra 128 bytes and fix all the offsets to the user/target
|
|
|
|
// strings. We'll store the user string at +0x4C0 and the target string at +0x500.
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80BD97A :: mov r0,0xA8 // malloc an extra 128 bytes for longer user/target strings
|
2017-03-26 20:16:09 +01:00
|
|
|
|
|
|
|
// Fix user/target pointers
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80C9942 :: bl c980c_user_pointer
|
|
|
|
.org 0x80C9954 :: bl c980c_target_pointer
|
|
|
|
.org 0x80EBFDC :: bl ebfd4_user_pointer :: b 0x80EBFFA
|
|
|
|
.org 0x80EC004 :: push {lr} :: bl ec004_user_pointer
|
|
|
|
.org 0x80EC018 :: bl ec010_target_pointer :: b 0x80EC038
|
|
|
|
.org 0x80EC046 :: push {lr} :: bl ec046_target_pointer
|
2017-03-26 20:16:09 +01:00
|
|
|
|
|
|
|
// Length fixes
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DAE02 :: add sp,-0x40
|
|
|
|
.org 0x80DAE08 :: mov r2,0x3E
|
|
|
|
.org 0x80DAE38 :: mov r2,0x3A
|
|
|
|
.org 0x80DAEA2 :: mov r1,0x3E
|
|
|
|
.org 0x80DAEDE :: add sp,0x40
|
|
|
|
|
|
|
|
.org 0x80DB04E :: add sp,-0x40
|
|
|
|
.org 0x80DB058 :: mov r2,0x3E
|
|
|
|
.org 0x80DB08C :: mov r2,0x3A
|
|
|
|
.org 0x80DB116 :: mov r1,0x3E
|
|
|
|
.org 0x80DB15A :: add sp,0x40
|
|
|
|
|
|
|
|
.org 0x80DCD02 :: add sp,-0x40
|
|
|
|
.org 0x80DCD0C :: mov r2,0x3C
|
|
|
|
.org 0x80DCD64 :: mov r2,0x3A
|
|
|
|
.org 0x80DCDA2 :: mov r1,0x3E
|
|
|
|
.org 0x80DCDA8 :: add sp,0x40
|
2017-03-26 20:16:09 +01:00
|
|
|
|
2017-03-26 20:16:19 +01:00
|
|
|
// Add a space between enemy name and letter
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DCD94 :: bl dcd00_enemy_letter
|
|
|
|
.org 0x80DCD9A :: strb r0,[r5,2]
|
|
|
|
.org 0x80DCD9E :: strb r0,[r5,3]
|
2017-03-26 20:16:19 +01:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DAE7E :: bl dae00_enemy_letter
|
|
|
|
.org 0x80DAE84 :: strb r0,[r4,2]
|
|
|
|
.org 0x80DAE88 :: strb r0,[r4,3]
|
2017-03-27 05:48:23 +01:00
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DB0CE :: bl dae00_enemy_letter
|
|
|
|
.org 0x80DB0D2 :: strb r5,[r4,2]
|
|
|
|
.org 0x80DB0D6 :: strb r0,[r4,3]
|
2017-03-27 06:26:29 +01:00
|
|
|
|
2017-03-27 05:19:17 +01:00
|
|
|
// "The" flag checks
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DB084 :: bl db04c_theflag :: nop :: nop
|
2017-03-27 05:19:17 +01:00
|
|
|
|
2017-03-26 23:30:02 +01:00
|
|
|
// Ignore the hard-coded Japanese "and cohorts"
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80DB0E6 :: b 0x80DB0FE
|
2017-03-26 23:30:02 +01:00
|
|
|
|
2017-03-26 19:13:51 +01:00
|
|
|
|
2015-03-13 23:09:31 +00:00
|
|
|
//==============================================================================
|
|
|
|
// Data files
|
|
|
|
//==============================================================================
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x8B2C000
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
// Box font relocation
|
|
|
|
m2_font_relocate:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-font-relocate.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
// Co-ordinate table
|
|
|
|
m2_coord_table:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-coord-table.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
// EB fonts
|
|
|
|
m2_font_table:
|
2017-04-13 23:10:51 +01:00
|
|
|
dw m2_font_main
|
|
|
|
dw m2_font_saturn
|
|
|
|
dw m2_font_big
|
|
|
|
dw m2_font_battle
|
|
|
|
dw m2_font_tiny
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
m2_font_main:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-font-main.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
m2_font_saturn:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-font-saturn.bin"
|
2017-04-13 23:10:51 +01:00
|
|
|
m2_font_big:
|
|
|
|
.incbin "m2-font-big.bin"
|
|
|
|
m2_font_battle:
|
|
|
|
.incbin "m2-font-battle.bin"
|
|
|
|
m2_font_tiny:
|
|
|
|
.incbin "m2-font-tiny.bin"
|
|
|
|
|
|
|
|
// EB font dimensions
|
|
|
|
m2_font_widths:
|
|
|
|
db 2, 2, 2, 1, 1
|
|
|
|
.align 4
|
2015-03-13 23:09:31 +00:00
|
|
|
|
2017-04-11 00:41:21 +01:00
|
|
|
m2_font_heights:
|
2017-04-13 23:10:51 +01:00
|
|
|
db 2, 2, 2, 2, 1
|
|
|
|
.align 4
|
2017-03-09 18:16:25 +00:00
|
|
|
|
2015-03-13 23:09:31 +00:00
|
|
|
// EB font widths
|
|
|
|
m2_widths_table:
|
2017-04-13 23:10:51 +01:00
|
|
|
dw m2_widths_main
|
|
|
|
dw m2_widths_saturn
|
|
|
|
dw m2_widths_big
|
|
|
|
dw m2_widths_battle
|
|
|
|
dw m2_widths_tiny
|
2015-03-13 23:09:31 +00:00
|
|
|
|
|
|
|
m2_widths_main:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-widths-main.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
m2_widths_saturn:
|
2017-04-13 23:10:51 +01:00
|
|
|
.incbin "m2-widths-saturn.bin"
|
|
|
|
m2_widths_big:
|
|
|
|
.incbin "m2-widths-big.bin"
|
|
|
|
m2_widths_battle:
|
|
|
|
.incbin "m2-widths-battle.bin"
|
|
|
|
m2_widths_tiny:
|
|
|
|
.incbin "m2-widths-tiny.bin"
|
2017-03-07 22:12:52 +00:00
|
|
|
|
2017-03-09 18:15:42 +00:00
|
|
|
m2_bits_to_nybbles:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-bits-to-nybbles.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
|
2017-03-10 05:44:39 +00:00
|
|
|
m2_nybbles_to_bits:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-nybbles-to-bits.bin"
|
2017-03-10 05:44:39 +00:00
|
|
|
|
2017-03-27 03:05:18 +01:00
|
|
|
m2_enemy_attributes:
|
2017-03-29 05:19:51 +01:00
|
|
|
.incbin "m2-enemy-attributes.bin"
|
2015-03-13 23:09:31 +00:00
|
|
|
|
2017-03-07 22:12:52 +00:00
|
|
|
|
2015-03-13 23:09:31 +00:00
|
|
|
//==============================================================================
|
|
|
|
// Code files
|
|
|
|
//==============================================================================
|
|
|
|
|
2017-03-29 05:19:51 +01:00
|
|
|
.org 0x80FCE6C
|
2017-04-11 22:12:20 +01:00
|
|
|
.include "syscalls.asm"
|
2017-03-29 05:19:51 +01:00
|
|
|
.include "m2-vwf.asm"
|
|
|
|
.include "m2-vwf-entries.asm"
|
|
|
|
.include "m2-formatting.asm"
|
|
|
|
.include "m2-customcodes.asm"
|
2017-04-08 07:22:38 +01:00
|
|
|
.include "m2-compiled.asm"
|
2017-03-29 05:19:51 +01:00
|
|
|
|
|
|
|
.close
|