-
-
Notifications
You must be signed in to change notification settings - Fork 488
sync
sync([mask=0], [bank=0], [tocart=false])
The PRO version of TIC-80 contains 8 memory banks. For more information, see bankswitching. To switch between these banks, sync
can be used to either load contents from a memory bank to runtime, or save contents from the active runtime to a bank. The function can only be called once per frame.
- mask : mask of sections you want to switch:
tiles = 1<<0 -- 1
sprites = 1<<1 -- 2
map = 1<<2 -- 4
sfx = 1<<3 -- 8
music = 1<<4 -- 16
palette = 1<<5 -- 32
flags = 1<<6 -- 64
screen = 1<<7 -- 128 (as of 0.90)
0
- will switch all the sections
1 | 2 | 4
- will switch only TILES
, SPRITES
and MAP
sections, for example
- bank : memory bank (0..7)
-
tocart :
true
- save memory from runtime to bank/cartridge,false
- load data from bank/cartridge to runtime.
Use sync()
to save data you modify during runtime and would like to persist, or to restore runtime data from the cartridge. For example, if you have manipulated the runtime memory (e.g. by using mset), you can reset the active state by calling sync(0,0,false)
. This resets the whole of runtime memory to the contents of bank 0.
Note that sync
is never used to load code from banks; this is done automatically. All data is restored from cartridge on every startup.
Note: In older versions of TIC-80, calling sync
was not required to save runtime map and sprite data. Sync should be called any time changes to the sprites and map are made during runtime if you'd like the changes to be applied.
sync [tocart=true]
-
tocart :
true
- save sprites/map/sound from runtime to cart,false
- to restore data from cart (can be useful to reset all the data)
sync(128,0,true)
will add the current screen as cover image.
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)