flat assembler
Message board for the users of flat assembler.
Index
> Windows > Beginner Assembly Question |
Author |
|
ragnar_graybeard87 28 Mar 2016, 01:13
Hey guys,
I included the source for the program in question. Basically, I'm following the UDEMY asm tutorial by XorPD and I'm stuck on one of the questions. It says to get a 32-bit integer as input then decompose it into 4 bytes then add them. Obviously the AL and AH were easy to get at but it says to figure out the extended 4 bytes by using DiV. My approach was to save AL and AH to another reg then zero out AX then keep dividing EAX by ECX (inc'ing by 1 till they matched) in hopes that it'd save the bytes into CX but it seems to place them into the extended portionl. I guess all I'm asking is how could I access those top bytes without using a fancy instruction which we haven't been introduced to yet? I'm sure its simpler than I'm making it out to be however I can't figure it out on my own so any suggestions and pointers would be highly appreciated! Thanks in advance
|
|||||||||||
28 Mar 2016, 01:13 |
|
ragnar_graybeard87 28 Mar 2016, 02:41
That's amazing, I've been pulling my hair out trying to figure it out. I wouldn't have guessed the 10000h in a million years. In fact I realize I wasn't even doing the addition properly. I thought I'd be able to do this once I got the bytes in the right containers:
add ah,ch add al,cl then the sum of all 4 would be inside AH and AL which should be AX so then I'd: movzx EAX,AX call print_eax but I never got the desired result. Thank you again for helping me with this its very very appreciated. Now I can figure out why this code does what it does and start learning bitwise operations |
|||
28 Mar 2016, 02:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.