View Single Post
  #2 (permalink)  
Old May 10th, 2007, 05:15 PM
lewkor lewkor is offline
Registered User
Join Date: May 2007
Location: Calgary, AB, Canada.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

First make sure that you can write a byte to stdio. Put 65 in a register and print it. You should see a 'A' on the screen.

What you need to do is divide the number by the radix (presumably 10) and save the remainder and the quotient. save the remainder on a stack. Divide the new quotient by the radix - save the new remainder. Repeat until the quotient is 0.

What you have now is numbers between 0 and 9 saved in a stack. For each element on the stack add 0x30 (ascii 0) to that value and print it. The stack is conveniently contained in the call stack if you make this a recursive function.;)

When you have that mastered then you can try to create a function that will print float/doubles.

Have fun!