masm6.15 code by sadaf65

VIEWS: 182 PAGES: 6

More Info
									1. OBJECTIVE
       a.   To learn how to declare and use array of word etc.
       b.   To learn use of ‘lengthof’ and ‘sizeof’ operator
       c.   To learn the syntax and use of ADD instruction
       d.   To learn the basic jump instructions
       e.   To learn how to repeat the execution of a piece of code using jump instruction
       f.   To learn the use of typedef in MASM
       g.   To learn the use of NEG (Negate) instruction
       h.   To learn the use of the DUP operator

2. TASKS
a. Implement the expression Rval = -Xval + (Yval – Zval). Take the values of the
   variables X,Y and Z from user.

    SOURCE CODE:

    Title LAB3
    include irvine16.inc

    .data
    x word 0
    y word 0
    z word 0

    .code
    main PROC
    MOV AX,@Data
    MOV DS,AX

    Call ReadInt
    MOV z,bx
    Call crlf

    Call ReadInt
    MOV y,ax
    Call crlf

    Call ReadInt
    mov x,cx
    Call crlf
    SUB ax,bx
    NEG x

    ADD AX,x

    call writeint
    .exit
    main ENDP
    END main
b. Declare a string and then copy this string to another string in reverse order and
   print that string

   SOURCE CODE:

   TITLE lab1
   include irvine16.inc
   .data
   array byte "eme college" , 0
   array1 byte (Lengthof array) DUP(0)
   x word 0

   .code
   main PROC
   mov ax,@data
   mov ds,ax
   mov SI,offset array
   mov DI,offset array1
   mov x,LengthOf array
   add SI,x
   dec SI
   dec SI
   label1:
   mov bl,[SI]
   mov [DI],bl
   inc DI
   dec SI
   dec x
   jnz label1
   mov dx,offset array1
   call writestring

   .exit
   main ENDP

								
To top