print_int in nasm
Posted: Thu May 04, 2006 11:00 pm
I'm building an asm kernel based on josh's rudimentary kernel http://www.mohanraj.info/josh4.jsp. I have written a function which converts a single digit to its equivalent char, but now i want to be able to print numbers, not just digits.
This is my plan:
1) divide the [original] by 10 until it is less than 10, saving how many divides it took [n]
2) then print the single digit
3) [m]=10^[n]
4) calculate [original]=[original]-[m]*digit, save [original]
5) do this until [original]!=0
Is this ok?
Thanks a lot!
ps: i'm fairly new to asm
This is my plan:
1) divide the [original] by 10 until it is less than 10, saving how many divides it took [n]
2) then print the single digit
3) [m]=10^[n]
4) calculate [original]=[original]-[m]*digit, save [original]
5) do this until [original]!=0
Is this ok?
Thanks a lot!
ps: i'm fairly new to asm