Advertisement
Guest User

Untitled

a guest
May 10th, 2014
496
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. dbg = false -- print messages to window
  3.  
  4. bank = memory.readbyte(0xA24E) -- store the current ROM bank
  5. start_bank = nil
  6. return_addr = nil
  7.  
  8. autofire = false -- for firing pause glitch
  9. unpause = 0
  10.  
  11. -- Returns HEX representation of num padded with zeros
  12. function hex(num,dig)
  13. local dig = dig or 4 --assume 4 digits if not given
  14. local hexstr = '0123456789ABCDEF'
  15. local s = ''
  16. --while num > 0 do
  17. while dig > 0 do -- use digit instead so there is padding
  18. local mod = math.fmod(num, 16)
  19. s = string.sub(hexstr, mod+1, mod+1) .. s
  20. num = math.floor(num / 16)
  21. dig = dig - 1
  22. end
  23. if s == '' then s = '0' end
  24. return s
  25. end
  26.  
  27. -- this function will be called everytime vblank interrupt occurs
  28. -- since glitch depends on vblank, use this to investigate when it occurs
  29. -- note: each "frame" represents a vblank period
  30. function vblank()
  31. start_bank = bank
  32. return_addr = memory.readwordunsigned(memory.getregister("sp")) -- return addr is first val on stack
  33. if dbg then
  34. vba.print("== VBLANK ==")
  35. vba.print("start bank: "..bank)
  36. vba.print("return addr: "..hex(return_addr))
  37. end
  38. end
  39.  
  40. --end of vblank, called when vblank is about to end
  41. function vblank_done()
  42. if dbg then
  43. vba.print("end bank: "..bank)
  44. end
  45. -- addrs >= 4000 are in the switchable ROM bank
  46. --so if starting bank is dif than ending bank, glitch will occur
  47. if return_addr >= 0x4000 and start_bank ~= bank then
  48. vba.print("*** GLITCH - "..hex(return_addr).." ***")
  49. gui.text(2,2,"glitch! return addr: "..hex(return_addr),"green")
  50. vba.pause()
  51. end
  52. end
  53.  
  54. memory.registerexec(0x0154, vblank)
  55. memory.registerexec(0x01E4, vblank_done)
  56.  
  57. memory.registerexec(0xa201, function ()
  58. vba.print("A201 executed !!")
  59. gui.text(2,12,"!! A201 executed !!","orange")
  60. --print_a20x()
  61. vba.pause()
  62. end)
  63.  
  64. -- use this to keep track of the current ROM bank
  65. -- because there is no easy way to read it
  66. -- (a24e is sometimes set when 2100 is, but not sure if it always is)
  67. memory.registerwrite(0x2100, function ()
  68. --vba.print("bank changed to "..reg("a"))
  69. bank = memory.getregister("a")
  70. end)
  71.  
  72.  
  73.  
  74.  
  75. while true do
  76. keys = input.get()
  77. autofire = true--keys.G -- autofire if G held
  78.  
  79. if unpause > 0 and memory.readbyte(0xFF9B) == 8 then -- game is paused and needs to be unpaused
  80. if unpause == 1 then
  81. buttons = joypad.get(1)
  82. buttons["start"] = 1
  83. --joypad.set(1,buttons) -- unpause game
  84. end
  85. unpause = unpause - 1 -- only send one press, then release button to unpause
  86. end
  87.  
  88. if autofire and vba.lagged() then
  89. -- vba.pause()
  90. buttons = joypad.get(1)
  91. buttons["start"] = 1
  92. --y = 10
  93. --for k,v in pairs(buttons) do
  94. -- gui.text(2,y,k..": "..tostring(v))
  95. -- y = y + 7
  96. --end
  97. --joypad.set(1,buttons)
  98. unpause = 2
  99. gui.text(155,128,"G","yellow")
  100. end
  101.  
  102. -- OWN:
  103.  
  104.  
  105. gui.opacity(0.4)
  106. gui.drawbox(4,8,250,15, "black")
  107. gui.drawbox(76,18,250,25, "black")
  108. gui.drawbox(116,28,250,74, "black")
  109. gui.drawbox(49,18,70,25, "black")
  110. gui.opacity(0.62)
  111. gui.text(6,8, hex(memory.readbyte(0xA201),2))
  112. gui.text(18,8, hex(memory.readbyte(0xA202),2))
  113. gui.text(30,8, hex(memory.readbyte(0xA203),2))
  114. gui.text(42,8, hex(memory.readbyte(0xA204),2))
  115. gui.text(54,8, hex(memory.readbyte(0xA205),2))
  116. gui.text(66,8, hex(memory.readbyte(0xA206),2))
  117. gui.text(78,8, hex(memory.readbyte(0xA207),2))
  118. gui.text(90,8, hex(memory.readbyte(0xA208),2))
  119. gui.text(102,8, hex(memory.readbyte(0xA209),2))
  120. gui.text(114,8, hex(memory.readbyte(0xA20A),2))
  121. gui.text(126,8, hex(memory.readbyte(0xA20B),2))
  122. gui.text(138,8, hex(memory.readbyte(0xA20C),2))
  123. gui.text(150,8, hex(memory.readbyte(0xA20D),2))
  124.  
  125. gui.text(78,18, hex(memory.readbyte(0xA225),2))
  126. gui.text(90,18, hex(memory.readbyte(0xA226),2))
  127. gui.text(102,18, hex(memory.readbyte(0xA227),2))
  128. gui.text(114,18, hex(memory.readbyte(0xA228),2))
  129. gui.text(126,18, hex(memory.readbyte(0xA229),2))
  130. gui.text(138,18, hex(memory.readbyte(0xA22A),2))
  131. gui.text(150,18, hex(memory.readbyte(0xA22B),2))
  132.  
  133. gui.text(119,28, "A ".. hex(memory.readwordunsigned(memory.getregister("af"))) .." F" )
  134. gui.text(119,36, "B ".. hex(memory.readwordunsigned(memory.getregister("bc"))) .." C")
  135. gui.text(119,44, "D ".. hex(memory.readwordunsigned(memory.getregister("de"))) .." E")
  136. gui.text(119,52, "H ".. hex(memory.readwordunsigned(memory.getregister("hl"))) .." L")
  137. gui.text(119,60, "SP ".. hex(memory.readwordunsigned(memory.getregister("sp"))))
  138. gui.text(119,68, "PC ".. hex(memory.readwordunsigned(memory.getregister("pc"))))
  139.  
  140. if memory.readbyte(0xA2D5) ~= 0 then gui.text(50,18, hex(memory.readbyte(0xA2D5),2),"green")
  141. else gui.text(50,18, hex(memory.readbyte(0xA2D5),2)) end
  142. gui.text(62,18, hex(memory.readbyte(0xFF9B),2))
  143. if hex(memory.readbyte(0xFF9B),2) == "12" then gui.text(62,18, hex(memory.readbyte(0xFF9B),2),"green") end
  144. if hex(memory.readbyte(0xFF9B),2)== "13" then gui.text(62,18, hex(memory.readbyte(0xFF9B),2), "green") end
  145. if hex(memory.readbyte(0xFF9B),2)== "23" then gui.text(62,18, hex(memory.readbyte(0xFF9B),2), "green") end
  146. gui.opacity(1.0)
  147.  
  148. memory.registerexec(0xa201, function ()
  149. gui.drawbox(4,8,15,15,"yellow")
  150. if hex(memory.readbyte(0xa201),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  151. if hex(memory.readbyte(0xa201),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  152. if hex(memory.readbyte(0xa201),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  153. if hex(memory.readbyte(0xa201),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  154. if hex(memory.readbyte(0xa201),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  155. if hex(memory.readbyte(0xa201),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  156. if hex(memory.readbyte(0xa201),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  157. if hex(memory.readbyte(0xa201),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  158. if hex(memory.readbyte(0xa201),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  159. if hex(memory.readbyte(0xa201),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  160. if hex(memory.readbyte(0xa201),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  161. if hex(memory.readbyte(0xa201),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  162. end)
  163.  
  164. memory.registerexec(0xa202, function ()
  165. gui.drawbox(16,8,27,15,"yellow")
  166. if hex(memory.readbyte(0xa202),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  167. if hex(memory.readbyte(0xa202),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  168. if hex(memory.readbyte(0xa202),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  169. if hex(memory.readbyte(0xa202),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  170. if hex(memory.readbyte(0xa202),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  171. if hex(memory.readbyte(0xa202),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  172. if hex(memory.readbyte(0xa202),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  173. if hex(memory.readbyte(0xa202),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  174. if hex(memory.readbyte(0xa202),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  175. if hex(memory.readbyte(0xa202),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  176. if hex(memory.readbyte(0xa202),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  177. if hex(memory.readbyte(0xa202),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  178. end)
  179.  
  180. memory.registerexec(0xa203, function ()
  181. gui.drawbox(28,8,39,15,"yellow")
  182. if hex(memory.readbyte(0xa203),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  183. if hex(memory.readbyte(0xa203),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  184. if hex(memory.readbyte(0xa203),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  185. if hex(memory.readbyte(0xa203),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  186. if hex(memory.readbyte(0xa203),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  187. if hex(memory.readbyte(0xa203),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  188. if hex(memory.readbyte(0xa203),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  189. if hex(memory.readbyte(0xa203),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  190. if hex(memory.readbyte(0xa203),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  191. if hex(memory.readbyte(0xa203),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  192. if hex(memory.readbyte(0xa203),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  193. if hex(memory.readbyte(0xa203),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  194. end)
  195.  
  196. memory.registerexec(0xa204, function ()
  197. gui.drawbox(40,8,51,15,"yellow")
  198. if hex(memory.readbyte(0xa204),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  199. if hex(memory.readbyte(0xa204),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  200. if hex(memory.readbyte(0xa204),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  201. if hex(memory.readbyte(0xa204),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  202. if hex(memory.readbyte(0xa204),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  203. if hex(memory.readbyte(0xa204),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  204. if hex(memory.readbyte(0xa204),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  205. if hex(memory.readbyte(0xa204),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  206. if hex(memory.readbyte(0xa204),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  207. if hex(memory.readbyte(0xa204),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  208. if hex(memory.readbyte(0xa204),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  209. if hex(memory.readbyte(0xa204),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  210. end)
  211.  
  212. memory.registerexec(0xa205, function ()
  213. gui.drawbox(52,8,63,15,"yellow")
  214. if hex(memory.readbyte(0xa205),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  215. if hex(memory.readbyte(0xa205),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  216. if hex(memory.readbyte(0xa205),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  217. if hex(memory.readbyte(0xa205),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  218. if hex(memory.readbyte(0xa205),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  219. if hex(memory.readbyte(0xa205),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  220. if hex(memory.readbyte(0xa205),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  221. if hex(memory.readbyte(0xa205),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  222. if hex(memory.readbyte(0xa205),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  223. if hex(memory.readbyte(0xa205),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  224. if hex(memory.readbyte(0xa205),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  225. if hex(memory.readbyte(0xa205),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  226. end)
  227.  
  228. memory.registerexec(0xa206, function ()
  229. gui.drawbox(64,8,75,15,"yellow")
  230. if hex(memory.readbyte(0xa206),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  231. if hex(memory.readbyte(0xa206),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  232. if hex(memory.readbyte(0xa206),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  233. if hex(memory.readbyte(0xa206),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  234. if hex(memory.readbyte(0xa206),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  235. if hex(memory.readbyte(0xa206),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  236. if hex(memory.readbyte(0xa206),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  237. if hex(memory.readbyte(0xa206),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  238. if hex(memory.readbyte(0xa206),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  239. if hex(memory.readbyte(0xa206),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  240. if hex(memory.readbyte(0xa206),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  241. if hex(memory.readbyte(0xa206),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  242. end)
  243.  
  244. memory.registerexec(0xa207, function ()
  245. gui.drawbox(76,8,87,15,"yellow")
  246. if hex(memory.readbyte(0xa207),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  247. if hex(memory.readbyte(0xa207),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  248. if hex(memory.readbyte(0xa207),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  249. if hex(memory.readbyte(0xa207),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  250. if hex(memory.readbyte(0xa207),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  251. if hex(memory.readbyte(0xa207),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  252. if hex(memory.readbyte(0xa207),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  253. if hex(memory.readbyte(0xa207),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  254. if hex(memory.readbyte(0xa207),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  255. if hex(memory.readbyte(0xa207),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  256. if hex(memory.readbyte(0xa207),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  257. if hex(memory.readbyte(0xa207),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  258. end)
  259.  
  260. memory.registerexec(0xa208, function ()
  261. gui.drawbox(88,8,99,15,"yellow")
  262. if hex(memory.readbyte(0xa208),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  263. if hex(memory.readbyte(0xa208),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  264. if hex(memory.readbyte(0xa208),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  265. if hex(memory.readbyte(0xa208),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  266. if hex(memory.readbyte(0xa208),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  267. if hex(memory.readbyte(0xa208),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  268. if hex(memory.readbyte(0xa208),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  269. if hex(memory.readbyte(0xa208),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  270. if hex(memory.readbyte(0xa208),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  271. if hex(memory.readbyte(0xa208),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  272. if hex(memory.readbyte(0xa208),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  273. if hex(memory.readbyte(0xa208),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  274. end)
  275.  
  276. memory.registerexec(0xa209, function ()
  277. gui.drawbox(100,8,111,15,"yellow")
  278. if hex(memory.readbyte(0xa209),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  279. if hex(memory.readbyte(0xa209),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  280. if hex(memory.readbyte(0xa209),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  281. if hex(memory.readbyte(0xa209),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  282. if hex(memory.readbyte(0xa209),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  283. if hex(memory.readbyte(0xa209),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  284. if hex(memory.readbyte(0xa209),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  285. if hex(memory.readbyte(0xa209),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  286. if hex(memory.readbyte(0xa209),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  287. if hex(memory.readbyte(0xa209),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  288. if hex(memory.readbyte(0xa209),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  289. if hex(memory.readbyte(0xa209),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  290. end)
  291.  
  292. memory.registerexec(0xa20a, function ()
  293. gui.drawbox(112,8,123,15,"yellow")
  294. if hex(memory.readbyte(0xa20a),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  295. if hex(memory.readbyte(0xa20a),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  296. if hex(memory.readbyte(0xa20a),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  297. if hex(memory.readbyte(0xa20a),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  298. if hex(memory.readbyte(0xa20a),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  299. if hex(memory.readbyte(0xa20a),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  300. if hex(memory.readbyte(0xa20a),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  301. if hex(memory.readbyte(0xa20a),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  302. if hex(memory.readbyte(0xa20a),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  303. if hex(memory.readbyte(0xa20a),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  304. if hex(memory.readbyte(0xa20a),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  305. if hex(memory.readbyte(0xa20a),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  306. end)
  307.  
  308. memory.registerexec(0xa20b, function ()
  309. gui.drawbox(124,8,135,15,"yellow")
  310. if hex(memory.readbyte(0xa20b),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  311. if hex(memory.readbyte(0xa20b),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  312. if hex(memory.readbyte(0xa20b),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  313. if hex(memory.readbyte(0xa20b),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  314. if hex(memory.readbyte(0xa20b),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  315. if hex(memory.readbyte(0xa20b),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  316. if hex(memory.readbyte(0xa20b),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  317. if hex(memory.readbyte(0xa20b),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  318. if hex(memory.readbyte(0xa20b),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  319. if hex(memory.readbyte(0xa20b),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  320. if hex(memory.readbyte(0xa20b),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  321. if hex(memory.readbyte(0xa20b),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  322. end)
  323.  
  324. memory.registerexec(0xa20c, function ()
  325. gui.drawbox(136,8,147,15,"yellow")
  326. if hex(memory.readbyte(0xa20c),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  327. if hex(memory.readbyte(0xa20c),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  328. if hex(memory.readbyte(0xa20c),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  329. if hex(memory.readbyte(0xa20c),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  330. if hex(memory.readbyte(0xa20c),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  331. if hex(memory.readbyte(0xa20c),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  332. if hex(memory.readbyte(0xa20c),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  333. if hex(memory.readbyte(0xa20c),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  334. if hex(memory.readbyte(0xa20c),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  335. if hex(memory.readbyte(0xa20c),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  336. if hex(memory.readbyte(0xa20c),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  337. if hex(memory.readbyte(0xa20c),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  338. end)
  339.  
  340. memory.registerexec(0xa20d, function ()
  341. gui.drawbox(148,8,159,15,"yellow")
  342. if hex(memory.readbyte(0xa20d),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  343. if hex(memory.readbyte(0xa20d),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  344. if hex(memory.readbyte(0xa20d),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  345. if hex(memory.readbyte(0xa20d),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  346. if hex(memory.readbyte(0xa20d),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  347. if hex(memory.readbyte(0xa20d),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  348. if hex(memory.readbyte(0xa20d),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  349. if hex(memory.readbyte(0xa20d),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  350. if hex(memory.readbyte(0xa20d),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  351. if hex(memory.readbyte(0xa20d),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  352. if hex(memory.readbyte(0xa20d),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  353. if hex(memory.readbyte(0xa20d),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  354. end)
  355.  
  356. memory.registerexec(0xA225, function ()
  357. gui.drawbox(76,18,87,25, "yellow")
  358. if hex(memory.readbyte(0xA225),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  359. if hex(memory.readbyte(0xA225),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  360. if hex(memory.readbyte(0xA225),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  361. if hex(memory.readbyte(0xA225),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  362. if hex(memory.readbyte(0xA225),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  363. if hex(memory.readbyte(0xA225),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  364. if hex(memory.readbyte(0xA225),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  365. if hex(memory.readbyte(0xA225),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  366. if hex(memory.readbyte(0xA225),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  367. if hex(memory.readbyte(0xA225),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  368. if hex(memory.readbyte(0xA225),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  369. if hex(memory.readbyte(0xA225),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  370. end)
  371.  
  372. memory.registerexec(0xA226, function ()
  373. gui.drawbox(88,18,99,25, "yellow")
  374. if hex(memory.readbyte(0xA226),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  375. if hex(memory.readbyte(0xA226),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  376. if hex(memory.readbyte(0xA226),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  377. if hex(memory.readbyte(0xA226),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  378. if hex(memory.readbyte(0xA226),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  379. if hex(memory.readbyte(0xA226),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  380. if hex(memory.readbyte(0xA226),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  381. if hex(memory.readbyte(0xA226),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  382. if hex(memory.readbyte(0xA226),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  383. if hex(memory.readbyte(0xA226),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  384. if hex(memory.readbyte(0xA226),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  385. if hex(memory.readbyte(0xA226),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  386. end)
  387.  
  388.  
  389. memory.registerexec(0xA227, function ()
  390. gui.drawbox(100,18,111,25, "yellow")
  391. if hex(memory.readbyte(0xA227),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  392. if hex(memory.readbyte(0xA227),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  393. if hex(memory.readbyte(0xA227),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  394. if hex(memory.readbyte(0xA227),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  395. if hex(memory.readbyte(0xA227),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  396. if hex(memory.readbyte(0xA227),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  397. if hex(memory.readbyte(0xA227),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  398. if hex(memory.readbyte(0xA227),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  399. if hex(memory.readbyte(0xA227),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  400. if hex(memory.readbyte(0xA227),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  401. if hex(memory.readbyte(0xA227),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  402. if hex(memory.readbyte(0xA227),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  403. end)
  404.  
  405.  
  406. memory.registerexec(0xA228, function ()
  407. gui.drawbox(112,18,123,25, "yellow")
  408. if hex(memory.readbyte(0xA228),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  409. if hex(memory.readbyte(0xA228),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  410. if hex(memory.readbyte(0xA228),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  411. if hex(memory.readbyte(0xA228),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  412. if hex(memory.readbyte(0xA228),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  413. if hex(memory.readbyte(0xA228),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  414. if hex(memory.readbyte(0xA228),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  415. if hex(memory.readbyte(0xA228),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  416. if hex(memory.readbyte(0xA228),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  417. if hex(memory.readbyte(0xA228),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  418. if hex(memory.readbyte(0xA228),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  419. if hex(memory.readbyte(0xA228),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  420. end)
  421.  
  422.  
  423. memory.registerexec(0xA229, function ()
  424. gui.drawbox(124,18,135,25, "yellow")
  425. if hex(memory.readbyte(0xA229),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  426. if hex(memory.readbyte(0xA229),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  427. if hex(memory.readbyte(0xA229),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  428. if hex(memory.readbyte(0xA229),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  429. if hex(memory.readbyte(0xA229),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  430. if hex(memory.readbyte(0xA229),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  431. if hex(memory.readbyte(0xA229),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  432. if hex(memory.readbyte(0xA229),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  433. if hex(memory.readbyte(0xA229),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  434. if hex(memory.readbyte(0xA229),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  435. if hex(memory.readbyte(0xA229),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  436. if hex(memory.readbyte(0xA229),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  437. end)
  438.  
  439.  
  440. memory.registerexec(0xA22A, function ()
  441. gui.drawbox(136,18,147,25, "yellow")
  442. if hex(memory.readbyte(0xA22A),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  443. if hex(memory.readbyte(0xA22A),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  444. if hex(memory.readbyte(0xA22A),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  445. if hex(memory.readbyte(0xA22A),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  446. if hex(memory.readbyte(0xA22A),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  447. if hex(memory.readbyte(0xA22A),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  448. if hex(memory.readbyte(0xA22A),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  449. if hex(memory.readbyte(0xA22A),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  450. if hex(memory.readbyte(0xA22A),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  451. if hex(memory.readbyte(0xA22A),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  452. if hex(memory.readbyte(0xA22A),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  453. if hex(memory.readbyte(0xA22A),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  454. end)
  455.  
  456. memory.registerexec(0xA22B, function ()
  457. gui.drawbox(148,18,159,25, "yellow")
  458. if hex(memory.readbyte(0xA22B),2) == "10" then gui.drawbox(52,8,63,15,"orange") end
  459. if hex(memory.readbyte(0xA22B),2) == "D3" then gui.drawbox(52,8,63,15,"red") end
  460. if hex(memory.readbyte(0xA22B),2) == "DB" then gui.drawbox(52,8,63,15,"red") end
  461. if hex(memory.readbyte(0xA22B),2) == "DD" then gui.drawbox(52,8,63,15,"red") end
  462. if hex(memory.readbyte(0xA22B),2) == "E3" then gui.drawbox(52,8,63,15,"red") end
  463. if hex(memory.readbyte(0xA22B),2) == "E4" then gui.drawbox(52,8,63,15,"red") end
  464. if hex(memory.readbyte(0xA22B),2) == "EB" then gui.drawbox(52,8,63,15,"red") end
  465. if hex(memory.readbyte(0xA22B),2) == "EC" then gui.drawbox(52,8,63,15,"red") end
  466. if hex(memory.readbyte(0xA22B),2) == "ED" then gui.drawbox(52,8,63,15,"red") end
  467. if hex(memory.readbyte(0xA22B),2) == "F4" then gui.drawbox(52,8,63,15,"red") end
  468. if hex(memory.readbyte(0xA22B),2) == "FC" then gui.drawbox(52,8,63,15,"red") end
  469. if hex(memory.readbyte(0xA22B),2) == "FB" then gui.drawbox(52,8,63,15,"red") end
  470. end)
  471.  
  472. gui.opacity(0.7)
  473. gui.drawbox(10,26,70,45,"black")
  474. gui.opacity(0.95)
  475.  
  476. gui.text(12,28,"pattern: " ..memory.readbytesigned(0xa200))
  477. if vba.lagged() then gui.text(12,35,"speed: " ..memory.readbytesigned(0xa202), "red")
  478. else gui.text(12,35,"speed: " ..memory.readbytesigned(0xa202)) end
  479.  
  480. if memory.readword(0xAD00) ~= 0 then sprite1 = 1 else sprite1 = 0 end
  481. if memory.readword(0xAD20) ~= 0 then sprite2 = 1 else sprite2 = 0 end
  482. if memory.readword(0xAD40) ~= 0 then sprite3 = 1 else sprite3 = 0 end
  483. if memory.readword(0xAD60) ~= 0 then sprite4 = 1 else sprite4 = 0 end
  484. if memory.readword(0xAD80) ~= 0 then sprite5 = 1 else sprite5 = 0 end
  485. if memory.readword(0xADA0) ~= 0 then sprite6 = 1 else sprite6 = 0 end
  486. if memory.readword(0xADC0) ~= 0 then sprite7 = 1 else sprite7 = 0 end
  487. if memory.readword(0xADE0) ~= 0 then sprite8 = 1 else sprite8 = 0 end
  488. if memory.readword(0xAE00) ~= 0 then sprite9 = 1 else sprite9 = 0 end
  489. if memory.readword(0xAE20) ~= 0 then sprite10 = 1 else sprite10 = 0 end
  490. if memory.readword(0xAE40) ~= 0 then sprite11 = 1 else sprite11 = 0 end
  491. if memory.readword(0xAE60) ~= 0 then sprite12 = 1 else sprite12 = 0 end
  492. if memory.readword(0xAE80) ~= 0 then sprite13 = 1 else sprite13 = 0 end
  493. if memory.readword(0xAEA0) ~= 0 then sprite14 = 1 else sprite14 = 0 end
  494. if memory.readword(0xAEC0) ~= 0 then sprite15 = 1 else sprite15 = 0 end
  495. if memory.readword(0xAEE0) ~= 0 then sprite16 = 1 else sprite16 = 0 end
  496. local spritecount = 0 + sprite1 + sprite2 + sprite3 + sprite4 + sprite5 +sprite6 + sprite7 + sprite8+sprite9+sprite10+sprite11+sprite12+sprite13+sprite14+sprite15+sprite16
  497. gui.drawbox(147,0,160,7,"black","black")
  498. gui.text(151,0, spritecount)
  499.  
  500. vba.frameadvance()
  501. end
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement