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?
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.
While you could use
Int 11h
that will only tell you the default display at startup, not necessarily the card the BIOS is currently writing to as the default display. IMHO if you want to know the address of the current text regen buffer the BIOS is actively using then I'd check 0040:0063. If it returns 3B4h then it is Monochrome and thus the current active regen buf segment is at b000h otherwise it is 0b800h. I only mention this if you are trying to figure out the regen buffer that the BIOS routines are currently writing to (It could be a dual head system)