Advertisement
Guest User

Vg5000DisplayEditorX2_201703241747.sdlbas

a guest
Mar 24th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SdlBasic 13.29 KB | None | 0 0
  1. chcur=65:ikcur=14:ppcur=1
  2.  
  3. dim paleta$[16]
  4. paleta$[00]="0x000000":paleta$[01]="0xFF0000":paleta$[02]="0x00FF00":paleta$[03]="0xFFFF00"
  5. paleta$[04]="0x0000FF":paleta$[05]="0xFF00FF":paleta$[06]="0x00FFFF":paleta$[07]="0xFFFFFF"
  6. paleta$[08]="0x808080":paleta$[09]="0x808080":paleta$[10]="0x808080":paleta$[11]="0x808080"
  7. paleta$[12]="0x808080":paleta$[13]="0x808080":paleta$[14]="0x808080":paleta$[15]="0x808080"
  8.  
  9. dim z$[512]:for i=0 to 511:z$[i]="55aa55aa55aa55aa55aa":next
  10. z$[0]="00000000000000000000":z$[1]="00000000000000000000":z$[2]="00000000000000000000":z$[3]="00000000000000000000"
  11. z$[4]="00000000000000000000":z$[5]="00000000000000000000":z$[6]="00000000000000000000":z$[7]="00000000000000000000"
  12. z$[8]="00000000000000000000":z$[9]="00000000000000000000":z$[10]="00000000000000000000":z$[11]="00000000000000000000"
  13. z$[12]="00000000000000000000":z$[13]="00000000000000000000":z$[14]="00000000000000000000":z$[15]="00000000000000000000"
  14. z$[16]="00000000000028000000":z$[17]="00102800301010380000":z$[18]="00081038447c40380000":z$[19]="00201800444444380000"
  15. z$[20]="00280030101010380000":z$[21]="00000038404040381020":z$[22]="0010280044444c340000":z$[23]="002010344c444c340000"
  16. z$[24]="001028344c444c340000":z$[25]="00201038447c40380000":z$[26]="00102800384444380000":z$[27]="00102838447c40380000"
  17. z$[28]="000814103810243c0000":z$[29]="0040c0404c5204081e00":z$[30]="00000000000000000000":z$[31]="00000000000000000000"
  18. z$[32]="00000000000000000000":z$[33]="00101010101000100000":z$[34]="00282828000000000000":z$[35]="0028287c287c28280000"
  19. z$[36]="00103850381454381000":z$[37]="0060640810204c0c0000":z$[38]="00205050205448340000":z$[39]="00101020000000000000"
  20. z$[40]="00081020202010080000":z$[41]="00201008080810200000":z$[42]="00105438103854100000":z$[43]="000010107c1010000000"
  21. z$[44]="00000000000020204000":z$[45]="00000000003c00000000":z$[46]="00000000000000200000":z$[47]="01020204081020204080"
  22. z$[48]="00102844444428100000":z$[49]="00103010101010100000":z$[50]="003844041820407c0000":z$[51]="007c0408180444380000"
  23. z$[52]="00081828487c08080000":z$[53]="007c4078040444380000":z$[54]="00182040784444380000":z$[55]="007c0408102020200000"
  24. z$[56]="00384444384444380000":z$[57]="003844443c0404380000":z$[58]="00000020000000200000":z$[59]="00000020000020204000"
  25. z$[60]="00040810201008040000":z$[61]="0000007c007c00000000":z$[62]="00402010081020400000":z$[63]="00384404081000100000"
  26. z$[64]="0038445c545c40380000":z$[65]="00384444447c44440000":z$[66]="00784444784444780000":z$[67]="00384440404044380000"
  27. z$[68]="00784444444444780000":z$[69]="007c40407040407c0000":z$[70]="007c4040704040400000":z$[71]="00384440404c443c0000"
  28. z$[72]="004444447c4444440000":z$[73]="00381010101010380000":z$[74]="001c0808080848300000":z$[75]="00444850605048440000"
  29. z$[76]="004040404040407c0000":z$[77]="00446c54444444440000":z$[78]="00444464544c44440000":z$[79]="00384444444444380000"
  30. z$[80]="00784444784040400000":z$[81]="00384444445448340000":z$[82]="00784444785048440000":z$[83]="00384440380444380000"
  31. z$[84]="007c1010101010100000":z$[85]="00444444444444380000":z$[86]="00444444282810100000":z$[87]="00444444545454280000"
  32. z$[88]="00444428102844440000":z$[89]="00444428101010100000":z$[90]="007c04081020407c0000":z$[91]="001c10101010101c0000"
  33. z$[92]="80404020100804040201":z$[93]="00380808080808380000":z$[94]="00103854101010101000":z$[95]="000000000000000000ff"
  34. z$[96]="00000000ff0000000000":z$[97]="000000344c444c340000":z$[98]="00404078444444780000":z$[99]="00000038404040380000"
  35. z$[100]="0004043c4444443c0000":z$[101]="00000038447c40380000":z$[102]="00182420702020200000":z$[103]="0000003c44443c042418"
  36. z$[104]="00404058644444440000":z$[105]="00100030101010380000":z$[106]="00080018080808084830":z$[107]="00202024283028240000"
  37. z$[108]="00301010101010380000":z$[109]="00000068545454540000":z$[110]="00000058644444440000":z$[111]="00000038444444380000"
  38. z$[112]="00000078444444784040":z$[113]="0000003c4444443c0404":z$[114]="00000058644040400000":z$[115]="00000038403804780000"
  39. z$[116]="00202038202020180000":z$[117]="0000004444444c340000":z$[118]="00000044442828100000":z$[119]="00000044445454280000"
  40. z$[120]="00000044281028440000":z$[121]="00000044444c34044438":z$[122]="0000007c0810207c0000":z$[123]="80808080808080808080"
  41. z$[124]="10101010101010101010":z$[125]="01010101010101010101":z$[126]="ff000000000000000000":z$[127]="ffffffffffffffffffff"
  42.  
  43. z$[128+128]="00000000000000000000":z$[129+128]="70700000000000000000":z$[130+128]="07070000000000000000":z$[131+128]="77770000000000000000"
  44. z$[132+128]="00000070707000000000":z$[133+128]="70700070707000000000":z$[134+128]="07070070707000000000":z$[135+128]="77770070707000000000"
  45. z$[136+128]="00000007070700000000":z$[137+128]="70700007070700000000":z$[138+128]="07070007070700000000":z$[139+128]="77770007070700000000"
  46. z$[140+128]="00000077777700000000":z$[141+128]="70700077777700000000":z$[142+128]="07070077777700000000":z$[143+128]="77770077777700000000"
  47. z$[144+128]="00000000000000707000":z$[145+128]="70700000000000707000":z$[146+128]="07070000000000707000":z$[147+128]="77770000000000707000"
  48. z$[148+128]="00000070707000707000":z$[149+128]="70700070707000707000":z$[150+128]="07070070707000707000":z$[151+128]="77770070707000707000"
  49. z$[152+128]="00000007070700707000":z$[153+128]="70700007070700707000":z$[154+128]="07070007070700707000":z$[155+128]="77770007070700707000"
  50. z$[156+128]="00000077777700707000":z$[157+128]="70700077777700707000":z$[158+128]="07070077777700707000":z$[159+128]="77770077777700707000"
  51. z$[160+128]="00000000000000070700":z$[161+128]="70700000000000070700":z$[162+128]="07070000000000070700":z$[163+128]="77770000000000070700"
  52. z$[164+128]="00000070707000070700":z$[165+128]="70700070707000070700":z$[166+128]="07070070707000070700":z$[167+128]="77770070707000070700"
  53. z$[168+128]="00000007070700070700":z$[169+128]="70700007070700070700":z$[170+128]="07070007070700070700":z$[171+128]="77770007070700070700"
  54. z$[172+128]="00000077777700070700":z$[173+128]="70700077777700070700":z$[174+128]="07070077777700070700":z$[175+128]="77770077777700070700"
  55. z$[176+128]="00000000000000777700":z$[177+128]="70700000000000777700":z$[178+128]="07070000000000777700":z$[179+128]="77770000000000777700"
  56. z$[180+128]="00000070707000777700":z$[181+128]="70700070707000777700":z$[182+128]="07070070707000777700":z$[183+128]="77770070707000777700"
  57. z$[184+128]="00000007070700777700":z$[185+128]="70700007070700777700":z$[186+128]="07070007070700777700":z$[187+128]="77770007070700777700"
  58. z$[188+128]="00000077777700777700":z$[189+128]="70700077777700777700":z$[190+128]="07070077777700777700":z$[191+128]="77770077777700777700"
  59. z$[192+128]="00000000000000000000":z$[193+128]="f0f0f000000000000000":z$[194+128]="0f0f0f00000000000000":z$[195+128]="ffffff00000000000000"
  60. z$[196+128]="000000f0f0f0f0000000":z$[197+128]="f0f0f0f0f0f0f0000000":z$[198+128]="0f0f0ff0f0f0f0000000":z$[199+128]="fffffff0f0f0f0000000"
  61. z$[200+128]="0000000f0f0f0f000000":z$[201+128]="f0f0f00f0f0f0f000000":z$[202+128]="0f0f0f0f0f0f0f000000":z$[203+128]="ffffff0f0f0f0f000000"
  62. z$[204+128]="000000ffffffff000000":z$[205+128]="f0f0f0ffffffff000000":z$[206+128]="0f0f0fffffffff000000":z$[207+128]="ffffffffffffff000000"
  63. z$[208+128]="00000000000000f0f0f0":z$[209+128]="f0f0f000000000f0f0f0":z$[210+128]="0f0f0f00000000f0f0f0":z$[211+128]="ffffff00000000f0f0f0"
  64. z$[212+128]="000000f0f0f0f0f0f0f0":z$[213+128]="f0f0f0f0f0f0f0f0f0f0":z$[214+128]="0f0f0ff0f0f0f0f0f0f0":z$[215+128]="fffffff0f0f0f0f0f0f0"
  65. z$[216+128]="0000000f0f0f0ff0f0f0":z$[217+128]="f0f0f00f0f0f0ff0f0f0":z$[218+128]="0f0f0f0f0f0f0ff0f0f0":z$[219+128]="ffffff0f0f0f0ff0f0f0"
  66. z$[220+128]="000000fffffffff0f0f0":z$[221+128]="f0f0f0fffffffff0f0f0":z$[222+128]="0f0f0ffffffffff0f0f0":z$[223+128]="fffffffffffffff0f0f0"
  67. z$[224+128]="000000000000000f0f0f":z$[225+128]="f0f0f0000000000f0f0f":z$[226+128]="0f0f0f000000000f0f0f":z$[227+128]="ffffff000000000f0f0f"
  68. z$[228+128]="000000f0f0f0f00f0f0f":z$[229+128]="f0f0f0f0f0f0f00f0f0f":z$[230+128]="0f0f0ff0f0f0f00f0f0f":z$[231+128]="fffffff0f0f0f00f0f0f"
  69. z$[232+128]="0000000f0f0f0f0f0f0f":z$[233+128]="f0f0f00f0f0f0f0f0f0f":z$[234+128]="0f0f0f0f0f0f0f0f0f0f":z$[235+128]="ffffff0f0f0f0f0f0f0f"
  70. z$[236+128]="000000ffffffff0f0f0f":z$[237+128]="f0f0f0ffffffff0f0f0f":z$[238+128]="0f0f0fffffffff0f0f0f":z$[239+128]="ffffffffffffff0f0f0f"
  71. z$[240+128]="00000000000000ffffff":z$[241+128]="f0f0f000000000ffffff":z$[242+128]="0f0f0f00000000ffffff":z$[243+128]="ffffff00000000ffffff"
  72. z$[244+128]="000000f0f0f0f0ffffff":z$[245+128]="f0f0f0f0f0f0f0ffffff":z$[246+128]="0f0f0ff0f0f0f0ffffff":z$[247+128]="fffffff0f0f0f0ffffff"
  73. z$[248+128]="0000000f0f0f0fffffff":z$[249+128]="f0f0f00f0f0f0fffffff":z$[250+128]="0f0f0f0f0f0f0fffffff":z$[251+128]="ffffff0f0f0f0fffffff"
  74. z$[252+128]="000000ffffffffffffff":z$[253+128]="f0f0f0ffffffffffffff":z$[254+128]="0f0f0fffffffffffffff":z$[255+128]="ffffffffffffffffffff"
  75.  
  76. dim mapch[40,40]:dim mapat[40,40]
  77.  
  78. function hexvl(a$)
  79.    e=asc(ucase$(a$))
  80.    hexvl=abs(((e>=48 and e<=57)*(e-48))+((e>=65 and e<=70)*(e-55)))
  81.  end function
  82. function bytefromhexdump(a$,byteadr)
  83.    i=(byteadr*2)+1:m1$=mid$(a$,i,1):m2$=mid$(a$,i+1,1)
  84.    tmpr=(hexvl(m1$)*16)+hexvl(m2$):bytefromhexdump=tmpr
  85.  end function
  86. sub HexdumpPlot(x,y,a$,i,p)
  87.   for e=0 to (len(a$)/2)-1:v=bytefromhexdump(a$,e)
  88.     for z=0 to 7:ik=p:z2=7-z  
  89.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=i:end if
  90.       'ink(ik):dot(x+z,y+e):next:next
  91.       ink(ik):bar((x+z)*2,(y+e)*2,(x+z)*2+1,(y+e)*2+1):next:next
  92.  end sub
  93. sub hexdumpplotctx(xt,yt,cht,i,p)
  94.   ch=cht:a$=z$[ch]:x=xt*8:y=yt*10
  95.   for e=0 to (len(a$)/2)-1:v=bytefromhexdump(a$,e)
  96.     for z=0 to 7:ik=p:z2=7-z  
  97.       if (((int(v/(2^z2)))mod 2) and (2^z2)) then:ik=i:end if
  98.       'ink(ik):dot(x+z,y+e):next:next
  99.       ink(ik):bar((x+z)*2,(y+e)*2,(x+z)*2+1,(y+e)*2+1):next:next
  100.  
  101.  end sub
  102.  
  103. sub printsblo(xlt,ylt,oft,a$)
  104.   xl=xlt:yl=ylt:alen=len(a$)
  105.   for iz=1 to alen
  106.     hx$=z$[ (asc(mid$(a$,iz,1))+oft)mod 256 ]
  107.     HexdumpPlot(xl*8,yl*10,hx$,pen,paper):xl=xl+1
  108.     if xl>((displaywidth\8)-1) then:xl=0:yl=yl+1:end if:next
  109.   end sub
  110.  
  111. sub filchchc(ikt,ppt)
  112.   ik=ikt:pp=ppt
  113.   for y=0 to 13:for x=0 to 15:c=x+(y*16)
  114.     hexdumpplotctx(x+51,y+1,c,paleta$[ik mod 8],paleta$[8])
  115.     next:next
  116.   for y=16 to 29:for x=0 to 15:c=x+(y*16)
  117.     hexdumpplotctx(x+51,y-1,c,paleta$[ik mod 8],paleta$[pp mod 8])
  118.     next:next
  119.   end sub
  120.  
  121. xed=320+128+96:yed=270+30:wndwd=1:zoommode=2
  122. setdisplay(xed*zoommode,yed*zoommode,32,wndwd):paper(paleta$[8]):ink(paleta$[0]):pen(paleta$[0]):cls
  123. setcaption("Philips VG5000 display editor")
  124.  
  125. for y=0 to 1:for c=0 to 15
  126.   paper(paleta$[c]):pen(paleta$[c])
  127.   printsblo(42+c,10+(y*1),0," ")
  128.   next:next
  129.  
  130. for y=0 to 9:for x=0 to 7
  131.   ink(0xFFFFFF)
  132.   bar((336+x*8)*zoommode,(10+y*8)*zoommode,(342+x*8)*zoommode,(16+y*8)*zoommode)
  133.   next:next
  134.  
  135.  
  136. filchchc(ikcur,ppcur)
  137.  
  138. for y=0 to 24:for x=0 to 39
  139.   chrd=rnd(256):ikrd=int(rnd(79)/10):pprd=int(rnd(79)/10)
  140.   paper(paleta$[pprd]):pen(paleta$[ikrd])
  141.   hexdumpplotctx(x+1,y+1,chrd,pen,paper)
  142.   mapch[x,y]=chrd
  143.   mapat[x,y]=ikrd*16+pprd
  144.   next:next
  145.  
  146. paper(paleta$[7]):pen(paleta$[0])
  147. printsblo(1,27,0,"open"):printsblo(6,27,0,"save")
  148.  
  149. paper(paleta$[ppcur]):pen(paleta$[ikcur])
  150.  
  151. while 0=0
  152.   x=int(xmouse/(8*2)):y=int(ymouse/(10*2))
  153.  
  154.   if bmouse<>0 and x>17 and x<58 and y>0 and y<26 then
  155.     if chcur<256 then
  156.       ppcur=mapat[x-19,y-1]mod 8
  157.     end if
  158.       hexdumpplotctx(x,y,chcur,paleta$[ikcur],paleta$[ppcur])
  159.  
  160.     mapch[x-18,y-1]=chcur
  161.     mapat[x-18,y-1]=ikcur*16+ppcur
  162.     end if
  163.  
  164.   if bmouse<>0 and x>0 and x<17 and y>0 and y<17 then
  165.     chcur=(((x-1)+(y-1)*16)mod 256)
  166.     end if
  167.  
  168.   if bmouse<>0 and x>0 and x<17 and y=18 then
  169.     ikcur=((x-1)mod 16):filchchc(ikcur,ppcur)
  170.     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)
  171.     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)
  172.     end if
  173.  
  174.   if bmouse<>0 and x>0 and x<17 and y=19 then
  175.     ppcur=((x-1)mod 16):filchchc(ikcur,ppcur)
  176.     ink(paleta$[8]):line(8*1,10*19,8*17,10*19):line(8*1,10*19+7,8*17,10*19+7)
  177.     ink(paleta$[0]):line(8*x,10*19,8*x+7,10*19):line(8*x,10*19+7,8*x+7,10*19+7)
  178.     end if
  179.  
  180.   '- open file
  181.   if bmouse<>0 and x>=1 and x<=4 and y=24 then
  182.     shell("a=\"$(zenity --title \"open file...\" --file-selection ~/)\"; cp \"$a\" ./dummy.bin")
  183.     open "dummy.bin" for input as #1
  184.       for y=0 to 24:for x=0 to 39
  185.         mapch[x,y]=readbyte(1)
  186.         next:next
  187.       for y=0 to 63:dummy=readbyte(1):next
  188.       for y=0 to 24:for x=0 to 39
  189.         mapat[x,y]=readbyte(1)
  190.         hexdumpplotctx(x+18,y+1,mapch[x,y],paleta$[int(mapat[x,y]/16)],paleta$[mapat[x,y]mod 16])
  191.         next:next
  192.       close #1
  193.     end if
  194.  
  195.   '- save file
  196.   if bmouse<>0 and x>=6 and x<=9 and y=24 then
  197.     open "dummy.bin" for output as #1
  198.       for y=0 to 24:for x=0 to 39
  199.         writebyte(1,mapch[x,y])
  200.         next:next
  201.       for y=0 to 63:writebyte(1,0):next
  202.       for y=0 to 24:for x=0 to 39
  203.         writebyte(1,mapat[x,y])
  204.         next:next
  205.       close #1
  206.     shell("a=\"$(zenity --title \"save file...\" --save --confirm-overwrite --file-selection ./)\"; cp ./dummy.bin \"$a\"")
  207.     'shell("a=\"$(zenity --title \"save file...\" --save --confirm-overwrite --file-selection ./*.bin)\"; cp ./dummy.bin \"$a\"")
  208.     'shell("a=\"$(zenity --title \"save file...\" --save --confirm-overwrite --filename=\"./*.bin\")\"; cp ./dummy.bin \"$a\"")
  209.     end if
  210.  
  211.  
  212.  
  213.   waitvbl
  214.   wend
  215.  
  216. waitkey
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement