'*****************************************************************************
'* INT 10H AH=0Ah (CGA BIOS) WRITE CHAR TO CURSOR POSITION
'* Params: BH - video page
'*         AL - char
'*         CX - count 
'*****************************************************************************

use module "Tools" 'cga tools

protected function Exec as boolean

//params
dim Char as byte=cpu.AL 'char
dim Count as word=cpu.CX 'char count
dim Color as byte=cpu.BL 'color
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

//write char
if IsTextMode then
   result=WriteTextChar(Page,Row,Col,Char,-1,Count)
 else 
   Page=0 'only to first page in graph mode
   result=WriteGraphChar(Page,Row,Col,Char,Color,0,Count)
end if

end