ind = 22 function init() mode(1) map = {} col = {} for i=0,1199 do map[i] = 32 col[i] = 0x0f end map[ind] = 65 sel_col = 0x0f sel_chr = 65 end blink=30 function update() if btn(KEY_TAB) then draw_picker() update_picker() else draw_map() --update_map() end end function draw_picker() for y=0,15 do for x=0,15 do poke(x+y*40, x+y*16) poke(1200+x+y*40, sel_col) end end for i=0,15 do poke(1840+i, i<<4) poke(1880+i, i<<4) poke(640+i, 32) poke(680+i, 32) end poke(1840, 15) poke(1880, 15) poke(640+(sel_col&0xf), 203) poke(680+(sel_col>>4), 203) local mx, my = mousex(), mousey() if mx<16 then if my<16 then poke(1200+(mx+my*40), 0x4e) print(mx+my*40, 16, 13) elseif my>=16 then poke(mx+my*40, 144) end end end function update_picker() local mx, my = mousex(), mousey() if mousebutton(1) then if mx<16 then if my<16 then sel_chr = mx+my*16 else if my == 16 then sel_col = (sel_col & 0xf0) + mx elseif my == 17 then sel_col = (sel_col & 0x0f) + (mx << 4) end end end end end function draw_map() for i=0,1199 do poke(i, map[i]) poke(1200+i, col[i]) end local mx, my = mousex(), mousey() if mousebutton(1) then map[mx+my*40] = sel_chr col[mx+my*40] = sel_col end if btn(KEY_SPACE) then sel_chr = peek(mx+my*40) sel_col = peek(1200+mx+my*40) end if btnp(KEY_UP) then for i=40,1199 do map[i-40]=map[i]col[i-40]=col[i] end end if btnp(KEY_DOWN) then for i=1159,0,-1 do map[i+40]=map[i]col[i+40]=col[i] end end if btnp(KEY_LEFT) then for i=0,1198 do map[i]=map[i+1]col[i]=col[i+1] end end if btnp(KEY_RIGHT) then for i=1199,1,-1 do map[i]=map[i-1]col[i]=col[i-1] end end blink = blink - 1 if blink < 30 then if blink==0 then blink = 60 end local mx, my = mousex(), mousey() local c = peek(1200+(mx+my*40)) poke(1200+(mx+my*40), c~0xff) end if btn(KEY_S) then fileout("scr.bin", 0, 2400); elseif btn(KEY_L) then filein("scr.bin", 0, 2400); for i=0,1199 do map[i] = peek(i) col[i] = peek(1200+i) end end end