Jump to content

a quiz

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
adam2009

adam2009

    Newbie

  • Members
  • Pip
  • 2 posts
hey all,

I have some questions in assembly 80x86
and i wondered if anyone could give me a hand...

many thanks
Adam

Attached Files



#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
We don't just do homework. That said, what do you have so far? Guesses, precise questions, anything?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
adam2009

adam2009

    Newbie

  • Members
  • Pip
  • 2 posts

WingedPanther said:

We don't just do homework. That said, what do you have so far? Guesses, precise questions, anything?

i'm sorry
i have my draft written not in english
that's why i didn't attached it
i have translated it shortly, just to show that i did try by myself and got stucked :(



Question 1
external atoi

%macro print_num 1

mov dword[NUMBER], %1
//push NUMBER
//call atoi
//pop eax
// mov dword[NUMBER], eax //what if number is too big?? The result is moved to eax automaticall?
mov eax,0X04
mov ebx,0x01
mov ecx, NUMBER
mov edx 0x020 //32 decimal bytes
int 0x80
//can’t use labels to error printing
%endmacro


Question 2
The code checks how many ones are in ebx

?? there must be a test whether we searched the whole ebx

Byte masking

Calling func?
Doing 32 times

Question 3.1
mov ax, 0x01
inc ax //assuming ax is 0
add ax, 0x01 //assuming ax is 0
or ax, 0x01 //assuming ax is 0

Question 3.2
STC
Shr
?? not good not sure the other digits are zero

Q4
?? is there any catch ?
add y, 0x05 //canot add to memory?
sub x, 0x02
inc dword[z]
//suopposed to be longer…


Q5.1
//-no- carry only in 32 bytes--// Adds cx-1 times the carry from bx*2
Adds the previous carry bit to DX cx times (doest change during calculation)

Q5.2
??

times ecx
times ecx adc Dx, 0