



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture handout was provided at Quaid-i-Azam University for Microprocessor and Assembly Language Programming course by Prof. Saleem Raza. Its main points are: Bios, Services, Video, Int, Graphics, Ascii, Cursor, Write, Position, String, Altering, Attributes
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




AH = 00h AL = desired video mode
AH = 01h CH = cursor start and options CL = bottom scan line containing cursor (bits 0-4) INT 10 - VIDEO - SET CURSOR POSITION AH = 02h BH = page number 0-3 in modes 2& 0-7 in modes 0& 0 in graphics modes DH = row (00h is top) DL = column (00h is left) INT 10 - VIDEO - SCROLL UP WINDOW AH = 06h AL = number of lines by which to scroll up (00h = clear entire window) BH = attribute used to write blank lines at bottom of window CH, CL = row, column of window's upper left corner DH, DL = row, column of window's lower right corner INT 10 - VIDEO - SCROLL DOWN WINDOW AH = 07h AL = number of lines by which to scroll down (00h=clear entire window) BH = attribute used to write blank lines at top of window CH, CL = row, column of window's upper left corner DH, DL = row, column of window's lower right corner INT 10 - VIDEO - WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION AH = 09h AL = character to display BH = page number
BL = attribute (text mode) or color (graphics mode) CX = number of times to write character INT 10 - VIDEO - WRITE CHARACTER ONLY AT CURSOR POSITION AH = 0Ah AL = character to display BH = page number BL = attribute (text mode) or color (graphics mode) CX = number of times to write character INT 10 - VIDEO - WRITE STRING AH = 13h AL = write mode bit 0: update cursor after writing bit 1: string contains alternating characters and attributes bits 2-7: reserved (0) BH = page number BL = attribute if string contains only characters CX = number of characters in string DH, DL = row, column at which to start writing ES:BP -> string to write
AX = 1130h BH = pointer specifier Return: ES:BP = specified pointer CX = bytes/character of on-screen font DL = highest character row on screen INT 10 - TEXT-MODE CHARGEN AX = 1110h ES:BP -> user table CX = count of patterns to store DX = character offset into map 2 block BL = block to load in map 2 BH = number of bytes per character pattern
; put underlines on screen font [org 0x0100] jmp start
font: times 256*16 db 0 ; space for font
start: mov ax, 0x1130 ; service 11/30 โ get font info mov bx, 0x0600 ; ROM 8x16 font int 0x10 ; bios video services
mov si, bp ; point si to rom font data mov di, font ; point di to space for font
mov ax, 0x4c00 ; terminate program int 0x
AH = 0Ch BH = page number AL = pixel color CX = column DX = row
; draw line in graphics mode [org 0x0100] mov ax, 0x000D ; set 320x200 graphics mode int 0x10 ; bios video services
mov ax, 0x0C07 ; put pixel in white color xor bx, bx ; page number 0 mov cx, 200 ; x position 200 mov dx, 200 ; y position 200
l1: int 0x10 ; bios video services dec dx ; decrease y position loop l1 ; decrease x position and repeat
mov ah, 0 ; service 0 โ get keystroke int 0x16 ; bios keyboard services
mov ax, 0x0003 ; 80x25 text mode int 0x10 ; bios video services
mov ax, 0x4c00 ; terminate program int 0x
AH = 01h Return: AL = character read INT 21 - WRITE STRING TO STANDARD OUTPUT AH = 09h DS:DX -> $ terminated string INT 21 - BUFFERED INPUT AH = 0Ah DS:DX -> dos input buffer
; character input using dos services [org 0x0100] jmp start
maxlength: dw 80 ; maximum length of input message: db 10, 13, 'hello $' ; greetings message buffer: times 81 db 0 ; space for input string
start: mov cx, [maxlength] ; load maximum length in cx mov si, buffer ; point si to start of buffer
nextchar: mov ah, 1 ; service 1 โ read character int 0x21 ; dos services
cmp al, 13 ; is enter pressed je exit ; yes, leave input mov [si], al ; no, save this character inc si ; increment buffer pointer loop nextchar ; repeat for next input char
exit: mov byte [si], '$' ; append $ to user input
mov dx, message ; greetings message mov ah, 9 ; service 9 โ write string int 0x21 ; dos services
mov dx, buffer ; user input buffer mov ah, 9 ; service 9 โ write string int 0x21 ; dos services
mov ax, 0x4c00 ; terminate program int 0x
; buffer input using dos services [org 0x0100] jmp start
message: db 10,13,'hello ', 10, 13, '$' buffer: db 80 ; length of buffer db 0 ; number of character on return times 80 db 0 ; actual buffer space
start: mov dx, buffer ; input buffer mov ah, 0x0A ; service A โ buffered input int 0x21 ; dos services
mov bh, 0 mov bl, [buffer+1] ; read actual size in bx mov byte [buffer+2+bx], '$' ; append $ to user input
mov dx, message ; greetings message mov ah, 9 ; service 9 โ write string int 0x21 ; dos services
mov dx, buffer+2 ; user input buffer mov ah, 9 ; service 9 โ write string int 0x21 ; dos services
mov ax, 0x4c00 ; terminate program int 0x