Added some subroutine notes

This commit is contained in:
jeffman 2017-03-09 00:36:24 -05:00
parent cc1d370b8d
commit af075b69a0
3 changed files with 1952 additions and 10 deletions

View File

@ -17,14 +17,17 @@ Hard-coded characters:
0x3005230: addresses of all 11 windows
0x3005270: address of tilemap start in WRAM, can use this to figure out X and Y
LDRB Rx,[Ry,#n]: n has range 0-31
LDRH Rx,[Ry,#n]: n has range 0-62
LDR Rx,[Ry,#n]: n has range 0-124 (0-1020 for SP- and PC-relative)
LDRB Rx,[Ry,#n]: n has range 0-31 (0x0-0x1F)
LDRH Rx,[Ry,#n]: n has range 0-62 (0x0-0x3E)
LDR Rx,[Ry,#n]: n has range 0-124 (0x0-0x7C) (0-1020 for SP- and PC-relative)
Subroutines
-----------
80C980C: print next character (r0: window pointer)
80CA4BC: scroll text upwards (r0: window pointer)
Windows
-------
@ -36,18 +39,19 @@ Window structure:
0x04 - 0x07: start address of text being displayed
0x08 - 0x0B: same as above?
0x0C - 0x13: unused?
0x14 - 0x1B: ?
0x1C - 0x1F: unused?
0x14 - 0x17: text address offset
0x18 - 0x1B: ?
0x1C - 0x1F: ? (some kind of offset; used when printing nameable things?)
0x20 - 0x21: area (width*height)
0x22 - 0x23: text area X
0x24 - 0x25: text area Y
0x26 - 0x27: window width
0x22 - 0x23: window X (text area, not including border)
0x24 - 0x25: window Y
0x26 - 0x27: window width (tiles, not including border)
0x28 - 0x29: window height
0x2A - 0x2B: relative text X
0x2C - 0x2D: relative text Y
0x2E - 0x33: ?
0x34 - 0x35: cursor X
0x36 - 0x37: cursor Y
0x38 - 0x43: unused?
0x38 - 0x43: ?
0x44: ?
0x45 - 0x4F: unused?
0x45 - 0x4F: ?

1731
m2-subC980C.txt Normal file

File diff suppressed because it is too large Load Diff

207
m2-subCA4BC.txt Normal file
View File

@ -0,0 +1,207 @@
080CA4BC (T) push {r4-r7,r14} ;34 313
080CA4BE (T) mov r7,r10 ;2 315
080CA4C0 (T) mov r6,r9 ;2 317
080CA4C2 (T) mov r5,r8 ;2 319
080CA4C4 (T) push {r5-r7} ;22 341
080CA4C6 (T) add sp,-#0x4 ;2 343
080CA4C8 (T) mov r6,r0 ;2 345
080CA4CA (T) ldr r3,=#0x30051EC ;9 354
080CA4CC (T) ldr r1,=#0x1FF ;9 363
080CA4CE (T) mov r0,r1 ;2 365
080CA4D0 (T) ldrh r2,[r3] ;4 369
080CA4D2 (T) add r0,r0,r2 ;2 371
080CA4D4 (T) ldr r2,=#0x3005228 ;9 380
080CA4D6 (T) ldrh r1,[r2] ;4 384
080CA4D8 (T) orr r0,r1 ;2 386
080CA4DA (T) lsl r0,r0,#0x10 ;2 388
080CA4DC (T) lsr r0,r0,#0x10 ;2 390
080CA4DE (T) str r0,[sp] ;5 395
080CA4E0 (T) mov r4,#0x28 ;2 397
080CA4E2 (T) ldsh r0,[r6,r4] ;6 403
080CA4E4 (T) mov r7,r2 ;2 405
080CA4E6 (T) ldr r1,=#0x3005270 ;9 414
080CA4E8 (T) mov r10,r1 ;2 416
080CA4EA (T) cmp r0,#0x2 ;2 418
080CA4EC (T) bgt #0x80CA580 ;8 426
080CA4EE (T) mov r2,#0x24 ;2 428
080CA4F0 (T) ldsh r0,[r6,r2] ;4 432
080CA4F2 (T) lsl r0,r0,#0x6 ;2 434
080CA4F4 (T) ldr r1,[r1] ;4 438
080CA4F6 (T) add r1,r1,r0 ;2 440
080CA4F8 (T) mov r4,#0x22 ;2 442
080CA4FA (T) ldsh r0,[r6,r4] ;6 448
080CA4FC (T) lsl r0,r0,#0x1 ;2 450
080CA4FE (T) add r5,r1,r0 ;2 452
080CA500 (T) mov r0,#0x0 ;2 454
080CA502 (T) mov r12,r0 ;2 456
080CA504 (T) mov r4,#0x0 ;2 458
080CA506 (T) mov r8,r4 ;2 460
080CA508 (T) mov r1,#0x20 ;2 462
080CA50A (T) ldsh r0,[r6,r1] ;4 466
080CA50C (T) cmp r12,r0 ;2 468
080CA50E (T) bge #0x80CA580 ;8 476
080CA510 (T) lsl r0,r4,#0x10 ;2 478
080CA512 (T) asr r2,r0,#0x10 ;2 480
080CA514 (T) mov r4,#0x26 ;2 482
080CA516 (T) ldsh r1,[r6,r4] ;6 488
080CA518 (T) mov r4,r0 ;2 490
080CA51A (T) cmp r2,r1 ;2 492
080CA51C (T) bge #0x80CA528 ;8 500
080CA51E (T) mov r1,#0x22 ;2 502
080CA520 (T) ldsh r0,[r6,r1] ;4 506
080CA522 (T) add r0,r2,r0 ;2 508
080CA524 (T) cmp r0,#0x1F ;2 510
080CA526 (T) ble #0x80CA554 ;8 518
080CA528 (T) mov r2,r8 ;2 520
080CA52A (T) lsl r0,r2,#0x10 ;2 522
080CA52C (T) mov r4,#0x80 ;2 524
080CA52E (T) lsl r4,r4,#0x9 ;2 526
080CA530 (T) add r0,r0,r4 ;2 528
080CA532 (T) lsr r1,r0,#0x10 ;2 530
080CA534 (T) mov r8,r1 ;2 532
080CA536 (T) asr r0,r0,#0x10 ;2 534
080CA538 (T) mov r2,#0x24 ;2 536
080CA53A (T) ldsh r1,[r6,r2] ;4 540
080CA53C (T) add r0,r0,r1 ;2 542
080CA53E (T) cmp r0,#0x1F ;2 544
080CA540 (T) bgt #0x80CA580 ;8 552
080CA542 (T) lsl r0,r0,#0x6 ;2 554
080CA544 (T) mov r4,r10 ;2 556
080CA546 (T) ldr r1,[r4] ;4 560
080CA548 (T) add r1,r1,r0 ;2 562
080CA54A (T) mov r2,#0x22 ;2 564
080CA54C (T) ldsh r0,[r6,r2] ;4 568
080CA54E (T) lsl r0,r0,#0x1 ;2 570
080CA550 (T) add r5,r1,r0 ;2 572
080CA552 (T) mov r4,#0x0 ;2 574
080CA554 (T) ldr r1,=#0x1FF ;9 583
080CA556 (T) mov r0,r1 ;2 585
080CA558 (T) ldrh r2,[r3] ;4 589
080CA55A (T) add r0,r0,r2 ;2 591
080CA55C (T) ldrh r1,[r7] ;4 595
080CA55E (T) orr r0,r1 ;2 597
080CA560 (T) strh r0,[r5] ;7 604
080CA562 (T) mov r0,r12 ;2 606
080CA564 (T) lsl r1,r0,#0x10 ;2 608
080CA566 (T) mov r2,#0x80 ;2 610
080CA568 (T) lsl r2,r2,#0x9 ;2 612
080CA56A (T) add r1,r1,r2 ;2 614
080CA56C (T) add r5,#0x2 ;2 616
080CA56E (T) add r0,r4,r2 ;2 618
080CA570 (T) lsr r4,r0,#0x10 ;2 620
080CA572 (T) lsr r0,r1,#0x10 ;2 622
080CA574 (T) mov r12,r0 ;2 624
080CA576 (T) asr r1,r1,#0x10 ;2 626
080CA578 (T) mov r2,#0x20 ;2 628
080CA57A (T) ldsh r0,[r6,r2] ;4 632
080CA57C (T) cmp r1,r0 ;2 634
080CA57E (T) blt #0x80CA510 ;8 642
080CA580 (T) mov r4,#0x24 ;2 644
080CA582 (T) ldsh r3,[r6,r4] ;6 650
080CA584 (T) add r0,r3,2 ;2 652
080CA586 (T) lsl r0,r0,#0x6 ;2 654
080CA588 (T) mov r1,r10 ;2 656
080CA58A (T) ldr r2,[r1] ;4 660
080CA58C (T) add r0,r2,r0 ;2 662
080CA58E (T) mov r4,#0x22 ;2 664
080CA590 (T) ldsh r1,[r6,r4] ;6 670
080CA592 (T) lsl r1,r1,#0x1 ;2 672
080CA594 (T) add r7,r0,r1 ;2 674
080CA596 (T) lsl r3,r3,#0x6 ;2 676
080CA598 (T) add r2,r2,r3 ;2 678
080CA59A (T) add r5,r2,r1 ;2 680
080CA59C (T) mov r0,#0x0 ;2 682
080CA59E (T) mov r12,r0 ;2 684
080CA5A0 (T) mov r4,#0x0 ;2 686
080CA5A2 (T) mov r8,r4 ;2 688
080CA5A4 (T) mov r9,r4 ;2 690
080CA5A6 (T) mov r1,#0x20 ;2 692
080CA5A8 (T) ldsh r0,[r6,r1] ;4 696
080CA5AA (T) cmp r12,r0 ;2 698
080CA5AC (T) bge #0x80CA64A ;8 706
080CA5AE (T) lsl r0,r4,#0x10 ;2 708
080CA5B0 (T) asr r3,r0,#0x10 ;2 710
080CA5B2 (T) mov r2,#0x26 ;2 712
080CA5B4 (T) ldsh r1,[r6,r2] ;4 716
080CA5B6 (T) mov r4,r0 ;2 718
080CA5B8 (T) cmp r3,r1 ;2 720
080CA5BA (T) bge #0x80CA5C6 ;8 728
080CA5BC (T) mov r1,#0x22 ;2 730
080CA5BE (T) ldsh r0,[r6,r1] ;4 734
080CA5C0 (T) add r0,r3,r0 ;2 736
080CA5C2 (T) cmp r0,#0x1F ;2 738
080CA5C4 (T) ble #0x80CA608 ;8 746
080CA5C6 (T) mov r2,r8 ;2 748
080CA5C8 (T) lsl r0,r2,#0x10 ;2 750
080CA5CA (T) mov r4,#0x80 ;2 752
080CA5CC (T) lsl r4,r4,#0x9 ;2 754
080CA5CE (T) add r0,r0,r4 ;2 756
080CA5D0 (T) lsr r1,r0,#0x10 ;2 758
080CA5D2 (T) mov r8,r1 ;2 760
080CA5D4 (T) asr r1,r0,#0x10 ;2 762
080CA5D6 (T) mov r2,#0x24 ;2 764
080CA5D8 (T) ldsh r0,[r6,r2] ;4 768
080CA5DA (T) add r3,r1,r0 ;2 770
080CA5DC (T) cmp r3,#0x1F ;2 772
080CA5DE (T) bgt #0x80CA64A ;8 780
080CA5E0 (T) mov r4,#0x28 ;2 782
080CA5E2 (T) ldsh r0,[r6,r4] ;6 788
080CA5E4 (T) sub r0,#0x2 ;2 790
080CA5E6 (T) cmp r1,r0 ;2 792
080CA5E8 (T) blt #0x80CA5EE ;8 800
080CA5EA (T) mov r0,#0x1 ;2 802
080CA5EC (T) mov r9,r0 ;2 804
080CA5EE (T) add r0,r3,2 ;2 806
080CA5F0 (T) lsl r0,r0,#0x6 ;2 808
080CA5F2 (T) mov r1,r10 ;2 810
080CA5F4 (T) ldr r2,[r1] ;4 814
080CA5F6 (T) add r0,r2,r0 ;2 816
080CA5F8 (T) mov r4,#0x22 ;2 818
080CA5FA (T) ldsh r1,[r6,r4] ;6 824
080CA5FC (T) lsl r1,r1,#0x1 ;2 826
080CA5FE (T) add r7,r0,r1 ;2 828
080CA600 (T) lsl r0,r3,#0x6 ;2 830
080CA602 (T) add r2,r2,r0 ;2 832
080CA604 (T) add r5,r2,r1 ;2 834
080CA606 (T) mov r4,#0x0 ;2 836
080CA608 (T) mov r0,r9 ;2 838
080CA60A (T) cmp r0,#0x0 ;2 840
080CA60C (T) bne #0x80CA624 ;8 848
080CA60E (T) ldrh r0,[r7] ;4 852
080CA610 (T) strh r0,[r5] ;7 859
080CA612 (T) b #0x80CA62A ;8 867
080CA614 (T) str r4,[r5,r7] ;6 873
080CA616 (T) lsl r0,r0,#0xC ;2 875
080CA618 (T) lsl r7,r7,#0x7 ;2 877
080CA61A (T) lsl r0,r0,#0x0 ;2 879
080CA61C (T) strh r0,[r5,r0] ;7 886
080CA61E (T) lsl r0,r0,#0xC ;2 888
080CA620 (T) strh r0,[r6,r1] ;5 893
080CA622 (T) lsl r0,r0,#0xC ;2 895
080CA624 (T) mov r1,r13 ;2 897
080CA626 (T) ldrh r1,[r1] ;4 901
080CA628 (T) strh r1,[r5] ;7 908
080CA62A (T) mov r2,r12 ;2 910
080CA62C (T) lsl r0,r2,#0x10 ;2 912
080CA62E (T) mov r1,#0x80 ;2 914
080CA630 (T) lsl r1,r1,#0x9 ;2 916
080CA632 (T) add r0,r0,r1 ;2 918
080CA634 (T) add r7,#0x2 ;2 920
080CA636 (T) add r5,#0x2 ;2 922
080CA638 (T) add r1,r4,r1 ;2 924
080CA63A (T) lsr r4,r1,#0x10 ;2 926
080CA63C (T) lsr r2,r0,#0x10 ;2 928
080CA63E (T) mov r12,r2 ;2 930
080CA640 (T) asr r0,r0,#0x10 ;2 932
080CA642 (T) mov r2,#0x20 ;2 934
080CA644 (T) ldsh r1,[r6,r2] ;4 938
080CA646 (T) cmp r0,r1 ;2 940
080CA648 (T) blt #0x80CA5AE ;8 948
080CA64A (T) add sp,#0x4 ;2 950
080CA64C (T) pop {r3-r5} ;17 967
080CA64E (T) mov r8,r3 ;2 969
080CA650 (T) mov r9,r4 ;2 971
080CA652 (T) mov r10,r5 ;2 973
080CA654 (T) pop {r4-r7} ;21 994
080CA656 (T) pop {r0} ;9 1003
080CA658 (T) bx r0 ;8 1011