Advertisement
Appendko

RMX1.0 Memory Watch

May 10th, 2021
3,319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. local cumsum = 0
  2. local prev_counter = 0
  3. local tic = 0
  4. local flag_color = "yellow"
  5. local counter_color = "yellow"
  6. while true do
  7.     pad=joypad.get(1);
  8.     --print(pad)
  9.     counter = mainmemory.read_s8(0x001F9D)
  10.     flag = mainmemory.read_s8(0x001F9B)
  11.     if pad.X then
  12.         prev_counter = counter  
  13.         tic = counter  
  14.         cumsum = 0
  15.     end    
  16.     if prev_counter > counter then
  17.         cumsum = cumsum + 256
  18.     end  
  19.     for i = 3, 16, 1 do
  20.         gui.drawText(18*(i-3),  0, string.format("%02X", 0x90+i),"white", null, 12, "Courier New")
  21.         gui.drawText(18*(i-3), 12, string.format("%02X", mainmemory.read_u8(0x001F90+i)), "yellow", null, 12, "Courier New")
  22.     end    
  23.  
  24.     gui.drawText(0, 24, "Count: ", counter_color, null, 12, "Courier New")
  25.     if counter < 0 then
  26.         counter_color = "red"
  27.     else
  28.         counter_color = "yellow"
  29.     end
  30.     gui.drawText(45, 24, counter, counter_color, null, 12, "Courier New")
  31.  
  32.     gui.drawText(0, 36, "Flag: ", flag_color, null, 12, "Courier New")
  33.     if flag == 0 then
  34.         flag_color = "red"
  35.     else
  36.         flag_color = "yellow"
  37.     end
  38.     gui.drawText(45, 36, flag, flag_color, null, 12, "Courier New")
  39.     gui.drawText(0, 48, "Last: " .. cumsum + counter - tic, "white", null, 12, "Courier New")
  40.    
  41.     prev_counter = counter    
  42.     emu.frameadvance()
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement