Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement printf using ASSEMBLY LANGUAGE based off of the example code. Only allowed to use system calls to print data. No print_char, no print_string etc.

Implement printf using ASSEMBLY LANGUAGE based off of the example code. Only allowed to use system calls to print data. No print_char, no print_string etc. So we are supposed to use the example code given below and write the printf function without using extern printf. So leave the example code and implement own version of printf for %s, %c, %%, and %d.

image text in transcribedimage text in transcribed

Let's be honest, we take printfO for granted. We use this function every day. It looks so simple on the surface. Hand it some text and variables and it prints them out. Easy! But how much work does it really take to "printf"? What did the authors go through when writing this one beautiful function? Your job, implement printf. But not the whole thing. You are only responsible for: prints a string %c prints a characters % % prints a literally percent sign (%) And there's a catch: You're ONLY allowed to use system calls to print data. No print char, no print_string, etc. Example Code: segment .data strl str2 str3 str4 db Hello world",10,0 db "str3 is '%s', isn't that c 1?", 10,0 db woot woot",o db "%c is a char, but so is %8, %s again!", 10,0 segment .text global asm main asm main push strl call printf add esp, 4 push str3 push str2 call printf add esp, 8 push str3 push 'A push str4 call printf add esp. 8 Let's be honest, we take printfO for granted. We use this function every day. It looks so simple on the surface. Hand it some text and variables and it prints them out. Easy! But how much work does it really take to "printf"? What did the authors go through when writing this one beautiful function? Your job, implement printf. But not the whole thing. You are only responsible for: prints a string %c prints a characters % % prints a literally percent sign (%) And there's a catch: You're ONLY allowed to use system calls to print data. No print char, no print_string, etc. Example Code: segment .data strl str2 str3 str4 db Hello world",10,0 db "str3 is '%s', isn't that c 1?", 10,0 db woot woot",o db "%c is a char, but so is %8, %s again!", 10,0 segment .text global asm main asm main push strl call printf add esp, 4 push str3 push str2 call printf add esp, 8 push str3 push 'A push str4 call printf add esp. 8

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

Define the term Working Capital Gap.

Answered: 1 week ago