The main focus of this lab is to be acquainted with Matlab and Practice some basic codes like, CGPa calculation.
Problem #1 A basic while loop //Code label1: mov ah, 2 mov dl, ‘1’ int 21h jmp label1 Problem #2 (Example 6.1) [If-else structure] suppose AX aml BX contain signed numbers. Write some code to put the biggest one in cx. //Code mov ax, 70 mov bx, 60 cmp ax, bx jg label1 jl label2
Problem #1 Write a program to (a) prompt the user, (b) read first, middle, and last initials of a person’s name, and (c) display them down the left margin. Sample execution: ENTER THREE INITIALS: JFK J F K //Solution mov ah, 1 int 21h mov bl, al int 21h mov bh, al int 21h mov
Problem #1 General structure of Assembly code and printing characters. //Solution .MODEL small .STACK 100h .DATA .CODE MAIN PROC mov ah, 2 mov dl, 41h int 21h mov dl, 0ah int 21h mov dl, 0dh int 21h mov dl, 41h int 21h ENDP MAIN end MAIN Proiblem #2 Input and output of characters //Solution .MODEL
Problem 1 (Chapter 10 question 9) Write a program that uses XLAT to (a) read a line of text, and (b)print It on the next line with all small letters converted to capitals. The Input line may contain any characters-small letters, capital, letters, digit characters, punctuation, and so on. //Code To be done by students
Problem 1 (section 10.7) Encoding and Decoding string using XLAT instruction //Code Title secret message .Model small .stack 100h .data ; ;ABCDEFGHIJKLMNOPQRSTUVWXYZ code_key db 65 dup(‘ ‘), ‘XQPOGHZBCADEIJUVFMNKLRSTWY’ db 37 dup(‘ ‘) ; ;ABCDEFGHIJKLMNOPQRSTUVWXYZ decode_key db 65 dup(‘ ‘), ‘JHIKLQEFMNTURSDCBVWXOPYAZG’ db 37 dup(‘ ‘) coded db 80 dup(‘$’) ; XQPO$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$4 prompt db ‘Enter a message
Problem 1 Write a procedure to find the factorial of a number present in cx. //Code fact proc mov ax, 1 top1: mul cx loop top1 ret fact endp Problem 2 String usage (Example listings 11.1, 11.2, 11.3) //Code .model small .stack 256 .data str db ‘Hello’, , ‘$’ str2 db ‘This is a test$’