Advertisement
Guest User

Ef9345DisplayEditorX2_tortueformat_201704032221.sdlbas

a guest
Apr 3rd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SdlBasic 20.80 KB | None | 0 0
  1. zoommode=2:debug=1
  2.  
  3. '- to do:
  4. '-  1: test and fix bugs
  5.  
  6. '-------------------------------------------------------------------------------
  7.  
  8. chcur=90:ikcur=3:ppcur=4:mbutprs=0
  9.  
  10. debug=debug mod 2
  11. dim paleta$[16]
  12. dim z$[512]:for i=0 to 511:z$[i]="55aa55aa55aa55aa55aa":next
  13. dim setetg[5120]
  14. dim mapch[40,40]:dim mapat[40,40]
  15.  
  16. '-------------------------------------------------------------------------------
  17.  
  18. paleta$[00]="0x000000":paleta$[01]="0xFF0000":paleta$[02]="0x00FF00":paleta$[03]="0xFFFF00"
  19. paleta$[04]="0x0000FF":paleta$[05]="0xFF00FF":paleta$[06]="0x00FFFF":paleta$[07]="0xFFFFFF"
  20. paleta$[08]="0x808080":paleta$[09]="0x808080":paleta$[10]="0x808080":paleta$[11]="0x808080"
  21. paleta$[12]="0x808080":paleta$[13]="0x808080":paleta$[14]="0x808080":paleta$[15]="0x808080"
  22.  
  23. z$[  0]="00384440201000100000":z$[  1]="0010280038447c440000":z$[  2]="0008103c2030203c0000":z$[  3]="000814103810243c0000"
  24. z$[  4]="001028344c444c340000":z$[  5]="00384440404044381020":z$[  6]="0028003c2030203c0000":z$[  7]="0020180038447c440000"
  25. z$[  8]="00201800444444380000":z$[  9]="0010083c2030203c0000":z$[ 10]="003c50505850503c0000":z$[ 11]="0008143c2030203c0000"
  26. z$[ 12]="000010207f2010000000":z$[ 13]="00102800301010380000":z$[ 14]="00000804fe0408000000":z$[ 15]="10101010101054381000"
  27. z$[ 16]="00182418000000000000":z$[ 17]="0010107c1010007c0000":z$[ 18]="00081038447c40380000":z$[ 19]="00280038447c40380000"
  28. z$[ 20]="00280030101010380000":z$[ 21]="00000038404040381020":z$[ 22]="0010280044444c340000":z$[ 23]="002010344c444c340000"
  29. z$[ 24]="000010007c0010000000":z$[ 25]="00201038447c40380000":z$[ 26]="0000003c525e503e0000":z$[ 27]="00102838447c40380000"
  30. z$[ 28]="0040c040444c143e0400":z$[ 29]="0040c0404c5204081e00":z$[ 30]="00e0204024cc143e0400":z$[ 31]="00102800384444380000"
  31. z$[ 32]="00000000000000000000":z$[ 33]="00101010101000100000":z$[ 34]="00282828000000000000":z$[ 35]="0028287c287c28280000"
  32. z$[ 36]="00103850381454381000":z$[ 37]="0060640810204c0c0000":z$[ 38]="00205050205448340000":z$[ 39]="00101020000000000000"
  33. z$[ 40]="00081020202010080000":z$[ 41]="00201008080810200000":z$[ 42]="00105438103854100000":z$[ 43]="000010107c1010000000"
  34. z$[ 44]="00000000000020204000":z$[ 45]="00000000003c00000000":z$[ 46]="00000000000000200000":z$[ 47]="01020204081020204080"
  35. z$[ 48]="00102844444428100000":z$[ 49]="00103010101010100000":z$[ 50]="003844041820407c0000":z$[ 51]="007c0408180444380000"
  36. z$[ 52]="00081828487c08080000":z$[ 53]="007c4078040444380000":z$[ 54]="00182040784444380000":z$[ 55]="007c0408102020200000"
  37. z$[ 56]="00384444384444380000":z$[ 57]="003844443c0404380000":z$[ 58]="00000020000000200000":z$[ 59]="00000020000020204000"
  38. z$[ 60]="00040810201008040000":z$[ 61]="0000007c007c00000000":z$[ 62]="00402010081020400000":z$[ 63]="00384404081000100000"
  39. z$[ 64]="0038445c545c40380000":z$[ 65]="00384444447c44440000":z$[ 66]="00784444784444780000":z$[ 67]="00384440404044380000"
  40. z$[ 68]="00784444444444780000":z$[ 69]="007c40407040407c0000":z$[ 70]="007c4040704040400000":z$[ 71]="00384440404c443c0000"
  41. z$[ 72]="004444447c4444440000":z$[ 73]="00381010101010380000":z$[ 74]="001c0808080848300000":z$[ 75]="00444850605048440000"
  42. z$[ 76]="004040404040407c0000":z$[ 77]="00446c54444444440000":z$[ 78]="00444464544c44440000":z$[ 79]="00384444444444380000"
  43. z$[ 80]="00784444784040400000":z$[ 81]="00384444445448340000":z$[ 82]="00784444785048440000":z$[ 83]="00384440380444380000"
  44. z$[ 84]="007c1010101010100000":z$[ 85]="00444444444444380000":z$[ 86]="00444444282810100000":z$[ 87]="00444444545454280000"
  45. z$[ 88]="00444428102844440000":z$[ 89]="00444428101010100000":z$[ 90]="007c04081020407c0000":z$[ 91]="001c10101010101c0000"
  46. z$[ 92]="80404020100804040201":z$[ 93]="00380808080808380000":z$[ 94]="00103854101010101000":z$[ 95]="000000000000000000ff"
  47. z$[ 96]="00000000ff0000000000":z$[ 97]="000000344c444c340000":z$[ 98]="00404078444444780000":z$[ 99]="00000038404040380000"
  48. z$[100]="0004043c4444443c0000":z$[101]="00000038447c40380000":z$[102]="00182420702020200000":z$[103]="0000003c44443c042418"
  49. z$[104]="00404058644444440000":z$[105]="00100030101010380000":z$[106]="00080018080808084830":z$[107]="00202024283028240000"
  50. z$[108]="00301010101010380000":z$[109]="00000068545454540000":z$[110]="00000058644444440000":z$[111]="00000038444444380000"
  51. z$[112]="00000078444444784040":z$[113]="0000003c4444443c0404":z$[114]="00000058644040400000":z$[115]="00000038403804780000"
  52. z$[116]="00202038202020180000":z$[117]="0000004444444c340000":z$[118]="00000044442828100000":z$[119]="00000044445454280000"
  53. z$[120]="00000044281028440000":z$[121]="00000044444c34044438":z$[122]="0000007c0810207c0000":z$[123]="80808080808080808080"
  54. z$[124]="10101010101010101010":z$[125]="01010101010101010101":z$[126]="ff000000000000000000":z$[127]="ffffffffffffffffffff"
  55.  
  56. z$[128+128]="00000000000000000000":z$[129+128]="70700000000000000000":z$[130+128]="07070000000000000000":z$[131+128]="77770000000000000000"
  57. z$[132+128]="00000070707000000000":z$[133+128]="70700070707000000000":z$[134+128]="07070070707000000000":z$[135+128]="77770070707000000000"
  58. z$[136+128]="00000007070700000000":z$[137+128]="70700007070700000000":z$[138+128]="07070007070700000000":z$[139+128]="77770007070700000000"
  59. z$[140+128]="00000077777700000000":z$[141+128]="70700077777700000000":z$[142+128]="07070077777700000000":z$[143+128]="77770077777700000000"
  60. z$[144+128]="00000000000000707000":z$[145+128]="70700000000000707000":z$[146+128]="07070000000000707000":z$[147+128]="77770000000000707000"
  61. z$[148+128]="00000070707000707000":z$[149+128]="70700070707000707000":z$[150+128]="07070070707000707000":z$[151+128]="77770070707000707000"
  62. z$[152+128]="00000007070700707000":z$[153+128]="70700007070700707000":z$[154+128]="07070007070700707000":z$[155+128]="77770007070700707000"
  63. z$[156+128]="00000077777700707000":z$[157+128]="70700077777700707000":z$[158+128]="07070077777700707000":z$[159+128]="77770077777700707000"
  64. z$[160+128]="00000000000000070700":z$[161+128]="70700000000000070700":z$[162+128]="07070000000000070700":z$[163+128]="77770000000000070700"
  65. z$[164+128]="00000070707000070700":z$[165+128]="70700070707000070700":z$[166+128]="07070070707000070700":z$[167+128]="77770070707000070700"
  66. z$[168+128]="00000007070700070700":z$[169+128]="70700007070700070700":z$[170+128]="07070007070700070700":z$[171+128]="77770007070700070700"
  67. z$[172+128]="00000077777700070700":z$[173+128]="70700077777700070700":z$[174+128]="07070077777700070700":z$[175+128]="77770077777700070700"
  68. z$[176+128]="00000000000000777700":z$[177+128]="70700000000000777700":z$[178+128]="07070000000000777700":z$[179+128]="77770000000000777700"
  69. z$[180+128]="00000070707000777700":z$[181+128]="70700070707000777700":z$[182+128]="07070070707000777700":z$[183+128]="77770070707000777700"
  70. z$[184+128]="00000007070700777700":z$[185+128]="70700007070700777700":z$[186+128]="07070007070700777700":z$[187+128]="77770007070700777700"
  71. z$[188+128]="00000077777700777700":z$[189+128]="70700077777700777700":z$[190+128]="07070077777700777700":z$[191+128]="77770077777700777700"
  72. z$[192+128]="00000000000000000000":z$[193+128]="f0f0f000000000000000":z$[194+128]="0f0f0f00000000000000":z$[195+128]="ffffff00000000000000"
  73. z$[196+128]="000000f0f0f0f0000000":z$[197+128]="f0f0f0f0f0f0f0000000":z$[198+128]="0f0f0ff0f0f0f0000000":z$[199+128]="fffffff0f0f0f0000000"
  74. z$[200+128]="0000000f0f0f0f000000":z$[201+128]="f0f0f00f0f0f0f000000":z$[202+128]="0f0f0f0f0f0f0f000000":z$[203+128]="ffffff0f0f0f0f000000"
  75. z$[204+128]="000000ffffffff000000":z$[205+128]="f0f0f0ffffffff000000":z$[206+128]="0f0f0fffffffff000000":z$[207+128]="ffffffffffffff000000"
  76. z$[208+128]="00000000000000f0f0f0":z$[209+128]="f0f0f000000000f0f0f0":z$[210+128]="0f0f0f00000000f0f0f0":z$[211+128]="ffffff00000000f0f0f0"
  77. z$[212+128]="000000f0f0f0f0f0f0f0":z$[213+128]="f0f0f0f0f0f0f0f0f0f0":z$[214+128]="0f0f0ff0f0f0f0f0f0f0":z$[215+128]="fffffff0f0f0f0f0f0f0"
  78. z$[216+128]="0000000f0f0f0ff0f0f0":z$[217+128]="f0f0f00f0f0f0ff0f0f0":z$[218+128]="0f0f0f0f0f0f0ff0f0f0":z$[219+128]="ffffff0f0f0f0ff0f0f0"
  79. z$[220+128]="000000fffffffff0f0f0":z$[221+128]="f0f0f0fffffffff0f0f0":z$[222+128]="0f0f0ffffffffff0f0f0":z$[223+128]="fffffffffffffff0f0f0"
  80. z$[224+128]="000000000000000f0f0f":z$[225+128]="f0f0f0000000000f0f0f":z$[226+128]="0f0f0f000000000f0f0f":z$[227+128]="ffffff000000000f0f0f"
  81. z$[228+128]="000000f0f0f0f00f0f0f":z$[229+128]="f0f0f0f0f0f0f00f0f0f":z$[230+128]="0f0f0ff0f0f0f00f0f0f":z$[231+128]="fffffff0f0f0f00f0f0f"
  82. z$[232+128]="0000000f0f0f0f0f0f0f":z$[233+128]="f0f0f00f0f0f0f0f0f0f":z$[234+128]="0f0f0f0f0f0f0f0f0f0f":z$[235+128]="ffffff0f0f0f0f0f0f0f"
  83. z$[236+128]="000000ffffffff0f0f0f":z$[237+128]="f0f0f0ffffffff0f0f0f":z$[238+128]="0f0f0fffffffff0f0f0f":z$[239+128]="ffffffffffffff0f0f0f"
  84. z$[240+128]="00000000000000ffffff":z$[241+128]="f0f0f000000000ffffff":z$[242+128]="0f0f0f00000000ffffff":z$[243+128]="ffffff00000000ffffff"
  85. z$[244+128]="000000f0f0f0f0ffffff":z$[245+128]="f0f0f0f0f0f0f0ffffff":z$[246+128]="0f0f0ff0f0f0f0ffffff":z$[247+128]="fffffff0f0f0f0ffffff"
  86. z$[248+128]="0000000f0f0f0fffffff":z$[249+128]="f0f0f00f0f0f0fffffff":z$[250+128]="0f0f0f0f0f0f0fffffff":z$[251+128]="ffffff0f0f0f0fffffff"
  87. z$[252+128]="000000ffffffffffffff":z$[253+128]="f0f0f0ffffffffffffff":z$[254+128]="0f0f0fffffffffffffff":z$[255+128]="ffffffffffffffffffff"
  88.  
  89. '-------------------------------------------------------------------------------
  90. '- functions and routines
  91.  
  92. function hexvl(a$)
  93.    e=asc(ucase$(a$))
  94.    hexvl=abs(((e>=48 and e<=57)*(e-48))+((e>=65 and e<=70)*(e-55)))
  95.  end function
  96.  
  97. function bytefromhexdump(a$,byteadr)
  98.    i=(byteadr*2)+1:m1$=mid$(a$,i,1):m2$=mid$(a$,i+1,1)
  99.    tmpr=(hexvl(m1$)*16)+hexvl(m2$):bytefromhexdump=tmpr
  100.  end function
  101.  
  102. sub bindispzoom(xqq,yqq,v,i,p,xcs,ycs)
  103.   ink(p)
  104.   bar(   (xqq*xcs)*zoommode,(yqq*ycs)*zoommode,((xqq*xcs)+(xcs*8)-1)*zoommode,((yqq*ycs)+ycs-1)*zoommode  )
  105.   ink(i)
  106.   for zqq=0 to 7:ik=p:z2=7-zqq
  107.     bar(   ((xqq+zqq)*xcs)*zoommode+1,(yqq*ycs)*zoommode+1,(((xqq+zqq)*xcs)+2)*zoommode,((yqq*ycs)+2)*zoommode )
  108.     next
  109.   for zqq=0 to 7:ik=p:z2=7-zqq
  110.     if bitwiseand(v,2^z2)<>0 then
  111.       bar(   ((xqq+zqq)*xcs)*zoommode+1,(yqq*ycs)*zoommode+1,(((xqq+zqq)*xcs)+xcs-2)*zoommode,((yqq*ycs)+ycs-2)*zoommode )
  112.       end if
  113.     next
  114.   end sub
  115.  
  116. sub hexdumpplot(x,y,a$,i,p)
  117.   for e=0 to (len(a$)/2)-1:v=bytefromhexdump(a$,e)
  118.     for z=0 to 7:ik=p:z2=7-z
  119.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=i:end if
  120.       'ink(ik):dot(x+z,y+e):next:next
  121.       ink(ik):bar((x+z)*zoommode,(y+e)*zoommode,(x+z)*zoommode+1,(y+e)*zoommode+1):next:next
  122.  end sub
  123.  
  124. sub hexdumpplotctx(xt,yt,cht,i,p)
  125.   ch=cht:a$=z$[ch]:x=xt*8:y=yt*10
  126.   for e=0 to (len(a$)/2)-1:v=bytefromhexdump(a$,e)
  127.     for z=0 to 7:ik=p:z2=7-z  
  128.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=i:end if
  129.       'ink(ik):dot(x+z,y+e):next:next
  130.       ink(ik):bar((x+z)*zoommode,(y+e)*zoommode,(x+z)*zoommode+1,(y+e)*zoommode+1):next:next
  131.  end sub
  132.  
  133. sub hexdumpplotctxstg(xt,yt,cht,i,p)
  134.   ch=cht:x=xt*8:y=yt*10 '-:a$=z$[ch]
  135.   for e=0 to 9:v=setetg[ch*10+e]
  136.     for z=0 to 7:ik=i:z2=7-z  
  137.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=p:end if
  138.       ink(ik):bar((x+z)*zoommode,(y+e)*zoommode,(x+z)*zoommode+1,(y+e)*zoommode+1):next:next
  139.  end sub
  140.  
  141. sub hexdumpplotctxstgi(xt,yt,cht,i,p,iv)
  142.   ch=cht:x=xt*8:y=yt*10 '-:a$=z$[ch]
  143.   for e=0 to 9:v=setetg[ch*10+e]
  144.     if (iv mod 2)<>0 then:v=255-v:end if
  145.     for z=0 to 7:ik=i:z2=7-z  
  146.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=p:end if
  147.       ink(ik):bar((x+z)*zoommode,(y+e)*zoommode,(x+z)*zoommode+1,(y+e)*zoommode+1):next:next
  148.  end sub
  149.  
  150. sub printsblo(xlt,ylt,oft,a$)
  151.   xl=xlt:yl=ylt:alen=len(a$)
  152.   for iz=1 to alen
  153.     hx$=z$[ (asc(mid$(a$,iz,1))+oft)mod 256 ]
  154.     hexdumpplot(xl*8,yl*10,hx$,pen,paper):xl=xl+1
  155.     if xl>((displaywidth\8)-1) then:xl=0:yl=yl+1:end if:next
  156.   end sub
  157.  
  158. sub refreshchrpalette(ikt,ppt)
  159.   ik=ikt:pp=ppt
  160.   for y=0 to 7:for x=0 to 15:c=x+(y*16)
  161.     hexdumpplotctxstg(x+52,y+1,c,paleta$[ik mod 8],paleta$[8])
  162.     next:next
  163.   for y=10 to 15:for x=0 to 15:c=x+(y*16)
  164.     hexdumpplotctxstg(x+52,y-1,c,paleta$[ik mod 8],paleta$[8])
  165.     next:next
  166.   for y=16 to 23:for x=0 to 15:c=x+(y*16)
  167.     hexdumpplotctxstg(x+52,y-1,c,paleta$[ik mod 8],paleta$[pp mod 8])
  168.     next:next
  169.   for y=26 to 31:for x=0 to 15:c=x+(y*16)
  170.     hexdumpplotctxstg(x+52,y-3,c,paleta$[ik mod 8],paleta$[pp mod 8])
  171.     next:next
  172.   end sub
  173.  
  174. sub refreshdispedit()
  175.   pplast=0
  176.   for y=0 to 24:for x=0 to 39
  177.     if bitwiseand(mapat[x,y],128)<>0 then
  178.       pplast= (int(mapat[x,y]/16))mod 8  
  179.       end if
  180.     ivtx=0
  181.     if (bitwiseand(mapat[x,y],192))/64=1 then
  182.       ivtx=1
  183.       end if
  184.     'hexdumpplotctxstg(x+1,y+1,mapch[x,y]+(bitwiseand(mapat[x,y],128)*2),paleta$[ pplast   ],paleta$[mapat[x,y]mod 8 ])    
  185.     hexdumpplotctxstgi(x+1,y+1,mapch[x,y]+(bitwiseand(mapat[x,y],128)*2),paleta$[ pplast   ],paleta$[mapat[x,y]mod 8 ],ivtx)    
  186.     next:next
  187.   end sub
  188.  
  189. function posloc(pmou,poff,pws,pcsz,pzo):
  190.   return ( (pws*10)  + (int (( (pmou/pzo)-(poff*pcsz))/pcsz))  ) mod pws
  191.   end function
  192.  
  193. function posexs(pmou,poff,pws,pcsz,pzo):
  194.   vlou=1
  195.   if (pmou<((poff*pcsz)*pzo)) or (pmou>(((poff+pws)*pcsz))*pzo) then
  196.     vlou=0:end if
  197.   return vlou
  198.   end function
  199.  
  200. sub refreshikppcur()
  201.   ink(0x808080)
  202.   bar((43*8)*zoommode,(1*10)*zoommode,(51*8)*zoommode,(1*10+1)*zoommode)
  203.   bar((43*8)*zoommode,(1*10+8)*zoommode,(51*8)*zoommode,(1*10+9)*zoommode)
  204.   bar((43*8)*zoommode,(2*10)*zoommode,(51*8)*zoommode,(2*10+1)*zoommode)
  205.   bar((43*8)*zoommode,(2*10+8)*zoommode,(51*8)*zoommode,(2*10+9)*zoommode)
  206.   ink(0xC0C0C0)
  207.   bar((  (43+ikcur)  *8)*zoommode,(1*10)*zoommode,((44+ikcur)*8-1)*zoommode,(1*10+1)*zoommode)
  208.   bar((  (43+ikcur)  *8)*zoommode,(1*10+8)*zoommode,((44+ikcur)*8-1)*zoommode,(1*10+9)*zoommode)
  209.   bar((  (43+ppcur)  *8)*zoommode,(2*10)*zoommode,((44+ppcur)*8-1)*zoommode,(2*10+1)*zoommode)
  210.   bar((  (43+ppcur)  *8)*zoommode,(2*10+8)*zoommode,((44+ppcur)*8-1)*zoommode,(2*10+9)*zoommode)
  211.   end sub
  212.  
  213. sub refreshchcur(xmt,ymt)
  214.   ink(0x808080)
  215.   bar((51*8)*zoommode,(0*10)*zoommode,(69*8)*zoommode,(0*10+9)*zoommode)
  216.   bar((51*8)*zoommode,(29*10)*zoommode,(69*8)*zoommode,(29*10+9)*zoommode)
  217.   bar((51*8)*zoommode,(0*10)*zoommode,(51*8+7)*zoommode,(29*10+9)*zoommode)
  218.   bar((68*8)*zoommode,(0*10)*zoommode,(68*8+7)*zoommode,(29*10+9)*zoommode)
  219.   ink(0xC0C0C0)
  220.   bar((xmt*8)*zoommode,(0*10+8)*zoommode,(xmt*8+7)*zoommode,(0*10+9)*zoommode)
  221.   bar((xmt*8)*zoommode,(29*10+0)*zoommode,(xmt*8+7)*zoommode,(29*10+1)*zoommode)
  222.   bar((51*8+6)*zoommode,(ymt*10)*zoommode,(51*8+7)*zoommode,(ymt*10+9)*zoommode)
  223.   bar((68*8)*zoommode,(ymt*10)*zoommode,(68*8+1)*zoommode,(ymt*10+9)*zoommode)
  224.   end sub
  225.  
  226. '-------------------------------------------------------------------------------
  227.  
  228. for ee=0 to 511
  229.   for e=0 to (len(z$[ee])/2)-1:v=bytefromhexdump(z$[ee],e)
  230.     setetg[ee*10+e]=v
  231.     next
  232.   next
  233.  
  234. '-------------------------------------------------------------------------------
  235. '- opening display
  236.  
  237. xed=552:yed=280+20:wndwd=1
  238. setdisplay(xed*zoommode,(yed+(debug*20))*zoommode,32,wndwd):paper(paleta$[8]):ink(paleta$[0]):pen(paleta$[0]):cls
  239. setcaption("EF9345 display editor")
  240.  
  241. '- drawing stuff
  242.  
  243. for y=0 to 1:for c=0 to 15
  244.   paper(paleta$[c]):pen(paleta$[c]):ink(paleta$[c])
  245.   'printsblo(42+c,10+(y*1),0," ")
  246.   bar((336+8+c*8)*zoommode,(11+y*10)*zoommode,(344+8+c*8)*zoommode,(18+y*10)*zoommode)
  247.   next:next
  248.  
  249. '- draw zoomed setetg
  250. for y=0 to 9
  251.   'bindispzoom(43,8+y,0xFF,0xffffff,0x808080,8,8)
  252.   bindispzoom(43,8+y,setetg[chcur*10+y],0xffffff,0x808080,8,8)
  253.   next
  254.  
  255. refreshchrpalette(ikcur,ppcur)
  256.  
  257. for y=0 to 24:for x=0 to 39
  258.   chrd=rnd(128)+256:ikrd=int(rnd(79)/10):pprd=int(rnd(79)/10)
  259.   mapch[x,y]=chrd
  260.   mapat[x,y]=ikrd*16+pprd
  261.   next:next
  262.  
  263. refreshdispedit()
  264.  
  265. paper(paleta$[7]):pen(paleta$[0])
  266. printsblo(1,27,0,"open")
  267. printsblo(6,27,0,"save")
  268.  
  269. printsblo(44,15,0,"setet/g")
  270. printsblo(44,16,0,"copy to")
  271.  
  272. printsblo(42,25,0,"refresh")
  273.  
  274. printsblo(43,4,0,"x")
  275. printsblo(47,4,0,"x")
  276.  
  277. paper(0x808080):pen(paleta$[0])
  278. printsblo(44,4,0,"x2")
  279. printsblo(48,4,0,"y2")
  280.  
  281. paper(paleta$[ppcur]):pen(paleta$[ikcur])
  282.  
  283. 'bindispzoom(0,0,0xF1,0xFF0000,0x00FF00,8,8)
  284.  
  285. do
  286.   xmou=xmouse:ymou=ymouse
  287.   xmou2=int((xmou/zoommode)/8)
  288.   ymou2=int((ymou/zoommode)/10)
  289.   ymou3=int((ymou/zoommode)/8)
  290.  
  291.   '- debugging info
  292.   if debug=1 then:
  293.     paper(0x808080):pen(paleta$[0])
  294.     printsblo(1,28,0,right$("000"+str$(xmou2),3)  )
  295.     printsblo(1,29,0,right$("000"+str$(ymou2),3)  )
  296.     printsblo(6,28,0,right$("000"+str$(posloc(xmou,1,40,8,zoommode)),3)  )
  297.     printsblo(6,29,0,right$("000"+str$(posexs(xmou,1,40,8,zoommode)),3)  )
  298.     printsblo(10,28,0,right$("000"+str$(posloc(ymou,1,25,10,zoommode)),3)  )
  299.     printsblo(10,29,0,right$("000"+str$(posexs(ymou,1,25,10,zoommode)),3)  )
  300.     printsblo(16,28,0,right$("000"+str$(posloc(xmou,52,16,8,zoommode)),3)  )
  301.     printsblo(16,29,0,right$("000"+str$(posexs(xmou,52,16,8,zoommode)),3)  )
  302.     printsblo(20,28,0,right$("000"+str$(posloc(ymou,1,28,10,zoommode)),3)  )
  303.     printsblo(20,29,0,right$("000"+str$(posexs(ymou,1,28,10,zoommode)),3)  )
  304.     uuq1=posloc(ymou,1,32,10,zoommode)
  305.     uuq2=uuq1
  306.     if uuq1>7 then:uuq2=uuq2+2:end if
  307.     if uuq1>21 then:uuq2=uuq2+2:end if
  308.     printsblo(20,30,0,right$("000"+str$(uuq2),3) )
  309.     chq1=uuq2*16+posloc(xmou,52,16,8,zoommode)
  310.     printsblo(20,31,0,right$("000"+str$(chq1),3) )
  311.     printsblo(26,28,0,right$("000"+str$(posloc(xmou,43,8,8,zoommode)),3)  )
  312.     printsblo(26,29,0,right$("000"+str$(posexs(xmou,43,8,8,zoommode)),3)  )
  313.     printsblo(30,28,0,right$("000"+str$(posloc(ymou,8,10,8,zoommode)),3)  )
  314.     printsblo(30,29,0,right$("000"+str$(posexs(ymou,8,10,8,zoommode)),3)  )
  315.     end if
  316.   '------
  317.  
  318.   '- deprecated - remove soon
  319.   x=int(xmouse/(8*2)):y=int(ymouse/(10*2))
  320.  
  321.   if bmouse<>0 then:
  322.  
  323.   '- ink
  324.   if xmou2>=43 and xmou2<=50 and ymou2=1 then
  325.     ikcur=((xmou2-43)mod 8):refreshchrpalette(ikcur,ppcur)
  326.     'ink(paleta$[8]):box((8*2)*1,(10*2)*18,(8*2)*17,(10*2)*18+1):box((8*2)*1,(10*2)*18+(7*2),(8*2)*17,(10*2)*18+(7*2)+1)
  327.     'ink(paleta$[0]):box((8*2)*x,(10*2)*18,(8*2)*x+(7*2),(10*2)*18+1):box((8*2)*x,(10*2)*18+(7*2),(8*2)*x+(7*2),(10*2)*18+(7*2)+1)
  328.     refreshikppcur()
  329.     end if
  330.  
  331.   '- paper
  332.   if xmou2>=43 and xmou2<=50 and ymou2=2 then
  333.     ppcur=((xmou2-43)mod 8):refreshchrpalette(ikcur,ppcur)
  334.     refreshikppcur()
  335.     end if
  336.  
  337.   '- putchr
  338.   if  xmou2>=1 and xmou2<=40 and ymou2>=1 and ymou2<=25 then
  339.     if chcur<256 then
  340.       ppcur=mapat[xmou2-1,ymou2-1]mod 8
  341.     end if
  342.       'hexdumpplotctx(xmou2,ymou2,chcur,paleta$[ikcur],paleta$[ppcur])
  343.       hexdumpplotctxstg(xmou2,ymou2,chcur,paleta$[ikcur],paleta$[ppcur])
  344.     mapch[xmou2-1,ymou2-1]=chcur
  345.     mapat[xmou2-1,ymou2-1]=ikcur*16+ppcur
  346.     end if
  347.  
  348.   '- getchr
  349.   if xmou2>=52 and xmou2<=67 and ymou2>=1 and ymou2<=28 then
  350.     refreshchcur(xmou2,ymou2)
  351.     chcur=(((xmou2-52)+(ymou2-1)*16)mod 512)
  352.     if chcur>127 then:chcur=chcur+32:end if
  353.     if chcur>383 then:chcur=chcur+32:end if
  354.     for y=0 to 9
  355.       bindispzoom(43,8+y,setetg[chcur*10+y],0xffffff,0x808080,8,8)
  356.       next
  357.     end if
  358.  
  359.   '- refresh display
  360.   if xmou2>=42 and xmou2<=48 and ymou2=25 then
  361.    refreshdispedit()
  362.     end if
  363.  
  364.   'setet/seteg - important
  365.   if xmou2>=43 and xmou2<=52 and ymou3>=8 and ymou3<=18 and mbutprs=0 then
  366.     if (chcur>=160 and chcur<=255) or (chcur>=256+160 and chcur<=511) then:
  367.       setetg[chcur*10+(ymou3-8)]=bitwisexor(setetg[chcur*10+(ymou3-8)],2^(50-xmou2))
  368.       bindispzoom(43,8+(ymou3-8),setetg[chcur*10+(ymou3-8)],0xffffff,0x808080,8,8)
  369.       refreshchrpalette(ikcur,ppcur)
  370.       mbutprs=1
  371.       end if:end if
  372.  
  373.   '- open file
  374.   'if bmouse<>0 and x>=1 and x<=4 and y=27 then
  375.   if xmou2>=1 and xmou2<=4 and ymou2=27 then
  376.     shell("a=\"$(zenity --title \"open file...\" --file-selection ~/)\"; cp \"$a\" ./dummy.bin")
  377.     open "dummy.bin" for input as #1
  378.       for y=160 to 255:for x=0 to 9
  379.         setetg[y*10+x]=readbyte(1)
  380.         next:next
  381.       for y=160 to 255:for x=0 to 9
  382.         setetg[2560+y*10+x]=readbyte(1)
  383.         next:next
  384.       for y=0 to 24:for x=0 to 39
  385.         mapch[x,y]=readbyte(1)
  386.         mapat[x,y]=readbyte(1)
  387.         next:next
  388.       refreshdispedit()
  389.       refreshchrpalette(ikcur,ppcur)
  390.       refreshikppcur()
  391.       refreshchcur(60,1)  '-???? <-fix!!!!! :D
  392.       close #1
  393.     end if
  394.  
  395.   '- save file
  396.   'if bmouse<>0 and x>=6 and x<=9 and y=27 then
  397.   if xmou2>=6 and xmou2<=9 and ymou2=27 then
  398.     open "dummy.bin" for output as #1
  399.       for y=160 to 255:for x=0 to 9
  400.         writebyte(1,setetg[y*10+x])
  401.         next:next
  402.       for y=160 to 255:for x=0 to 9
  403.         writebyte(1,setetg[2560+y*10+x])
  404.         next:next
  405.       for y=0 to 24:for x=0 to 39
  406.         writebyte(1,mapch[x,y])
  407.         writebyte(1,bitwiseor(mapat[x,y], (int(mapch[x,y]/256))*128  )  )
  408.         next:next
  409.       close #1
  410.     shell("a=\"$(zenity --title \"save file...\" --save --confirm-overwrite --file-selection ./)\"; cp ./dummy.bin \"$a\"")
  411.     end if
  412.  
  413.   end if
  414.  
  415.   if bmouse=0 then:
  416.     mbutprs=0
  417.     end if
  418.  
  419.   waitvbl
  420.   loop
  421.  
  422. waitkey
  423.  
  424. '-------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement