logs archiveIRC Archive / Undernet / #asm / 2006 / March / 11 / 1
Dayus
hi?
hi
fedex
Hi Dayus.
Dayus
hi
:)
im seeking help
fedex
Okay.
Help in what?
Dayus
you know nasm?
fedex
I don't use nasm.
Dayus
hmmm
fedex
Is it a problem with NASM or ASM in general?
Dayus
well i guess both
im not very good in ASM
         

fedex
Maybe you can tell me about the problem.
Dayus
and i have a work to do ...
im a lil confuse
fedex
You mean school assignment? :]
Nevermind, explain your problem.
Dayus
the notes given by the teacher are not clear at all
fedex
Paste me the note.
Dayus
its like 84 pages in pdf :P
fedex
hmm....what's the point of the whole note?
Dayus
it talk a lot about memory
fedex
Okay.
And?
Dayus
but very little about the operation
fedex
It assumes you have the basics to work by the instruction given by the manual.
Anyway, maybe you can get into the point.
Dayus
like if id like to know about MUL
its doesntn explain it at all
it show not clear example of its use...
fedex
That's when your INTEL manuals comes in handy.
Dayus
really?
:P
fedex
Yes.
Dayus
i should check it out
but anyway
i want to check the marks of student
to see how many there is that are over 90
so the mark scale is from 0 to 100
and they say its stored in a single bytes unsigned integer
and right there im confuse
1 byte is 4 bits
Inode
no, 1 byte is usually 8 bits
Dayus
so 4 binary number
8 bits
oups
ok
so 8 binary
making 2 hexa
00h
right?
Inode
yar
fedex
So?
         

Dayus
so 0 to 100 would be
00h to ...
hmmm
Inode
64h
Dayus
oh thanks
Inode
max value of a byte is FFh
which is 255
Dayus
so
all result above 5Ah
is to be counted
Inode
ok
fedex
Dayus: What's the real problem?
Dayus
i dont know how to do it...
fedex
You can't do the assignment or there is something wrong in the code?
Which part exactly?
Dayus
how do you compare
fedex
cmp
cmp eax, 4
for example
Dayus
so i do cmp ebx, eax
fedex
Yes.
Dayus
eax being 5Ah
?
fedex
I dont really know whats the value inside EAX
Dayus
but thats not telling me its over 90% it tell me its the same...
fedex
It depends to you
Inode
say your byte is in al.... cmp al, 5Ah | jg OVER_90 | jmp FAIL
Dayus
in ebx i put the socre of one student
Inode
jg == jump if greater
fedex
jge
Dayus
aawww
yes
so i do the cmp
Inode
ok yep... jge is the correct one
Dayus
and after
i do the jg
fedex
jge
Dayus
make sens
fedex
Yes.
Inode
no jge... jump if greater or equal
Dayus
ok
fedex
Yes, he have a range to check Inode.
HE won't be taking only 1 point.
Dayus
if not i dont increment if it is i do increment my register...
Inode
i meant....
no to... <Dayus> i do the jg
fedex
Okay.
Sorry, misread it.
Inode
heh bad grammar sorry
Dayus
well thanks guy
fedex
Np, bad sight ^_^
Dayus
i should be able to do this easy one :P
fedex
I guess so.
Dayus
but some more difficult ahead :S
fedex
Dauys: How are you getting the scores of the students?
Dayus
i should have kept my old notes about ASM
fedex
Through a file or a hardcoded array?
Dayus
they dont really specify
fedex
I see.
Dayus
i just have to write part of the code
fedex
You will write a function then.
Dayus
they say it start a some address
fedex
Ahh, okay.
Then it wil be passed to your function
Just assume the data is passed to you in EAX or something
and start working from there.
Dayus
so i just do a add [ebx], something
to move in the memory
fedex
Why?
Why would you add?
Dayus
cause the score a 1 byte
so i move ebx one byte everytime
to see the next score
no?
Inode
you don't use add for that
fedex
inc
Dayus
inc is one byte?
wait
fedex
I think 1/2
That's not HALF, btw.
Inode: I think he doesn't know what he's talking about.
Am going to sleep.
Goodnight!
Dayus
so you want me to do inc [ebx]
Inode
inc is increment by 1, it'll work for 8 (al), 16 (ax) and 32 (eax) bit regs
Dayus
ok
Inode
you would do... inc ebx
Dayus
wont it increment the value in ebx?
Inode
because i guess ebx would hold a pointer (address of the scores) to the scores
Dayus
yes
ok
Inode
yar
Dayus
i get it
ok ill try to write it
Inode
so to get the next byte, you'll add 1 to the pointer
Dayus
make sense
« prev 1 2 3 4 next »