Search code examples
assemblyvideox86-16biosvga

Where the current text mode page address is recorded?


I read that we can know the current text mode page directly by an interrupt like this code:

mov ah, 15
int 10h

the current page number will be returned into 'bh'. How we can get the current page address or offset without calculating it nor saving all page addresses in constants. Is there a port instruction or memory location that has the current working video buffer?


Solution

  • The offset of the current video page from the beginning of the regen buffer is recorded in the BDA at 0040:004e. The text mode regen buffer is found at segment b000 for MDA and HGC cards and at b800 for all other cards. Query the equipment byte using int 11h to find if an MDA card is installed.

    Refer to this article for further details.