Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective The objective of this programming project is for you to practice writing an assembly language subroutine and to gain more experience with loop control.

Objective The objective of this programming project is for you to practice writing an assembly language subroutine and to gain more experience with loop control. Assignment For this assignment, you will write an assembly language subroutine that prints out a 64-bit unsigned number to standard output in hexadecimal format. The 64-bit value will be first interpreted from the users ASCII input (maximum of 20 characters allowed), then converted into a 64-bit value. This 64-bit value is to be converted into HEX, character by character by passing the character into a C subroutine (cfunc.c) through the RDI register. Your subroutine must preserve all registers (i.e., any registers that you use must be saved on the stack and restored before you return). Your subroutine should print the given number in hexadecimal and then do nothing else. To determine the values of each of the base 16 digits in the hexadecimal representation of the number, you will use the division method (don't use repeated subtraction). The DIV instruction will divide the 64-bit value stored in RDX:RAX after converting the users input. Note that RDX should be initialized to 0 here. After the DIV instruction is executed, the quotient is stored in the RAX register and the remainder is stored in the RDX register. (See further discussion of the DIV instruction in Implementation Notes below.) You are provided with a skeleton code hexConverter.asm and a C code cfunc.c (you will not modify the provided c function). The project is split into two files. You will be implementing your algorithm in the hexConverter.asm file. The entry point into the C subroutine/function must be named printhex and must be externally referenced using extern (as it already is in the skeleton project). The printf function/subroutine has also been declared extern for you in the skeleton project. You can review the expected test output in the test cases provided on Blackboard. If the input is less than 20 characters or more than 21 characters, the user input is no longer 64-bit. Validity checks must be implemented to ensure that the user inputs only numbers (no alphabets or special characters allowed). To build your project : nasm -g -f elf64 -F dwarf hexConverter.asm gcc -g hexConverter.o cfunc.c -o converter.out To test your project: ./converter.out

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

=+20.12. If F(x-) Answered: 1 week ago

Answered: 1 week ago

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago