Write a program to prompt a user to enter a number. Then display a menu of choic
ID: 3696576 • Letter: W
Question
Write a program to prompt a user to enter a number. Then display a menu of choices for the user to select as follows: Please choose one of the following options: 1. Print the number in binary separating each nibble with a space. 2. Same as option #1, but with leading zeros removed. 3. Print the number in binary in reverse order. 4. Print one particular nibble 5. Enter in a new number 6. Quit the program.
This needs to be in assembly language. saved as an .m file. I'll gladly take some help without the complete answer.
Explanation / Answer
.model small
.stack 100h
.data
menu db "Please select a choice:",
db "1. Print the number in binary separating each nibble with a space. "
db "2. leading zeros removed "
db "3. Binary number in reverse order"
db "4.Only one particular nibble"
db "5.Enter new number"
db "6. Exit",'$'
.code
start:
;INITIALIZE DATA SEGMENT.
mov ax, @data
mov ds, ax
call clear_screen
call display_menu
;WAIT FOR ANY KEY.
mov ah, 7
int 21h
;FINISH PROGRAM.
mov ax, 4c00h
int 21h
;---------------------------------------------
display_menu proc
mov dx, offset menu
mov ah, 9
int 21h
ret
display_menu endp
clear_screen proc
mov ah, 0
mov al, 3
int 10H
ret
clear_screen endp
end start
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.