130 likes | 233 Vues
Learn about registers, data transfer, basic arithmetic, and INT instructions in assembly language programming. Understand general purpose registers like AX, BX, CX, DX, segment registers CS, DS, SS, ES, and pointer/index registers SP, BP, IP, SI, DI. Practice exercises moving data, performing arithmetic, and handling interrupts.
E N D
Lab 2 Registers, Data Transfer Instruction, Basic Arithmetic Instruction, INT Instruction
Data Registers – General Purpose Registers • AX Accumulator Register • BX Base Register • CX Count Register • DX Data Register
Segment Registers • CS Code Segment • DS Data Segment • SS Stack Segment • ES Extra Segment
Pointer and Index Registers • SP Stack Pointer • BP Base Pointer • IP Instruction Pointer • SI Source Index • DI Destination Index
Data Transfer Instruction • XCHG
Basic Arithmetic Instruction • INC • DEC
INT Instruction • INT interrupt_number
Exercises • Move 50h to AL and display it on screen. • org 100h • MOV AL,50H • MOV AH,2 • MOV DL,AL • INT 21H • ret • Declare a variable named word2 as a word, which contains 55h then display it on screen. • org 100h • MOV AH,2 • MOV DX,WORD2 • INT 21H • ret • WORD2 DW 55H
Cont. Exercises • Add two numbers 5, 6 and move the result to CX. • org 100h • MOV AX,2 • MOV DX,3 • ADD AX,DX • MOV CX,AX • ret • Input a number (7) then move it to register BX • org 100h • MOV AH,1 • INT 21H • MOV BX,AX • ret
Cont. Exercises • Input number 2 then add it to number 5 that is located in BL register then show the result on screen. • org 100h • MOV AH,1 • INT 21H • MOV BL,5 • ADD BL,AL • MOV AH,2 • MOV DL,BL • INT 21H • ret