charmap("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#@-,'>!♥·") fn load_bg() // Tell the NES which VRAM address we want to upload to: ppu_reset_addr($2000) // Upload the tile data: for UU i = 0; i < 960; i += 1 {PPUDATA}($2C) // Then the attributes: for U i = 0; i < 64; i += 1 {PPUDATA}(%00000000) fn write_u(U x, AA addr) ppu_reset_addr(addr) fence {PPUDATA}(x >> 4) {PPUDATA}(x & %1111) fence fn write_uu(UU x, AA addr) ppu_reset_addr(addr) fence {PPUDATA}(x.b >> 4) {PPUDATA}(x.b & %1111) {PPUDATA}(x.a >> 4) {PPUDATA}(x.a & %1111) fence fn write_uuu(UUU x, AA addr) ppu_reset_addr(addr) fence {PPUDATA}(x.c >> 4) {PPUDATA}(x.c & %1111) {PPUDATA}(x.b >> 4) {PPUDATA}(x.b & %1111) {PPUDATA}(x.a >> 4) {PPUDATA}(x.a & %1111) fence // Variables: data /test_data [] test_arr U(0) U(1) U(2) omni data /test_omni [] omni_arr U(4) U(5) U(6) vars /globals CCC/test_data test_ptr = @test_arr UUU test_ptr_cast = UUU(@test_arr) CC/test_omni omni_ptr = @omni_arr UU omni_ptr_cast = UU(@omni_arr) // COMMMENT THIS OUT IN MAIN FOR COMPARISON fn init_globals() : employs /globals test_ptr = @test_arr test_ptr_cast = UUU(@test_arr) omni_ptr = @omni_arr omni_ptr_cast = UU(@omni_arr) nmi main_nmi() ppu_upload_oam_poll_pads(0) // compare normal data ptrs write_uuu(UUU(test_ptr), $218E) write_uuu(test_ptr_cast, $21CE) // compare omni data ptrs write_uu(UU(omni_ptr), $2198) write_uu(omni_ptr_cast, $21D8) ppu_reset_scroll(0, 0) mode main() : nmi main_nmi : employs /test_data/test_omni palette = example_palette ppu_upload_palette() load_bg() // COMMENT THIS OUT FOR COMPARISON init_globals() {PPUCTRL}(PPUCTRL_NMI_ON) {PPUMASK}(PPUMASK_ON | PPUMASK_NO_CLIP) while true nmi // Define the tileset (commonly called CHR): chrrom file(fmt, "tiles.png") file(fmt, "tiles.png")