diff --git a/nes/eznes.h b/nes/eznes.h index 5958fa9..31b4460 100644 --- a/nes/eznes.h +++ b/nes/eznes.h @@ -13,12 +13,16 @@ #define u8 unsigned char #define u16 unsigned short -#define s8 char -#define s16 short +#define s8 signed char +#define s16 signed short /* Generic constants */ +#ifdef PAL +#define CPU 1662607 /* PAL */ +#else #define CPU 1789773 /* NTSC */ +#endif #define SCREEN_WIDTH 32 #define SCREEN_HEIGHT 28 @@ -83,9 +87,12 @@ u8 joy_input_wait() { } /* palette loader */ -void init_palette(u8 bg, u8 c1, u8 c2, u8 c3, u8 c4) { +void init_palette(u8 bg1, u8 bg2, u8 bg3, u8 bg4, u8 c1, u8 c2, u8 c3, u8 c4) { u8 i, pal[16] = {0}; - pal[0] = pal[4] = pal[8] = pal[12] = bg; + pal[0] = bg1; + pal[4] = bg2; + pal[8] = bg3; + pal[12] = bg4; pal[3] = c1; pal[7] = c2; pal[11] = c3; @@ -149,11 +156,11 @@ void init_sound() { /* Game initialization section */ -void init_game(u8 bg, u8 c1, u8 c2, u8 c3, u8 c4) { +void init_game(u8 bg1, u8 bg2, u8 bg3, u8 bg4, u8 c1, u8 c2, u8 c3, u8 c4) { init_sound(); bgcolor(COLOR_BLACK); textcolor(0); - init_palette(bg, c1, c2, c3, c4); + init_palette(bg1, bg2, bg3, bg4, c1, c2, c3, c4); joy_install(joy_static_stddrv); clrscr(); } diff --git a/nes/nescoundrel.c b/nes/nescoundrel.c index 1bdb99a..85aa5dd 100644 --- a/nes/nescoundrel.c +++ b/nes/nescoundrel.c @@ -56,7 +56,7 @@ void beep_err() { void game_startup() { u8 i, j, x = 0; - init_game(NES_BLACK, NES_WHITE, NES_RED, NES_GREEN, NES_YELLOW); + init_game(NES_BLACK, NES_BLACK, NES_BLACK, NES_BLACK, NES_WHITE, NES_RED, NES_GREEN, NES_YELLOW); ppu_off(); for(j=0;j<24;j+=4) for(i=3;i<32;i+=4) @@ -147,7 +147,7 @@ Potion level: x - 21 /* Game stats */ /* main deck and room */ -static char deck[44], room[] = {0, 0, 0, 0}; +static s8 deck[44], room[] = {0, 0, 0, 0}; /* status message */ static char status_msg[(SCREEN_WIDTH-1)];