 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Should I continie the tutorial? |
Yes please |
|
96% |
[ 117 ] |
No thanks, I dont care about learning Assembly |
|
3% |
[ 4 ] |
|
Total Votes : 121 |
|
Author |
Message |
sportskid300 Grandmaster Cheater
Reputation: 0
Joined: 22 Jun 2006 Posts: 944 Location: You Wish.
|
Posted: Mon Jun 04, 2007 9:24 pm Post subject: [Tutorial] MASM32! Second Installment is in. |
|
|
ITS OFFICIAL, THE SECOND PART IS RELEASED!!
Thank you for all the support, 'yes' votes keep rising
Thank you for all your patience
VOTES SO FAR:
Yes: Around 95
No: 2
I apologize, for I cannot change poll options or even add another optoin.
Hey everyone.
I've recently taken up learning ASM, and realized how difficult it is to make the start, if you've never seen or studied any coding before.
This in mind, I've put together a tutorial, in hopes of jump-starting you.
Try to understand everything in one topic before moving on to the next concept.
I have added (#) after significant lines, or after lines you haven't seen yet, with explanations below.
Enjoy!
Topic 1: The assembler.
I use MASM, or Microsoft Auto-Assembler.
You can download that here: http://website.assemblercode.com/masm32/m32v9r.zip
Click 'Open', then run 'install'
There are a few others, but I would recommend MASM. It's the most noob-friendly.
I will be in QEditor the entire time. For the time being, don't worry about TheGun.
Everything in this tutorial is done from QEditor. That's the one you have a shortcut to on your desktop.
Any time I refer to clicking something, it will be in the menu bar on QEditor.
MASM is very similar to Auto Assemble (Cheat Engine function)
If you consider yourself proficient in AA, you should get along nicely with MASM.
Now, read carefully, this is important. I'm going to describe the different sections of a souce script. In order from top to bottom
(1) The include section:
Very first thing at the top of ANY script, does not have a defined beginning.
This tells the assembler which files or libraries to include. These define the commands, so you must have them
The example below contains a general use include.
Before it ends, even though it doesn't fall under including, defining prototypes also occurs before the data section.
You will see me using this in the dialog topic.
(2) Data section:
The section has its beginning defined by '.data'
In here, you enter Dword symbols and allocate values.
It's useful for much more, but I won't be covering much more than that
(3) Uninitialized data section:
Beginning defined by '.data?' Yes, I MEANT to include the question mark.
You use this for moving a function into allocated memory. Won't be seeing it in this tutorial.
(4)Code section:
Beginning defined by '.code'
Basically, it just shows the assembler when you are going to start telling it what your program is gonna do.
Where most all of the source is located.
I may refer to any of these sections during the tutorial.
Please make sure you know what they are (in general).
A great source for learning can be found in the 'Tutorial' directory of the main MASM directory.
Has explanations for most every line. Once you fully understand each code in there, move on to the 'example' directory.
No explanations, but it teaches a lot.
Assembling a program can be done one of two ways: With or without a console.
To assemble, click 'Project'
From there, you either click 'Assemble and Link', or 'Console Assemble and Link'
You will need to use the console until way later, when you learn how to create and control dialogs, and even later, windows.
Seeing as I'm not that good, you won't be learning that.
So just always use 'Console Assemble and Link', unless you want your program to crash a lot.
Topic 2: A beginner's entrance to ASM
Let's start with a basic skeleton:
Code: |
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc ; always first
include \masm32\macros\macros.asm ; MASM support macros
; -----------------------------------------------------------------
; include files that have MASM format prototypes for function calls
; -----------------------------------------------------------------
include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
; ------------------------------------------------
; Library files that have definitions for function
; exports and tested reliable prebuilt code.
; ------------------------------------------------
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.code ; (2)
start: ; (3)
call main ; (4)
exit ; (5)
main proc ; (6)
print chr$("Hello world!",10) ; (7)
inkey "Enter any key to continue...." ; (8)
ret ; (9)
main endp ; (10)
end start ; (11)
|
Explanations:
(1) This section is dedicated to describing your program. PLEASE look at C:\masm32\tutorial\console\demo1\hello.asm for explanations.
This entire section was copy/pasted right out of there!
This include macro covers all these things: Code: | include \masm32\include\masm32rt.inc | I will be using this for the rest of my tutorial.
(2) .code, anywhere, tell's the assembler where the code starts. It's the main section of your entire program.
(3) Where "start:" is, anything with an ':' it would work fine. It's basically a label. It spans your entire program.
(4) This calls the procedure, "main". You don't have to, but it is recommended in the examples. You can jump to a procedure.
(5) This tell's the assembler to exit the program. Terminates the program. It won't do this until any procedures called have returned back to it.
That's why I like to call a main procedure from start.
(6) Where you see 'main', anything would do the trick. This shows the assembler when a certain procedure starts. May be jumped to.
(7) Yes, it had to be a 'Hello World' program. I will describe the function later.
(8) This basically askes for an input to move on. The stuff between the quotes can be changed.
(9) This returns to the line after it was called from. Without it, the program with terminate.
(10) Defines the end of the procedure, 'main'. Change 'main' as the procedure definition changes (main proc)
(11) This declares the end of 'start'. Basically the end of the program. Put it at the very end of your program.
Now, Go to 'Project'-->'Console Assemble and Link'. Your first program!
Now, to add another procedure, add another 'call' function under the first.
Make sure to include another procedure.
Quick example:
Code: |
include \masm32\include\masm32rt.inc
.code
start:
call main
call another
exit
main proc
print chr$("Hello world!",10)
inkey "Enyer any key to continue
ret
main endp
another proc
print chr$("I'm in the second procedure now",10)
push 2000 ; (1)
call Sleep ; (1)
ret
another endp
end start
|
Explanation:
(1) These two commands, together, stall your program for the amount after push in thousandths of a second.
The means 1000 is one second, so on and so forth.
See how I added another procedure within 'start', but outside the procedure, 'main'?
Thats how you use more processes, along with the other 'call' I added.
You may assemble this.
Topic 3: Variables!
Variables may be registered in one of many ways.
The first of which, using LOCAL
A quick example with explanation:
Using LOCAL is probably the LEAST effecient way of registering a variable. Let me tell you why:
(1) You MUST have it registered within a procedure. You can't assemble if its under start.
(2) It is only defined for the one procedure you defined it in. Redefining the same variable will result in error
A much more effecient way is allocating a DWORD in the .data section
Under your includes, write '.data'
From there, you type in a preferred symbol, and allocate it a value.
Quick example:
Code: |
include \masm32\include\masm32rt.inc
.data
weiner dd 10
.code
|
Of course, the above won't assemble, but you get the idea.
I just allocated a dword, labeled it 'weiner', and set its value to 10.
This way of allocating variables has many advantages over LOCALS:
(1) It can effect the ENTIRE script
(2) If you change its value, it will not reset back to its original value in a different procedure
In general, its easier, more effecient, and has a larger range of uses.
It is at this point that Part 2 starts
Topic 4: Looping
The easiest way to loop is probably with conditional jumps.
That is where you copare two things, and go to some other part of code based on the outcome.
Example:
Code: |
cmp eax, ecx
jg bigger
jl smaller
jz zero
jmp same |
Many of you may not be familiar with 'jz'. 'jz' denotes Jump if zero.
Similarly, 'jnz' denotes jump if not zero.
A good use of loops, in mathematics, is for sequences.
A sequence is a bunch of terms related by their difference or factor.
Most of you guys will be too lazy to, but try to code it yourself before looking at my source.
Two examples:
Example 1: Show a series of numbers that are the previous number with three added to it. Start with 1. Show 10 terms.
Code: |
include \masm32\include\masm32rt.inc
.code
start:
call main
exit
main proc
LOCAL var1:DWORD
LOCAL number:DWORD
mov var1, 10
mov number, 1
begin: ; (1)
push 200
call Sleep
add number, 3
print str$(number) ; (2)
print chr$(10,10) ; (3)
dec var1
cmp var1, 0
jne begin
print chr$("I've shown ten now!")
push 2000
call Sleep
ret
main endp
end start |
This kind of thing could be created multiple other ways. Try to make your own, with reference to mine as a source of help.
Explanations:
(1) This is a label. These are very useful if you need to skip parts of your script. (Moving assigned values to variables) Can be jumped to within the same procedure.
(2) Similar to 'print chr()', but prints the value of a string or variable. Very useful.
(3) I'm not sure if this was confusing, but all I did was skip two lines. No text.
Now, for example 2. It is more complex, but don't get thrown:
Show a series of numbers that are the previous number multiplied by 2, then add 3 to it. Start with 1. Show 10 terms.
Code: |
include \masm32\include\masm32rt.inc
.code
start:
call main
exit
main proc
LOCAL var1:DWORD
LOCAL number:DWORD
mov var1, 10
mov number, 1
begin:
push 600
call Sleep
mov eax, number
mov ebx, 2
imul eax, ebx ; (1)
add eax, 3
mov number, eax
print str$(number)
print chr$(10,10)
dec var1
cmp var1, 0
jne begin
print chr$("I've shown ten now!")
push 2000
call Sleep
ret
main endp
end start |
Once again, there are multiple ways to accomplish this, but this is the easiest.
Explanations:
(1) Multiplication. Multiplies the two numbers, and stores the result in the first string. Works with registers, not variables or numbers.
By this time, you should have a decent idea of how to work with figures.
Now, you can incoporperate this math skill with what I'm about to show you.
Topic 5: Inputs
Inputs are values of choice, submitted by the person running the program.
Basic skeleton for getting an input value:
Code: |
......
main proc
LOCAL var1:DWORD
mov var1, sval(input("Enter a number: "))
......
|
This takes an input, and makes it a readable value, then stores it in var1.
With this, you can make things loop the specified number of times, choose a number to multiply, add, subtract, and divide by, etc.
Quick example of how useful this macro is:
Code: |
include \masm32\include\masm32rt.inc
.code
start:
call main
exit
main proc
LOCAL starter:DWORD
LOCAL times:DWORD
LOCAL multiply:DWORD
LOCAL adding:DWORD
LOCAL subtracting:DWORD
print chr$("This little sequence maker will take a bunch of inputs. Then, it will add to your starter, multiply, then subtract, and show the result, for the specified number of terms. Enjoy!",10,10)
mov starter, sval(input("What number should I start with? "))
mov times, sval(input(10,10,"How many terms should I show? "))
mov adding, sval(input(10,10,"What number should I add, in the beginning? "))
mov multiply, sval(input(10,10,"What number should I multiply by? "))
mov subtracting, sval(input(10,10,"What number should I subtract, at the very end? "))
print chr$(10,"Here we go:",10,10)
begin:
push 1000
call Sleep
mov eax, starter
mov ebx, adding
add eax, ebx
mov ebx, multiply
imul eax, ebx
mov ebx, subtracting
sub eax, ebx
mov starter, eax
print str$(starter)
print chr$(10,10)
dec times
cmp times, 0
jne begin
print chr$("All done! feel free to check answers")
push 5000
call Sleep
ret
main endp
end start |
As I said, you can check any answers you want.
As long as you dont try to put in negative numbers, or letters, it should work fine.
You may modify this however you like.
Additional on Labels:
appalsap wrote: |
anonymous operators
@@: makes one
@F is the next @@
@B is the previous @@ |
Thanks to appal for this little tidbit.
I realize that my original date has been postponed quite a bit.
This is due to studying finals and the like.
I may make more if I have free time over the summer.
LOOK IN THE EXAMPLE DIRECTORY TO GET BETTER BY YOURSELF!
_________________
Last edited by sportskid300 on Sat Jul 14, 2007 12:09 pm; edited 27 times in total |
|
Back to top |
|
 |
Simsgy Grandmaster Cheater
Reputation: 0
Joined: 07 May 2007 Posts: 581 Location: My new avatar <3
|
Posted: Mon Jun 04, 2007 9:41 pm Post subject: |
|
|
Wow, I am starting to read it right now.
_________________
|
|
Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Mon Jun 04, 2007 9:44 pm Post subject: |
|
|
programming section...
_________________
|
|
Back to top |
|
 |
sportskid300 Grandmaster Cheater
Reputation: 0
Joined: 22 Jun 2006 Posts: 944 Location: You Wish.
|
Posted: Tue Jun 05, 2007 3:51 pm Post subject: |
|
|
I know sponge, but do you think anyone who actually needs this would think to go there?
NO.
_________________
|
|
Back to top |
|
 |
Fis.Dollaz Grandmaster Cheater Supreme
Reputation: 0
Joined: 29 Nov 2006 Posts: 1328 Location: Philadelphia
|
Posted: Tue Jun 05, 2007 4:52 pm Post subject: |
|
|
Nice tut!
Please finish.
|
|
Back to top |
|
 |
Darkpyro Master Cheater
Reputation: 0
Joined: 03 May 2007 Posts: 303
|
Posted: Tue Jun 05, 2007 5:02 pm Post subject: |
|
|
You should finish it, it will help alot of people( aka me) because i dont get some of the stuff on the others tuts of asm.....however, it will be more interesting, if someone put a tut, on how to find the addys, because asm, is just to "active them" and find addys are the hardest thing to do..
|
|
Back to top |
|
 |
sportskid300 Grandmaster Cheater
Reputation: 0
Joined: 22 Jun 2006 Posts: 944 Location: You Wish.
|
Posted: Tue Jun 05, 2007 5:04 pm Post subject: |
|
|
This is more about the actual assembly language.
Its not a MapleStory hacking tut.
_________________
|
|
Back to top |
|
 |
Mapleblitzer Master Cheater
Reputation: 0
Joined: 08 Apr 2007 Posts: 254
|
Posted: Tue Jun 05, 2007 5:10 pm Post subject: |
|
|
Definitely continue this, I hope they sticky this, but at the same time I hope they don't, because then people will be less likely to find it. Good job!
|
|
Back to top |
|
 |
ScAr Grandmaster Cheater
Reputation: 0
Joined: 21 Oct 2006 Posts: 786
|
Posted: Tue Jun 05, 2007 5:11 pm Post subject: |
|
|
Wow thank you so much...I would give you rep but currently out = (
_________________
Meh Ist Teh Leetz
.jpg) |
|
Back to top |
|
 |
Renkokuken GO Moderator
Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Tue Jun 05, 2007 6:04 pm Post subject: |
|
|
This is very sexy.
|
|
Back to top |
|
 |
sportskid300 Grandmaster Cheater
Reputation: 0
Joined: 22 Jun 2006 Posts: 944 Location: You Wish.
|
Posted: Tue Jun 05, 2007 6:45 pm Post subject: |
|
|
Thanks you guys, not a single 'no' yet.
Just waiting for the idiots who only want to leech.
_________________
|
|
Back to top |
|
 |
MrFriedRice Grandmaster Cheater Supreme
Reputation: 0
Joined: 03 Oct 2006 Posts: 1418 Location: New York City
|
Posted: Wed Jun 06, 2007 12:18 pm Post subject: |
|
|
Bumping this because I find this tutorial to be important.
_________________
xMurtaghx wrote: | Ok if that's the way its going to be then Fuck you too,
Suggestion: get your Cocasian ass to Mongolia. |
Blank wrote: |
Quoted to save it.
Get my caucasian ass back to mongolia?
Someone needs a dictionary on what a 'caucasian' person is.
|
LAWL. |
|
Back to top |
|
 |
shedox Master Cheater
Reputation: 0
Joined: 23 Jan 2007 Posts: 354
|
Posted: Wed Jun 06, 2007 12:20 pm Post subject: |
|
|
thx, masm is intersting...
post other tut .....
_________________
|
|
Back to top |
|
 |
xPerfection Grandmaster Cheater Supreme
Reputation: 0
Joined: 06 Dec 2006 Posts: 1707 Location: echo $location
|
Posted: Wed Jun 06, 2007 12:21 pm Post subject: |
|
|
******
_________________
Last edited by xPerfection on Sun Aug 16, 2009 7:16 am; edited 1 time in total |
|
Back to top |
|
 |
Nuclear898 Grandmaster Cheater Supreme
Reputation: 0
Joined: 04 Jun 2006 Posts: 1597 Location: The Netherlands
|
Posted: Wed Jun 06, 2007 12:23 pm Post subject: |
|
|
*improve, not inprove
|
|
Back to top |
|
 |
|
|
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
|
|