Mov and Interrupts
Mov Instruction
• It is used for moving data from one storage space to another.
• It copies the second operand (source) to the first operand
(destination).
• The destination register can be a general-purpose register, or
memory location.
Syntax:
MOV destination, source
Example:
MOV AX, 0B800h
Mov Instruction
Types of operand supported by MOV
MOV SREG, memory
MOV memory, SREG
MOV REG, SREG
MOV SREG, REG
SREG: DS, ES, SS, and only as second operand: CS.
REG: AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP.
memory: [BX], [BX+SI+7], variable
Mov Instruction
Example of operands:
MOV AX, BX - REG, REG
MOV [BX], AX - MEM, REG
MOV AX, [BX] - REG, MEMORY
MOV [BX+SI], 5 - MEM, IMMEDIATE
MOV AX, 5 - REG, IMMEDIATE
( [ ] bracket symbol denote indirect addressing in assembly language.
In addition to using the BP, BX, DI, and SI registers to indirectly
address memory.
Example Code:
ORG 100h
MOV AX, 0B800h
MOV DS, AX
MOV CL, 'A'
MOV CH, 1101_1111b
MOV BX, 15Eh
MOV [BX], CX
RET
Interrupts
• It is a method of processing the microprocessor by peripheral
device.
• It the method of creating a temporary halt during program execution
and allows peripheral devices to access the microprocessor.
• Microprocessor responds to the interrupt with an interrupt
service routine, which is short program or subroutine that instructs
the microprocessor on how to handle the interrupt.
Interrupts
Interrupt can divide to five group:
1. Hardware interrupt
2. Non-maskable interrupt
3. Software interrupt
4. Internal interrupt
5. Reset
Short list of supported interrupts with
descriptions:
INT 10h / AH = 0 - set video mode.
input: AL = desired video mode.
These video modes are supported:
1. 00h - text mode. 40x25. 16 colors. 8 pages.
2. 03h - text mode. 80x25. 16 colors. 8 pages.
3. 13h - graphical mode. 40x25. 256 colors. 320x200 pixels. 1
page.
Short list of supported interrupts with
descriptions:
Example:
mov al, 13h
mov ah, 0
int 10h
Short list of supported interrupts with
descriptions:
INT 10h / AH = 01h - set text-mode cursor shape.
input:
CH = cursor start line (bits 0-4) and options (bits 5-7).
CL = bottom cursor line (bits 0-4).
Short list of supported interrupts with
descriptions:
hide blinking text cursor:
mov ch, 32
mov ah, 1
int 10h
Short list of supported interrupts with
descriptions:
How standard blinking text cursor:
mov ch, 6
mov cl, 7
mov ah, 1
int 10h
Short list of supported interrupts with
descriptions:
Show box-shaped blinking text cursor:
mov ch, 0
mov cl, 7
mov ah, 1
int 10h
Short list of supported interrupts with
descriptions:
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.
Short list of supported interrupts with
descriptions:
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.
Short list of supported interrupts with
descriptions:
Example:
mov al, 1
mov bh, 0
mov bl, 0011_1011b
mov cx, msg1end
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: