Wednesday, January 15, 2014

How to set video mode in X86 assembly?


The interrupt no. 10H is dedicated for all kinds on video operation of 8086/8088 DOS system. The function number 01 with interrupt 10H is used to set the video mode.
The mode values must be set in AL register.


The values 00h to 03H specifies the text modes of DOS. Remaining are Graphics modes. The default text mode is 80 X 25. That is, 80 character per line X 25 line per screen page.
So, this text resolution can be changed with the help of interrupt no. 10H.

By setting any video mode, the display screen will be cleared automatically.

For e.g.

    MOV AH,00H
  MOV AL,00H
  INT 10H

This will set the video mode (text) of 40 characters per line X 25 line per page. It changes the default resolution. Likewise, we may use different kind of values in AL register.

These are:

00H – 40 X 25 (text) color burst OFF
01H – 40 X 25 (text)
02H – 80 X 25 (text) color burst OFF
03H – 80 X 25
04H – 320 X 200 pixels (graphics)
05H – 320 X 200 pixels (graphics) color burst OFF
06H – 640 X 200 (graphics)
... and so on.

To Know more about these values, refer book “Advanced MS-DOS Programming” by Ray Duncan (BPB Publications).

2 comments: