Update notes

This commit is contained in:
jeffman 2019-02-18 20:39:29 -05:00
parent 2c45ca7a2d
commit 5e58ad7130
1 changed files with 154 additions and 128 deletions

View File

@ -1,5 +1,6 @@
// r0: window // r0: window
// r1: goods pointer // r1: goods pointer
// Returns 0 if no action, -1 if cancelled with B/select, or item index + 1 if accepted with A/L
080BEB6C (T) push r4-r7,r14 ;9 144 080BEB6C (T) push r4-r7,r14 ;9 144
080BEB6E (T) mov r7,r10 ;2 146 080BEB6E (T) mov r7,r10 ;2 146
@ -940,6 +941,7 @@
080BF1B8 (T) lsl r7,r5,4h ;2 2915 080BF1B8 (T) lsl r7,r5,4h ;2 2915
080BF1BA (T) lsl r0,r0,0h ;2 2917 080BF1BA (T) lsl r0,r0,0h ;2 2917
// If not up or down pressed:
080BF1BC (T) mov r0,30h ;2 2919 080BF1BC (T) mov r0,30h ;2 2919
080BF1BE (T) and r0,r1 ;2 2921 080BF1BE (T) and r0,r1 ;2 2921
080BF1C0 (T) cmp r0,0h ;2 2923 080BF1C0 (T) cmp r0,0h ;2 2923
@ -954,22 +956,30 @@
080BF1D2 (T) mov r0,97h ;2 2957 080BF1D2 (T) mov r0,97h ;2 2957
080BF1D4 (T) lsl r0,r0,1h ;2 2959 080BF1D4 (T) lsl r0,r0,1h ;2 2959
080BF1D6 (T) bl m2_soundeffect ;10 2969 080BF1D6 (T) bl m2_soundeffect ;10 2969
// Shadow directions pressed:
080BF1DA (T) ldr r0,[r7] ;4 2973 080BF1DA (T) ldr r0,[r7] ;4 2973
080BF1DC (T) mov r1,10h ;2 2975 080BF1DC (T) mov r1,10h ;2 2975
080BF1DE (T) orr r0,r1 ;2 2977 080BF1DE (T) orr r0,r1 ;2 2977
080BF1E0 (T) b 80BF1EAh ;8 2985 080BF1E0 (T) b 80BF1EAh ;8 2985 set flag 0x10
// No shadow directions pressed:
080BF1E2 (T) ldr r0,[r7] ;4 2989 080BF1E2 (T) ldr r0,[r7] ;4 2989
080BF1E4 (T) mov r1,11h ;2 2991 080BF1E4 (T) mov r1,11h ;2 2991
080BF1E6 (T) neg r1,r1 ;2 2993 080BF1E6 (T) neg r1,r1 ;2 2993
080BF1E8 (T) and r0,r1 ;2 2995 080BF1E8 (T) and r0,r1 ;2 2995 unsert flag 0x10
080BF1EA (T) str r0,[r7] ;5 3000 080BF1EA (T) str r0,[r7] ;5 3000
// Check for B/select
080BF1EC (T) ldr r0,=3002500h ;9 3009 080BF1EC (T) ldr r0,=3002500h ;9 3009
080BF1EE (T) ldrh r1,[r0] ;6 3015 080BF1EE (T) ldrh r1,[r0] ;6 3015
080BF1F0 (T) mov r0,6h ;2 3017 080BF1F0 (T) mov r0,6h ;2 3017
080BF1F2 (T) and r0,r1 ;2 3019 080BF1F2 (T) and r0,r1 ;2 3019
080BF1F4 (T) cmp r0,0h ;2 3021 080BF1F4 (T) cmp r0,0h ;2 3021
080BF1F6 (T) beq 80BF21Ch ;8 3029 080BF1F6 (T) beq 80BF21Ch ;8 3029
// B/select pressed
080BF1F8 (T) mov r0,0h ;2 3031 080BF1F8 (T) mov r0,0h ;2 3031
080BF1FA (T) strh r0,[r7,32h] ;5 3036 080BF1FA (T) strh r0,[r7,32h] ;5 3036
080BF1FC (T) mov r0,97h ;2 3038 080BF1FC (T) mov r0,97h ;2 3038
@ -985,10 +995,14 @@
080BF216 (T) lsl r0,r0,0h ;2 3088 080BF216 (T) lsl r0,r0,0h ;2 3088
080BF218 (T) mov r5,0h ;2 3090 080BF218 (T) mov r5,0h ;2 3090
080BF21A (T) lsl r0,r0,0Ch ;2 3092 080BF21A (T) lsl r0,r0,0Ch ;2 3092
// Check for A/L
080BF21C (T) ldr r0,=201h ;9 3101 080BF21C (T) ldr r0,=201h ;9 3101
080BF21E (T) and r0,r1 ;2 3103 080BF21E (T) and r0,r1 ;2 3103
080BF220 (T) cmp r0,0h ;2 3105 080BF220 (T) cmp r0,0h ;2 3105
080BF222 (T) beq 80BF268h ;8 3113 080BF222 (T) beq 80BF268h ;8 3113
// A/L pressed
080BF224 (T) ldr r0,=0FFFFh ;9 3122 080BF224 (T) ldr r0,=0FFFFh ;9 3122
080BF226 (T) strh r0,[r7,32h] ;5 3127 080BF226 (T) strh r0,[r7,32h] ;5 3127
080BF228 (T) ldr r0,=12Dh ;9 3136 080BF228 (T) ldr r0,=12Dh ;9 3136
@ -998,13 +1012,13 @@
080BF232 (T) ldsh r0,[r0,r1] ;4 3161 080BF232 (T) ldsh r0,[r0,r1] ;4 3161
080BF234 (T) add r0,1h ;2 3163 080BF234 (T) add r0,1h ;2 3163
080BF236 (T) bl 80A334Ch ;10 3173 080BF236 (T) bl 80A334Ch ;10 3173
080BF23A (T) mov r2,r10 ;2 3175 080BF23A (T) mov r2,r10 ;2 3175 cursor_col
080BF23C (T) lsl r4,r2,10h ;2 3177 080BF23C (T) lsl r4,r2,10h ;2 3177
080BF23E (T) asr r4,r4,10h ;2 3179 080BF23E (T) asr r4,r4,10h ;2 3179
080BF240 (T) ldr r3,[sp,4h] ;4 3183 080BF240 (T) ldr r3,[sp,4h] ;4 3183 cursor_y * 2
080BF242 (T) lsl r0,r3,10h ;2 3185 080BF242 (T) lsl r0,r3,10h ;2 3185
080BF244 (T) asr r0,r0,10h ;2 3187 080BF244 (T) asr r0,r0,10h ;2 3187
080BF246 (T) add r4,r4,r0 ;2 3189 080BF246 (T) add r4,r4,r0 ;2 3189 cursor_col + cursor_y * 2
080BF248 (T) add r4,1h ;2 3191 080BF248 (T) add r4,1h ;2 3191
080BF24A (T) mov r0,r4 ;2 3193 080BF24A (T) mov r0,r4 ;2 3193
080BF24C (T) bl 80A3384h ;10 3203 080BF24C (T) bl 80A3384h ;10 3203
@ -1020,6 +1034,7 @@
080BF262 (T) lsl r0,r0,0h ;2 3237 080BF262 (T) lsl r0,r0,0h ;2 3237
080BF264 (T) strh r4,[r4,r1] ;5 3242 080BF264 (T) strh r4,[r4,r1] ;5 3242
080BF266 (T) lsl r0,r0,0Ch ;2 3244 080BF266 (T) lsl r0,r0,0Ch ;2 3244
080BF268 (T) ldrh r3,[r7,32h] ;4 3248 080BF268 (T) ldrh r3,[r7,32h] ;4 3248
080BF26A (T) mov r4,32h ;2 3250 080BF26A (T) mov r4,32h ;2 3250
080BF26C (T) ldsh r1,[r7,r4] ;4 3254 080BF26C (T) ldsh r1,[r7,r4] ;4 3254
@ -1027,8 +1042,10 @@
080BF270 (T) neg r0,r0 ;2 3258 080BF270 (T) neg r0,r0 ;2 3258
080BF272 (T) cmp r1,r0 ;2 3260 080BF272 (T) cmp r1,r0 ;2 3260
080BF274 (T) beq 80BF2EEh ;8 3268 080BF274 (T) beq 80BF2EEh ;8 3268
080BF276 (T) add r3,1h ;2 3270
080BF278 (T) strh r3,[r7,32h] ;5 3275 // If counter != 0xFFFF:
080BF276 (T) add r3,1h ;2 3270 r3 is the unsigned counter
080BF278 (T) strh r3,[r7,32h] ;5 3275 increment counter
080BF27A (T) ldr r2,=3005270h ;9 3284 080BF27A (T) ldr r2,=3005270h ;9 3284
080BF27C (T) mov r5,24h ;2 3286 080BF27C (T) mov r5,24h ;2 3286
080BF27E (T) ldsh r1,[r7,r5] ;4 3290 080BF27E (T) ldsh r1,[r7,r5] ;4 3290
@ -1045,11 +1062,13 @@
080BF294 (T) ldsh r1,[r7,r4] ;4 3320 080BF294 (T) ldsh r1,[r7,r4] ;4 3320
080BF296 (T) add r0,r0,r1 ;2 3322 080BF296 (T) add r0,r0,r1 ;2 3322
080BF298 (T) lsl r0,r0,1h ;2 3324 080BF298 (T) lsl r0,r0,1h ;2 3324
080BF29A (T) add r6,r2,r0 ;2 3326 080BF29A (T) add r6,r2,r0 ;2 3326 tilemap pointer to cursor location
080BF29C (T) lsl r3,r3,10h ;2 3328 080BF29C (T) lsl r3,r3,10h ;2 3328
080BF29E (T) asr r3,r3,10h ;2 3330 080BF29E (T) asr r3,r3,10h ;2 3330
080BF2A0 (T) cmp r3,7h ;2 3332 080BF2A0 (T) cmp r3,7h ;2 3332
080BF2A2 (T) bgt 80BF2C8h ;8 3340 080BF2A2 (T) bgt 80BF2C8h ;8 3340
// If counter <= 7: draw larger cursor (tile 0x99)
080BF2A4 (T) ldr r3,=30051ECh ;9 3349 080BF2A4 (T) ldr r3,=30051ECh ;9 3349
080BF2A6 (T) ldrh r0,[r3] ;4 3353 080BF2A6 (T) ldrh r0,[r3] ;4 3353
080BF2A8 (T) add r0,99h ;2 3355 080BF2A8 (T) add r0,99h ;2 3355
@ -1068,6 +1087,8 @@
080BF2C2 (T) lsl r0,r0,0Ch ;2 3408 080BF2C2 (T) lsl r0,r0,0Ch ;2 3408
080BF2C4 (T) strh r0,[r5,r0] ;5 3413 080BF2C4 (T) strh r0,[r5,r0] ;5 3413
080BF2C6 (T) lsl r0,r0,0Ch ;2 3415 080BF2C6 (T) lsl r0,r0,0Ch ;2 3415
// Else: draw smaller cursor (tile 0x9A)
080BF2C8 (T) ldr r3,=30051ECh ;9 3424 080BF2C8 (T) ldr r3,=30051ECh ;9 3424
080BF2CA (T) ldrh r0,[r3] ;4 3428 080BF2CA (T) ldrh r0,[r3] ;4 3428
080BF2CC (T) add r0,9Ah ;2 3430 080BF2CC (T) add r0,9Ah ;2 3430
@ -1078,15 +1099,20 @@
080BF2D6 (T) add r6,40h ;2 3452 080BF2D6 (T) add r6,40h ;2 3452
080BF2D8 (T) ldrh r0,[r3] ;4 3456 080BF2D8 (T) ldrh r0,[r3] ;4 3456
080BF2DA (T) add r0,0BAh ;2 3458 080BF2DA (T) add r0,0BAh ;2 3458
080BF2DC (T) ldrh r1,[r2] ;4 3462 080BF2DC (T) ldrh r1,[r2] ;4 3462
080BF2DE (T) orr r0,r1 ;2 3464 080BF2DE (T) orr r0,r1 ;2 3464
080BF2E0 (T) strh r0,[r6] ;5 3469 080BF2E0 (T) strh r0,[r6] ;5 3469 draw bottom half of cursor
// If counter > 0x10, set to 0
080BF2E2 (T) mov r5,32h ;2 3471 080BF2E2 (T) mov r5,32h ;2 3471
080BF2E4 (T) ldsh r0,[r7,r5] ;4 3475 080BF2E4 (T) ldsh r0,[r7,r5] ;4 3475
080BF2E6 (T) cmp r0,10h ;2 3477 080BF2E6 (T) cmp r0,10h ;2 3477
080BF2E8 (T) ble 80BF2EEh ;8 3485 080BF2E8 (T) ble 80BF2EEh ;8 3485
080BF2EA (T) mov r0,0h ;2 3487 080BF2EA (T) mov r0,0h ;2 3487
080BF2EC (T) strh r0,[r7,32h] ;5 3492 080BF2EC (T) strh r0,[r7,32h] ;5 3492
// Return 0
080BF2EE (T) mov r0,0h ;2 3494 080BF2EE (T) mov r0,0h ;2 3494
080BF2F0 (T) add sp,20h ;2 3496 080BF2F0 (T) add sp,20h ;2 3496
080BF2F2 (T) pop r3-r5 ;6 3502 080BF2F2 (T) pop r3-r5 ;6 3502