-
-
Notifications
You must be signed in to change notification settings - Fork 489
vbank
vbank(0)
Switch to bank 0 of VRAM
vbank(1)
Switch to bank 1 of VRAM ("overlay" VRAM)
- id : the VRAM bank ID to switch to (0 or 1)
VRAM is double-banked, such that the entire 16kb VRAM address space can be "swapped" at any time between banks 0 and 1. This is most commonly used for layering effects (background vs foreground layers, or a HUD that sits overtop of your main gameplay area, etc).
Note: vbank
should not be confused with sync
. VRAM banks can be switched
many times during a single TIC
(though this isn't common) - this is not true for the other banked RAM.
The banks are rendered to the screen simultaneously with any opaque portions of bank 1 appearing on "top" of bank 0. Bank 0 data is rendered using the bank 0 palette and bank 1 is rendered using the bank 1 palette. OVR TRANSPARENCY
(0x03FF8) controls which palette index of bank 1 is considered transparent.
Currently this behavior cannot be modified.
Previously there was no way to access bank 1 VRAM, one had to rely on the magic of the OVR callback - whose graphics calls magically wrote only to bank 1. Now anyone can implement this functionality using vbank
.
function draw_overlay()
-- switch to vram bank 1
vbank(1)
-- set palette entry 15 to transparent
poke(0x03FF8, 15)
-- clear the overlay layer (fully transparent, all index 2)
cls(15)
-- draw your custom overlay graphics here
end
function TIC()
-- switch back to vram bank 0
vbank(0)
-- draw normal stuff here
draw_overlay()
end
None yet.
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
Platform
RAM & VRAM | Display | Palette | Bits per Pixel (BPP) |
.tic
Format | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
- BDR (0.90)
- BOOT (1.0)
- MENU
- OVR (deprecated)
- SCN (deprecated)
- TIC
- btn & btnp
- circ & circb
- clip
- cls
- elli & ellib (0.90)
- exit
- fget & fset (0.80)
- font
- key & keyp
- line
- map
- memcpy & memset
- mget & mset
- mouse
- music
- peek, peek4
- peek1, peek2 (1.0)
- pix
- pmem
- poke, poke4
- poke1, poke2 (1.0)
- rect & rectb
- reset
- sfx
- spr
- sync
- ttri (1.0)
- time
- trace
- tri & trib (0.90)
- tstamp (0.80)
- vbank (1.0)