40 likes | 220 Views
CS 206D Computer Organization Lab1. Exercise 1. Write assembly program that define two variables of type byte (BYTE1 initialized by ‘B’, and BYTE2 initialized by 22H) then try to swap the values of these tow variables. org 100h .MODEL SMALL .STACK 100H .Data
E N D
CS 206D Computer Organization Lab1 CS 111
Exercise 1 CS 111 • Write assembly program that define two variables of type byte (BYTE1 initialized by ‘B’, and BYTE2 initialized by 22H) then try to swap the values of these tow variables.
org 100h • .MODEL SMALL • .STACK 100H • .Data • BYTE1 DB 'B’ ; declare BYTE1 initialized by ‘B’ • BYTE2 DB 22H ; declare BYTE2 initialized by 22H • .CODE • ;initialize DS • MOV AX, @DATA • MOV DS, AX • MAIN PROC • ;Swap values between BYTE1 and BYTE2 • MOV BL,BYTE1 • XCHG BL,BYTE2 • MOV BYTE1 ,BL • MAIN ENDP • END MAIN CS 111