function hex(a) return string.format("%x",a) end
mem=manager:machine().devices[":maincpu"].spaces["program"]
emu.pause()
for brightloop=1,3 do
xo=0 yo=200 xpos=xo
for wave=1,2 do
--middle to under
ibits=7 for i=0x5e77,0x5ef7,2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo+x,xpos,yo+x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
--under to middle
for i=0x5ef7-2,0x5e77,-2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo+x,xpos,yo+x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
-- middle to top
for i=0x5e77+2,0x5ef7,2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo-x,xpos,yo-x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
--top to middle
for i=0x5ef7-2,0x5e77+2,-2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo-x,xpos,yo-x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
print("wave"..wave.."done")
end -- wave
end --brightloop