From 31359cc376a6ec849295989a6c37e4defd6de1aa Mon Sep 17 00:00:00 2001 From: jeffman Date: Fri, 19 Jul 2019 18:34:31 -0400 Subject: [PATCH 1/6] Update notes --- notes/m2-notes.txt | 5 + notes/m2-subB8BBC.txt | 1227 +++++++++++++++++++++++++++++++++++++++++ notes/m2-subBAEF8.txt | 2 +- 3 files changed, 1233 insertions(+), 1 deletion(-) create mode 100644 notes/m2-subB8BBC.txt diff --git a/notes/m2-notes.txt b/notes/m2-notes.txt index a851374..d0577dc 100644 --- a/notes/m2-notes.txt +++ b/notes/m2-notes.txt @@ -84,6 +84,11 @@ English names: - 04: Body select - 05: Arms select - 06: Other select + - PSI: + - 01: character select + - 02: PSI select + - 03: target select + - 04: text box 0x3005228: current text palette, << 0xC 0x3005230: addresses of all 11 windows [00]: A menu diff --git a/notes/m2-subB8BBC.txt b/notes/m2-subB8BBC.txt new file mode 100644 index 0000000..48d314c --- /dev/null +++ b/notes/m2-subB8BBC.txt @@ -0,0 +1,1227 @@ +// PSI window loop +// No input parameters +// Returns: 0 if no action, 1 if descending deeper into the windows, -1 if ascending back out, +// -2 if the player got to the end and all the windows closed + +080B8BBC (T) push r4-r7,r14 ;9 185 +080B8BBE (T) mov r7,r10 ;2 187 +080B8BC0 (T) mov r6,r9 ;2 189 +080B8BC2 (T) mov r5,r8 ;2 191 +080B8BC4 (T) push r5-r7 ;7 198 +080B8BC6 (T) add sp,-0Ch ;2 200 +080B8BC8 (T) mov r0,0h ;2 202 +080B8BCA (T) mov r9,r0 ;2 204 +080B8BCC (T) mov r5,0h ;2 206 +080B8BCE (T) ldr r0,=3005224h ;9 215 +080B8BD0 (T) mov r1,0h ;2 217 +080B8BD2 (T) ldsh r0,[r0,r1] ;4 221 +080B8BD4 (T) cmp r0,4h ;2 223 +080B8BD6 (T) bls 80B8BDCh ;8 231 +080B8BD8 (T) bl 80B9638h ;10 241 +080B8BDC (T) lsl r0,r0,2h ;2 243 +080B8BDE (T) ldr r1,=80B8BF0h ;9 252 +080B8BE0 (T) add r0,r0,r1 ;2 254 +080B8BE2 (T) ldr r0,[r0] ;4 258 +080B8BE4 (T) mov r15,r0 ;2 260 +080B8BE6 (T) lsl r0,r0,0h ;2 262 +080B8BE8 (T) strh r4,[r4,r0] ;5 267 +080B8BEA (T) lsl r0,r0,0Ch ;2 269 +080B8BEC (T) ldrh r0,[r6,1Eh] ;4 273 +080B8BEE (T) lsr r3,r1,20h ;2 275 +080B8BF0 (T) ldrh r4,[r0,20h] ;4 279 +080B8BF2 (T) lsr r3,r1,20h ;2 281 +080B8BF4 (T) ldrh r6,[r1,26h] ;4 285 +080B8BF6 (T) lsr r3,r1,20h ;2 287 +080B8BF8 (T) ldrh r0,[r6,2Ch] ;4 291 +080B8BFA (T) lsr r3,r1,20h ;2 293 +080B8BFC (T) ldrh r0,[r1,34h] ;4 297 +080B8BFE (T) lsr r3,r1,20h ;2 299 +080B8C00 (T) str r2,[sp,268h] ;5 304 +080B8C02 (T) lsr r3,r1,20h ;2 306 +080B8C04 (T) mov r0,0h ;2 308 +080B8C06 (T) bl 80BD7F8h ;10 318 +080B8C0A (T) ldr r0,=3002500h ;9 327 +080B8C0C (T) mov r1,0h ;2 329 +080B8C0E (T) strh r1,[r0] ;5 334 +080B8C10 (T) strh r1,[r0,2h] ;5 339 +080B8C12 (T) ldr r6,=3005230h ;9 348 +080B8C14 (T) ldr r0,[r6,1Ch] ;4 352 +080B8C16 (T) strh r1,[r0,32h] ;5 357 +080B8C18 (T) bl 80ED480h ;10 367 +080B8C1C (T) lsl r0,r0,10h ;2 369 +080B8C1E (T) asr r0,r0,10h ;2 371 +080B8C20 (T) cmp r0,1h ;2 373 +080B8C22 (T) bne 80B8C78h ;8 381 +080B8C24 (T) ldr r0,[r6,1Ch] ;4 385 +080B8C26 (T) mov r1,0h ;2 387 +080B8C28 (T) mov r2,0h ;2 389 +080B8C2A (T) bl m2_initwindow ;10 399 +080B8C2E (T) ldr r0,[r6,24h] ;4 403 +080B8C30 (T) mov r1,0h ;2 405 +080B8C32 (T) mov r2,0h ;2 407 +080B8C34 (T) bl m2_initwindow ;10 417 +080B8C38 (T) ldr r4,=m2_active_window_pc ;9 426 +080B8C3A (T) mov r2,0h ;2 428 +080B8C3C (T) ldsh r0,[r4,r2] ;4 432 +080B8C3E (T) mov r1,1h ;2 434 +080B8C40 (T) mov r2,0Fh ;2 436 +080B8C42 (T) bl m2_psiwindow ;10 446 +080B8C46 (T) mov r3,0h ;2 448 +080B8C48 (T) ldsh r0,[r4,r3] ;4 452 +080B8C4A (T) bl m2_hpwindow_up ;10 462 +080B8C4E (T) mov r0,0h ;2 464 +080B8C50 (T) bl m2_swapwindowbuf ;10 474 +080B8C54 (T) ldr r1,=3005224h ;9 483 +080B8C56 (T) mov r0,2h ;2 485 +080B8C58 (T) strh r0,[r1] ;5 490 +080B8C5A (T) mov r0,0h ;2 492 +080B8C5C (T) mov r1,0F0h ;2 494 +080B8C5E (T) mov r2,14h ;2 496 +080B8C60 (T) mov r3,5h ;2 498 +080B8C62 (T) bl 8000364h ;10 508 +080B8C66 (T) b 80B8DB0h ;8 516 +080B8C68 (T) mov r5,0h ;2 518 +080B8C6A (T) lsl r0,r0,0Ch ;2 520 +080B8C6C (T) strh r0,[r6,r0] ;5 525 +080B8C6E (T) lsl r0,r0,0Ch ;2 527 +080B8C70 (T) strh r4,[r4,r1] ;5 532 +080B8C72 (T) lsl r0,r0,0Ch ;2 534 +080B8C74 (T) strh r4,[r4,r0] ;5 539 +080B8C76 (T) lsl r0,r0,0Ch ;2 541 +080B8C78 (T) ldr r0,[r6,1Ch] ;4 545 +080B8C7A (T) mov r1,0h ;2 547 +080B8C7C (T) mov r2,0h ;2 549 +080B8C7E (T) bl m2_initwindow ;10 559 +080B8C82 (T) ldr r4,=m2_active_window_pc ;9 568 +080B8C84 (T) mov r1,0h ;2 570 +080B8C86 (T) ldsh r0,[r4,r1] ;4 574 +080B8C88 (T) mov r1,1h ;2 576 +080B8C8A (T) mov r2,0Fh ;2 578 +080B8C8C (T) bl m2_psiwindow ;10 588 +080B8C90 (T) mov r0,0h ;2 590 +080B8C92 (T) bl m2_swapwindowbuf ;10 600 +080B8C96 (T) ldr r0,=8B17EE4h ;9 609 +080B8C98 (T) ldr r1,=8B17424h ;9 618 +080B8C9A (T) mov r2,0Ah ;2 620 +080B8C9C (T) bl m2_strlookup ;10 630 +080B8CA0 (T) mov r5,r0 ;2 632 +080B8CA2 (T) ldr r0,[r6,0Ch] ;4 636 +080B8CA4 (T) mov r1,r5 ;2 638 +080B8CA6 (T) mov r2,0h ;2 640 +080B8CA8 (T) bl m2_initwindow ;10 650 +080B8CAC (T) ldr r0,[r6,0Ch] ;4 654 +080B8CAE (T) bl 80C8BE4h ;10 664 +080B8CB2 (T) ldr r0,[r6,1Ch] ;4 668 +080B8CB4 (T) bl 80C3F28h ;10 678 +080B8CB8 (T) mov r2,0h ;2 680 +080B8CBA (T) ldsh r0,[r4,r2] ;4 684 +080B8CBC (T) bl m2_hpwindow_up ;10 694 +080B8CC0 (T) ldr r1,=3005224h ;9 703 +080B8CC2 (T) mov r0,1h ;2 705 +080B8CC4 (T) strh r0,[r1] ;5 710 +080B8CC6 (T) mov r0,0h ;2 712 +080B8CC8 (T) mov r1,0F0h ;2 714 +080B8CCA (T) bl 8000398h ;10 724 +080B8CCE (T) ldr r4,=3005230h ;9 733 +080B8CD0 (T) ldr r0,[r4,1Ch] ;4 737 +080B8CD2 (T) bl m2_clearwindowtiles ;10 747 +080B8CD6 (T) ldr r0,[r4,1Ch] ;4 751 +080B8CD8 (T) bl 80C3F28h ;10 761 +080B8CDC (T) lsl r0,r0,10h ;2 763 +080B8CDE (T) lsr r5,r0,10h ;2 765 +080B8CE0 (T) ldr r7,=m2_active_window_pc ;9 774 +080B8CE2 (T) mov r3,0h ;2 776 +080B8CE4 (T) ldsh r0,[r7,r3] ;4 780 +080B8CE6 (T) mov r1,1h ;2 782 +080B8CE8 (T) mov r2,0Fh ;2 784 +080B8CEA (T) bl m2_psiwindow ;10 794 +080B8CEE (T) lsl r0,r5,10h ;2 796 +080B8CF0 (T) asr r6,r0,10h ;2 798 +080B8CF2 (T) cmp r6,0h ;2 800 +080B8CF4 (T) ble 80B8D56h ;8 808 +080B8CF6 (T) mov r0,1h ;2 810 +080B8CF8 (T) bl 80BD7F8h ;10 820 +080B8CFC (T) bl 80D7154h ;10 830 +080B8D00 (T) ldr r0,[r4,1Ch] ;4 834 +080B8D02 (T) bl 80C3F28h ;10 844 +080B8D06 (T) ldr r0,[r4,24h] ;4 848 +080B8D08 (T) mov r1,0h ;2 850 +080B8D0A (T) mov r2,0h ;2 852 +080B8D0C (T) bl m2_initwindow ;10 862 +080B8D10 (T) ldr r0,[r4,1Ch] ;4 866 +080B8D12 (T) mov r1,0h ;2 868 +080B8D14 (T) mov r2,0h ;2 870 +080B8D16 (T) bl m2_initwindow ;10 880 +080B8D1A (T) mov r1,0h ;2 882 +080B8D1C (T) ldsh r0,[r7,r1] ;4 886 +080B8D1E (T) mov r1,1h ;2 888 +080B8D20 (T) mov r2,0Fh ;2 890 +080B8D22 (T) bl m2_psiwindow ;10 900 +080B8D26 (T) ldr r1,[r4,1Ch] ;4 904 +080B8D28 (T) ldr r0,=0FFFFh ;9 913 +080B8D2A (T) strh r0,[r1,32h] ;5 918 +080B8D2C (T) ldr r0,[r4,1Ch] ;4 922 +080B8D2E (T) bl 80C3F28h ;10 932 +080B8D32 (T) mov r0,0h ;2 934 +080B8D34 (T) mov r1,0F0h ;2 936 +080B8D36 (T) mov r2,14h ;2 938 +080B8D38 (T) mov r3,5h ;2 940 +080B8D3A (T) bl 8000364h ;10 950 +080B8D3E (T) ldr r0,[r4,1Ch] ;4 954 +080B8D40 (T) bl 80C438Ch ;10 964 +080B8D44 (T) ldr r1,[r4,1Ch] ;4 968 +080B8D46 (T) mov r0,0h ;2 970 +080B8D48 (T) strh r0,[r1,32h] ;5 975 +080B8D4A (T) ldr r1,[r4,1Ch] ;4 979 +080B8D4C (T) strh r0,[r1,36h] ;5 984 +080B8D4E (T) strh r0,[r1,34h] ;5 989 +080B8D50 (T) ldr r1,=3005224h ;9 998 +080B8D52 (T) mov r0,2h ;2 1000 +080B8D54 (T) strh r0,[r1] ;5 1005 +080B8D56 (T) mov r0,1h ;2 1007 +080B8D58 (T) neg r0,r0 ;2 1009 +080B8D5A (T) cmp r6,r0 ;2 1011 +080B8D5C (T) bne 80B8DA4h ;8 1019 +080B8D5E (T) mov r0,1h ;2 1021 +080B8D60 (T) bl m2_swapwindowbuf ;10 1031 +080B8D64 (T) bl 80D7154h ;10 1041 +080B8D68 (T) ldr r1,[r4,1Ch] ;4 1045 +080B8D6A (T) ldr r0,=0FFFFh ;9 1054 +080B8D6C (T) strh r0,[r1,32h] ;5 1059 +080B8D6E (T) ldr r0,[r4,1Ch] ;4 1063 +080B8D70 (T) bl 80C3F28h ;10 1073 +080B8D74 (T) ldr r1,[r4,1Ch] ;4 1077 +080B8D76 (T) mov r0,0h ;2 1079 +080B8D78 (T) strh r0,[r1,32h] ;5 1084 +080B8D7A (T) mov r1,0F0h ;2 1086 +080B8D7C (T) mov r2,14h ;2 1088 +080B8D7E (T) mov r3,14h ;2 1090 +080B8D80 (T) bl 8000364h ;10 1100 +080B8D84 (T) mov r0,1h ;2 1102 +080B8D86 (T) neg r0,r0 ;2 1104 +080B8D88 (T) bl 80B963Ch ;10 1114 +080B8D8C (T) strh r4,[r4,r1] ;5 1119 +080B8D8E (T) lsl r0,r0,0Ch ;2 1121 +080B8D90 (T) ldrb r4,[r4,1Bh] ;4 1125 +080B8D92 (T) lsr r1,r6,2h ;2 1127 +080B8D94 (T) strb r4,[r4,10h] ;5 1132 +080B8D96 (T) lsr r1,r6,2h ;2 1134 +080B8D98 (T) strh r4,[r4,r0] ;5 1139 +080B8D9A (T) lsl r0,r0,0Ch ;2 1141 +080B8D9C (T) strh r0,[r6,r0] ;5 1146 +080B8D9E (T) lsl r0,r0,0Ch ;2 1148 +080B8DA0 (T) bl lr+0FFEh ;10 1158 +080B8DA2 (T) lsl r0,r0,0h ;2 1160 +080B8DA4 (T) mov r2,0h ;2 1162 +080B8DA6 (T) ldsh r0,[r7,r2] ;4 1166 +080B8DA8 (T) bl m2_hpwindow_up ;10 1176 +080B8DAC (T) bl 80B9638h ;10 1186 +080B8DB0 (T) ldr r4,=3005230h ;9 1195 +080B8DB2 (T) ldr r0,[r4,1Ch] ;4 1199 +080B8DB4 (T) bl 80C438Ch ;10 1209 +080B8DB8 (T) ldr r1,[r4,1Ch] ;4 1213 +080B8DBA (T) ldr r1,[r1,10h] ;4 1217 +080B8DBC (T) lsl r2,r0,10h ;2 1219 +080B8DBE (T) strh r0,[r1,2h] ;5 1224 +080B8DC0 (T) lsr r5,r2,10h ;2 1226 +080B8DC2 (T) asr r2,r2,10h ;2 1228 +080B8DC4 (T) cmp r2,0h ;2 1230 +080B8DC6 (T) bne 80B8DD4h ;8 1238 +080B8DC8 (T) mov r0,0h ;2 1240 +080B8DCA (T) bl 80B963Ch ;10 1250 +080B8DCE (T) lsl r0,r0,0h ;2 1252 +080B8DD0 (T) strh r0,[r6,r0] ;5 1257 +080B8DD2 (T) lsl r0,r0,0Ch ;2 1259 +080B8DD4 (T) cmp r2,0h ;2 1261 +080B8DD6 (T) ble 80B8DF8h ;8 1269 +080B8DD8 (T) ldr r0,=3001D40h ;9 1278 +080B8DDA (T) ldr r3,=1CBh ;9 1287 +080B8DDC (T) add r0,r0,r3 ;2 1289 +080B8DDE (T) ldrb r0,[r0] ;4 1293 +080B8DE0 (T) cmp r0,1h ;2 1295 +080B8DE2 (T) bls 80B8DF2h ;8 1303 +080B8DE4 (T) ldr r0,[r4,1Ch] ;4 1307 +080B8DE6 (T) ldr r0,[r0,10h] ;4 1311 +080B8DE8 (T) mov r1,2h ;2 1313 +080B8DEA (T) ldsh r0,[r0,r1] ;4 1317 +080B8DEC (T) mov r1,1h ;2 1319 +080B8DEE (T) bl 80C2480h ;10 1329 +080B8DF2 (T) ldr r1,=3005224h ;9 1338 +080B8DF4 (T) mov r0,3h ;2 1340 +080B8DF6 (T) strh r0,[r1] ;5 1345 +080B8DF8 (T) lsl r0,r5,10h ;2 1347 +080B8DFA (T) asr r5,r0,10h ;2 1349 +080B8DFC (T) mov r0,1h ;2 1351 +080B8DFE (T) neg r0,r0 ;2 1353 +080B8E00 (T) cmp r5,r0 ;2 1355 +080B8E02 (T) bne 80B8E88h ;8 1363 +080B8E04 (T) ldr r4,=3005230h ;9 1372 +080B8E06 (T) ldr r0,[r4,1Ch] ;4 1376 +080B8E08 (T) mov r6,0h ;2 1378 +080B8E0A (T) strh r6,[r0,36h] ;5 1383 +080B8E0C (T) strh r6,[r0,34h] ;5 1388 +080B8E0E (T) bl 80ED480h ;10 1398 +080B8E12 (T) lsl r0,r0,10h ;2 1400 +080B8E14 (T) asr r0,r0,10h ;2 1402 +080B8E16 (T) cmp r0,1h ;2 1404 +080B8E18 (T) bne 80B8E38h ;8 1412 +080B8E1A (T) ldr r0,=3005224h ;9 1421 +080B8E1C (T) strh r6,[r0] ;5 1426 +080B8E1E (T) mov r0,1h ;2 1428 +080B8E20 (T) neg r0,r0 ;2 1430 +080B8E22 (T) bl 80B963Ch ;10 1440 +080B8E26 (T) lsl r0,r0,0h ;2 1442 +080B8E28 (T) add r0,r0,5 ;2 1444 +080B8E2A (T) lsl r0,r0,0Ch ;2 1446 +080B8E2C (T) lsl r3,r1,7h ;2 1448 +080B8E2E (T) lsl r0,r0,0h ;2 1450 +080B8E30 (T) strh r4,[r4,r0] ;5 1455 +080B8E32 (T) lsl r0,r0,0Ch ;2 1457 +080B8E34 (T) strh r0,[r6,r0] ;5 1462 +080B8E36 (T) lsl r0,r0,0Ch ;2 1464 +080B8E38 (T) mov r0,1h ;2 1466 +080B8E3A (T) bl m2_swapwindowbuf ;10 1476 +080B8E3E (T) ldr r0,[r4,1Ch] ;4 1480 +080B8E40 (T) mov r1,0h ;2 1482 +080B8E42 (T) mov r2,0h ;2 1484 +080B8E44 (T) bl m2_initwindow ;10 1494 +080B8E48 (T) ldr r1,[r4,1Ch] ;4 1498 +080B8E4A (T) ldr r0,=0FFFFh ;9 1507 +080B8E4C (T) strh r0,[r1,32h] ;5 1512 +080B8E4E (T) ldr r0,[r4,1Ch] ;4 1516 +080B8E50 (T) bl 80C3F28h ;10 1526 +080B8E54 (T) ldr r0,[r4,1Ch] ;4 1530 +080B8E56 (T) strh r6,[r0,32h] ;5 1535 +080B8E58 (T) ldr r4,=m2_active_window_pc ;9 1544 +080B8E5A (T) mov r2,0h ;2 1546 +080B8E5C (T) ldsh r0,[r4,r2] ;4 1550 +080B8E5E (T) mov r1,1h ;2 1552 +080B8E60 (T) mov r2,0Fh ;2 1554 +080B8E62 (T) bl m2_psiwindow ;10 1564 +080B8E66 (T) bl 80D42F8h ;10 1574 +080B8E6A (T) mov r3,0h ;2 1576 +080B8E6C (T) ldsh r0,[r4,r3] ;4 1580 +080B8E6E (T) bl m2_hpwindow_up ;10 1590 +080B8E72 (T) ldr r0,=3005224h ;9 1599 +080B8E74 (T) strh r6,[r0] ;5 1604 +080B8E76 (T) mov r0,0h ;2 1606 +080B8E78 (T) b 80B963Ch ;8 1614 +080B8E7A (T) lsl r0,r0,0h ;2 1616 +080B8E7C (T) bl lr+0FFEh ;10 1626 +080B8E7E (T) lsl r0,r0,0h ;2 1628 +080B8E80 (T) strh r4,[r4,r1] ;5 1633 +080B8E82 (T) lsl r0,r0,0Ch ;2 1635 +080B8E84 (T) strh r4,[r4,r0] ;5 1640 +080B8E86 (T) lsl r0,r0,0Ch ;2 1642 +080B8E88 (T) ldr r2,=8B204E4h ;9 1651 +080B8E8A (T) ldr r7,=8B2A9B0h ;9 1660 +080B8E8C (T) ldr r6,=3005230h ;9 1669 +080B8E8E (T) ldr r5,[r6,1Ch] ;4 1673 +080B8E90 (T) mov r0,r5 ;2 1675 +080B8E92 (T) add r0,42h ;2 1677 +080B8E94 (T) ldrb r0,[r0] ;4 1681 +080B8E96 (T) lsl r0,r0,4h ;2 1683 +080B8E98 (T) add r3,r0,r7 ;2 1685 +080B8E9A (T) mov r0,4h ;2 1687 +080B8E9C (T) ldsh r1,[r3,r0] ;4 1691 +080B8E9E (T) lsl r0,r1,1h ;2 1693 +080B8EA0 (T) add r0,r0,r1 ;2 1695 +080B8EA2 (T) lsl r0,r0,2h ;2 1697 +080B8EA4 (T) add r0,r0,r2 ;2 1699 +080B8EA6 (T) ldrb r0,[r0,3h] ;4 1703 +080B8EA8 (T) mov r9,r0 ;2 1705 +080B8EAA (T) ldr r4,=3001D40h ;9 1714 +080B8EAC (T) ldr r1,=m2_active_window_pc ;9 1723 +080B8EAE (T) mov r8,r1 ;2 1725 +080B8EB0 (T) mov r2,0h ;2 1727 +080B8EB2 (T) ldsh r1,[r1,r2] ;4 1731 +080B8EB4 (T) mov r0,6Ch ;2 1733 +080B8EB6 (T) mul r0,r1 ;3 1736 +080B8EB8 (T) add r0,r0,r4 ;2 1738 +080B8EBA (T) add r0,52h ;2 1740 +080B8EBC (T) mov r1,0h ;2 1742 +080B8EBE (T) ldsh r0,[r0,r1] ;4 1746 +080B8EC0 (T) cmp r9,r0 ;2 1748 +080B8EC2 (T) ble 80B8FACh ;8 1756 +080B8EC4 (T) ldr r2,=1CBh ;9 1765 +080B8EC6 (T) add r0,r4,r2 ;2 1767 +080B8EC8 (T) ldrb r0,[r0] ;4 1771 +080B8ECA (T) cmp r0,1h ;2 1773 +080B8ECC (T) bne 80B8EDAh ;8 1781 +080B8ECE (T) ldr r0,[r5,10h] ;9 1790 +080B8ED0 (T) mov r3,2h ;2 1792 +080B8ED2 (T) ldsh r0,[r0,r3] ;4 1796 +080B8ED4 (T) mov r1,1h ;2 1798 +080B8ED6 (T) bl 80C2480h ;10 1808 +080B8EDA (T) ldr r0,[r6,8h] ;4 1812 +080B8EDC (T) mov r1,4h ;2 1814 +080B8EDE (T) str r1,[sp] ;5 1819 +080B8EE0 (T) mov r2,1h ;2 1821 +080B8EE2 (T) mov r3,16h ;2 1823 +080B8EE4 (T) bl 80BE188h ;10 1833 +080B8EE8 (T) ldr r0,[r6,8h] ;4 1837 +080B8EEA (T) ldr r1,=69Ch ;9 1846 +080B8EEC (T) add r4,r4,r1 ;2 1848 +080B8EEE (T) mov r3,0h ;2 1850 +080B8EF0 (T) ldsh r2,[r4,r3] ;4 1854 +080B8EF2 (T) mov r1,0h ;2 1856 +080B8EF4 (T) bl m2_initwindow ;10 1866 +080B8EF8 (T) ldr r5,=8BBA423h ;9 1875 +080B8EFA (T) ldr r0,[r6,8h] ;4 1879 +080B8EFC (T) mov r1,0h ;2 1881 +080B8EFE (T) ldsh r2,[r4,r1] ;4 1885 +080B8F00 (T) mov r1,r5 ;2 1887 +080B8F02 (T) bl m2_initwindow ;10 1897 +080B8F06 (T) mov r4,r6 ;2 1899 +080B8F08 (T) bl 80BD844h ;10 1909 +080B8F0C (T) ldr r0,[r4,8h] ;4 1913 +080B8F0E (T) bl 80C8BE4h ;10 1923 +080B8F12 (T) ldr r0,[r4,8h] ;4 1927 +080B8F14 (T) add r0,44h ;2 1929 +080B8F16 (T) ldrb r5,[r0] ;4 1933 +080B8F18 (T) cmp r5,0h ;2 1935 +080B8F1A (T) bne 80B8F08h ;8 1943 +080B8F1C (T) bl 80BD844h ;10 1953 +080B8F20 (T) mov r0,1h ;2 1955 +080B8F22 (T) bl m2_swapwindowbuf ;10 1965 +080B8F26 (T) ldr r4,=3005230h ;9 1974 +080B8F28 (T) ldr r0,[r4,8h] ;4 1978 +080B8F2A (T) mov r1,6h ;2 1980 +080B8F2C (T) str r1,[sp] ;5 1985 +080B8F2E (T) mov r1,0Bh ;2 1987 +080B8F30 (T) mov r2,1h ;2 1989 +080B8F32 (T) mov r3,12h ;2 1991 +080B8F34 (T) bl 80BE188h ;10 2001 +080B8F38 (T) ldr r0,[r4,1Ch] ;4 2005 +080B8F3A (T) mov r1,0h ;2 2007 +080B8F3C (T) mov r2,0h ;2 2009 +080B8F3E (T) bl m2_initwindow ;10 2019 +080B8F42 (T) ldr r1,[r4,1Ch] ;4 2023 +080B8F44 (T) ldr r0,=0FFFFh ;9 2032 +080B8F46 (T) strh r0,[r1,32h] ;5 2037 +080B8F48 (T) ldr r0,[r4,24h] ;4 2041 +080B8F4A (T) mov r1,0h ;2 2043 +080B8F4C (T) mov r2,0h ;2 2045 +080B8F4E (T) bl m2_initwindow ;10 2055 +080B8F52 (T) ldr r0,[r4,1Ch] ;4 2059 +080B8F54 (T) bl 80C3F28h ;10 2069 +080B8F58 (T) ldr r0,=m2_active_window_pc ;9 2078 +080B8F5A (T) mov r2,0h ;2 2080 +080B8F5C (T) ldsh r0,[r0,r2] ;4 2084 +080B8F5E (T) mov r1,1h ;2 2086 +080B8F60 (T) mov r2,0Fh ;2 2088 +080B8F62 (T) bl m2_psiwindow ;10 2098 +080B8F66 (T) ldr r0,[r4,1Ch] ;4 2102 +080B8F68 (T) ldr r0,[r0,10h] ;4 2106 +080B8F6A (T) mov r3,2h ;2 2108 +080B8F6C (T) ldsh r0,[r0,r3] ;4 2112 +080B8F6E (T) mov r1,0h ;2 2114 +080B8F70 (T) bl 80C2480h ;10 2124 +080B8F74 (T) ldr r0,[r4,1Ch] ;4 2128 +080B8F76 (T) strh r5,[r0,32h] ;5 2133 +080B8F78 (T) bl 80D7154h ;10 2143 +080B8F7C (T) ldr r1,=3005224h ;9 2152 +080B8F7E (T) mov r0,2h ;2 2154 +080B8F80 (T) strh r0,[r1] ;5 2159 +080B8F82 (T) b 80B8DB0h ;8 2167 +080B8F84 (T) lsl r4,r4,13h ;2 2169 +080B8F86 (T) lsr r2,r6,2h ;2 2171 +080B8F88 (T) add r1,sp,2C0h ;2 2173 +080B8F8A (T) lsr r2,r6,2h ;2 2175 +080B8F8C (T) strh r0,[r6,r0] ;5 2180 +080B8F8E (T) lsl r0,r0,0Ch ;2 2182 +080B8F90 (T) add r0,r0,5 ;2 2184 +080B8F92 (T) lsl r0,r0,0Ch ;2 2186 +080B8F94 (T) strh r4,[r4,r1] ;5 2191 +080B8F96 (T) lsl r0,r0,0Ch ;2 2193 +080B8F98 (T) lsl r3,r1,7h ;2 2195 +080B8F9A (T) lsl r0,r0,0h ;2 2197 +080B8F9C (T) lsl r4,r3,1Ah ;2 2199 +080B8F9E (T) lsl r0,r0,0h ;2 2201 +: add r4,=80B9030h ;2 2203 +080B8FA2 (T) lsr r3,r7,2h ;2 2205 +080B8FA4 (T) bl lr+0FFEh ;10 2215 +080B8FA6 (T) lsl r0,r0,0h ;2 2217 +080B8FA8 (T) strh r4,[r4,r0] ;5 2222 +080B8FAA (T) lsl r0,r0,0Ch ;2 2224 +080B8FAC (T) ldrb r0,[r3,2h] ;4 2228 +080B8FAE (T) cmp r0,8h ;2 2230 +080B8FB0 (T) beq 80B8FB4h ;8 2238 +080B8FB2 (T) b 80B915Ch ;8 2246 +080B8FB4 (T) mov r0,0h ;2 2248 +080B8FB6 (T) mov r9,r0 ;2 2250 +080B8FB8 (T) ldr r1,=22Bh ;9 2259 +080B8FBA (T) add r0,r4,r1 ;2 2261 +080B8FBC (T) ldrb r0,[r0] ;4 2265 +080B8FBE (T) cmp r0,9h ;2 2267 +080B8FC0 (T) beq 80B9068h ;8 2275 +080B8FC2 (T) mov r2,8Bh ;2 2277 +080B8FC4 (T) lsl r2,r2,2h ;2 2279 +080B8FC6 (T) add r0,r4,r2 ;2 2281 +080B8FC8 (T) ldrb r0,[r0] ;4 2285 +080B8FCA (T) cmp r0,9h ;2 2287 +080B8FCC (T) beq 80B9068h ;8 2295 +080B8FCE (T) ldr r5,=2F2h ;9 2304 +080B8FD0 (T) mov r0,r5 ;2 2306 +080B8FD2 (T) bl 80262A8h ;10 2316 +080B8FD6 (T) cmp r0,0h ;2 2318 +080B8FD8 (T) bne 80B9068h ;8 2326 +080B8FDA (T) ldr r2,=872F2DCh ;9 2335 +080B8FDC (T) ldr r0,=30038C4h ;9 2344 +080B8FDE (T) ldr r1,[r0] ;4 2348 +080B8FE0 (T) lsl r0,r1,2h ;2 2350 +080B8FE2 (T) add r0,r0,r1 ;2 2352 +080B8FE4 (T) lsl r0,r0,2h ;2 2354 +080B8FE6 (T) add r0,r0,r2 ;2 2356 +080B8FE8 (T) ldrh r1,[r0,0Ah] ;4 2360 +080B8FEA (T) mov r0,1h ;2 2362 +080B8FEC (T) and r0,r1 ;2 2364 +080B8FEE (T) cmp r0,0h ;2 2366 +080B8FF0 (T) beq 80B9068h ;8 2374 +080B8FF2 (T) mov r0,r5 ;2 2376 +080B8FF4 (T) bl 80262A8h ;10 2386 +080B8FF8 (T) cmp r0,0h ;2 2388 +080B8FFA (T) bne 80B9068h ;8 2396 +080B8FFC (T) ldr r0,=30052F8h ;9 2405 +080B8FFE (T) mov r3,0h ;2 2407 +080B9000 (T) ldsh r0,[r0,r3] ;4 2411 +080B9002 (T) cmp r0,3h ;2 2413 +080B9004 (T) bgt 80B9068h ;8 2421 +080B9006 (T) ldr r1,=1CBh ;9 2430 +080B9008 (T) add r0,r4,r1 ;2 2432 +080B900A (T) ldrb r0,[r0] ;4 2436 +080B900C (T) cmp r0,1h ;2 2438 +080B900E (T) bhi 80B901Eh ;8 2446 +080B9010 (T) ldr r0,[r6,1Ch] ;4 2450 +080B9012 (T) ldr r0,[r0,10h] ;4 2454 +080B9014 (T) mov r2,2h ;2 2456 +080B9016 (T) ldsh r0,[r0,r2] ;4 2460 +080B9018 (T) mov r1,1h ;2 2462 +080B901A (T) bl 80C2480h ;10 2472 +080B901E (T) ldr r0,=8B17EE4h ;9 2481 +080B9020 (T) ldr r1,=8B17424h ;9 2490 +080B9022 (T) mov r2,90h ;2 2492 +080B9024 (T) bl m2_strlookup ;10 2502 +080B9028 (T) mov r5,r0 ;2 2504 +080B902A (T) ldr r0,[r6,0Ch] ;4 2508 +080B902C (T) mov r1,r5 ;2 2510 +080B902E (T) mov r2,0h ;2 2512 +080B9030 (T) bl m2_initwindow ;10 2522 +080B9034 (T) ldr r0,[r6,0Ch] ;4 2526 +080B9036 (T) bl 80C8BE4h ;10 2536 +080B903A (T) ldr r0,[r6,18h] ;4 2540 +080B903C (T) bl 80C5CC4h ;10 2550 +080B9040 (T) lsl r0,r0,18h ;2 2552 +080B9042 (T) lsr r0,r0,18h ;2 2554 +080B9044 (T) mov r9,r0 ;2 2556 +080B9046 (T) b 80B90B2h ;8 2564 +080B9048 (T) lsl r3,r5,8h ;2 2566 +080B904A (T) lsl r0,r0,0h ;2 2568 +080B904C (T) lsl r2,r6,0Bh ;2 2570 +080B904E (T) lsl r0,r0,0h ;2 2572 +080B9050 (T) ???? ;10 2582 +080B9052 (T) lsr r2,r6,1h ;2 2584 +080B9054 (T) sub r0,0C4h ;2 2586 +080B9056 (T) lsl r0,r0,0Ch ;2 2588 +080B9058 (T) strh r0,[r7,r3] ;5 2593 +080B905A (T) lsl r0,r0,0Ch ;2 2595 +080B905C (T) lsl r3,r1,7h ;2 2597 +080B905E (T) lsl r0,r0,0h ;2 2599 +080B9060 (T) ldrb r4,[r4,1Bh] ;4 2603 +080B9062 (T) lsr r1,r6,2h ;2 2605 +080B9064 (T) strb r4,[r4,10h] ;5 2610 +080B9066 (T) lsr r1,r6,2h ;2 2612 +080B9068 (T) ldr r2,=2024860h ;9 2621 +080B906A (T) ldr r0,[r2] ;4 2625 +080B906C (T) mov r1,10h ;2 2627 +080B906E (T) orr r0,r1 ;2 2629 +080B9070 (T) str r0,[r2] ;5 2634 +080B9072 (T) ldr r5,=8BBBD24h ;9 2643 +080B9074 (T) ldr r4,=3005230h ;9 2652 +080B9076 (T) ldr r0,[r4,8h] ;4 2656 +080B9078 (T) ldr r1,=3001D40h ;9 2665 +080B907A (T) ldr r3,=69Ch ;9 2674 +080B907C (T) add r1,r1,r3 ;2 2676 +080B907E (T) mov r3,0h ;2 2678 +080B9080 (T) ldsh r2,[r1,r3] ;4 2682 +080B9082 (T) mov r1,r5 ;2 2684 +080B9084 (T) bl m2_initwindow ;10 2694 +080B9088 (T) ldr r0,[r4,8h] ;4 2698 +080B908A (T) bl 80C8BE4h ;10 2708 +080B908E (T) bl 80BD844h ;10 2718 +080B9092 (T) ldr r0,[r4,8h] ;4 2722 +080B9094 (T) bl 80C8BE4h ;10 2732 +080B9098 (T) ldr r0,[r4,8h] ;4 2736 +080B909A (T) add r0,44h ;2 2738 +080B909C (T) ldrb r0,[r0] ;4 2742 +080B909E (T) cmp r0,0h ;2 2744 +080B90A0 (T) bne 80B908Eh ;8 2752 +080B90A2 (T) bl 80BD844h ;10 2762 +080B90A6 (T) ldr r0,=2024860h ;9 2771 +080B90A8 (T) ldr r1,[r0] ;4 2775 +080B90AA (T) mov r2,11h ;2 2777 +080B90AC (T) neg r2,r2 ;2 2779 +080B90AE (T) and r1,r2 ;2 2781 +080B90B0 (T) str r1,[r0] ;5 2786 +080B90B2 (T) mov r0,r9 ;2 2788 +080B90B4 (T) cmp r0,0h ;2 2790 +080B90B6 (T) beq 80B90BAh ;8 2798 +080B90B8 (T) b 80B929Ah ;8 2806 +080B90BA (T) mov r0,1h ;2 2808 +080B90BC (T) bl m2_swapwindowbuf ;10 2818 +080B90C0 (T) bl 80ED480h ;10 2828 +080B90C4 (T) lsl r0,r0,10h ;2 2830 +080B90C6 (T) asr r0,r0,10h ;2 2832 +080B90C8 (T) cmp r0,1h ;2 2834 +080B90CA (T) bne 80B90F8h ;8 2842 +080B90CC (T) ldr r4,=3005230h ;9 2851 +080B90CE (T) ldr r0,[r4,1Ch] ;4 2855 +080B90D0 (T) mov r1,0h ;2 2857 +080B90D2 (T) mov r2,0h ;2 2859 +080B90D4 (T) bl m2_initwindow ;10 2869 +080B90D8 (T) ldr r0,[r4,24h] ;4 2873 +080B90DA (T) mov r1,0h ;2 2875 +080B90DC (T) mov r2,0h ;2 2877 +080B90DE (T) bl m2_initwindow ;10 2887 +080B90E2 (T) b 80B9104h ;8 2895 +080B90E4 (T) ldr r0,=80082002h ;9 2904 +080B90E6 (T) lsl r2,r0,8h ;2 2906 +: pop r2,r5,r15 ;23 2929 +080B90EA (T) lsr r3,r7,2h ;2 2931 +080B90EC (T) strh r0,[r6,r0] ;5 2936 +080B90EE (T) lsl r0,r0,0Ch ;2 2938 +080B90F0 (T) add r0,r0,5 ;2 2940 +080B90F2 (T) lsl r0,r0,0Ch ;2 2942 +080B90F4 (T) lsl r4,r3,1Ah ;2 2944 +080B90F6 (T) lsl r0,r0,0h ;2 2946 +080B90F8 (T) ldr r0,=3005230h ;9 2955 +080B90FA (T) ldr r0,[r0,1Ch] ;4 2959 +080B90FC (T) mov r1,0h ;2 2961 +080B90FE (T) mov r2,0h ;2 2963 +080B9100 (T) bl m2_initwindow ;10 2973 +080B9104 (T) ldr r4,=3005230h ;9 2982 +080B9106 (T) ldr r0,[r4,24h] ;4 2986 +080B9108 (T) mov r1,0h ;2 2988 +080B910A (T) mov r2,0h ;2 2990 +080B910C (T) bl m2_initwindow ;10 3000 +080B9110 (T) ldr r0,[r4,1Ch] ;4 3004 +080B9112 (T) ldr r0,[r0,10h] ;4 3008 +080B9114 (T) mov r1,2h ;2 3010 +080B9116 (T) ldsh r0,[r0,r1] ;4 3014 +080B9118 (T) bl m2_psitargetwindow ;10 3024 +080B911C (T) ldr r0,[r4,1Ch] ;4 3028 +080B911E (T) mov r1,0h ;2 3030 +080B9120 (T) mov r2,0h ;2 3032 +080B9122 (T) bl m2_initwindow ;10 3042 +080B9126 (T) ldr r1,[r4,1Ch] ;4 3046 +080B9128 (T) ldr r0,=0FFFFh ;9 3055 +080B912A (T) strh r0,[r1,32h] ;5 3060 +080B912C (T) ldr r0,[r4,1Ch] ;4 3064 +080B912E (T) bl 80C3F28h ;10 3074 +080B9132 (T) ldr r1,[r4,1Ch] ;4 3078 +080B9134 (T) mov r0,0h ;2 3080 +080B9136 (T) strh r0,[r1,32h] ;5 3085 +080B9138 (T) ldr r4,=m2_active_window_pc ;9 3094 +080B913A (T) mov r2,0h ;2 3096 +080B913C (T) ldsh r0,[r4,r2] ;4 3100 +080B913E (T) mov r1,1h ;2 3102 +080B9140 (T) mov r2,0Fh ;2 3104 +080B9142 (T) bl m2_psiwindow ;10 3114 +080B9146 (T) bl 80D42F8h ;10 3124 +080B914A (T) mov r3,0h ;2 3126 +080B914C (T) ldsh r0,[r4,r3] ;4 3130 +080B914E (T) b 80B9262h ;8 3138 +080B9150 (T) strh r0,[r6,r0] ;5 3143 +080B9152 (T) lsl r0,r0,0Ch ;2 3145 +080B9154 (T) bl lr+0FFEh ;10 3155 +080B9156 (T) lsl r0,r0,0h ;2 3157 +080B9158 (T) strh r4,[r4,r1] ;5 3162 +080B915A (T) lsl r0,r0,0Ch ;2 3164 +080B915C (T) ldr r0,=8B17EE4h ;9 3173 +080B915E (T) ldr r1,=8B17424h ;9 3182 +080B9160 (T) mov r2,57h ;2 3184 +080B9162 (T) bl m2_strlookup ;10 3194 +080B9166 (T) mov r5,r0 ;2 3196 +080B9168 (T) ldr r0,[r6,0Ch] ;4 3200 +080B916A (T) mov r1,r5 ;2 3202 +080B916C (T) mov r2,0h ;2 3204 +080B916E (T) bl m2_initwindow ;10 3214 +080B9172 (T) ldr r0,[r6,0Ch] ;4 3218 +080B9174 (T) bl 80C8BE4h ;10 3228 +080B9178 (T) ldr r2,=2024860h ;9 3237 +080B917A (T) mov r0,r2 ;2 3239 +080B917C (T) add r0,4Ah ;2 3241 +080B917E (T) mov r3,0h ;2 3243 +080B9180 (T) strh r3,[r0] ;5 3248 +080B9182 (T) add r0,sp,4h ;2 3250 +080B9184 (T) strh r3,[r0] ;5 3255 +080B9186 (T) ldr r1,=40000D4h ;9 3264 +080B9188 (T) str r0,[r1] ;5 3269 +080B918A (T) add r2,1Ch ;2 3271 +080B918C (T) str r2,[r1,4h] ;5 3276 +080B918E (T) ldr r0,=81000015h ;9 3285 +080B9190 (T) str r0,[r1,8h] ;5 3290 +080B9192 (T) ldr r0,[r1,8h] ;4 3294 +080B9194 (T) ldr r0,=3002500h ;9 3303 +080B9196 (T) strh r3,[r0] ;5 3308 +080B9198 (T) strh r3,[r0,2h] ;5 3313 +080B919A (T) ldr r0,[r6,1Ch] ;4 3317 +080B919C (T) add r0,42h ;2 3319 +080B919E (T) ldrb r0,[r0] ;4 3323 +080B91A0 (T) lsl r0,r0,4h ;2 3325 +080B91A2 (T) add r0,r0,r7 ;2 3327 +080B91A4 (T) mov r1,4h ;2 3329 +080B91A6 (T) ldsh r0,[r0,r1] ;4 3333 +080B91A8 (T) mov r2,r8 ;2 3335 +080B91AA (T) mov r3,0h ;2 3337 +080B91AC (T) ldsh r1,[r2,r3] ;4 3341 +080B91AE (T) bl 80BA860h ;10 3351 +080B91B2 (T) mov r8,r7 ;2 3353 +080B91B4 (T) mov r7,1h ;2 3355 +080B91B6 (T) neg r7,r7 ;2 3357 +080B91B8 (T) ldr r4,=3005230h ;9 3366 +080B91BA (T) ldr r0,[r4,1Ch] ;4 3370 +080B91BC (T) add r0,42h ;2 3372 +080B91BE (T) ldrb r0,[r0] ;4 3376 +080B91C0 (T) lsl r0,r0,4h ;2 3378 +080B91C2 (T) add r0,r8 ;2 3380 +080B91C4 (T) mov r1,4h ;2 3382 +080B91C6 (T) ldsh r0,[r0,r1] ;4 3386 +080B91C8 (T) ldr r6,=m2_active_window_pc ;9 3395 +080B91CA (T) mov r2,0h ;2 3397 +080B91CC (T) ldsh r1,[r6,r2] ;4 3401 +080B91CE (T) bl 80BA860h ;10 3411 +080B91D2 (T) lsl r0,r0,10h ;2 3413 +080B91D4 (T) lsr r5,r0,10h ;2 3415 +080B91D6 (T) asr r0,r0,10h ;2 3417 +080B91D8 (T) cmp r0,r7 ;2 3419 +080B91DA (T) bne 80B9204h ;8 3427 +080B91DC (T) bl 80BD844h ;10 3437 +080B91E0 (T) b 80B91B8h ;8 3445 +080B91E2 (T) lsl r0,r0,0h ;2 3447 +080B91E4 (T) ldrb r4,[r4,1Bh] ;4 3451 +080B91E6 (T) lsr r1,r6,2h ;2 3453 +080B91E8 (T) strb r4,[r4,10h] ;5 3458 +080B91EA (T) lsr r1,r6,2h ;2 3460 +080B91EC (T) ldr r0,=5EE22300h ;9 3469 +080B91EE (T) lsl r2,r0,8h ;2 3471 +080B91F0 (T) lsl r4,r2,3h ;2 3473 +080B91F2 (T) lsl r0,r0,10h ;2 3475 +080B91F4 (T) lsl r5,r2,0h ;2 3477 +080B91F6 (T) strh r0,[r0,8h] ;5 3482 +080B91F8 (T) mov r5,0h ;2 3484 +080B91FA (T) lsl r0,r0,0Ch ;2 3486 +080B91FC (T) strh r0,[r6,r0] ;5 3491 +080B91FE (T) lsl r0,r0,0Ch ;2 3493 +080B9200 (T) strh r4,[r4,r1] ;5 3498 +080B9202 (T) lsl r0,r0,0Ch ;2 3500 +080B9204 (T) lsl r0,r5,18h ;2 3502 +080B9206 (T) lsr r0,r0,18h ;2 3504 +080B9208 (T) mov r9,r0 ;2 3506 +080B920A (T) mov r0,1h ;2 3508 +080B920C (T) bl 80BD7F8h ;10 3518 +080B9210 (T) mov r3,r9 ;2 3520 +080B9212 (T) cmp r3,0h ;2 3522 +080B9214 (T) bne 80B9284h ;8 3530 +080B9216 (T) mov r0,1h ;2 3532 +080B9218 (T) bl m2_swapwindowbuf ;10 3542 +080B921C (T) ldr r0,[r4,24h] ;4 3546 +080B921E (T) mov r1,0h ;2 3548 +080B9220 (T) mov r2,0h ;2 3550 +080B9222 (T) bl m2_initwindow ;10 3560 +080B9226 (T) ldr r0,[r4,1Ch] ;4 3564 +080B9228 (T) ldr r0,[r0,10h] ;4 3568 +080B922A (T) mov r1,2h ;2 3570 +080B922C (T) ldsh r0,[r0,r1] ;4 3574 +080B922E (T) bl m2_psitargetwindow ;10 3584 +080B9232 (T) ldr r0,[r4,1Ch] ;4 3588 +080B9234 (T) mov r1,0h ;2 3590 +080B9236 (T) mov r2,0h ;2 3592 +080B9238 (T) bl m2_initwindow ;10 3602 +080B923C (T) ldr r1,[r4,1Ch] ;4 3606 +080B923E (T) ldr r0,=0FFFFh ;9 3615 +080B9240 (T) strh r0,[r1,32h] ;5 3620 +080B9242 (T) ldr r0,[r4,1Ch] ;4 3624 +080B9244 (T) bl 80C3F28h ;10 3634 +080B9248 (T) ldr r0,[r4,1Ch] ;4 3638 +080B924A (T) mov r2,r9 ;2 3640 +080B924C (T) strh r2,[r0,32h] ;5 3645 +080B924E (T) mov r3,0h ;2 3647 +080B9250 (T) ldsh r0,[r6,r3] ;4 3651 +080B9252 (T) mov r1,1h ;2 3653 +080B9254 (T) mov r2,0Fh ;2 3655 +080B9256 (T) bl m2_psiwindow ;10 3665 +080B925A (T) bl 80D42F8h ;10 3675 +080B925E (T) mov r1,0h ;2 3677 +080B9260 (T) ldsh r0,[r6,r1] ;4 3681 +080B9262 (T) bl m2_hpwindow_up ;10 3691 +080B9266 (T) ldr r1,=3005224h ;9 3700 +080B9268 (T) mov r0,2h ;2 3702 +080B926A (T) strh r0,[r1] ;5 3707 +080B926C (T) mov r0,0h ;2 3709 +080B926E (T) mov r1,0F0h ;2 3711 +080B9270 (T) mov r2,14h ;2 3713 +080B9272 (T) mov r3,5h ;2 3715 +080B9274 (T) bl 8000364h ;10 3725 +080B9278 (T) mov r0,0h ;2 3727 +080B927A (T) b 80B963Ch ;8 3735 +080B927C (T) bl lr+0FFEh ;10 3745 +080B927E (T) lsl r0,r0,0h ;2 3747 +080B9280 (T) strh r4,[r4,r0] ;5 3752 +080B9282 (T) lsl r0,r0,0Ch ;2 3754 +080B9284 (T) ldr r1,=3005224h ;9 3763 +080B9286 (T) mov r0,4h ;2 3765 +080B9288 (T) strh r0,[r1] ;5 3770 +080B928A (T) mov r2,r9 ;2 3772 +080B928C (T) cmp r2,0FFh ;2 3774 +080B928E (T) beq 80B929Ah ;8 3782 +080B9290 (T) mov r0,r9 ;2 3784 +080B9292 (T) sub r0,1h ;2 3786 +080B9294 (T) lsl r0,r0,18h ;2 3788 +080B9296 (T) lsr r0,r0,18h ;2 3790 +080B9298 (T) mov r9,r0 ;2 3792 +080B929A (T) mov r0,1h ;2 3794 +080B929C (T) bl 80BD7F8h ;10 3804 +080B92A0 (T) bl 80D7154h ;10 3814 +080B92A4 (T) ldr r4,=m2_active_window_pc ;9 3823 +080B92A6 (T) mov r3,0h ;2 3825 +080B92A8 (T) ldsh r0,[r4,r3] ;4 3829 +080B92AA (T) ldr r7,=8B204E4h ;9 3838 +080B92AC (T) ldr r5,=8B2A9B0h ;9 3847 +080B92AE (T) ldr r6,=3005230h ;9 3856 +080B92B0 (T) ldr r1,[r6,1Ch] ;4 3860 +080B92B2 (T) add r1,42h ;2 3862 +080B92B4 (T) ldrb r1,[r1] ;4 3866 +080B92B6 (T) lsl r1,r1,4h ;2 3868 +080B92B8 (T) add r1,r1,r5 ;2 3870 +080B92BA (T) mov r3,4h ;2 3872 +080B92BC (T) ldsh r2,[r1,r3] ;4 3876 +080B92BE (T) lsl r1,r2,1h ;2 3878 +080B92C0 (T) add r1,r1,r2 ;2 3880 +080B92C2 (T) lsl r1,r1,2h ;2 3882 +080B92C4 (T) add r1,r1,r7 ;2 3884 +080B92C6 (T) ldrb r1,[r1,3h] ;4 3888 +080B92C8 (T) mov r2,1h ;2 3890 +080B92CA (T) bl 80B964Ch ;10 3900 +080B92CE (T) ldr r0,[r6,1Ch] ;4 3904 +080B92D0 (T) add r0,42h ;2 3906 +080B92D2 (T) ldrb r0,[r0] ;4 3910 +080B92D4 (T) lsl r0,r0,4h ;2 3912 +080B92D6 (T) add r1,r0,r5 ;2 3914 +080B92D8 (T) ldrb r0,[r1,2h] ;4 3918 +080B92DA (T) cmp r0,8h ;2 3920 +080B92DC (T) bne 80B9304h ;8 3928 +080B92DE (T) ldrb r1,[r1,1h] ;4 3932 +080B92E0 (T) mov r0,r9 ;2 3934 +080B92E2 (T) bl 80F0944h ;10 3944 +080B92E6 (T) bl 80CAEC8h ;10 3954 +080B92EA (T) mov r0,2h ;2 3956 +080B92EC (T) neg r0,r0 ;2 3958 +080B92EE (T) b 80B963Ch ;8 3966 +080B92F0 (T) strh r4,[r4,r0] ;5 3971 +080B92F2 (T) lsl r0,r0,0Ch ;2 3973 +080B92F4 (T) strh r4,[r4,r1] ;5 3978 +080B92F6 (T) lsl r0,r0,0Ch ;2 3980 +080B92F8 (T) lsl r4,r4,13h ;2 3982 +080B92FA (T) lsr r2,r6,2h ;2 3984 +080B92FC (T) add r1,sp,2C0h ;2 3986 +080B92FE (T) lsr r2,r6,2h ;2 3988 +080B9300 (T) strh r0,[r6,r0] ;5 3993 +080B9302 (T) lsl r0,r0,0Ch ;2 3995 +080B9304 (T) ldr r1,=300538Ch ;9 4004 +080B9306 (T) ldr r0,=2020C70h ;9 4013 +080B9308 (T) str r0,[r1] ;5 4018 +080B930A (T) mov r2,0h ;2 4020 +080B930C (T) ldsh r1,[r4,r2] ;4 4024 +080B930E (T) bl 80DA4ECh ;10 4034 +080B9312 (T) mov r3,0h ;2 4036 +080B9314 (T) ldsh r1,[r4,r3] ;4 4040 +080B9316 (T) lsl r0,r1,1h ;2 4042 +080B9318 (T) add r0,r0,r1 ;2 4044 +080B931A (T) lsl r0,r0,1h ;2 4046 +080B931C (T) ldr r4,=m2_ness_name ;9 4055 +080B931E (T) add r0,r0,r4 ;2 4057 +080B9320 (T) mov r1,6h ;2 4059 +080B9322 (T) bl 80EBFD4h ;10 4069 +080B9326 (T) mov r0,r9 ;2 4071 +080B9328 (T) cmp r0,0FFh ;2 4073 +080B932A (T) beq 80B933Ah ;8 4081 +080B932C (T) lsl r0,r0,1h ;2 4083 +080B932E (T) add r0,r9 ;2 4085 +080B9330 (T) lsl r0,r0,1h ;2 4087 +080B9332 (T) add r0,r0,r4 ;2 4089 +080B9334 (T) mov r1,6h ;2 4091 +080B9336 (T) bl 80EC010h ;10 4101 +080B933A (T) ldr r0,[r6,1Ch] ;4 4105 +080B933C (T) add r0,42h ;2 4107 +080B933E (T) ldrb r0,[r0] ;4 4111 +080B9340 (T) bl 80EC050h ;10 4121 +080B9344 (T) ldr r0,[r6,1Ch] ;4 4125 +080B9346 (T) add r0,42h ;2 4127 +080B9348 (T) ldrb r0,[r0] ;4 4131 +080B934A (T) lsl r0,r0,4h ;2 4133 +080B934C (T) add r0,r0,r5 ;2 4135 +080B934E (T) mov r2,4h ;2 4137 +080B9350 (T) ldsh r1,[r0,r2] ;4 4141 +080B9352 (T) lsl r0,r1,1h ;2 4143 +080B9354 (T) add r0,r0,r1 ;2 4145 +080B9356 (T) lsl r0,r0,2h ;2 4147 +080B9358 (T) add r1,r7,4 ;2 4149 +080B935A (T) add r0,r0,r1 ;2 4151 +080B935C (T) ldr r5,[r0] ;4 4155 +080B935E (T) ldr r0,[r6,8h] ;4 4159 +080B9360 (T) ldr r3,=4CCh ;9 4168 +080B9362 (T) add r4,r4,r3 ;2 4170 +080B9364 (T) mov r1,0h ;2 4172 +080B9366 (T) ldsh r2,[r4,r1] ;4 4176 +080B9368 (T) mov r1,0h ;2 4178 +080B936A (T) bl m2_initwindow ;10 4188 +080B936E (T) ldr r0,[r6,8h] ;4 4192 +080B9370 (T) mov r3,0h ;2 4194 +080B9372 (T) ldsh r2,[r4,r3] ;4 4198 +080B9374 (T) mov r1,r5 ;2 4200 +080B9376 (T) bl m2_initwindow ;10 4210 +080B937A (T) mov r4,r6 ;2 4212 +080B937C (T) bl 80BD844h ;10 4222 +080B9380 (T) ldr r0,[r4,8h] ;4 4226 +080B9382 (T) bl 80C8BE4h ;10 4236 +080B9386 (T) ldr r0,[r4,8h] ;4 4240 +080B9388 (T) add r0,44h ;2 4242 +080B938A (T) ldrb r5,[r0] ;4 4246 +080B938C (T) cmp r5,0h ;2 4248 +080B938E (T) bne 80B937Ch ;8 4256 +080B9390 (T) bl 80BD844h ;10 4266 +080B9394 (T) ldr r2,=8B204E4h ;9 4275 +080B9396 (T) ldr r0,=8B2A9B0h ;9 4284 +080B9398 (T) mov r10,r0 ;2 4286 +080B939A (T) ldr r1,=3005230h ;9 4295 +080B939C (T) mov r8,r1 ;2 4297 +080B939E (T) ldr r0,[r1,1Ch] ;4 4301 +080B93A0 (T) add r0,42h ;2 4303 +080B93A2 (T) ldrb r0,[r0] ;4 4307 +080B93A4 (T) lsl r0,r0,4h ;2 4309 +080B93A6 (T) add r0,r10 ;2 4311 +080B93A8 (T) mov r3,4h ;2 4313 +080B93AA (T) ldsh r1,[r0,r3] ;4 4317 +080B93AC (T) lsl r0,r1,1h ;2 4319 +080B93AE (T) add r0,r0,r1 ;2 4321 +080B93B0 (T) lsl r0,r0,2h ;2 4323 +080B93B2 (T) mov r7,r2 ;2 4325 +080B93B4 (T) add r7,8h ;2 4327 +080B93B6 (T) add r0,r0,r7 ;2 4329 +080B93B8 (T) ldr r0,[r0] ;4 4333 +080B93BA (T) cmp r0,0h ;2 4335 +080B93BC (T) bne 80B93C0h ;8 4343 +080B93BE (T) b 80B9622h ;8 4351 +080B93C0 (T) ldr r0,=3005390h ;9 4360 +080B93C2 (T) ldr r1,=2020D04h ;9 4369 +080B93C4 (T) str r1,[r0] ;5 4374 +080B93C6 (T) mov r0,r9 ;2 4376 +080B93C8 (T) cmp r0,0FFh ;2 4378 +080B93CA (T) beq 80B93CEh ;8 4386 +080B93CC (T) b 80B9554h ;8 4394 +080B93CE (T) mov r1,0h ;2 4396 +080B93D0 (T) mov r9,r1 ;2 4398 +080B93D2 (T) ldr r0,=3001D40h ;9 4407 +080B93D4 (T) ldr r2,=1CBh ;9 4416 +080B93D6 (T) add r1,r0,r2 ;2 4418 +080B93D8 (T) ldrb r3,[r1] ;4 4422 +080B93DA (T) cmp r9,r3 ;2 4424 +080B93DC (T) blt 80B93E0h ;8 4432 +080B93DE (T) b 80B9622h ;8 4440 +080B93E0 (T) str r0,[sp,8h] ;5 4445 +080B93E2 (T) ldr r6,=2024860h ;9 4454 +080B93E4 (T) ldr r0,[sp,8h] ;4 4458 +080B93E6 (T) mov r1,0E2h ;2 4460 +080B93E8 (T) lsl r1,r1,1h ;2 4462 +080B93EA (T) add r4,r0,r1 ;2 4464 +080B93EC (T) add r4,r9 ;2 4466 +080B93EE (T) ldrb r1,[r4] ;4 4470 +080B93F0 (T) lsl r0,r1,1h ;2 4472 +080B93F2 (T) add r0,r0,r1 ;2 4474 +080B93F4 (T) lsl r0,r0,1h ;2 4476 +080B93F6 (T) ldr r2,=m2_ness_name ;9 4485 +080B93F8 (T) add r0,r0,r2 ;2 4487 +080B93FA (T) mov r1,6h ;2 4489 +080B93FC (T) bl 80EC010h ;10 4499 +080B9400 (T) ldrb r1,[r4] ;4 4503 +080B9402 (T) mov r3,94h ;2 4505 +080B9404 (T) mov r0,r1 ;2 4507 +080B9406 (T) mul r0,r3 ;3 4510 +080B9408 (T) ldr r5,=2020C70h ;9 4519 +080B940A (T) add r0,r0,r5 ;2 4521 +080B940C (T) bl 80DA4ECh ;10 4531 +080B9410 (T) ldr r1,=3005390h ;9 4540 +080B9412 (T) ldrb r0,[r4] ;4 4544 +080B9414 (T) mov r2,94h ;2 4546 +080B9416 (T) mul r0,r2 ;3 4549 +080B9418 (T) add r0,r0,r5 ;2 4551 +080B941A (T) str r0,[r1] ;5 4556 +080B941C (T) mov r1,0h ;2 4558 +080B941E (T) strh r1,[r6,1Ah] ;5 4563 +080B9420 (T) add r0,sp,4h ;2 4565 +080B9422 (T) strh r1,[r0] ;5 4570 +080B9424 (T) ldr r1,=40000D4h ;9 4579 +080B9426 (T) str r0,[r1] ;5 4584 +080B9428 (T) ldr r3,=202487Ch ;9 4593 +080B942A (T) str r3,[r1,4h] ;5 4598 +080B942C (T) ldr r0,=81000015h ;9 4607 +080B942E (T) str r0,[r1,8h] ;5 4612 +080B9430 (T) ldr r0,[r1,8h] ;4 4616 +080B9432 (T) mov r0,1h ;2 4618 +080B9434 (T) add r0,r9 ;2 4620 +080B9436 (T) mov r10,r0 ;2 4622 +080B9438 (T) bl 80BD844h ;10 4632 +080B943C (T) ldr r0,[r6] ;4 4636 +080B943E (T) mov r1,1h ;2 4638 +080B9440 (T) and r0,r1 ;2 4640 +080B9442 (T) cmp r0,0h ;2 4642 +080B9444 (T) beq 80B94ACh ;8 4650 +080B9446 (T) mov r1,r8 ;2 4652 +080B9448 (T) ldr r0,[r1,8h] ;4 4656 +080B944A (T) bl 80C8BE4h ;10 4666 +080B944E (T) mov r2,r8 ;2 4668 +080B9450 (T) ldr r0,[r2,8h] ;4 4672 +080B9452 (T) add r0,44h ;2 4674 +080B9454 (T) ldrb r0,[r0] ;4 4678 +080B9456 (T) cmp r0,0h ;2 4680 +080B9458 (T) bne 80B9438h ;8 4688 +080B945A (T) ldr r0,[r6] ;4 4692 +080B945C (T) mov r1,2h ;2 4694 +080B945E (T) neg r1,r1 ;2 4696 +080B9460 (T) and r0,r1 ;2 4698 +080B9462 (T) str r0,[r6] ;5 4703 +080B9464 (T) ldr r0,[r6,6Ch] ;4 4707 +080B9466 (T) cmp r0,0h ;2 4709 +080B9468 (T) beq 80B9438h ;8 4717 +080B946A (T) bl 80F499Ch ;10 4727 +080B946E (T) b 80B9438h ;8 4735 +080B9470 (T) strh r4,[r1,r6] ;5 4740 +080B9472 (T) lsl r0,r0,0Ch ;2 4742 +080B9474 (T) lsr r0,r6,11h ;2 4744 +080B9476 (T) lsl r2,r0,8h ;2 4746 +080B9478 (T) sub r0,r2,4 ;2 4748 +080B947A (T) lsl r0,r0,0Ch ;2 4750 +080B947C (T) lsl r4,r1,13h ;2 4752 +080B947E (T) lsl r0,r0,0h ;2 4754 +080B9480 (T) lsl r4,r4,13h ;2 4756 +080B9482 (T) lsr r2,r6,2h ;2 4758 +080B9484 (T) add r1,sp,2C0h ;2 4760 +080B9486 (T) lsr r2,r6,2h ;2 4762 +080B9488 (T) strh r0,[r6,r0] ;5 4767 +080B948A (T) lsl r0,r0,0Ch ;2 4769 +080B948C (T) strh r0,[r2,r6] ;5 4774 +080B948E (T) lsl r0,r0,0Ch ;2 4776 +080B9490 (T) lsr r4,r0,14h ;2 4778 +080B9492 (T) lsl r2,r0,8h ;2 4780 +080B9494 (T) add r0,r0,5 ;2 4782 +080B9496 (T) lsl r0,r0,0Ch ;2 4784 +080B9498 (T) lsl r3,r1,7h ;2 4786 +080B949A (T) lsl r0,r0,0h ;2 4788 +080B949C (T) ldr r0,=0F018DDF6h ;9 4797 +080B949E (T) lsl r2,r0,8h ;2 4799 +080B94A0 (T) lsl r4,r2,3h ;2 4801 +080B94A2 (T) lsl r0,r0,10h ;2 4803 +080B94A4 (T) ldr r0,=324C8019h ;9 4812 +080B94A6 (T) lsl r2,r0,8h ;2 4814 +080B94A8 (T) lsl r5,r2,0h ;2 4816 +080B94AA (T) strh r0,[r0,8h] ;5 4821 +080B94AC (T) mov r3,1Ah ;2 4823 +080B94AE (T) ldsh r0,[r6,r3] ;4 4827 +080B94B0 (T) cmp r0,0h ;2 4829 +080B94B2 (T) bne 80B94F0h ;8 4837 +080B94B4 (T) mov r1,r8 ;2 4839 +080B94B6 (T) ldr r0,[r1,1Ch] ;4 4843 +080B94B8 (T) add r0,42h ;2 4845 +080B94BA (T) ldrb r0,[r0] ;4 4849 +080B94BC (T) lsl r0,r0,4h ;2 4851 +080B94BE (T) ldr r2,=8B2A9B0h ;9 4860 +080B94C0 (T) add r0,r0,r2 ;2 4862 +080B94C2 (T) mov r3,4h ;2 4864 +080B94C4 (T) ldsh r1,[r0,r3] ;4 4868 +080B94C6 (T) lsl r0,r1,1h ;2 4870 +080B94C8 (T) add r0,r0,r1 ;2 4872 +080B94CA (T) lsl r0,r0,2h ;2 4874 +080B94CC (T) ldr r1,=8B204ECh ;9 4883 +080B94CE (T) add r0,r0,r1 ;2 4885 +080B94D0 (T) ldr r0,[r0] ;4 4889 +080B94D2 (T) bl 80F499Ch ;10 4899 +080B94D6 (T) mov r3,r8 ;2 4901 +080B94D8 (T) ldr r2,[r3,8h] ;4 4905 +080B94DA (T) ldr r0,[r2] ;4 4909 +080B94DC (T) ldr r1,=0FFFFFEFFh ;9 4918 +080B94DE (T) and r0,r1 ;2 4920 +080B94E0 (T) str r0,[r2] ;5 4925 +080B94E2 (T) b 80B9438h ;8 4933 +080B94E4 (T) add r1,sp,2C0h ;2 4935 +080B94E6 (T) lsr r2,r6,2h ;2 4937 +080B94E8 (T) lsl r4,r5,13h ;2 4939 +080B94EA (T) lsr r2,r6,2h ;2 4941 +080B94EC (T) bl lr+0DFEh ;10 4951 +080B94EE (T) bl lr+0FFEh ;10 4961 +080B94F0 (T) mov r1,r8 ;2 4963 +080B94F2 (T) ldr r0,[r1,8h] ;4 4967 +080B94F4 (T) ldr r1,[r0] ;4 4971 +080B94F6 (T) ldr r2,=0FFFFFEFFh ;9 4980 +080B94F8 (T) and r1,r2 ;2 4982 +080B94FA (T) str r1,[r0] ;5 4987 +080B94FC (T) bl 80BD844h ;10 4997 +080B9500 (T) ldr r2,=3001F0Bh ;9 5006 +080B9502 (T) ldrb r2,[r2] ;4 5010 +080B9504 (T) cmp r9,r2 ;2 5012 +080B9506 (T) bge 80B9532h ;8 5020 +080B9508 (T) mov r3,0h ;2 5022 +080B950A (T) ldr r7,=3005390h ;9 5031 +080B950C (T) ldr r0,=3001F04h ;9 5040 +080B950E (T) mov r1,r9 ;2 5042 +080B9510 (T) add r4,r1,r0 ;2 5044 +080B9512 (T) ldr r2,=0FFFFFE90h ;9 5053 +080B9514 (T) add r5,r0,r2 ;2 5055 +080B9516 (T) mov r2,6Ch ;2 5057 +080B9518 (T) ldrb r0,[r4] ;4 5061 +080B951A (T) mov r1,r0 ;2 5063 +080B951C (T) mul r1,r2 ;6 5069 +080B951E (T) add r1,r3,r1 ;2 5071 +080B9520 (T) add r1,r1,r5 ;2 5073 +080B9522 (T) ldr r0,[r7] ;4 5077 +080B9524 (T) add r0,5Fh ;2 5079 +080B9526 (T) add r0,r0,r3 ;2 5081 +080B9528 (T) ldrb r0,[r0] ;4 5085 +080B952A (T) strb r0,[r1] ;5 5090 +080B952C (T) add r3,1h ;2 5092 +080B952E (T) cmp r3,6h ;2 5094 +080B9530 (T) ble 80B9518h ;8 5102 +080B9532 (T) mov r9,r10 ;2 5104 +080B9534 (T) ldr r3,=3001F0Bh ;9 5113 +080B9536 (T) ldrb r3,[r3] ;4 5117 +080B9538 (T) cmp r9,r3 ;2 5119 +080B953A (T) bge 80B953Eh ;8 5127 +080B953C (T) b 80B93E4h ;8 5135 +080B953E (T) b 80B9622h ;8 5143 +080B9540 (T) bl lr+0DFEh ;10 5153 +080B9542 (T) bl lr+0FFEh ;10 5163 +080B9544 (T) sub r3,r1,4 ;2 5165 +080B9546 (T) lsl r0,r0,0Ch ;2 5167 +080B9548 (T) strh r0,[r2,r6] ;5 5172 +080B954A (T) lsl r0,r0,0Ch ;2 5174 +080B954C (T) sub r4,r0,4 ;2 5176 +080B954E (T) lsl r0,r0,0Ch ;2 5178 +080B9550 (T) bl lr+0D20h ;10 5188 +080B9552 (T) bl lr+0FFEh ;10 5198 +080B9554 (T) mov r0,r1 ;2 5200 +080B9556 (T) mov r1,r9 ;2 5202 +080B9558 (T) bl 80DA4ECh ;10 5212 +080B955C (T) ldr r2,=2024860h ;9 5221 +080B955E (T) strh r5,[r2,1Ah] ;5 5226 +080B9560 (T) add r0,sp,4h ;2 5228 +080B9562 (T) strh r5,[r0] ;5 5233 +080B9564 (T) ldr r1,=40000D4h ;9 5242 +080B9566 (T) str r0,[r1] ;5 5247 +080B9568 (T) mov r0,r2 ;2 5249 +080B956A (T) add r0,1Ch ;2 5251 +080B956C (T) str r0,[r1,4h] ;5 5256 +080B956E (T) ldr r0,=81000015h ;9 5265 +080B9570 (T) str r0,[r1,8h] ;5 5270 +080B9572 (T) ldr r0,[r1,8h] ;4 5274 +080B9574 (T) mov r4,r2 ;2 5276 +080B9576 (T) mov r5,r8 ;2 5278 +080B9578 (T) mov r6,r10 ;2 5280 +080B957A (T) bl 80BD844h ;10 5290 +080B957E (T) ldr r0,[r4] ;4 5294 +080B9580 (T) mov r1,1h ;2 5296 +080B9582 (T) and r0,r1 ;2 5298 +080B9584 (T) cmp r0,0h ;2 5300 +080B9586 (T) beq 80B95BCh ;8 5308 +080B9588 (T) ldr r0,[r5,8h] ;9 5317 +080B958A (T) bl 80C8BE4h ;10 5327 +080B958E (T) ldr r0,[r5,8h] ;9 5336 +080B9590 (T) add r0,44h ;2 5338 +080B9592 (T) ldrb r0,[r0] ;4 5342 +080B9594 (T) cmp r0,0h ;2 5344 +080B9596 (T) bne 80B957Ah ;8 5352 +080B9598 (T) ldr r0,[r4] ;4 5356 +080B959A (T) mov r1,2h ;2 5358 +080B959C (T) neg r1,r1 ;2 5360 +080B959E (T) and r0,r1 ;2 5362 +080B95A0 (T) str r0,[r4] ;5 5367 +080B95A2 (T) ldr r0,[r4,6Ch] ;4 5371 +080B95A4 (T) cmp r0,0h ;2 5373 +080B95A6 (T) beq 80B957Ah ;8 5381 +080B95A8 (T) bl 80F499Ch ;10 5391 +080B95AC (T) b 80B957Ah ;8 5399 +080B95AE (T) lsl r0,r0,0h ;2 5401 +080B95B0 (T) ldr r0,=80B9F94h ;9 5410 +080B95B2 (T) lsl r2,r0,8h ;2 5412 +080B95B4 (T) lsl r4,r2,3h ;2 5414 +080B95B6 (T) lsl r0,r0,10h ;2 5416 +080B95B8 (T) lsl r5,r2,0h ;2 5418 +080B95BA (T) strh r0,[r0,8h] ;5 5423 +080B95BC (T) mov r1,1Ah ;2 5425 +080B95BE (T) ldsh r0,[r4,r1] ;4 5429 +080B95C0 (T) cmp r0,0h ;2 5431 +080B95C2 (T) bne 80B95F0h ;8 5439 +080B95C4 (T) ldr r0,[r5,1Ch] ;9 5448 +080B95C6 (T) add r0,42h ;2 5450 +080B95C8 (T) ldrb r0,[r0] ;4 5454 +080B95CA (T) lsl r0,r0,4h ;2 5456 +080B95CC (T) add r0,r0,r6 ;2 5458 +080B95CE (T) mov r2,4h ;2 5460 +080B95D0 (T) ldsh r1,[r0,r2] ;4 5464 +080B95D2 (T) lsl r0,r1,1h ;2 5466 +080B95D4 (T) add r0,r0,r1 ;2 5468 +080B95D6 (T) lsl r0,r0,2h ;2 5470 +080B95D8 (T) add r0,r0,r7 ;2 5472 +080B95DA (T) ldr r0,[r0] ;4 5476 +080B95DC (T) bl 80F499Ch ;10 5486 +080B95E0 (T) ldr r2,[r5,8h] ;9 5495 +080B95E2 (T) ldr r0,[r2] ;4 5499 +080B95E4 (T) ldr r1,=0FFFFFEFFh ;9 5508 +080B95E6 (T) and r0,r1 ;2 5510 +080B95E8 (T) str r0,[r2] ;5 5515 +080B95EA (T) b 80B957Ah ;8 5523 +080B95EC (T) bl lr+0DFEh ;10 5533 +080B95EE (T) bl lr+0FFEh ;10 5543 +080B95F0 (T) ldr r2,[r5,8h] ;9 5552 +080B95F2 (T) ldr r0,[r2] ;4 5556 +080B95F4 (T) ldr r1,=0FFFFFEFFh ;9 5565 +080B95F6 (T) and r0,r1 ;2 5567 +080B95F8 (T) str r0,[r2] ;5 5572 +080B95FA (T) bl 80BD844h ;10 5582 +080B95FE (T) mov r3,0h ;2 5584 +080B9600 (T) ldr r0,=3001D40h ;9 5593 +080B9602 (T) mov r1,6Ch ;2 5595 +080B9604 (T) mov r2,r9 ;2 5597 +080B9606 (T) mul r2,r1 ;3 5600 +080B9608 (T) mov r1,r2 ;2 5602 +080B960A (T) add r0,54h ;2 5604 +080B960C (T) add r1,r1,r0 ;2 5606 +080B960E (T) ldr r2,=3005390h ;9 5615 +080B9610 (T) ldr r0,[r2] ;4 5619 +080B9612 (T) add r0,5Fh ;2 5621 +080B9614 (T) add r0,r0,r3 ;2 5623 +080B9616 (T) ldrb r0,[r0] ;4 5627 +080B9618 (T) strb r0,[r1] ;5 5632 +080B961A (T) add r1,1h ;2 5634 +080B961C (T) add r3,1h ;2 5636 +080B961E (T) cmp r3,6h ;2 5638 +080B9620 (T) ble 80B9610h ;8 5646 +080B9622 (T) bl 80D1D84h ;10 5656 +080B9626 (T) mov r0,2h ;2 5658 +080B9628 (T) neg r0,r0 ;2 5660 +080B962A (T) b 80B963Ch ;8 5668 +080B962C (T) bl lr+0DFEh ;10 5678 +080B962E (T) bl lr+0FFEh ;10 5688 +080B9630 (T) add r0,r0,5 ;2 5690 +080B9632 (T) lsl r0,r0,0Ch ;2 5692 +080B9634 (T) strh r0,[r2,r6] ;5 5697 +080B9636 (T) lsl r0,r0,0Ch ;2 5699 +080B9638 (T) lsl r0,r5,10h ;2 5701 +080B963A (T) asr r0,r0,10h ;2 5703 +080B963C (T) add sp,0Ch ;2 5705 +080B963E (T) pop r3-r5 ;6 5711 +080B9640 (T) mov r8,r3 ;2 5713 +080B9642 (T) mov r9,r4 ;2 5715 +080B9644 (T) mov r10,r5 ;2 5717 +080B9646 (T) pop r4-r7 ;7 5724 +080B9648 (T) pop r1 ;4 5728 +080B964A (T) bx r1 ;8 5736 diff --git a/notes/m2-subBAEF8.txt b/notes/m2-subBAEF8.txt index 5711232..e79fa2d 100644 --- a/notes/m2-subBAEF8.txt +++ b/notes/m2-subBAEF8.txt @@ -64,7 +64,7 @@ // ---------------------------------------------------------------------------- // Substate 1 (character select) 080BAF5C (T) ldr r6,=3005230h ;9 495 -080BAF5E (T) ldr r0,[r6,18h] ;4 499 +080BAF5E (T) ldr r0,[r6,18h] ;4 499 slot window pointer 080BAF60 (T) bl 80C4EB0h ;10 509 080BAF64 (T) lsl r0,r0,10h ;2 511 080BAF66 (T) asr r5,r0,10h ;2 513 From 391182811f092ac999b448e186bd29bce9890222 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Sun, 4 Aug 2019 00:38:39 +0200 Subject: [PATCH 2/6] Fix some window headers issues (#51) * Fix window headers requiring too many tiles Also fixes issue where Poo's name would not be printed properly in the inner PSI window. * Improve comment --- src/m2-hack.asm | 21 ++++++++++++- src/m2-vwf-entries.asm | 71 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/m2-hack.asm b/src/m2-hack.asm index be23043..46b5c91 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -794,6 +794,17 @@ nop //--------------------------------------------------------- .org 0x802A75F :: db 0x30 //Add 8 extra frames before the game can start reading again. +//--------------------------------------------------------- +// Fix windows printing too many tiles due to not going off of pixels, but off of characters +//--------------------------------------------------------- +.org 0x80C0B28 :: bl c0b28_fix_char_tiles //Status window +.org 0x80C009E :: bl c009e_fix_char_tiles //Give window +.org 0x80C4BD6 :: bl c4bd6_fix_char_tiles //Equip window +.org 0x80C42E0 :: bl c42e0_fix_char_tiles //Outer PSI window +.org 0x80C3FD8 :: bl c42e0_fix_char_tiles //Inner PSI window +.org 0x80C4448 :: bl c4448_fix_char_tiles //Inner PSI window - part 2 +.org 0x80DBF36 :: bl c009e_fix_char_tiles //Battle menu window + //--------------------------------------------------------- // Names hacks //--------------------------------------------------------- @@ -846,6 +857,8 @@ nop .org 0x80D6B44 :: lsl r1,r4,#3 :: sub r1,r1,r4 :: nop .org 0x80D6E3A :: lsl r1,r4,#3 :: sub r1,r1,r4 :: nop .org 0x80D6ED0 :: lsl r1,r4,#3 :: sub r1,r1,r4 :: nop +.org 0x80C3FC6 :: lsl r1,r0,#3 :: sub r1,r1,r0 :: nop +.org 0x80C4436 :: lsl r1,r0,#3 :: sub r1,r1,r0 :: nop //Change the way the characters' names are called. Instead of number * 6, it's now number * 7. These ones already received an lsl of 1 beforehand. .org 0x80C0AC8 :: lsl r1,r1,#2 :: sub r1,r1,r5 @@ -927,7 +940,13 @@ nop .org 0x80121DC :: cmp r2,#4 .org 0x8013672 :: cmp r5,#4 -.org 0x80C0B0A :: cmp r2,#4 +.org 0x80C0B0A :: cmp r2,#4 //Status window header +.org 0x80C4BBC :: cmp r2,#4 //Equip window header +.org 0x80C42C6 :: cmp r2,#4 //Outer PSI window header +.org 0x80C3FBE :: cmp r2,#4 //Inner PSI window header +.org 0x80C442E :: cmp r2,#4 //Inner PSI window - part 2 header +.org 0x80C0082 :: cmp r5,#4 //Give window header +.org 0x80DBF28 :: cmp r0,#4 //Battle menu window header .org 0x80C97E2 :: cmp r1,#6 .org 0x80DAF3A :: cmp r0,#6 .org 0x80D33BC :: cmp r2,#6 diff --git a/src/m2-vwf-entries.asm b/src/m2-vwf-entries.asm index 33ced33..2e62834 100644 --- a/src/m2-vwf-entries.asm +++ b/src/m2-vwf-entries.asm @@ -1379,4 +1379,75 @@ strh r5,[r1,#6] mov r2,#1 mov r5,#0 +pop {pc} + +//============================================================================== +//Routine for window headers that fixes the issue character - tiles +fix_char_tiles: +push {lr} +lsl r0,r2,#1 +lsl r1,r2,#2 +add r1,r1,r0 //Multiply r2 (character count) by 6 +lsr r0,r1,#3 //Divide by 8 +lsl r0,r0,#3 //Re-multiply by 8 +cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?) +beq @@next +add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed +@@next: +lsr r0,r0,#3 //Get the amount of tiles needed +cmp r0,r2 //If it's not the same amout as the characters... +beq @@end +sub r0,r2,r0 +lsl r0,r0,#1 +sub r6,r6,r0 //Remove the amount of extra tiles +@@end: +pop {pc} + +//============================================================================== +//Specific fix_char_tiles routine - Status window +c0b28_fix_char_tiles: +push {lr} +bl fix_char_tiles +ldr r0,[r4,#0] //Clobbered code +add r0,#0xB3 +pop {pc} + +//============================================================================== +//Specific fix_char_tiles routine - Give window +c009e_fix_char_tiles: +push {lr} +mov r2,r5 +bl fix_char_tiles +ldr r2,=#0x30051EC //Clobbered code +ldrh r0,[r2] +pop {pc} + +//============================================================================== +//Specific fix_char_tiles routine - Equip window +c4bd6_fix_char_tiles: +push {lr} +mov r6,r7 +bl fix_char_tiles +mov r7,r6 +ldr r2,=#0x30051EC //Clobbered code +ldrh r0,[r2] +pop {pc} + +.pool +//============================================================================== +//Specific fix_char_tiles routine - Outer PSI window +c42e0_fix_char_tiles: +push {lr} +bl fix_char_tiles +mov r2,r9 //Clobbered code +ldrh r0,[r2,#0] +pop {pc} + +//============================================================================== +//Specific fix_char_tiles routine - Inner PSI window - part 2 +c4448_fix_char_tiles: +push {lr} +bl fix_char_tiles +mov r2,r8 //Clobbered code +ldrh r0,[r2,#0] pop {pc} \ No newline at end of file From 0b48ef5400b91cca85accf31df81939d0804fa80 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Sun, 4 Aug 2019 21:58:41 +0200 Subject: [PATCH 3/6] Fix https://github.com/jeffman/Mother2GbaTranslation/issues/46 and https://github.com/jeffman/Mother2GbaTranslation/issues/28 (#52) Also improves formatting from previous pieces of code. --- src/c/vwf.c | 6 +- src/c/vwf.h | 2 +- src/m2-hack.asm | 23 +++ src/m2-vwf-entries.asm | 338 ++++++++++++++++++++++++----------------- working/m12-other.json | 10 +- 5 files changed, 233 insertions(+), 146 deletions(-) diff --git a/src/c/vwf.c b/src/c/vwf.c index 79f90c1..64f1a0c 100644 --- a/src/c/vwf.c +++ b/src/c/vwf.c @@ -206,10 +206,10 @@ int print_window_header_string(int *dest, byte *str, int x, int y) return pixelX - (x & 7); } -void clear_window_header(int *dest) +void clear_window_header(int *dest, int length, int x, int y) { - dest += (WINDOW_HEADER_X + (WINDOW_HEADER_Y * 32)) * 8; - clear_rect_ram(dest, 16, WINDOW_HEADER_BG); + dest += (x + (y * 32)) * 8; + clear_rect_ram(dest, length, WINDOW_HEADER_BG); } unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window) diff --git a/src/c/vwf.h b/src/c/vwf.h index cfb1621..c5024c3 100644 --- a/src/c/vwf.h +++ b/src/c/vwf.h @@ -38,7 +38,7 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro int *dest, int (*getTileCallback)(int, int), int useTilemap); byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground); int print_window_header_string(int *dest, byte *str, int x, int y); -void clear_window_header(int *dest); +void clear_window_header(int *dest, int length, int x, int y); unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window); unsigned short format_tile(unsigned short tile, bool flip_x, bool flip_y); diff --git a/src/m2-hack.asm b/src/m2-hack.asm index 46b5c91..8acf245 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -116,6 +116,9 @@ b 0x80BADD8 .org 0x80C55F8 mov r4,r0 mov r0,r9 +mov r1,#0x10 //Tiles to clear +mov r2,#0x10 //x +mov r3,#0x11 //y bl clear_window_header mov r0,r4 mov r1,r6 // tilemap @@ -794,6 +797,26 @@ nop //--------------------------------------------------------- .org 0x802A75F :: db 0x30 //Add 8 extra frames before the game can start reading again. +//--------------------------------------------------------- +// Teleport header fix +//--------------------------------------------------------- +.org 0x80C5DE0 :: bl c65da_clean_print //To: +.org 0x80C5E30 :: bl c6190_clean_print //Number on first entering the menu +.org 0x80C6190 :: bl c6190_clean_print //Number on page change +.org 0x80C5E04 :: nop :: strh r0,[r4,#0] :: add r4,#2 :: nop ::nop //Remove extra tile + +//--------------------------------------------------------- +// Stored Goods header fix +//--------------------------------------------------------- +.org 0x80C656C :: mov r2,#0x10 :: mov r3,#0x11 :: bl c6570_clean_print_change_pos :: b 0x80C65C0 //Changes position and cleans tiles for Stored Goods +.org 0x80C65DA :: bl c65da_clean_print //Number on first entering the menu +.org 0x80C6996 :: bl c65da_clean_print //Number on page change + +//--------------------------------------------------------- +// Call header fix +//--------------------------------------------------------- +.org 0x80BD26A :: bl c6190_clean_print //Call: + //--------------------------------------------------------- // Fix windows printing too many tiles due to not going off of pixels, but off of characters //--------------------------------------------------------- diff --git a/src/m2-vwf-entries.asm b/src/m2-vwf-entries.asm index 2e62834..a919b34 100644 --- a/src/m2-vwf-entries.asm +++ b/src/m2-vwf-entries.asm @@ -1276,178 +1276,242 @@ pop {pc} //============================================================================== //Hacks that load specific numbers for the new names _2352_load_1d7: -mov r0,#0xEB -lsl r0,r0,#1 -add r0,r0,#1 -bx lr +mov r0,#0xEB +lsl r0,r0,#1 +add r0,r0,#1 +bx lr _2372_load_1e5: -mov r0,#0xF2 -lsl r0,r0,#1 -add r0,r0,#1 -bx lr +mov r0,#0xF2 +lsl r0,r0,#1 +add r0,r0,#1 +bx lr c98c4_load_1d7: -mov r4,#0xEB -lsl r4,r4,#1 -add r4,r4,#1 -bx lr +mov r4,#0xEB +lsl r4,r4,#1 +add r4,r4,#1 +bx lr c98d4_load_1e5: -mov r4,#0xF2 -lsl r4,r4,#1 -add r4,r4,#1 -bx lr +mov r4,#0xF2 +lsl r4,r4,#1 +add r4,r4,#1 +bx lr //============================================================================== //Fast routine that uses the defaults and stores them. Original one is a nightmare. Rewriting it from scratch. r1 has the target address. r5 has 0. cb2f2_hardcoded_defaults: -push {lr} -mov r0,#0x7E //Ness' name -strb r0,[r1,#0] -mov r2,#0x95 -strb r2,[r1,#1] -strb r2,[r1,#0xF] -mov r0,#0xA3 -strb r0,[r1,#2] -strb r0,[r1,#3] -mov r4,#0xFF -lsl r5,r4,#8 -strh r5,[r1,#4] -add r1,#7 -mov r0,#0x80 //Paula's name -strb r0,[r1,#0] -strb r0,[r1,#0xE] -mov r3,#0x91 -strb r3,[r1,#1] -strb r3,[r1,#4] -mov r0,#0xA5 -strb r0,[r1,#2] -mov r0,#0x9C -strb r0,[r1,#3] -strb r5,[r1,#5] -strb r4,[r1,#6] -add r1,#7 -mov r0,#0x7A //Jeff's name -strb r0,[r1,#0] -mov r0,#0x95 -strb r0,[r1,#1] -mov r0,#0x96 -strb r0,[r1,#2] -strb r0,[r1,#3] -strh r5,[r1,#4] -add r1,#7 -strb r4,[r1,#4] -mov r4,#0x9F //Poo's name -strb r4,[r1,#1] -strb r4,[r1,#2] -strb r5,[r1,#3] -add r1,#7 -mov r0,#0x7B //King's name -strb r0,[r1,#0] -mov r0,#0x99 -strb r0,[r1,#1] -mov r0,#0x9E -strb r0,[r1,#2] -mov r0,#0x97 -strb r0,[r1,#3] -strh r5,[r1,#4] -add r1,#8 -mov r0,#0x83 //Steak's name -strb r0,[r1,#0] -mov r0,#0xA4 -strb r0,[r1,#1] -strb r2,[r1,#2] -strb r3,[r1,#3] -mov r3,#0x9B -strb r3,[r1,#4] -mov r2,#0xFF -strb r5,[r1,#5] -strb r2,[r1,#6] -add r1,#8 -mov r0,#0x82 //Rockin's name -strb r0,[r1,#0] -strb r4,[r1,#1] -mov r0,#0x93 -strb r0,[r1,#2] -strb r3,[r1,#3] -mov r0,#0x99 -strb r0,[r1,#4] -mov r0,#0x9E -strb r0,[r1,#5] -strh r5,[r1,#6] -mov r2,#1 -mov r5,#0 +push {lr} +mov r0,#0x7E //Ness' name +strb r0,[r1,#0] +mov r2,#0x95 +strb r2,[r1,#1] +strb r2,[r1,#0xF] +mov r0,#0xA3 +strb r0,[r1,#2] +strb r0,[r1,#3] +mov r4,#0xFF +lsl r5,r4,#8 +strh r5,[r1,#4] +add r1,#7 +mov r0,#0x80 //Paula's name +strb r0,[r1,#0] +strb r0,[r1,#0xE] +mov r3,#0x91 +strb r3,[r1,#1] +strb r3,[r1,#4] +mov r0,#0xA5 +strb r0,[r1,#2] +mov r0,#0x9C +strb r0,[r1,#3] +strb r5,[r1,#5] +strb r4,[r1,#6] +add r1,#7 +mov r0,#0x7A //Jeff's name +strb r0,[r1,#0] +mov r0,#0x95 +strb r0,[r1,#1] +mov r0,#0x96 +strb r0,[r1,#2] +strb r0,[r1,#3] +strh r5,[r1,#4] +add r1,#7 +strb r4,[r1,#4] +mov r4,#0x9F //Poo's name +strb r4,[r1,#1] +strb r4,[r1,#2] +strb r5,[r1,#3] +add r1,#7 +mov r0,#0x7B //King's name +strb r0,[r1,#0] +mov r0,#0x99 +strb r0,[r1,#1] +mov r0,#0x9E +strb r0,[r1,#2] +mov r0,#0x97 +strb r0,[r1,#3] +strh r5,[r1,#4] +add r1,#8 +mov r0,#0x83 //Steak's name +strb r0,[r1,#0] +mov r0,#0xA4 +strb r0,[r1,#1] +strb r2,[r1,#2] +strb r3,[r1,#3] +mov r3,#0x9B +strb r3,[r1,#4] +mov r2,#0xFF +strb r5,[r1,#5] +strb r2,[r1,#6] +add r1,#8 +mov r0,#0x82 //Rockin's name +strb r0,[r1,#0] +strb r4,[r1,#1] +mov r0,#0x93 +strb r0,[r1,#2] +strb r3,[r1,#3] +mov r0,#0x99 +strb r0,[r1,#4] +mov r0,#0x9E +strb r0,[r1,#5] +strh r5,[r1,#6] +mov r2,#1 +mov r5,#0 -pop {pc} +pop {pc} //============================================================================== //Routine for window headers that fixes the issue character - tiles fix_char_tiles: -push {lr} -lsl r0,r2,#1 -lsl r1,r2,#2 -add r1,r1,r0 //Multiply r2 (character count) by 6 -lsr r0,r1,#3 //Divide by 8 -lsl r0,r0,#3 //Re-multiply by 8 -cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?) -beq @@next -add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed +push {lr} +lsl r0,r2,#1 +lsl r1,r2,#2 +add r1,r1,r0 //Multiply r2 (character count) by 6 +lsr r0,r1,#3 //Divide by 8 +lsl r0,r0,#3 //Re-multiply by 8 +cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?) +beq @@next +add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed + @@next: -lsr r0,r0,#3 //Get the amount of tiles needed -cmp r0,r2 //If it's not the same amout as the characters... -beq @@end -sub r0,r2,r0 -lsl r0,r0,#1 -sub r6,r6,r0 //Remove the amount of extra tiles +lsr r0,r0,#3 //Get the amount of tiles needed +cmp r0,r2 //If it's not the same amout as the characters... +beq @@end +sub r0,r2,r0 +lsl r0,r0,#1 +sub r6,r6,r0 //Remove the amount of extra tiles + @@end: -pop {pc} +pop {pc} //============================================================================== //Specific fix_char_tiles routine - Status window c0b28_fix_char_tiles: -push {lr} -bl fix_char_tiles -ldr r0,[r4,#0] //Clobbered code -add r0,#0xB3 -pop {pc} +push {lr} +bl fix_char_tiles +ldr r0,[r4,#0] //Clobbered code +add r0,#0xB3 +pop {pc} //============================================================================== //Specific fix_char_tiles routine - Give window c009e_fix_char_tiles: -push {lr} -mov r2,r5 -bl fix_char_tiles -ldr r2,=#0x30051EC //Clobbered code -ldrh r0,[r2] -pop {pc} +push {lr} +mov r2,r5 +bl fix_char_tiles +ldr r2,=#0x30051EC //Clobbered code +ldrh r0,[r2] +pop {pc} //============================================================================== //Specific fix_char_tiles routine - Equip window c4bd6_fix_char_tiles: -push {lr} -mov r6,r7 -bl fix_char_tiles -mov r7,r6 -ldr r2,=#0x30051EC //Clobbered code -ldrh r0,[r2] -pop {pc} +push {lr} +mov r6,r7 +bl fix_char_tiles +mov r7,r6 +ldr r2,=#0x30051EC //Clobbered code +ldrh r0,[r2] +pop {pc} .pool //============================================================================== //Specific fix_char_tiles routine - Outer PSI window c42e0_fix_char_tiles: -push {lr} -bl fix_char_tiles -mov r2,r9 //Clobbered code -ldrh r0,[r2,#0] -pop {pc} +push {lr} +bl fix_char_tiles +mov r2,r9 //Clobbered code +ldrh r0,[r2,#0] +pop {pc} //============================================================================== //Specific fix_char_tiles routine - Inner PSI window - part 2 c4448_fix_char_tiles: -push {lr} -bl fix_char_tiles -mov r2,r8 //Clobbered code -ldrh r0,[r2,#0] -pop {pc} \ No newline at end of file +push {lr} +bl fix_char_tiles +mov r2,r8 //Clobbered code +ldrh r0,[r2,#0] +pop {pc} + +//============================================================================== +//Routine which clears the header and THEN makes it so the string is printed +c6190_clean_print: +push {lr} +push {r0-r3} +mov r1,#6 //Number of tiles to clean +bl clear_window_header +pop {r0-r3} +bl 0x80CAB90 +pop {pc} + +//============================================================================== +//Routine which clears the header and THEN makes it so the string is printed +c65da_clean_print: +push {lr} +push {r0-r3} +mov r1,#3 //Number of tiles to clean +bl clear_window_header +pop {r0-r3} +bl 0x80CAB90 +pop {pc} + +//============================================================================== +//Routine which clears the header and THEN makes it so the string is printed +_0x10_clean_print: +push {lr} +push {r0-r3} +mov r1,#0x10 //Number of tiles to clean +bl clear_window_header +pop {r0-r3} +bl 0x80CAB90 +pop {pc} + +//============================================================================== +//Routine which calls the header clearer and changes the position of Stored Goods in the arrangement +c6570_clean_print_change_pos: +push {lr} +bl _0x10_clean_print +ldr r2,=#0x230 //Change starting position +mov r0,r2 //Clobbered code +ldrh r3,[r4,#0] +add r0,r0,r3 +mov r2,r8 +ldrh r1,[r2,#0] +orr r0,r1 +mov r2,#0 + +@@cycle: //Print 9 tiles in the arrangement +lsl r0,r0,#0x10 +lsr r0,r0,#0x10 +mov r1,r0 +add r0,r1,#1 +strh r1,[r5,#0] +add r5,#2 +add r2,#1 +cmp r2,#9 +bne @@cycle + +pop {pc} + +.pool diff --git a/working/m12-other.json b/working/m12-other.json index 8fe0adb..680993e 100644 --- a/working/m12-other.json +++ b/working/m12-other.json @@ -126,7 +126,7 @@ 810724 ], "Old": "ばしょ[00 FF]", - "New": "To[00 FF]" + "New": "To:[00 FF]" }, { "OldPointer": 11647572, @@ -134,7 +134,7 @@ 813508 ], "Old": "➨あずかりもの(1)へ[00 FF]", - "New": "➨Stored goods(1)[00 FF]" + "New": "➨Stored Goods(1)[00 FF]" }, { "OldPointer": 11647585, @@ -143,13 +143,13 @@ 813768 ], "Old": "➨あずかりもの(2)へ[00 FF]", - "New": "➨Stored goods(2)[00 FF]" + "New": "➨Stored Goods(2)[00 FF]" }, { "OldPointer": 11647598, "PointerLocations": [], "Old": "➨あずかりもの(3)へ[00 FF]", - "New": "➨Stored goods(3)[00 FF]" + "New": "➨Stored Goods(3)[00 FF]" }, { "OldPointer": 11647611, @@ -157,6 +157,6 @@ 812788 ], "Old": "あずかりもの[00 FF]", - "New": "Stored goods[00 FF]" + "New": "Stored Goods[00 FF]" } ] \ No newline at end of file From fe49e2068454870eb8718706c6ef91cbf1eed9b1 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Mon, 5 Aug 2019 06:18:32 +0200 Subject: [PATCH 4/6] Add shop window support (#53) * Add shop window support * Improved getprice...maybe? --- src/c/goods.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/c/goods.h | 3 +++ src/m2-hack.asm | 11 +++++++++++ 3 files changed, 59 insertions(+) diff --git a/src/c/goods.c b/src/c/goods.c index 6971479..c388d51 100644 --- a/src/c/goods.c +++ b/src/c/goods.c @@ -476,3 +476,48 @@ void goods_print_items(WINDOW *window, unsigned short *items, int y_offset) } } } + +//This works. Gets price given the item (Could not get a proper thumb routine to work, it would automatically go to arm) +//What this routine does is: it receives the item value, multiplies it by 20 and then sums it with the address of m2_items to get the item price that is at that address. +//Original code is at 0x80C7D58 +unsigned short getPrice(int item) +{ + unsigned short *value = (unsigned short *)(&m2_items + (item * 5)); + return value[0]; +} + +// Prints all itemsnum items to a shop window. +// Erases the slot before printing. Prints blanks for null items. +void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum) +{ + int item_x = (window->window_x << 3) + 8; + int item_y = (window->window_y + y_offset) << 3; + + for (int i = 0; i < itemsnum; i++) + { + int item = items[i]; + int x = item_x; + int y = item_y + (i * 16); + + print_blankstr(x >> 3, y >> 3, 16); + + if (item > 0) + { + int x_offset = 0; + byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item); + print_string(item_str, x + x_offset, y); + int digit_count; + int bcd = bin_to_bcd(getPrice(item), &digit_count); //Get the price in bcd, so it can be printed + int base = 120; + print_character(decode_character(0x56), x + base, y); //00, it will be at the end, always at the same position + print_character(decode_character(0x54), x + base - 8 - (digit_count * 6), y); //dollar, it must be before all digits + // Write the digits + for (int j = 0; j < digit_count; j++) + { + byte digit = ((bcd >> ((digit_count - 1 - j) * 4)) & 0xF) + ZERO; + print_character(decode_character(digit), x + base - 8 - ((digit_count - j - 1) * 6), y); //write a single digit + } + } + } +} + diff --git a/src/c/goods.h b/src/c/goods.h index e673ed1..bd7ff4b 100644 --- a/src/c/goods.h +++ b/src/c/goods.h @@ -21,6 +21,7 @@ typedef enum GOODS_ACTION int goods_outer_process(WINDOW* window, int y_offset); int goods_inner_process(WINDOW *window, unsigned short *items); void goods_print_items(WINDOW *window, unsigned short *items, int y_offset); +void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum); extern bool m2_isequipped(int item_index); extern void m2_soundeffect(int index); @@ -28,5 +29,7 @@ extern int m2_div(int dividend, int divisor); extern int m2_sub_a334c(int value); extern int m2_sub_a3384(int value); extern void m2_clearwindowtiles(WINDOW* window); +extern int bin_to_bcd(int value, int* digit_count); +extern int m2_items; #endif diff --git a/src/m2-hack.asm b/src/m2-hack.asm index 8acf245..a7f5015 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -662,6 +662,16 @@ mov r1,1 bl goods_outer_process pop {pc} +//--------------------------------------------------------- +// C7CA4 hacks (Shop) +//--------------------------------------------------------- +.org 0x80C7CA4 +mov r0,r8 //Window +ldr r1,[sp,#0xC] //Items in shop +mov r2,#0 //y_offset | r3 already has the item total for this window +bl shop_print_items //Print the items +b 0x80C7E12 //Avoid the game's printing by jumping it + //--------------------------------------------------------- // C1C98 hacks (menu selection) //--------------------------------------------------------- @@ -1142,6 +1152,7 @@ m2_enemy_attributes: .definelabel m2_hpwindow_up ,0x80D3F0C .definelabel m2_curhpwindow_down ,0x80D41D8 .definelabel m2_div ,0x80F49D8 +.definelabel m2_items ,0x8B1D62C .definelabel m2_default_names ,0x82B9330 //============================================================================== From db4131ce1cb0cc86d1e84dd13936e3be2733a3ad Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Mon, 5 Aug 2019 21:08:11 +0200 Subject: [PATCH 5/6] Add Give window support. (#54) (Also makes certain old changes obsolete) --- src/c/goods.c | 26 ++++++++++++++------------ src/c/goods.h | 2 +- src/m2-hack.asm | 14 +++++++++++++- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/c/goods.c b/src/c/goods.c index c388d51..5e14182 100644 --- a/src/c/goods.c +++ b/src/c/goods.c @@ -6,12 +6,12 @@ // Process the outer Goods window (i.e. character selection) // Called every frame. Replaces $80BF858 fully. -// Returns 1 if the user steps into the inner window, +// Returns 1 if the user steps into the inner window, or the chosen party member's number if it's the give window, // -1 if the user steps back out to the previous window, // and 0 for no action. // y_offset is added to account for the Tracy goods window, which // the game offsets by one tile downwards -int goods_outer_process(WINDOW* window, int y_offset) +int goods_outer_process(WINDOW* window, int y_offset, bool give) { // Get the weird signed parity value short unknown = window->unknown6; @@ -129,7 +129,7 @@ int goods_outer_process(WINDOW* window, int y_offset) { if (current_pc != original_pc) { - if (*window_flags & 0x800) + if ((!give) && (*window_flags & 0x800)) m2_soundeffect(0x131); else m2_soundeffect(0x12E); @@ -156,15 +156,17 @@ int goods_outer_process(WINDOW* window, int y_offset) { m2_soundeffect(0x12D); window->counter = 0; - - unsigned short first_item = current_items[0]; - if (first_item > 0) + if(!give) { - // If the first item isn't null, erase the arrow border tiles - clear_window_arrows(window); + unsigned short first_item = current_items[0]; + if (first_item > 0) + { + // If the first item isn't null, erase the arrow border tiles + clear_window_arrows(window); + } + return signed_parity + 1; } - - return signed_parity + 1; + return current_pc + 1; } window->counter++; @@ -510,12 +512,12 @@ void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int it int bcd = bin_to_bcd(getPrice(item), &digit_count); //Get the price in bcd, so it can be printed int base = 120; print_character(decode_character(0x56), x + base, y); //00, it will be at the end, always at the same position - print_character(decode_character(0x54), x + base - 8 - (digit_count * 6), y); //dollar, it must be before all digits + print_character(decode_character(0x54), x + base - 6 - (digit_count * 6), y); //dollar, it must be before all digits // Write the digits for (int j = 0; j < digit_count; j++) { byte digit = ((bcd >> ((digit_count - 1 - j) * 4)) & 0xF) + ZERO; - print_character(decode_character(digit), x + base - 8 - ((digit_count - j - 1) * 6), y); //write a single digit + print_character(decode_character(digit), x + base - 6 - ((digit_count - j - 1) * 6), y); //write a single digit } } } diff --git a/src/c/goods.h b/src/c/goods.h index bd7ff4b..b026b79 100644 --- a/src/c/goods.h +++ b/src/c/goods.h @@ -18,7 +18,7 @@ typedef enum GOODS_ACTION ACTION_STEPOUT = -1 } GOODS_ACTION; -int goods_outer_process(WINDOW* window, int y_offset); +int goods_outer_process(WINDOW* window, int y_offset, bool give); int goods_inner_process(WINDOW *window, unsigned short *items); void goods_print_items(WINDOW *window, unsigned short *items, int y_offset); void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum); diff --git a/src/m2-hack.asm b/src/m2-hack.asm index a7f5015..ce091f3 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -649,6 +649,7 @@ pop {pc} .org 0x80BF858 push {lr} mov r1,0 +mov r2,0 bl goods_outer_process pop {pc} @@ -659,19 +660,30 @@ pop {pc} .org 0x80C0420 push {lr} mov r1,1 +mov r2,0 bl goods_outer_process pop {pc} //--------------------------------------------------------- // C7CA4 hacks (Shop) //--------------------------------------------------------- -.org 0x80C7CA4 +.org 0x80C7CA4 mov r0,r8 //Window ldr r1,[sp,#0xC] //Items in shop mov r2,#0 //y_offset | r3 already has the item total for this window bl shop_print_items //Print the items b 0x80C7E12 //Avoid the game's printing by jumping it +//--------------------------------------------------------- +// BFE74 hacks (Goods outer menu for Give) +//--------------------------------------------------------- +.org 0x80BFE74 +push {lr} +mov r1,#1 +mov r2,#1 +bl goods_outer_process +pop {pc} + //--------------------------------------------------------- // C1C98 hacks (menu selection) //--------------------------------------------------------- From 87a1e261df35c697f5b36f09778d15a4f4e49104 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Tue, 6 Aug 2019 04:06:43 +0200 Subject: [PATCH 6/6] Fix going out of the Give menu + Issue 55 (#56) * Fix going out of the Give menu * Fix https://github.com/jeffman/Mother2GbaTranslation/issues/55 --- src/m2-hack.asm | 19 ++++++++++++ src/m2-vwf-entries.asm | 66 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/src/m2-hack.asm b/src/m2-hack.asm index ce091f3..bca1477 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -684,6 +684,18 @@ mov r2,#1 bl goods_outer_process pop {pc} +//--------------------------------------------------------- +// BA61C hacks (Fixes inventory when out of Give via B button) +//--------------------------------------------------------- +.org 0x80BA61C +bl ba61c_get_print_inventory_window + +//--------------------------------------------------------- +// BA48E hacks (Fixes inventory when out of Give via text) +//--------------------------------------------------------- +.org 0x80BA48E +bl ba48e_get_print_inventory_window + //--------------------------------------------------------- // C1C98 hacks (menu selection) //--------------------------------------------------------- @@ -850,6 +862,12 @@ nop .org 0x80C4448 :: bl c4448_fix_char_tiles //Inner PSI window - part 2 .org 0x80DBF36 :: bl c009e_fix_char_tiles //Battle menu window +//--------------------------------------------------------- +// Proper dollar and 00 symbols for [9C FF] +//--------------------------------------------------------- +.org 0x80B8AA0 :: mov r0,#0x54 //Dollar +.org 0x80B8AA6 :: mov r0,#0x56 //00 + //--------------------------------------------------------- // Names hacks //--------------------------------------------------------- @@ -1145,6 +1163,7 @@ m2_enemy_attributes: .definelabel m2_enable_script ,0x80A1F6C .definelabel m2_sub_a334c ,0x80A334C .definelabel m2_sub_a3384 ,0x80A3384 +.definelabel m2_get_selected_item ,0x80A469C .definelabel m2_psitargetwindow ,0x80B8AE0 .definelabel m2_isequipped ,0x80BC670 .definelabel m2_swapwindowbuf ,0x80BD7AC diff --git a/src/m2-vwf-entries.asm b/src/m2-vwf-entries.asm index a919b34..9115114 100644 --- a/src/m2-vwf-entries.asm +++ b/src/m2-vwf-entries.asm @@ -1515,3 +1515,69 @@ bne @@cycle pop {pc} .pool + +//============================================================================== +//Routine which gives the address to the party member's inventory +get_inventory_selected: +push {r3,lr} +ldr r0,[r5,#0x1C] //Load source pc +lsl r0,r0,#0x10 +asr r0,r0,#0x10 +ldr r3,=#0x3001D40 //Get inventory +mov r2,#0x6C +mul r0,r2 +add r3,#0x14 +add r0,r0,r3 +pop {r3,pc} + +//============================================================================== +//Routine which gets the address to the selected party member's inventory and then prints it +get_print_inventory_window: +push {r0-r4,lr} +bl get_inventory_selected +mov r1,r0 //Inventory +ldr r0,[r4,#0x10] //Window + +ldr r3,=m2_active_window_pc //Change the pc of the window so m2_isequipped can work properly +ldr r2,[r3,#0] +lsl r2,r2,#0x10 +asr r2,r2,#0x10 +push {r2} +ldr r2,[r5,#0x1C] //Load source pc +lsl r2,r2,#0x10 +asr r2,r2,#0x10 +str r2,[r3,#0] //Store it + +mov r2,#0 //No y offset +bl goods_print_items //Print the inventory + +pop {r2} +ldr r3,=m2_active_window_pc //Restore pc of the window +lsl r2,r2,#0x10 +asr r2,r2,#0x10 +str r2,[r3,#0] + +pop {r0-r4,pc} + +//============================================================================== +//Specific Routine which calls get_print_inventory_window +ba48e_get_print_inventory_window: +push {lr} +push {r4} +ldr r4,=#0x3005230 +bl get_print_inventory_window //Prints old inventory +pop {r4} +bl 0x80BD7F8 //Copies old arrangements, this includes the highlight +pop {pc} + + +//============================================================================== +//Specific Routine which calls get_print_inventory_window +ba61c_get_print_inventory_window: +push {r5,lr} +mov r5,r7 +bl get_print_inventory_window //Prints old inventory +bl 0x80BD7F8 //Copies old arrangements, this includes the highlight +pop {r5,pc} + +.pool \ No newline at end of file