1.) ; program to do octal input and output org 100h section .data prompt1: db "Please enter a decimal number: $" prompt2: db 0Dh,0Ah, "The number in octal is: $" prompt3: db 0Dh,0Ah, "The number in decimal is: $" section .text mov ah,9 ; print prompt mov dx,prompt1 int 21h call dec_in ; read value into bx mov ah,9 ; print output label mov dx,prompt2 int 21h call hexout mov ah,9 ; print output label mov dx,prompt3 int 21h call dec_out ; display the value in bx as hex exit: ; exit to DOS mov ax,4C00h ; Normal Exit int 21h ; bye! ; dec_in will read a base 10 value from the keyboard and place it into the bx register dec_in: ; save registers push ax push dx xor bx,bx ; bx holds accumulated input mov ah,1 ; read char fcn int 21h ; read it into al while1: cmp al,0Dh ; char = CR? je finis ; if so, we are done push ax ; save the character read mov ax,10 ; set up for multiply mul bx ; dx:ax <- bx * 10 mov bx,ax ; put 16-bit result back in bx (assume no overflow) pop ax ; restore the char read and ax,000Fh ; convert character '0'-'9' to value 0-9 add bx,ax ; add value to accumulated input mov ah,1 ; read char fcn int 21h ; read next char into al jmp while1 ; loop until done finis: ; restore registers pop dx pop ax ret
2.)
; hexout will display the binary value in the bx register as a base 16 value hexout: ; save registers we will be using push ax push cx push dx mov ah,2 ; display char fcn mov cx,4 ; loop counter init for1: ; top of for loop rol bx,4 ; rotate so digit is in lowest 4 bits mov dl,bl ; get low half in dl and dl,0Fh ; and mask out all but 4 bits cmp dl,9 ; dl <= 9? jnbe AtoF ; if not, then it's A-F or dl,30h ; convert 0-9 to '0'-'9' jmp endif1 ; get ready to display AtoF: add dl,55 ; convert 10-15 to 'A'-'F' endif1: int 21h ; display char loop for1 ; loop until done ; restore registers pop dx pop cx pop ax ret ; dec_out will display the binary value in the bx register as a base 10 value dec_out: ; save registers we will be using push ax push bx push cx push dx xor cx,cx ; cx counts digits, initially zero rept: mov ax,bx ; set up to divide by by 10 xor dx,dx ; must have a 32 bit (unsigned) dividend mov bx,10 ; divisor will be in bx div bx ; quotient will be in ax, remainder in dx push dx ; push remainder on stack inc cx ; we generated another digit, so count it mov bx,ax ; the quotient goes back in bx cmp ax,0 ; clever way to test if quotient is zero jne rept ; if not, generate next digit mov ah,2 ; display character function for2: ; loop cx times pop dx ; pop digit to print or dl,30h ; convert the digit to print to ASCII code int 21h ; display the character loop for2 ; and keep going until all digits displayed ; restore registers pop dx pop cx pop bx pop ax ret
i tried for 3rd and 4th program but i dint get correct answers that's why i din;t post the answers.
Help with this please Write an 8086 pasm program which will: Prompt the user to enter...
using assembly 8086, Convert a binary string to decimal. Accept buffered user input in the form of a 16-bit binary string. Convert to signed integer and print to the screen. If the user enters less than 16 bits, or input illegal character return an error message and prompt for input again. Sample Execution: Enter a 16-bit binary number: 100111100101110 The decimal signed integer equivalent is -24996 Enter a binary number: 11001011100 Error! Please enter exactly 16-bits: 100111100101110 Enter a 16-bit...
using assembly 8086 , Convert a binary string to decimal. Accept buffered user input in the form of a 16-bit binary string. Convert to unsigned integer and print to the screen. if the user enters less than 16 bits, you may pad the binary number with zeros on the left. Sample Execution: Enter a 16-bit binary number: 1001111001011100 The decimal unsigned integer equivalent is 40540 Enter a 16-bit binary number: 01100 The decimal unsigned integer equivalent is 12
Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display the numbers in 3 formats. Then check, whether the larger of the 2 is evenly divisible by the smaller. Detail: Write a complete C program, more complex than the typical "hello world" program. Prompt the user to enter 2 integer numbers that are not negative. After either entry, display that number again. Print the smaller in hexadecimal, in decimal, and in octal format. Include...
Write a program that allows the user to enter an unsigned integer (the maximum value of an unsigned 4-byte int is 232 = 4,294,967,296) and reverses its format (from little to big endian, or vice versa). Print out the user-entered number in hexadecimal and binary, reverse the endianness, and print the reverse in hexadecimal and binary. Integers in most machine architectures are represented in little endian format: the least significant byte is stored in the smallest address; for instance, the...
In Java please: Write a program that will prompt the user to enter GPA values one per line, stopping when the user enters a negative Input: value. Print the following on separate lines: . The number of vaild GPAs entered » The sum of the GPAs 4.0 3.7 2.9 3.5 -1 The average GPA
Write a program that will loop ten times. In each iteration prompt user to enter an integer between -50&50. Print the input, keep a running sum of the inputs, and track the minimun and maximum numbers input. After the loop is complete, minimum number entered, maximum number entered, sum of all numberes entered, and average of all numbers entered. Format all output. Before running the loop, print the label "Input values: ". Within the loop, print value entered by user...
write codes and give detailed explanation of how to execute. What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word or PDF...
Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...
Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...
c++ Write a program that prompts the user to enter a length in feet and then enter a length in inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers. Your error message should read A non positive number is entered and allow the user to try again.