hw1

1
Fall 2012 ECE498 Linux Assembly Language – Homework 1 Due: 21 November 2012, 6PM 1. Download the code from http://www.eece.maine.edu/vweaver/classes/ece498asm 2012f/hw1 code.tar.gz to an x86 Linux machine. 2. Uncompress/unpack it with the command tar -xzvf hw1 code.tar.gz (the options to tar stand for eXtract Zipped Verbose File) 3. Change into the hw1 code directory cd hw1 code 4. Run make to build the code 5. Run ./count to 32 This should only print “06. Modify the count to 32.s file so it counts to 32. Place your code where the comments say to. Be sure to comment your code! Hint: there are many possible ways to do this. Some useful instructions are inc, add, dec, sub, cmp, jnz, jz, and if you’re feeling CISCy: loop. 7. Describe how the decimal printing routine in count to 32.s works. Put your answer in the README file. 8. Can the call print string at the end of print number be changed to an unconditional jmp instruction? What advantage would there be in doing this? Put your answer in the README file. 9. Make a copy of your working count-to-32 code cp count to 32.s count to 32 hex.s 10. Convert the print number routine in count to 32 hex.s to instead print base-16 hexadecimal. Hint: man ascii can help. The finished pro- gram should count from 0 to 32 in hex. 11. Run make submit which will create a hw1 submit.tar.gz file. con- taining count to 32.s, count to 32 hex.s, and README. 12. You can verify the contents with tar -tzvf hw1 submit.tar.gz 13. e-mail the hw1 submit.tar.gz file to me by the homework deadline.

Upload: remus-calina

Post on 17-Aug-2015

213 views

Category:

Documents


1 download

DESCRIPTION

hw1

TRANSCRIPT

Fall 2012 ECE498 Linux Assembly Language Homework 1Due: 21 November 2012, 6PM1. Download the code fromhttp://www.eece.maine.edu/vweaver/classes/ece498asm2012f/hw1code.tar.gzto an x86 Linux machine.2. Uncompress/unpack it with the command tar -xzvf hw1code.tar.gz(the options to tar stand for eXtract Zipped Verbose File)3. Change into the hw1 code directory cd hw1code4. Run make to build the code5. Run ./countto32This should only print 06. Modify the countto32.s le so it counts to 32. Place your code wherethe comments say to. Be sure to comment your code!Hint: there are many possible ways to do this. Some useful instructions areinc, add, dec, sub, cmp, jnz, jz, and if youre feeling CISCy: loop.7. Describe how the decimal printing routine in count to 32.s works. Put youranswer in the README le.8. Can the call printstring at the end of printnumber be changedto an unconditionaljmp instruction? What advantage would there be indoing this? Put your answer in the README le.9. Make a copy of your working count-to-32 codecp countto32.s countto32hex.s10. Convert the printnumber routine in countto32hex.s to insteadprint base-16 hexadecimal. Hint:man ascii can help. The nished pro-gram should count from 0 to 32 in hex.11. Run make submit which will create a hw1submit.tar.gz le. con-taining countto32.s, countto32hex.s, and README.12. You can verify the contents with tar -tzvf hw1submit.tar.gz13. e-mail the hw1submit.tar.gz le to me by the homework deadline.