Wrap asm statements in NONMATCHING

This commit is contained in:
GriffinR 2020-08-18 08:11:25 -04:00
parent 3372993a63
commit 0e7f634b00
13 changed files with 59 additions and 30 deletions

View File

@ -475,15 +475,15 @@ u8 GetLastTextColor(u8 colorType)
\
for (; i < toY; i++) \
{ \
asm("":::"sl"); \
asm("":::"sl"); /* NONMATCHING */ \
r5 = *(ptr++); \
for (j = fromX; j < toX; j++) \
{ \
const u32 toOrr = r5 & 0xF; \
if (toOrr) \
{ \
dst = windowTiles + ((j / 8) * 32) + ((j & 7) >> 1) + ((i / 8) * widthOffset) + ((i & 7) * 4); \
bits = ((j & 1) * 4); \
dst = windowTiles + ((j / 8) * 32) + ((j & 7) >> 1) + ((i / 8) * widthOffset) + ((i & 7) * 4); \
bits = ((j & 1) * 4); \
*dst = (toOrr << bits) | ((0xF0 >> bits) & *dst); \
} \
r5 >>= 4; \

View File

@ -355,7 +355,11 @@ static void GenerateOpponentMons(void)
{
u16 trainerId;
s32 i, j, k;
register const u16 *monSet asm("r9"); // Fix me. Compiler insists on moving that variable into stack.
#ifndef NONMATCHING
register const u16 *monSet asm("r9"); // Fix me. Compiler insists on moving that variable into stack.
#else
const u16 *monSet;
#endif
u16 species[FRONTIER_PARTY_SIZE];
u16 heldItems[FRONTIER_PARTY_SIZE];
s32 monId = 0;

View File

@ -1466,7 +1466,9 @@ u8 GetFrontierOpponentClass(u16 trainerId)
else
{
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
asm("");
#ifndef NONMATCHING
asm("");
#endif
}
}
else
@ -1478,7 +1480,9 @@ u8 GetFrontierOpponentClass(u16 trainerId)
else
{
trainerClass = gFacilityClassToTrainerClass[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
asm("");
#ifndef NONMATCHING
asm("");
#endif
}
}

View File

@ -3974,7 +3974,9 @@ static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task)
for (i = 0; i < 160; i++, var6 += var8)
{
s16 index = var6 / 256;
asm("");
#ifndef NONMATCHING
asm("");
#endif
gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude);
}

View File

@ -2698,7 +2698,8 @@ const u8 gMonIcon_Deoxys[] = INCBIN_U8("graphics/pokemon/deoxys/icon.4bpp");
const u8 gMonIcon_DeoxysSpeed[] = INCBIN_U8("graphics/pokemon/deoxys/icon_speed.4bpp");
const u8 gMonIcon_DeoxysSpeedWide[] = INCBIN_U8("graphics/unused/deoxys_speed_icon_wide.4bpp");
asm(".space 0x6800");
// Probably the leftover space from the other Deoxys forms
static const u8 sEmpty[0x6800] = {0};
const u16 gUnknown_D437F8[] = INCBIN_U16("graphics/unknown/unknown_D437F8.bin");

View File

@ -225,7 +225,9 @@ void TrendyPhraseIsOld(void)
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 < 2)
{
asm("":::"r2"); //Force the compiler to store address of gSaveBlock1 in r3 instead of r2
#ifndef NONMATCHING
asm("":::"r2"); //Force the compiler to store address of gSaveBlock1 in r3 instead of r2
#endif
if (!gSaveBlock1Ptr->easyChatPairs[0].unk1_6 && gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
result = 1;
}

View File

@ -1239,7 +1239,9 @@ static void sub_80C6104(u8 cursorArea, u8 previousCursorArea)
if (!var)
{
asm("":::"r4");
#ifndef NONMATCHING
asm("":::"r4");
#endif
if (previousCursorArea == CURSOR_AREA_NOTHING || previousCursorArea > CURSOR_AREA_CANCEL)
return;
}

View File

@ -987,8 +987,7 @@ const u16 gTilesetAnims_BattleDomePals0_1[] = INCBIN_U16("graphics/battle_fronti
const u16 gTilesetAnims_BattleDomePals0_2[] = INCBIN_U16("graphics/battle_frontier/dome_anim3.gbapal");
const u16 gTilesetAnims_BattleDomePals0_3[] = INCBIN_U16("graphics/battle_frontier/dome_anim4.gbapal");
// 8D856C0
asm(".2byte 0x013F, 0x0119, 0x0113, 0x010E"); // unused?
static const u16 sUnused0[] = {0x13F, 0x119, 0x113, 0x10E};
const u16 gUnknown_08D856C8[] = INCBIN_U16("graphics/battle_frontier/pyramid_light.gbapal"); // unfaded pal for the player light in battle pyramid
@ -1362,17 +1361,17 @@ const u8 gBerryBlenderMarubatsuTiles[] = INCBIN_U8("graphics/berry_blender/marub
const u8 gBerryBlenderParticlesTiles[] = INCBIN_U8("graphics/berry_blender/particles.4bpp");
asm(".space 0x120");
static const u8 sEmpty0[0x120] = {0};
const u8 gBerryBlenderCountdownNumbersTiles[] = INCBIN_U8("graphics/berry_blender/countdown_numbers.4bpp");
const u8 gBerryBlenderStartTiles[] = INCBIN_U8("graphics/berry_blender/start.4bpp");
asm(".space 0x200");
static const u8 sEmpty1[0x200] = {0};
const u8 gBerryBlenderArrowTiles[] = INCBIN_U8("graphics/berry_blender/arrow.4bpp");
asm(".space 0x2C0");
static const u8 sEmpty2[0x2C0] = {0};
const u16 gEasyChatCursor_Pal[] = INCBIN_U16("graphics/easy_chat/cursor.gbapal");
const u32 gEasyChatCursor_Gfx[] = INCBIN_U32("graphics/easy_chat/cursor.4bpp.lz");
@ -1481,8 +1480,7 @@ const u16 gTradeGba_Pal[] = INCBIN_U16("graphics/link/gba.gbapal");
const u16 gTradeGba2_Pal[] = INCBIN_U16("graphics/link/gba_pal2.gbapal");
const u8 gTradeGba_Gfx[] = INCBIN_U8("graphics/link/gba.4bpp");
// 8DD8760
asm(".space 0x20"); //blank palette??
static const u16 sEmptyPal[16] = {0};
#include "data/graphics/berry_fix.h"
@ -1564,10 +1562,10 @@ const u32 gUnknown_08DE34B8[] = INCBIN_U32("graphics/berry_crusher/tiles.4bpp.lz
const u32 gUnknown_08DE3FD4[] = INCBIN_U32("graphics/berry_crusher/tiles.bin.lz");
// random garbage at the end.
asm(".space 0x54BAC \n\
.byte 0x0D, 0x00, 0x58, 0x02 \n\
.space 0x1145 \n\
.byte 0x02 \n\
.space 0x3242 \n\
.byte 0x40 \n\
.space 0x13");
static const u8 sEmpty3[0x54BAC] = {0};
static const u8 sUnused1[] = {0x0D, 0x00, 0x58, 0x02};
static const u8 sEmpty4[0x1145] = {0};
static const u8 sUnused2[] = {0x02};
static const u8 sEmpty5[0x3242] = {0};
static const u8 sUnused3[] = {0x40};
static const u8 sEmpty6[0x13] = {0};

View File

@ -148,7 +148,11 @@ static void sio32intr_clock_slave(void)
{
u32 regSIODATA32;
u32 r0;
register u32 reqLen asm("r2");
#ifndef NONMATCHING
register u32 reqLen asm("r2");
#else
u32 reqLen;
#endif
gSTWIStatus->timerActive = 0;
STWI_set_timer_in_RAM(100);

View File

@ -904,7 +904,9 @@ void CgbModVol(struct CgbChannel *chan)
// Force chan->rightVolume and chan->leftVolume to be read from memory again,
// even though there is no reason to do so.
// The command line option "-fno-gcse" achieves the same result as this.
asm("" : : : "memory");
#ifndef NONMATCHING
asm("" : : : "memory");
#endif
chan->eg = (u32)(chan->rightVolume + chan->leftVolume) >> 4;
if (chan->eg > 15)

View File

@ -6814,7 +6814,9 @@ static void sub_806F160(struct Unknown_806F160_Struct* structPtr)
structPtr->templates[i] = gUnknown_08329D98[i];
for (j = 0; j < structPtr->field_1; j++)
{
asm("");
#ifndef NONMATCHING
asm("");
#endif
structPtr->frameImages[i * structPtr->field_1 + j].data = &structPtr->byteArrays[i][j * 0x800];
}
structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->field_1];

View File

@ -2884,7 +2884,11 @@ static void sub_8181C2C(struct Sprite *sprite)
}
else
{
register s32 var asm("r4") = sUnknown_03001240[sprite->data[0]].field_8;
#ifndef NONMATCHING
register s32 var asm("r4") = sUnknown_03001240[sprite->data[0]].field_8;
#else
s32 var = sUnknown_03001240[sprite->data[0]].field_8;
#endif
sprite->pos2.x = (var << 3) * (counter % 128) / 128 - (sUnknown_03001240[sprite->data[0]].field_8 * 8);
sprite->pos2.y = -(Sin(counter % 128, 8));

View File

@ -872,8 +872,12 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
var2 = sub_80E7A9C(&_src->mail[1]);
if (!var1 && var2)
{
register u8 one asm("r0") = 1; // boo, a fakematch
sp24[j][1] = one;
#ifndef NONMATCHING
register u8 one asm("r0") = 1; // boo, a fakematch
sp24[j][1] = one;
#else
sp24[j][1] = 1;
#endif
}
else if ((var1 && var2) || (!var1 && !var2))
{