̬̬̬̈̬̬̬̬̈̬̬̬̬̬̪쬪̬̬̬̪쬪 >48 ̈"""""""""""""""wwwwwwwwwwwwwwẅ"""""""""""""""wwwwwwwwwwwwwwẅ"""""""""""""""wwwwwwwwwwwwwww̬,""""""""""""""""<3333333333333333lffffffffffffffff̬,""""""""""""""""<3333333333333333lffffffffffffffff̬,""""""""""""""""<3333333333333333lffffffffffffffff̬,"!"<3"""""""""""""23lfwwwwwwwwwwwwwgf̬,"!"<3"""""""""""""23lfwwwwwwwwwwwwwgf̬,"!"<3"""""""""""""23lfwwwwwwwwwwwwwgf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3 <3lflf̬̬,","<3 <3lflf̬̬,","<3 <3lflf̬̬,","<3<3lf lf̬̬,","<3<3lf lf̬̬,","<3<3lf lf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3<3lflf̬̬,","<3<3lflf̬ ,"""""""""""""""" <3333333333333333 lffffffffffffffff ̬ ,"""""""""""""""" <3333333333333333 lffffffffffffffff ̬ ,"""""""""""""""" <3333333333333333 lffffffffffffffff ̬̬̬,"""""""""""<33333333lfffflffff̬̬̬,"""""""""""<33333333lfffflffff̬̬̬,"""""""""""<33333333lfffflffff̬̪,"""","""",""""<3333<3<3<3333lfffffffffff̬̪,"""","""",""""<3333<3<3<3333lfffffffffff̬̪,"""","""",""""<3333<3<3<3333lfffffffffff̬,""""""""""""""""<3333333333333333lffffffffffffffff̬,""""""""""""""""<3333333333333333lffffffffffffffff̬,""""""""""""""""<3333333333333333lffffffffffffffff̌,""""""""""""""""|wwwwwwwwwwwwwwww̌,""""""""""""""""|wwwwwwwwwwwwwwww̌,""""""""""""""""|wwwwwwwwwwwwwwww 333333333333333̈333333333333333̈333333333333333̈LDDDDDDDDDDDDDDDD̜LDDDDDDDDDDDDDDDD̜LDDDDDDDDDDDDDDDD̜LD3333333333333CD̜LD3333333333333CD̜LD3333333333333CD̜LDLD̜̜LDLD̜̜LDLD̜̜LD,",",","LD̜̜LD,",",","LD̜̜LD,",",","LD̜̜LD,"""",""""LD̜̜LD,"""",""""LD̜̜LD,"""",""""LD̜̜LD""LD̜̜LD""LD̜̜LD""LD̜̜LDLD̜̜LDLD̜̜LDLD̜̜LDDDDDDDDDDDDDDDD ̜ LDDDDDDDDDDDDDDDD ̜ LDDDDDDDDDDDDDDDD ̜ LDDDDLDDDD̜̜̜LDDDDLDDDD̜̜̜LDDDDLDDDD̜̜̜LDDDDDDDDDDD̜̙LDDDDDDDDDDD̜̙LDDDDDDDDDDD̜̙LDDDDDDDDDDDDDDDD̜LDDDDDDDDDDDDDDDD̜LDDDDDDDDDDDDDDDD̜<3333333333333333̌<3333333333333333̌<3333333333333333̌ ,0,]']>S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl30 then banks[n].tiles=peeks(0x4000,8192) end if (m&2)>0 then banks[n].sprites=peeks(0x6000,8192) end if (m&4)>0 then banks[n].map=peeks(0x8000,240*136) end if (m&8)>0 then banks[n].sfx=peeks(0xffe4,256+4224) end if (m&16)>0 then banks[n].music=peeks(0x11164,11520+408) end if (m&32)>0 then -- palettes are special case since we want to store both vbanks _vbank(0) banks[n].palette=peeks(0x3fc0,48) _vbank(1) banks[n].palette1=peeks(0x3fc0,48) _vbank(cur_vbank) end if (m&64)>0 then banks[n].flags=peeks(0x14404,512) end if (m&128)>0 then banks[n].screen=peeks(0,16320) end end local function setbank(n,m) m=m or 255 if (m&1)>0 then pokes(0x4000,banks[n].tiles) end if (m&2)>0 then pokes(0x6000,banks[n].sprites) end if (m&4)>0 then pokes(0x8000,banks[n].map) end if (m&8)>0 then pokes(0xffe4,banks[n].sfx) end if (m&16)>0 then pokes(0x11164,banks[n].music) end if (m&32)>0 then -- palettes are special case since we want to store both vbanks _vbank(0) pokes(0x3fc0,banks[n].palette) _vbank(1) pokes(0x3fc0,banks[n].palette1) _vbank(cur_vbank) end if (m&64)>0 then pokes(0x14404,banks[n].flags) end if (m&128)>0 then pokes(0,banks[n].screen) end end local _sync=sync local ret={} --- Define banks for later use. -- Call this function after you define your TIC function; once gsync finishes loading, control will be returned to your TIC(). ---@param fn A function to use as TIC() while gsync loads the banks. Defaults to a "Loading" screen. ---@returns nil function ret.load(fn) fn=fn or function(n) cls() local s = "Loading"..(("."):rep(n)) local _w = print(s,0,-6) print(s,(240//2)-(_w//2),65) end local T=_G.TIC local fr=0 function _G.TIC() if fr==8 then sync(0,0,false) _G.TIC=T return T() end sync(0,fr,false) defbank(fr) vbank(0) pokes(0x3fc0,banks[0].palette) fn(fr) fr=fr+1 end end --- Sync sections to or from the cartridge. -- Unlike default `sync`, you can sync a section from the cart multiple times per frame. -- However, when syncing *to* the cart, you can only do that once per frame (since that requires a call to sync). -- I could probably find a way around that but I don't feel like it. ---@param mask A bitmask of sections to swap. If 0, swaps all sections. (Default: 0) ---@param bank The bank to swap. (Default: 0) ---@param tocart If true, saves section to cart; otherwise, loads section from cart. (Default: false) ---@returns nil function ret.sync(mask,bank,tocart) mask = mask or 0 bank = bank or 0 tocart = tocart or false if mask==0 then mask=255 end if tocart then -- define bank defbank(bank,mask) -- call through to tic_api_sync return _sync(mask,bank,tocart) end -- tocart is false so load us up setbank(bank,mask) end -- calling gsync(...) is the same as calling gsync.sync(...) return setmetatable(ret,{__call=function(t,mask,bank,tocart) return t.sync(mask,bank,tocart) end}) end)() function _G.TIC() cls() local x,y=12,16 for bank=0,7 do gsync(1,bank) spr(1,x,y,bank==7 and 11 or 14,3,0,0,2,2) if bank==3 then x=12 y=y+48+8 else x=x+48+8 end end end gsync.load()