@@ -113,18 +113,26 @@ void sub_0801C25C(void) {
113
113
}
114
114
}
115
115
116
- void sub_0801C2F0 (u32 param_1 , u32 param_2 ) {
117
- u32 uVar1 ;
118
- register u32 rem asm("r1" );
119
- param_1 = param_1 * 0x20 + 0x6010000 ;
116
+ void sub_0801C2F0 (u32 dest , u32 param_2 ) {
117
+ u32 tensDigit ;
118
+ #ifdef NON_MATCHING
119
+ u32 onesDigit ;
120
+ union SplitDWord divRem ;
121
+ #else
122
+ FORCE_REGISTER (u32 onesDigit , r1 );
123
+ FORCE_REGISTER (union SplitDWord divRem , r0 );
124
+ #endif
120
125
121
- uVar1 = Div (param_2 , 10 );
122
- if (uVar1 > 9 ) {
123
- uVar1 = 9 ;
124
- }
126
+ dest = dest * 0x20 + 0x6010000 ;
127
+ divRem = DivAndMod (param_2 , 10 );
128
+ onesDigit = divRem .HALF_U .HI ;
129
+ tensDigit = divRem .HALF_U .LO ;
130
+
131
+ if (tensDigit >= 10 )
132
+ tensDigit = 9 ;
125
133
126
- DmaCopy32 (3 , ( gUnk_085C4620 + uVar1 * 8 ), param_1 , 0x8 * 4 );
127
- DmaCopy32 (3 , ( gUnk_085C4620 + (rem + 10 ) * 8 ), param_1 + 0x20 , 0x8 * 4 );
134
+ DmaCopy32 (3 , gUnk_085C4620 + tensDigit * 0x8 , dest , 0x8 * 4 );
135
+ DmaCopy32 (3 , gUnk_085C4620 + (onesDigit + 10 ) * 0x8 , dest + 0x20 , 0x8 * 4 );
128
136
}
129
137
130
138
void DrawUI (void ) {
@@ -277,7 +285,11 @@ void RenderDigits(u32 iconVramIndex, u32 count, u32 isTextYellow, u32 digits) {
277
285
u32 digit ;
278
286
vu32 * ptr ;
279
287
vu32 * ptr2 ;
280
- register u32 r1 asm("r1" );
288
+ #ifdef NON_MATCHING
289
+ union SplitDWord divRem ;
290
+ #else
291
+ FORCE_REGISTER (union SplitDWord divRem , r0 );
292
+ #endif
281
293
282
294
puVar4 = RupeeKeyDigits ;
283
295
if (isTextYellow == 0 ) {
@@ -287,13 +299,15 @@ void RenderDigits(u32 iconVramIndex, u32 count, u32 isTextYellow, u32 digits) {
287
299
iVar2 = iVar3 + 0x600c000 ;
288
300
switch (digits ) {
289
301
case 3 :
290
- digit = Div (count , 100 );
291
- count = r1 ;
302
+ divRem = DivAndMod (count , 100 );
303
+ digit = divRem .HALF_U .LO ;
304
+ count = divRem .HALF_U .HI ;
292
305
DmaCopy32 (3 , puVar4 + digit * 0x40 , iVar2 , 0x10 * 4 );
293
306
iVar2 += 0x40 ;
294
307
case 2 :
295
- digit = Div (count , 10 );
296
- count = r1 ;
308
+ divRem = DivAndMod (count , 10 );
309
+ digit = divRem .HALF_U .LO ;
310
+ count = divRem .HALF_U .HI ;
297
311
DmaCopy32 (3 , puVar4 + digit * 0x40 , iVar2 , 0x10 * 4 );
298
312
iVar2 += 0x40 ;
299
313
}
@@ -440,21 +454,14 @@ void EraseChargeBar(void) {
440
454
}
441
455
}
442
456
443
- typedef union {
444
- u32 values [2 ];
445
- u64 raw ;
446
- } returnValues ;
447
-
448
- typedef u64 DivRem (u32 , u32 );
449
-
450
457
void DrawChargeBar (void ) {
451
458
bool32 tmp1 ;
452
459
u16 * BufferPos ;
453
- returnValues ret ;
454
460
// these names are almost certainly inaccurate
455
461
u32 chargeTime ;
456
462
u32 chargeState ;
457
463
u32 chargeFrame ;
464
+ union SplitDWord divRem ;
458
465
459
466
tmp1 = FALSE;
460
467
if (!(gHUD .hideFlags & HUD_HIDE_CHARGE_BAR ))
@@ -476,10 +483,9 @@ void DrawChargeBar(void) {
476
483
gHUD .unk_6 = 1 ;
477
484
gHUD .unk_7 = chargeTime ;
478
485
479
- // this calls Div and returns the result in ret.values[0] and the remainder in ret.values[1]
480
- ret .raw = ((DivRem * )& Div )(chargeTime , 4 );
481
- chargeState = ret .values [0 ];
482
- chargeFrame = ret .values [1 ];
486
+ divRem = DivAndMod (chargeTime , 4 );
487
+ chargeState = divRem .HALF_U .LO ;
488
+ chargeFrame = divRem .HALF_U .HI ;
483
489
484
490
BufferPos [0 ] = 0xf016 ;
485
491
BufferPos [11 ] = 0xf416 ;
0 commit comments