'*****************************************************************************
'* INT 10H AH=08h (CGA BIOS) READ CHAR/ATTRIB FROM CURSOR POSITION
'* Params: BH - video page
'* Result: AL - char
'*         AH - attribute
'*****************************************************************************

use module "Tools" 'cga tools

protected function Exec as boolean

//params
dim Char as byte 'char
dim Attrib as byte 'attribute
dim Page as byte=cpu.BH : if Page>7 then exit(false) 'video page
dim Col as byte=mem.Byte(0x450+Page*2) 'cursor column in page
dim Row as byte=mem.Byte(0x451+Page*2) 'cursor row in page

//read char
if IsTextMode then
    result=ReadTextChar(Page,Row,Col,Char,Attrib)
 else 
    result=false //TODO
 end if

if not(result) then exit(false)
cpu.AL=Char : cpu.AH=Attrib

end