;NES hardware-dependent functions by Shiru (shiru@mail.ru) ;Feel free to do anything you want with this code, consider it Public Domain .export _pal_all,_pal_bg,_pal_spr,_pal_col,_pal_clear,_pal_bright .export _ppu_off,_ppu_on_all,_ppu_on_bg,_ppu_on_spr,_ppu_mask .export _oam_clear,_oam_spr,_oam_meta_spr,_oam_hide_rest .export _ppu_waitnmi .export _unrle_vram .export _scroll .export _bank_spr,_bank_bg .export _vram_read,_vram_write .export _music_play,_music_stop,_music_pause .export _sfx_play .export _pad_poll,_pad_trigger,_pad_state .export _rand8,_rand16,_set_rand .export _set_vram_update,_vram_adr,_vram_put,_vram_fill,_vram_inc .export _memcpy ;NMI handler nmi: pha txa pha tya pha lda OAM_BUF sta PPU_OAM_DMA lda #$3f sta PPU_ADDR stx PPU_ADDR .repeat 4,I ldy PAL_BUF+I lda (PAL_PTR),y sta PPU_DATA .endrepeat .repeat 7,J lda PPU_DATA ;skip background color .repeat 3,I ldy PAL_BUF+5+(J*4)+I lda (PAL_PTR),y sta PPU_DATA .endrepeat .endrepeat ldx palBrightTable sta