Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Playing with dwords?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
sportskid300
Grandmaster Cheater
Reputation: 0

Joined: 22 Jun 2006
Posts: 944
Location: You Wish.

PostPosted: Tue Jun 05, 2007 8:43 pm    Post subject: Playing with dwords? Reply with quote

As far as I know, I have to keep moving dwords into registers to mess with them.
Is there a way around this?
The reason I ask is because Im trying to make a simple program that spits out a specified number of terms in the Fibonacci sequence.
In case you didn't know, the Fibonacci sequence works like this:
1st term: 1
2nd term: 1
3rd term: addition of the first terms (2)
4th term: addiction of the last 2 terms (1+2=3)
5th term: addition of the last two terms (3+2=5)
So on and so forth.
This is as far as I got:
Code:

include \masm32\include\masm32rt.inc

.data

ass dd 1
ass1 dd 1
count dd 0
timer dd 0

.code

start:

call main
invoke ExitProcess, 0

main proc

mov ass, 1
mov ass1, 1
mov count, sval(input("How many terms of the Fibonacci sequence would you like shown? "))
mov eax, count
sub eax, 2
mov count, eax
cmp count, 0
jg first
je only
invoke ExitProcess, 0
only:
print chr$(10,"1",10,10,"1",10,10)
push 1000
call Sleep
invoke ExitProcess, 0
first:
print chr$(10,"1",10,10,"1",10,10)
do:
mov eax, ass
mov ebx, ass1
add eax, ebx
print str$(eax)
mov ass, eax
mov ass1, ebx
call space
mov eax, ass
mov ebx, ass1
add ebx, eax
print str$(ebx)
mov ass, eax
mov ass1, ebx
call space
jmp do

main endp

space proc

print chr$(10,10)
mov ecx, timer
mov edx, count
inc ecx
cmp ecx, edx
jne dont
push 1000
call Sleep
invoke ExitProcess, 0
dont:
mov timer, ecx
mov edx, count
push 800
call Sleep
ret

space endp

end start

It assembles just fine, but if you run it, it spits out:
1
1
2
2
3
3
etc...
Thanks for the help!

_________________
Thanks to Mr.Mohammed for the Avatar!
http://forum.cheatengine.org/viewtopic.php?t=92760&sid=b5cfb5d8e759c2b023910472b2fac2e8 EXCELLENT ASM TUT!

If you need help, ask!
http://www.youtube.com/watch?v=cW44BpXpjYw INSANE Line Rider!
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Tue Jun 05, 2007 9:06 pm    Post subject: Reply with quote

thats because the extended register set is 32 bits or a dword... so you have to move it in. or else it wont fit... for smaller registers use the unextended set...ax bx dx cx... di si... etc. or even smaller ah al bh bl ch cl dh dl
_________________
Back to top
View user's profile Send private message
sportskid300
Grandmaster Cheater
Reputation: 0

Joined: 22 Jun 2006
Posts: 944
Location: You Wish.

PostPosted: Tue Jun 05, 2007 9:09 pm    Post subject: Reply with quote

wait what?
sponge I need ur MSN :'(

_________________
Thanks to Mr.Mohammed for the Avatar!
http://forum.cheatengine.org/viewtopic.php?t=92760&sid=b5cfb5d8e759c2b023910472b2fac2e8 EXCELLENT ASM TUT!

If you need help, ask!
http://www.youtube.com/watch?v=cW44BpXpjYw INSANE Line Rider!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites