logs archiveIRC Archive / Undernet / #asm / 2007 / January / 6 / 1
bidsen
can anyone help regarding assembly ?
tiocsti
not if you dont ask
and maybe not if you do, but only way is to ask
bidsen
:)
here it comes...
suppose DX holds a 16 bit value. what should i do in order to output it base 10 converted ?
tiocsti
convert it to a string
and write it out
bidsen
i don't belive it is that simple
tiocsti
if its a 16 bit value, you can just do a bunch of division
find number of 10000s in the number (via div) and then 1000s then 100s then 10s
so if its 65535 you know that its 6 10000s 5 1000s 5 100s 3 10s 5 1s
so you just go into a divide/sub loop until your 16 bit value is 0
bidsen
that's it
tiocsti
yeah, there's not much to it
you prob wanna add some cleverness to avoid outputting leading 0s
bidsen
so basicaly after i do a div operation i could insert the result into an array ?
         

tiocsti
but apart from that, it's quite straightforward
yeah like when you check the 1000s you put that result in first spot in array
then sub that value * 10000 from the register
then the 1000s get next position, then sub that value * 1000 from register
and so forth
bidsen
yeah
tiocsti
till you get to the 1s
bidsen
ok so what about the leading 0's part ? :D
through substractions...
right
10x
thx a lot dud8
tiocsti
well lets say your register was 123, with the algorithm i gave you, you'd end up with 00123, which is prob not what you want
bidsen
yeah...
tiocsti
so when displaying, you can skip the 0s until you get a valid number, then start outputting from there
bidsen
right
Enferex
I was thinking about a program such as memtest86. I need to access RAM and cache. Now the question is, I could start by accessing 0x0000 and working my way up. But that seems a bit incorrect because 1) How can I tell if I'm accessing cache, and 2) When the RAM ends?
santabug
`lo
« prev