////////////////////////////////////////////////////////////////////// // Put an ascii-encoded string int VRAM ////////////////////////////////////////////////////////////////////// void __fastcall__ vram_puts(unsigned char x, unsigned char y, const char *str) { char ch; vram_adr(NTADR(x, y)); while((ch=*str++) != 0) { vram_put(ch-0x20); } }
////////////////////////////////////////////////////////////////////// // Set up the playfield ////////////////////////////////////////////////////////////////////// void playfield_init(unsigned char rows) { vram_adr(0x2020); for(i=0; i<32; i++) { vram_put(BORDER_BLOCK); } vram_put(BORDER_BLOCK); for(i=0; i<30; i++) { vram_put(0); } vram_put(BORDER_BLOCK); for(j=0; j<26; j++) { vram_put(BORDER_BLOCK); for(i=0; i<15; i++) { if (j<rows) { vram_put(BRICK_L); vram_put(BRICK_R); bricks[16+16*j + i] = rows-j; } else { vram_put(0); vram_put(0); } } vram_put(BORDER_BLOCK); } vram_puts(10, 28, "SCORE 000000"); vram_adr(0x23c0); for(j=0; j<16; j+=2) { col = j & 0x3; col |= ((j+1) & 0x3) << 4; col |= col << 2; for(i=0; i<8; i++) { vram_put(col); } } }
void title_screen(void) { scroll(-8,240);//title is aligned to the color attributes, so shift it a bit to the right unrle_vram(title_nam,0x2000); vram_adr(0x2800);//clear second nametable, as it is visible in the jumping effect vram_fill(0,1024); pal_bg(palTitle); pal_bright(4); ppu_on_bg(); delay(20);//delay just to make it look better iy=240<<FP_BITS; dy=-8<<FP_BITS; frame_cnt=0; wait=160; bright=4; while(1) { ppu_waitnmi(); scroll(-8,iy>>FP_BITS); if(pad_trigger(0)&PAD_START) break; iy+=dy; if(iy<0) { iy=0; dy=-dy>>1; } if(dy>(-8<<FP_BITS)) dy-=2; if(wait) { --wait; } else { pal_col(2,(frame_cnt&32)?0x0f:0x20);//blinking press start text ++frame_cnt; } }