Docsity

ASSEMBLY LANGUAGE SOLVED LAB ON COMPLEX QUESTION, Lab Reports of Computer Architecture and Organization

Partial preview of the text

Download ASSEMBLY LANGUAGE SOLVED LAB ON COMPLEX QUESTION and more Lab Reports Computer Architecture and Organization in PDF only on Docsity!

NUST

Military College of Signals,

Rawalpindi.

COA

LAB# 11

BATCH-26C

Submitted By:

AYMEN FATIMA

Cms:

Submitted To:

Mam LARAIB

DEPARTMENT OF COMPUTER SOFTWARE ENGINEERING.

EXERCISES

Exercise 11.1:

Write a program in assembly to check if the number is positive or negative. org 100h include 'emu8086.inc' .code main proc looop: printn '' printn 'Enter the Number' call scan_num Mov Ax, Cx cmp Ax, 0 jg positive jl negative

org 100h include 'emu8086.inc' .code main proc looop: printn '' printn 'Enter the Number' call scan_num Mov Ax, Cx cmp Ax, 0 jg level jle notValid level1: cmp Ax, 100 jge notValid jl level jmp end level2: printn ''

printn 'The number is VALID.' Mov Cx, 2 Mul Cx call print_num jmp end notValid: printn '' printn 'The number is NOT VALID.' jmp end end: jmp looop main endp define_scan_num define_print_num define_print_num_uns ret

Exercise 11.3:

Write a program in assembly which takes marks from the user and allot the grade accordingly A โ†’ 100 - 80 B โ†’ 70 - 79 C โ†’ 60 - 69

looop: printn '' printn 'Enter the Number' call scan_num mov Ax, 100 cmp Cx, Ax jg notVAlid mov Ax, 0 cmp Cx, Ax jl notValid jge valid jmp end valid: mov Ax, 49 cmp Cx, Ax jle F mov Ax, 59 cmp Cx, Ax jle D

mov Ax, 69 cmp Cx, Ax jle C mov Ax, 79 cmp Cx, Ax jle B mov Ax, 100 cmp Cx, Ax jle A F: printn '' printn 'You are fail.' jmp end D: printn '' printn 'Your grade is D.' jmp end C: printn ''

define_scan_num define_print_num define_print_num_uns ret