Skip to content

Instantly share code, notes, and snippets.

@rkachowski
Created February 4, 2010 09:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkachowski/294466 to your computer and use it in GitHub Desktop.
Save rkachowski/294466 to your computer and use it in GitHub Desktop.
gameboy rom to try clear screen in apa mode
#include <gb/gb.h>
#include <gb/drawing.h>
void main()
{
int x =0;
int y =0;
int clean = 0;
UBYTE blankTile[] =
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
UWORD idx;
//whoopty
color(BLACK,BLACK,M_FILL);
box(0,0,GRAPHICS_WIDTH-1,GRAPHICS_HEIGHT-1,M_FILL);
while(1)
{
UBYTE joy = joypad();
if ( joy & J_A )//clear screen
{
if(clean ==0)
{
disable_interrupts();
for(idx=0; idx < 0xFF; idx++)
set_bkg_data(idx, 0x01, blankTile);
enable_interrupts();
clean =1;
}
}
if ( joy & J_RIGHT)//scroll right
{
color(BLACK,BLACK,M_NOFILL);
line(x,y,x,GRAPHICS_HEIGHT-1);
if(x<GRAPHICS_WIDTH-1)
x+=1;
clean =0;
}
if ( joy & J_LEFT)//scroll left
{
color(WHITE,WHITE,M_NOFILL);
line(x,y,x,GRAPHICS_HEIGHT-1);
if(x>0)
x-=1;
clean =0;
}
if ( joy & J_B)//black screen
{
color(BLACK,BLACK,M_FILL);
box(0,0,GRAPHICS_WIDTH-1,GRAPHICS_HEIGHT-1,M_FILL);
clean =0;
}
wait_vbl_done();
}
waitpad(J_START); // other keys are J_A, J_UP, J_SELECT, etc.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment