0% found this document useful (0 votes)
101 views

Input:: / AH 0 - Set Video Mode

The document describes various BIOS and DOS interrupts for video mode setting, cursor positioning, character input/output, pixel color manipulation, string output, date/time functions, and mouse pointer control. Key functions include setting video modes and retrieving cursor position (INT 10h), reading/writing characters and strings (INT 10h and INT 21h), getting system date and time (INT 21h), and showing the mouse pointer (INT 33h). Parameters and register usage are provided for each function.

Uploaded by

AkhilGovind
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

Input:: / AH 0 - Set Video Mode

The document describes various BIOS and DOS interrupts for video mode setting, cursor positioning, character input/output, pixel color manipulation, string output, date/time functions, and mouse pointer control. Key functions include setting video modes and retrieving cursor position (INT 10h), reading/writing characters and strings (INT 10h and INT 21h), getting system date and time (INT 21h), and showing the mouse pointer (INT 33h). Parameters and register usage are provided for each function.

Uploaded by

AkhilGovind
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 6

INT 10h / AH = 0 - set video mode.

input:
AL = desired video mode.
these video modes are supported:
00h - text mode. 40x25. 16 colors. 8 pages.
03h - text mode. 80x25. 16 colors. 8 pages.
13h - graphical mode. 40x25. 256 colors. 320x200 pixels. 1 page.
example:
mov al, 13h
mov ah, 0
int 10h

INT 10h / AH = 2 - set cursor position.


input:
DH = row.
DL = column.
BH = page number (0..7).
example:
mov
mov
mov
mov
int

dh,
dl,
bh,
ah,
10h

10
20
0
2

INT 10h / AH = 03h - get cursor position and size.


input:
BH = page number.
return:
DH = row.
DL = column.
CH = cursor start line.
CL = cursor bottom line.

INT 10h / AH = 05h - select active video page.


input:
AL = new page number (0..7).
the activated page is displayed.
INT 10h / AH = 08h - read character and attribute at cursor
position.
input:
BH = page number.
return:
AH = attribute.
AL = character.

INT 10h / AH = 09h - write character and attribute at cursor


position.
input:
AL = character to display.
BH = page number.
BL = attribute.
CX = number of times to write character.

INT 10h / AH = 0Ah - write character only at cursor position.


input:
AL = character to display.
BH = page number.
CX = number of times to write character.
INT 10h / AH = 0Ch - change color for a single pixel.
input:
AL = pixel color
CX = column.
DX = row.
example:

mov
mov
int
mov
mov
mov
mov
int

al,
ah,
10h
al,
cx,
dx,
ah,
10h

13h
0

; set graphics video mode.


1100b
10
20
0ch
; set pixel.

INT 10h / AH = 0Dh - get color of a single pixel.


input:
CX = column.
DX = row.
output:
AL = pixel color

INT 10h / AH = 13h - write string.


input:
AL = write mode:
bit 0: update cursor after writing;
bit 1: string contains attributes.
BH = page number.
BL = attribute if string contains only characters (bit 1 of AL is zero).
CX = number of characters in string (attributes are not counted).
DL,DH = column, row at which to start writing.
ES:BP points to string to be printed.
example:
mov al, 1
mov bh, 0
mov bl, 0011_1011b
mov cx, msg1end - offset msg1 ; calculate message size.
mov dl, 10
mov dh, 7
push cs
pop es
mov bp, offset msg1
mov ah, 13h
int 10h
jmp msg1end
msg1 db " hello, world! "
msg1end:

INT 21h / AH=1 - read character from standard input, with

echo, result is stored in AL.


if there is no character in the keyboard buffer, the function waits
until any key is pressed.
example:
mov ah, 1
int 21h

INT 21h / AH=2 - write character to standard output.


entry: DL = character to write, after execution AL = DL.
example:
mov ah, 2
mov dl, 'a'

int 21h

INT 21h / AH=7 - character input without echo to AL.


if there is no character in the keyboard buffer, the function waits
until any key is pressed.
example:
mov ah, 7
int 21h

INT 21h / AH=9 - output of a string at DS:DX. String must be


terminated by '$'.
example:
org
mov
mov
int
ret
msg

100h
dx, offset msg
ah, 9
21h
db "hello world $"

INT 21h / AH=0Ah - input of a string to DS:DX, fist byte is buffer


size, second byte is number of chars actually read. this function
does not add '$' in the end of string. to print using INT
21h / AH=9 you must set dollar character at the end of it and start
printing from address DS:DX + 2.
example:
org 100h
mov dx, offset buffer
mov ah, 0ah
int 21h
jmp print
buffer db 10,?, 10 dup(' ')
print:
xor bx, bx
mov bl, buffer[1]
mov buffer[bx+2], '$'
mov dx, offset buffer + 2
mov ah, 9
int 21h
ret

the function does not allow to enter more characters than the
specified buffer size.
see also int21.asm in c:\emu8086\examples

INT 21h / AH=0Bh - get input status;


returns: AL = 00h if no character available, AL = 0FFh if character
is available.

INT 21h / AH=2Ah - get system date;


return: CX = year (1980-2099). DH = month. DL = day. AL = day
of week (00h=Sunday)

INT 21h / AH=2Ch - get system time;


return: CH = hour. CL = minute. DH = second. DL = 1/100
seconds.
INT 16h / AH = 00h - get keystroke from keyboard (no echo).
return:
AH = BIOS scan code.
AL = ASCII character.
(if a keystroke is present, it is removed from the
keyboard buffer).
INT 1Ah / AH = 00h - get system time.
return:
CX:DX = number of clock ticks since midnight.
AL = midnight counter, advanced each time
midnight passes.
notes:
there are approximately 18.20648 clock ticks per second,
and 1800B0h per 24 hours.
AL is not set by the emulator.
INT 33h / AX=0001 - show mouse pointer.
example:
mov ax, 1
int 33h

You might also like