| |
Hedge of Disgrace - Only Sprites Compo Edition [2020] |
AKA :
Duff Design
Released At :
Only Sprites Compo
Credits :
SIDs used in this release :
Download :
Look for downloads on external sites:
Pokefinder.org
Production Info Submitted by Raistlin on 26 November 2020
Mostly coded in C++ .. with a little bit of 6510 "support".
Using my support libraries, it's probably ~500 lines of C++ in total and another 500 lines of ASM. Additionally, the C++ generates another memory-wasting 3905 lines of ASM ;-)
void HEDGE_OutputRasterASM(LPTSTR OutRasterASM)
{
CodeGen code(OutRasterASM);
code.OutputFunctionLine(fmt::format("DoScreen"));
code.OutputBlankLine();
static const int SpriteStartY = 54;
int SpriteYPos = SpriteStartY;
code.OutputCodeLine(LDA_IMM, fmt::format("#${:02x}", SpriteYPos));
for (int i = 0; i < 8; i++)
{
code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite{:d}Y", i));
}
int SetSprite0Col = -1;
int SetSprite1Col = -1;
int SetSprite2Col = -1;
bool bUpdateSpriteY = false;
for (int Line = 0; Line < 198; Line++)
{
int RasterLine = Line + 46;
int NumCyclesToUse = 63;
if (RasterLine >= SpriteStartY)
NumCyclesToUse -= 17;
NumCyclesToUse -= code.OutputCodeLine(DEC_ABS, fmt::format("VIC_D016"));
NumCyclesToUse -= code.OutputCodeLine(STY_ABS, fmt::format("VIC_D016"));
if (RasterLine == SpriteStartY)
{
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#SpriteTextColour"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite3Colour"));
}
if (RasterLine == (SpriteStartY + 42))
{
SetSprite1Col = 8;
SetSprite2Col = 9;
}
if (RasterLine == (SpriteStartY + 74))
{
SetSprite1Col = 12;
}
if (RasterLine == (SpriteStartY + 144))
{
SetSprite0Col = 14;
SetSprite1Col = 6;
}
if (RasterLine >= (SpriteStartY + 21))
{
int SubLine = RasterLine - (SpriteStartY + 21);
if ((SubLine % 21) == 0)
{
int iRow = SubLine / 21 + 1;
code.OutputFunctionLine(fmt::format("ScrollerSpriteX_{:d}", iRow));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#$ab"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite3X"));
code.OutputFunctionLine(fmt::format("ScrollerSpriteXMSB_{:d}", iRow));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#$ab"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_SpriteXMSB"));
code.OutputFunctionLine(fmt::format("ScrollerSpriteVal_{:d}", iRow));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#$ab"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("SpriteVals + 3"));
}
}
if ((RasterLine == SpriteYPos - 1) && (SpriteYPos > SpriteStartY))
{
static int iSpriteRow = 1;
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#Sprites0StartIndex + ({:02d} * 4) + 1", iSpriteRow));
NumCyclesToUse -= code.OutputCodeLine(SAX_ABS, fmt::format("SpriteVals + 4"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("SpriteVals + 5"));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#Sprites0StartIndex + ({:02d} * 4) + 3", iSpriteRow));
NumCyclesToUse -= code.OutputCodeLine(SAX_ABS, fmt::format("SpriteVals + 6"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("SpriteVals + 7"));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#Sprites1StartIndex + ({:02d} * 4) + 1", iSpriteRow));
NumCyclesToUse -= code.OutputCodeLine(SAX_ABS, fmt::format("SpriteVals + 0"));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("SpriteVals + 1"));
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#Sprites1StartIndex + ({:02d} * 4) + 3", iSpriteRow));
NumCyclesToUse -= code.OutputCodeLine(SAX_ABS, fmt::format("SpriteVals + 2"));
iSpriteRow++;
}
if (RasterLine > SpriteYPos + 4)
{
bUpdateSpriteY = true;
}
if ((SetSprite0Col != -1) && EnoughFreeCycles(NumCyclesToUse, 6))
{
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#${:02x}", SetSprite0Col));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite0Colour"));
SetSprite0Col = -1;
}
if ((SetSprite1Col != -1) && EnoughFreeCycles(NumCyclesToUse, 6))
{
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#${:02x}", SetSprite1Col));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite1Colour"));
SetSprite1Col = -1;
}
if ((SetSprite2Col != -1) && EnoughFreeCycles(NumCyclesToUse, 6))
{
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#${:02x}", SetSprite2Col));
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite2Colour"));
SetSprite2Col = -1;
}
if ((bUpdateSpriteY) && EnoughFreeCycles(NumCyclesToUse, 2 + 4 * 8))
{
SpriteYPos += 21;
if (SpriteYPos < (250 - 21))
{
NumCyclesToUse -= code.OutputCodeLine(LDA_IMM, fmt::format("#${:02x}", SpriteYPos));
for (int i = 0; i < 8; i++)
{
NumCyclesToUse -= code.OutputCodeLine(STA_ABS, fmt::format("VIC_Sprite{:d}Y", i));
}
}
bUpdateSpriteY = false;
}
code.WasteCycles(NumCyclesToUse);
}
code.OutputCodeLine(RTS);
} |
|
|
|
| Search CSDb |
| Navigate | |
|
| Detailed Info | |
|
| Fun Stuff | |
· Goofs · Hidden Parts · Trivia
|
|
| Forum | |
|
| Support CSDb | |
|
| |
|