CSC231 Homework 8 Fall 2012
--D. Thiebaut 13:14, 31 October 2012 (EDT)
Problem 1
- Write an assembly file called hw8a.asm that will contain a series of functions (you decide how many) that help print the contents of all the registers on the screen. The main function will be called dumpRegs and when you call it, all the major registers ( eax, ebx, ecx, edx, edi and esi) will be displayed in hex on the screen, inside a nice box. Here is an example of how your function could get used in a simple hello program:
section .data
Hello db "Hello there!", 10, 10, 10
HelloLen equ $-Hello
section .text
global _start
_start:
;;; print message
mov eax, 4 ; write
mov ebx, 1 ; stdout
call dumpRegs
mov ecx, Hello ; address of message to print
mov edx, HelloLen ; # of chars to print
int 0x80
;;; exit
mov ebx, 0
mov eax, 1
int 0x80
The output of the program will be (something like) this:
+------------------+ | eax = 0000 00 04 | | ebx = 0000 00 01 | | ecx = F503 21 11 | | edx = 0000 12 FC | | edi = FFFF EEC3 | | esi = 1223 5557 | +------------------+ Hello there!
Submission
Submit your program as follows:
rsubmit hw8 hw8a.asm
Problem #2