Handle Birthday Menu Input
Jump to navigation
Jump to search
# ROUTINE: HANDLE BIRTHDAY MENU INPUT # Parameters: # r4 = (input) (Struct pointer) (Entries are 4-byte words) # 0x00: ? # 0x0c: ? # 0x20: (Month) Currently selected month (1 to 12) # 0x24: (Day) Currently selected day # 0x28: (Selection) Which selection is being made # 0 = Day # 1 = Month 8006bde0: 27bdffe8 addiu r29,r29,-0x0018 8006bde4: afb00010 sw r16,0x0010(r29) 8006bde8: 00808021 addu r16,r4,r0 # input 8006bdec: afbf0014 sw r31,0x0014(r29) 8006bdf0: 8e02000c lw r2,0x000c(r16) # input.0x0c 8006bdf4: 00000000 nop 8006bdf8: 000218c0 sll r3,r2,0x03 # input.0x0c * 8 8006bdfc: 00621823 subu r3,r3,r2 # input.0x0c * 9 8006be00: 000318c0 sll r3,r3,0x03 # input.0x0c * 72 8006be04: 3c018008 lui r1,0x8008 8006be08: 24216098 addiu r1,r1,0x6098 # 0x80086068 8006be0c: 00230821 addu r1,r1,r3 # 0x80086068 + (input.0x0c * 72) 8006be10: 8c220000 lw r2,0x0000(r1) # *(0x80086068 + (input.0x0c * 72)) 8006be14: 00000000 nop 8006be18: 30420100 andi r2,r2,0x0100 # *(0x80086068 + (input.0x0c * 72)) & 0x100 8006be1c: 144000a7 bne r2,r0,0x8006c0bc # if ((*(0x80086068 + (input.0x0c * 72)) & 0x100) != 0) return; 8006be20: 00000000 nop 8006be24: 3c028008 lui r2,0x8008 8006be28: 8c4255a4 lw r2,0x55a4(r2) # newButtonInput 8006be2c: 00000000 nop 8006be30: 30420820 andi r2,r2,0x0820 # newButtonInput & 0x820 // Non-zero if Start or Circle pressed 8006be34: 10400009 beq r2,r0,0x8006be5c # if (newButtonInput & 0x820) { // If Start or Circle pressed 8006be38: 00000000 nop 8006be3c: 0c010ffe jal 0x80043ff8 # Play Sound Effect (1); 8006be40: 34040001 ori r4,r0,0x0001 8006be44: 0c01af27 jal 0x8006bc9c # ? 0x6bc9c (input); 8006be48: 02002021 addu r4,r16,r0 8006be4c: 0c01b034 jal 0x8006c0d0 # ? 0x6c0d0 (); 8006be50: 00000000 nop 8006be54: 0801b02f j 0x8006c0bc # return; 8006be58: 00000000 nop # } 8006be5c: 0c01a09a jal 0x80068268 # result_0x68268 = Button Input Related? (0x68268) (0x1000); // 0x1000 = Up button pressed 8006be60: 34041000 ori r4,r0,0x1000 # jumpPastNextTwoSections = false # jumpPastNextSection = false 8006be64: 10400022 beq r2,r0,0x8006bef0 # if (result_0x68268 != 0) { 8006be68: 00000000 nop 8006be6c: 8e020028 lw r2,0x0028(r16) # input.Selection // Day or Month 8006be70: 00000000 nop 8006be74: 14400015 bne r2,r0,0x8006becc # if (input.Selection == 0) { 8006be78: 00000000 nop 8006be7c: 8e030024 lw r3,0x0024(r16) # input.Day 8006be80: 8e040020 lw r4,0x0020(r16) # input.Month 8006be84: 24630001 addiu r3,r3,0x0001 # input.Day + 1 8006be88: ae030024 sw r3,0x0024(r16) # input.Day = input.Day + 1 8006be8c: 3c018007 lui r1,0x8007 8006be90: 24213f33 addiu r1,r1,0x3f33 # 0x80073f33 8006be94: 00240821 addu r1,r1,r4 # 0x80073f33 + *(p1 + 0x20) 8006be98: 90220000 lbu r2,0x0000(r1) # *(0x80073f33 + *(p1 + 0x20)) 8006be9c: 00000000 nop 8006bea0: 0043102a slt r2,r2,r3 8006bea4: 10400041 beq r2,r0,0x8006bfac # if (*(0x80073f33 + input.Month) < input.Day) { 8006bea8: 24820001 addiu r2,r4,0x0001 # input.Month + 1 8006beac: ae020020 sw r2,0x0020(r16) # input.Month = input.Month + 1 8006beb0: 2842000d slti r2,r2,0x000d 8006beb4: 14400003 bne r2,r0,0x8006bec4 # if (input.Month == 0) { 8006beb8: 34020001 ori r2,r0,0x0001 8006bebc: ae020020 sw r2,0x0020(r16) # input.Month = 1 8006bec0: 34020001 ori r2,r0,0x0001 # } 8006bec4: 0801afeb j 0x8006bfac 8006bec8: ae020024 sw r2,0x0024(r16) # input.Day = 1 # } # jumpPastNextSection = true # } else { 8006becc: 8e020020 lw r2,0x0020(r16) # input.Month 8006bed0: 00000000 nop 8006bed4: 24420001 addiu r2,r2,0x0001 # input.Month + 1 8006bed8: ae020020 sw r2,0x0020(r16) # input.Month = input.Month + 1 8006bedc: 2842000d slti r2,r2,0x000d 8006bee0: 14400026 bne r2,r0,0x8006bf7c # if (input.Month >= 13) { 8006bee4: 34020001 ori r2,r0,0x0001 8006bee8: 0801afdf j 0x8006bf7c 8006beec: ae020020 sw r2,0x0020(r16) # input.Month = 1 # } # } # } else { 8006bef0: 0c01a09a jal 0x80068268 # result_0x68268 = Button Input Related? (0x68268) (0x4000); // 0x4000 = Down button pressed 8006bef4: 34044000 ori r4,r0,0x4000 8006bef8: 1040003a beq r2,r0,0x8006bfe4 # if (result_0x68268 == 0) { 8006befc: 00000000 nop # jumpPastNextTwoSections = true # } else { 8006bf00: 8e020028 lw r2,0x0028(r16) # input.Selection 8006bf04: 00000000 nop 8006bf08: 14400015 bne r2,r0,0x8006bf60 # if (input.Selection == 0) { 8006bf0c: 00000000 nop 8006bf10: 8e020024 lw r2,0x0024(r16) # input.Day 8006bf14: 00000000 nop 8006bf18: 2442ffff addiu r2,r2,-0x0001 # input.Day - 1 8006bf1c: 1c400023 bgtz r2,0x8006bfac 8006bf20: ae020024 sw r2,0x0024(r16) # input.Day = input.Day - 1 # if ((input.Day - 1) <= 0) { 8006bf24: 8e020020 lw r2,0x0020(r16) # input.Month 8006bf28: 00000000 nop 8006bf2c: 2442ffff addiu r2,r2,-0x0001 # input.Month - 1 8006bf30: 1c400003 bgtz r2,0x8006bf40 8006bf34: ae020020 sw r2,0x0020(r16) # input.Month = input.Month - 1 # if ((input.Month - 1) <= 0) { 8006bf38: 3402000c ori r2,r0,0x000c 8006bf3c: ae020020 sw r2,0x0020(r16) # input.Month = 12 # } 8006bf40: 8e020020 lw r2,0x0020(r16) # input.Month 8006bf44: 00000000 nop 8006bf48: 3c018007 lui r1,0x8007 8006bf4c: 24213f33 addiu r1,r1,0x3f33 # 0x80073f33 8006bf50: 00220821 addu r1,r1,r2 # 0x80073f33 + input.Month 8006bf54: 90220000 lbu r2,0x0000(r1) # *(0x80073f33 + input.Month) 8006bf58: 0801afeb j 0x8006bfac 8006bf5c: ae020024 sw r2,0x0024(r16) # input.Day = *(0x80073f33 + input.Month) # } # jumpPastNextSection = true # } else { 8006bf60: 8e020020 lw r2,0x0020(r16) # input.Month 8006bf64: 00000000 nop 8006bf68: 2442ffff addiu r2,r2,-0x0001 # input.Month - 1 8006bf6c: 1c400003 bgtz r2,0x8006bf7c 8006bf70: ae020020 sw r2,0x0020(r16) # input.Month = input.Month - 1 # if (input.Month < 0) { 8006bf74: 3402000c ori r2,r0,0x000c 8006bf78: ae020020 sw r2,0x0020(r16) # input.Month = 12 # } # } # } # } # if (not (jumpPastNextTwoSections)) { # if (not (jumpPastNextSection)) { 8006bf7c: 8e020020 lw r2,0x0020(r16) # input.Month 8006bf80: 00000000 nop 8006bf84: 3c018007 lui r1,0x8007 8006bf88: 24213f33 addiu r1,r1,0x3f33 # 0x80073f33 8006bf8c: 00220821 addu r1,r1,r2 # 0x80073f33 + input.Month 8006bf90: 90230000 lbu r3,0x0000(r1) # *(0x80073f33 + input.Month) 8006bf94: 8e020024 lw r2,0x0024(r16) # input.Day 8006bf98: 00000000 nop 8006bf9c: 0062102a slt r2,r3,r2 8006bfa0: 10400002 beq r2,r0,0x8006bfac # if (*(0x80073f33 + input.Month) < input.Day) { 8006bfa4: 00000000 nop 8006bfa8: ae030024 sw r3,0x0024(r16) # input.Day = *(0x80073f33 + input.Month) # } # } 8006bfac: 3c028008 lui r2,0x8008 8006bfb0: 8c425fc4 lw r2,0x5fc4(r2) # *0x80085fc4 8006bfb4: 3c038008 lui r3,0x8008 8006bfb8: 8c6352a8 lw r3,0x52a8(r3) # *0x800852a8 8006bfbc: 2442ffff addiu r2,r2,-0x0001 # *0x80085fc4 - 1 8006bfc0: 2463ffff addiu r3,r3,-0x0001 # *0x800852a8 - 1 8006bfc4: 3c018008 lui r1,0x8008 8006bfc8: ac225fc4 sw r2,0x5fc4(r1) # *0x80085fc4 = *0x80085fc4 - 1 8006bfcc: 3c018008 lui r1,0x8008 8006bfd0: ac2352a8 sw r3,0x52a8(r1) # *0x800852a8 = *0x800852a8 - 1 8006bfd4: 0c01ae64 jal 0x8006b990 # Display Birthday Menu Text (p1); 8006bfd8: 02002021 addu r4,r16,r0 8006bfdc: 0c010ffe jal 0x80043ff8 # Play Sound Effect (3); 8006bfe0: 34040003 ori r4,r0,0x0003 # } 8006bfe4: 3c028008 lui r2,0x8008 8006bfe8: 8c4255a4 lw r2,0x55a4(r2) # newButtonInput 8006bfec: 00000000 nop 8006bff0: 30428000 andi r2,r2,0x8000 # newButtonInput & 0x8000 // Left button 8006bff4: 10400016 beq r2,r0,0x8006c050 # if (newButtonInput & 0x8000) { // Left button pressed 8006bff8: 00000000 nop 8006bffc: 8e020028 lw r2,0x0028(r16) # input.Selection 8006c000: 00000000 nop 8006c004: 14400012 bne r2,r0,0x8006c050 # if (input.Selection == 0) { 8006c008: 34020001 ori r2,r0,0x0001 8006c00c: 8e040000 lw r4,0x0000(r16) # *p1 8006c010: ae020028 sw r2,0x0028(r16) # input.Selection = 1 8006c014: 000418c0 sll r3,r4,0x03 # *p1 * 8 8006c018: 00641821 addu r3,r3,r4 # *p1 * 9 8006c01c: 00031880 sll r3,r3,0x02 # *p1 * 36 8006c020: 3c018008 lui r1,0x8008 8006c024: 24215d1c addiu r1,r1,0x5d1c # 0x80085d1c 8006c028: 00230821 addu r1,r1,r3 # 0x80085d1c + (*p1 * 36) 8006c02c: 8c220000 lw r2,0x0000(r1) # cursorX = *(0x80085d1c + (*p1 * 36)) 8006c030: 00000000 nop 8006c034: 2442ffe0 addiu r2,r2,-0x0020 # cursorX - 32 8006c038: 3c018008 lui r1,0x8008 8006c03c: 24215d1c addiu r1,r1,0x5d1c # 0x80085d1c 8006c040: 00230821 addu r1,r1,r3 # 0x80085d1c + (*p1 * 36) 8006c044: ac220000 sw r2,0x0000(r1) # cursorX = cursorX - 32 8006c048: 0c010ffe jal 0x80043ff8 # Play Sound Effect (3); 8006c04c: 34040003 ori r4,r0,0x0003 # } # } 8006c050: 3c028008 lui r2,0x8008 8006c054: 8c4255a4 lw r2,0x55a4(r2) # newButtonInput 8006c058: 00000000 nop 8006c05c: 30422000 andi r2,r2,0x2000 # newButtonInput & 0x2000 // Right button 8006c060: 10400016 beq r2,r0,0x8006c0bc # if (newButtonInput & 0x2000) { // Right button pressed 8006c064: 00000000 nop 8006c068: 8e020028 lw r2,0x0028(r16) # input.Selection 8006c06c: 00000000 nop 8006c070: 10400012 beq r2,r0,0x8006c0bc # if (input.Selection != 0) { 8006c074: 00000000 nop 8006c078: 8e020000 lw r2,0x0000(r16) # *p1 8006c07c: ae000028 sw r0,0x0028(r16) # input.Selection = 0 8006c080: 000218c0 sll r3,r2,0x03 # *p1 * 8 8006c084: 00621821 addu r3,r3,r2 # *p1 * 9 8006c088: 00031880 sll r3,r3,0x02 # *p1 * 36 8006c08c: 3c018008 lui r1,0x8008 8006c090: 24215d1c addiu r1,r1,0x5d1c # 0x80085d1c 8006c094: 00230821 addu r1,r1,r3 # 0x80085d1c + (*p1 * 36) 8006c098: 8c220000 lw r2,0x0000(r1) # cursorX = *(0x80085d1c + (*p1 * 36)) 8006c09c: 00000000 nop 8006c0a0: 24420020 addiu r2,r2,0x0020 # cursorX + 32 8006c0a4: 3c018008 lui r1,0x8008 8006c0a8: 24215d1c addiu r1,r1,0x5d1c # 0x80085d1c 8006c0ac: 00230821 addu r1,r1,r3 # 0x80085d1c + (*p1 * 36) // cursorX address 8006c0b0: ac220000 sw r2,0x0000(r1) # cursorX = cursorX + 32 8006c0b4: 0c010ffe jal 0x80043ff8 # Play Sound Effect (3); 8006c0b8: 34040003 ori r4,r0,0x0003 # } # } 8006c0bc: 8fbf0014 lw r31,0x0014(r29) 8006c0c0: 8fb00010 lw r16,0x0010(r29) 8006c0c4: 27bd0018 addiu r29,r29,0x0018 8006c0c8: 03e00008 jr r31 8006c0cc: 00000000 nop