






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Two exercises on assembly programming. The first exercise requires the student to write a program to check if a number is positive or negative. The second exercise requires the student to write a program to allot grades based on marks entered by the user. the code for both exercises. likely to be useful as study notes or exercises for a course on assembly programming.
Typology: Lab Reports
1 / 10
This page cannot be seen from the preview
Don't miss anything!







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
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