Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

What is int 10 doing in assembly?

Writer Andrew Mclaughlin

I'm trying to learn assembly for school and there is this part at the beginning of the example code:

mov al, 0
mov ah, 5
int 10

Before this there is a procedure :

.386
instructions SEGMENT use16 ASSUME CS:instructions
interrupt_handler PROC
; some code
interrupt_handler ENDP

What is the int 10 line doing? Is it calling the interrupt_handler procedure? Why is it exactly 10?

This is all running in DoSBox and is assembled using masm.

0

2 Answers

I found what appears to be a complete copy of the code in the OPs native language (Polish). . There is this section of code (run through Google translate):

; ================================================= =======
; main program - installation and uninstallation of the procedure
; interrupt handling
; determining page number 0 for text mode
start:
mov al, 0
mov ah, 5
int 10

It is clear from this code that it is a bug. It should be int 10h and not int 10 (same as int 0ah). int 10h is documented as:

VIDEO - SELECT ACTIVE DISPLAY PAGE
AH = 05h
AL = new page number (00h to number of pages - 1) (see #00010)
Return:
Nothing
Desc: Specify which of possibly multiple display pages will be visible

int 10 is something completely different:

IRQ2 - LPT2 (PC), VERTICAL RETRACE INTERRUPT (EGA,VGA)

Calling IRQ2 interrupt handler with int 10 will effectively do nothing from the standpoint of the program. Since the default text page is likely already 0 the program works as expected.


The correct code:

mov al, 0
mov ah, 5
int 10h

would set the text mode display page to 0 using the BIOS service 10h function 5.

Simple answer is int 10h (I think your code has a typo) typically calls a real mode interrupt handler at the vector that provides video services. int 10h services include setting the video mode, character and string output, and graphics primitives (reading and writing pixels in graphics mode).

9

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.