I added a memory lookup as well using mem:read_u8() and noticed that it doesn't account for which hi-res page is displayed, so let's look that up in an item called ":a2video/0/m_page2".


Code
function rem(a) print(a) end
function remp(a,b,c,d) print(a,b,c,d) end
function rem(a) end
function float(f) return string.format("%6.2f",f) end
function hex(a) return string.format("0x%02x",a) end
function calc(line,page) page=page or 0 return line % 8 * 1024 + math.floor(line / 64) * 40 + math.floor((line%64) / 8) * 128 + 8192*(page + 1) end

function iif(a,b,c) if a then return b else return c end end 
function bool10(a) return iif(a,1,0) end

function bin(x,numbits,gap) if x==nil then return nil end gap=gap or "_" numbits=numbits or 8 str="" for i=numbits-1,0,-1 do str=str..iif((x&(2^i))~=0,"1","0")..iif((i%8==0) and (i>0),gap,"") end return str end

function myframedispatcher() if myframedispatchlist ~= nil then for i,j in pairs(myframedispatchlist) do j() end end end

function get_page() return  emu.item(manager:machine().devices[":a2video"].items["0/m_page2"]):read(0) end

function draw_crosshairs()
x,y,button,target=manager:machine():uiinput():find_mouse()
if target==nil then print ("TARGET=nil") return end 
manager:machine().screens[":screen"]:draw_line(0,0,x/target:width()*559,y/target:height()*191,0xffffffff)
boxsize=4
manager:machine().screens[":screen"]:draw_box(x/target:width()*559-boxsize*2,y/target:height()*191-boxsize,x/target:width()*559+boxsize*2,y/target:height()*191+boxsize,0x22ffffff,0xffff0000)
xsize=target:width() 
ysize=target:height() 
textx=math.min(math.floor(x/xsize*560+10),400)
texty=math.min(math.floor(y/ysize*192+10),160)
cpu = manager:machine().devices[":maincpu"];mem = cpu.spaces["program"]
page=get_page()
screenaddr=calc(math.floor(y/ysize*192),get_page())+math.floor(x/xsize*279/7)
screenvalue=mem:read_u8(screenaddr)
manager:machine().screens[":screen"]:draw_text(textx,texty,"x="..float(x/xsize*280).." y="..float(y/ysize*192).."\naddr="..hex(screenaddr).."\nvideo page= "..page.."\nvalue="..hex(screenvalue).." "..bin(screenvalue),0xffffffff,0xffff0000)
if button then
  myframedispatchlist={}
end
end

myframedispatchlist={} table.insert(myframedispatchlist,draw_crosshairs)

if alreadyregisteredmyframedispatcher==nil then
  emu.register_frame_done(myframedispatcher)
  alreadyregisteredmyframedispatcher=true
end

function clrd() myframedispatchlist={} end

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

And you can flip the hi-res pages with the following command in the debugger:
b!c054=1 (for page 1)
b!c055=1 (for page 2)

or if you're adventurous:
emu.item(manager:machine().devices[":a2video"].items["0/m_page2"]):write(0,0) for page 1
emu.item(manager:machine().devices[":a2video"].items["0/m_page2"]):write(0,1) for page 2

So if I hover over the character A in the opening menu screen and work downward, I find that the bytes are 7c,44,44,7c,46,46,46
and if I do a search with "find 0,c000,7c,44,44,7c,46,46,46" it tells that it's found at 7A08, and further study finds the text font starting at 0x7900.

Last edited by Golden Child; 01/31/19 09:28 AM.