diff --git a/nes/nescoundrel.c b/nes/nescoundrel.c index 61d4651..e96dce3 100644 --- a/nes/nescoundrel.c +++ b/nes/nescoundrel.c @@ -30,6 +30,14 @@ #define GAME_YELLOW 2 #define GAME_GREEN 3 +void ppu_off() { + PPU.mask &= 0xE7; +} + +void ppu_on() { + PPU.mask |= 0x1A; +} + int joy_input_wait() { unsigned char last_joy = 0, joy, pressed; /* wait until the previous key is released */ @@ -88,6 +96,7 @@ void game_startup() { textcolor(0); init_palette(); clrscr(); + ppu_off(); for(j=0;j<24;j+=4) for(i=3;i<32;i+=4) colorxy(i, j, 1 + ((++entropy) % 3)); @@ -120,6 +129,7 @@ void game_startup() { cputsxy(1, SCREEN_HEIGHT - 2, "Luxferre"); cputsxy(SCREEN_WIDTH-5, SCREEN_HEIGHT - 2, "2026"); joy_install(joy_static_stddrv); + ppu_on(); while(1) { ++entropy; joy = joy_read(JOY_1); @@ -134,6 +144,7 @@ void game_startup() { void win_screen(int score) { unsigned char i, j; clrscr(); + ppu_off(); for(j=0;j<12;j+=4) for(i=3;i<32;i+=4) colorxy(i, j, 1 + (rand() % 3)); @@ -153,6 +164,7 @@ void win_screen(int score) { cputs("\r\nOriginal concept by Zach Gage\r\nand Kurt Bieg, 2011"); chlinexy(0, 23, SCREEN_WIDTH); cputsxy(10, 25, "Press Start"); + ppu_on(); while(joy_input_wait() != KEY_ST); } @@ -273,6 +285,7 @@ void render_main_scene() { for(i=0;i