Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Assembly

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Assembly
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

Learning ASM for the 1st time (slight problem)
Old 01-17-2010, 09:34 PM   #1
Junior Member

why06's Avatar

Join Date: Dec 2009
Posts: 40
Reputation: 114
Rep Power: 28
why06 is officially drafted by UCwhy06 is officially drafted by UC
Last Achievements
Learning ASM for the 1st time (slight problem)

So I'm starting out learning asm and my code won't compile. At first I thought it was a compiler problem, but now I think it may be a problem with the code. Even though the code is supposed to be for an 8086 processor I think something is wrong.

here's the code the book gave me:
Code:
; prog1

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STACKSEG    SEGMENT   STACK  'STACK'

             dw     200 dup (?)

STACKSEG    ENDS
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DATASTUFF    SEGMENT   PUBLIC  'DATA'

; + + + + + + + + + + + + + + + START DATA BELOW THIS LINE

; + + + + + + + + + + + + + + + END DATA ABOVE THIS LINE

DATASTUFF    ENDS
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CODESTUFF    SEGMENT   PUBLIC  'CODE'

       EXTRN  print_num:NEAR , get_num:NEAR 
       EXTRN  get_ascii:NEAR , get_hex:NEAR , get_binary:NEAR

       ASSUME cs:CODESTUFF, ds:DATASTUFF

main   proc far
start: push  ds               ; set up for return
       sub   ax,ax
       push  ax

       mov   ax, DATASTUFF
       mov   ds,ax

; + + + + + + + + + + + + + + + START CODE BELOW THIS LINE
first_label:
                 call get_num
                 call print_num
                 jmp  first_label

; + + + + + + + + + + + + + + + END CODE ABOVE THIS LINE

       ret

main   endp

CODESTUFF    ENDS
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

       END     start
which seemed good at 1st, but now I'm looking around at more up to date code an this is a hello world app written this year by someone else:

Code:
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke MessageBox, NULL, addr HelloWorld, addr HelloWorld, MB_OK
invoke ExitProcess, 0
end start
Now Im thinking the book was written in 1989, which to my knowledge was after Windows NT... I think. So is this code outdated and will no longer compile on a Windows machine or is there just something I did wrong. or both for that matter! o_O


Also the attached document is one of the many chapters Im using for learning asm.... EDIT: can't attach.
why06 is offline

Reply With Quote


Old 01-17-2010, 10:12 PM   #2
Hacker Supreme

Krtek's Avatar

Join Date: Oct 2008
Posts: 235
Reputation: 3567
Rep Power: 80
Krtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating community
A book with code examples that dates 1989 is going to give you a lot more problems than you want. You should try to find a better source.
Krtek is offline

Reply With Quote

Old 01-17-2010, 10:39 PM   #3
Junior Member

why06's Avatar

Threadstarter
Join Date: Dec 2009
Posts: 40
Reputation: 114
Rep Power: 28
why06 is officially drafted by UCwhy06 is officially drafted by UC
Last Achievements
Quote:
Originally Posted by Krtek View Post
A book with code examples that dates 1989 is going to give you a lot more problems than you want. You should try to find a better source.
Yeh I know your right. But the only good tuts I can find is this one http://win32assembly.online.fr/tutorials.html on Windows asm. And I'm looking for one that covers more basic instruction centered asm and less windows. ;(

I also found this one http://www.arl.wustl.edu/~lockwood/c...ofasm/toc.html , but its more like a manual and there's no example code to learn from.

It would be nice if I could find something because I would hate to have to make my own curriculum since I have no idea what to learn 1st and how.

Last edited by why06; 01-17-2010 at 10:44 PM.
why06 is offline

Reply With Quote

Old 01-17-2010, 11:08 PM   #4
Hacker Supreme

Krtek's Avatar

Join Date: Oct 2008
Posts: 235
Reputation: 3567
Rep Power: 80
Krtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating community
Perhaps you will find this useful: Programming Tutorial - Assembly Language

There are other links to useful resources in the topmost thread.

I found using inline assembler in visual studio to be very useful when experimenting with assembly code; it allows you to mix familiar C/C++ with the new assembly in a completely controlled environment.

Last edited by Krtek; 01-17-2010 at 11:14 PM.
Krtek is offline

Reply With Quote

Old 01-18-2010, 12:28 AM   #5
h4x0!2

G36KV's Avatar

Join Date: Nov 2009
Location: Germany
Posts: 116
Reputation: 3743
Rep Power: 66
G36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating communityG36KV is a legend in the cheating community
Points: 3,381, Level: 5
Points: 3,381, Level: 5 Points: 3,381, Level: 5 Points: 3,381, Level: 5
Activity: 14.1%
Activity: 14.1% Activity: 14.1% Activity: 14.1%
Last Achievements
I have some great idea. Why you don't buy a new book? There are some really good new assembly books available -> amazon.com

I don't think any tutorial can ever replace a good book, especially if you really want to learn a programming language.
G36KV is offline

Reply With Quote

Old 01-18-2010, 12:44 AM   #6
Junior Member

why06's Avatar

Threadstarter
Join Date: Dec 2009
Posts: 40
Reputation: 114
Rep Power: 28
why06 is officially drafted by UCwhy06 is officially drafted by UC
Last Achievements
Quote:
Originally Posted by Krtek View Post
Perhaps you will find this useful: Programming Tutorial - Assembly Language

There are other links to useful resources in the topmost thread.

I found using inline assembler in visual studio to be very useful when experimenting with assembly code; it allows you to mix familiar C/C++ with the new assembly in a completely controlled environment.
Well thx for the link and i'll try to use that inline assembler thing too. I'll figure it out the rest out.

@G36: It's hard for me to find the right book. I'm not sure which one I should buy and since most of them are 50 - 100 dollars I'd hat to do it by trial and error. I know I thought Art of ASM would be a good book, but the truth is HLA looks nothing like a disassembly viewed in a debugger.

Last edited by why06; 01-18-2010 at 01:02 AM.
why06 is offline

Reply With Quote

Old 01-18-2010, 01:55 AM   #7
Hacker Supreme

Krtek's Avatar

Join Date: Oct 2008
Posts: 235
Reputation: 3567
Rep Power: 80
Krtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating communityKrtek is a legend in the cheating community
Because assembly is a low level language it is actually pretty simple, or at least to learn how to write and read. There is a set amount of commands and certain rules you need to stick to.

Translating your code from C++ to assembly is a good exercise. Create a function in C ( make it simple ) and then mimic it's behaviour in inline assembly. ( Don't forget to turn of compiler optimization when doing this kind of stuff, it tends to mess things up )

To find most if not all assembly commands you could use the Intel x86 Instruction Set Reference. It is downloadable for free at Intel's site.

On a side note; a book to learn assembly just for cheats is kinda overkill. You don't need to be able to develop an entire game in it .
Krtek is offline

Reply With Quote

Old 08-31-2010, 08:11 PM   #8
Level 3

DeltaCheater's Avatar

Join Date: May 2004
Posts: 18
Reputation: 10
Rep Power: 95
DeltaCheater has made posts that are generally average in quality
Points: 5,655, Level: 8
Points: 5,655, Level: 8 Points: 5,655, Level: 8 Points: 5,655, Level: 8
Activity: 1.2%
Activity: 1.2% Activity: 1.2% Activity: 1.2%
Last Achievements
I recommend you read Assembling Language and Computer Architecture using C++ and Java. I found it real cheap in a specialty book website [forgot the name sorry].

Last edited by DeltaCheater; 08-31-2010 at 10:51 PM.
DeltaCheater is offline

Reply With Quote

Old 09-08-2010, 03:26 AM   #9
I see what u did there

scrapdizle's Avatar

Join Date: Jun 2009
Location: pbcl.dll
Posts: 1,183
Reputation: 36186
Rep Power: 417
scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!scrapdizle has a huge epeen!
Commando Arena Champion George Wants Beer Champion Domino Champion Shotgun: Defend The Flag Champion Elroy Learns To Fly Champion Mini Putt 2 Champion Lumpy Artist Champion Homerun Frenzy Champion Dr.Strangeblix Champion Export Extreme Champion Americas Army Champion X-Training Champion YetiSports 8 - Jungle Swing Champion
Points: 22,478, Level: 21
Points: 22,478, Level: 21 Points: 22,478, Level: 21 Points: 22,478, Level: 21
Activity: 1.1%
Activity: 1.1% Activity: 1.1% Activity: 1.1%
Last Achievements
+rep for reading a book
scrapdizle is online now

Reply With Quote

Old 09-08-2010, 10:36 PM   #10
n00bie

sraeG's Avatar

Join Date: Mar 2009
Location: UK
Posts: 21
Reputation: 599
Rep Power: 41
sraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wall
Fuck reading books.

Firstly, choose your assembler. Alot use fasm/masm so they are recommended. Don't try being one of these tools who think they're cool by picking up tasm/nasm to be different and then finding problems with their code that no-one around knows how to fix as they don't use it.

Next, use Iczelion's tutorials to convert from your old language (on the fasm forum you'll find the code translated into fasm syntax). If you don't already know a language, step the fuck back and goto C/C++ or something. I'm not saying ASM is impossible to learn as a first language, but it helps knowing program flow before you start.

After you have a grip for general syntax (functions/api, conditional jumps, variables..etc.) then start downloading commented source code. As said, for cheats you don't need to be reading a book on how to make apps that count how many apples jim has.

Once you've done this, you should be fine. Remember, a basic trainer is what, like 5 API calls? If you need any help then PM me, but I don't think I'll be around much.. A pre-requisite to doing the above though is knowing enough c++ to code a trainer from scratch, downloading fasm and having enough braincells to entertain me.
__________________
I was once called eVoByTe.. Then I grew up.
sraeG is offline

Reply With Quote

Old 09-08-2010, 11:20 PM   #11
SEGnosis
Guest

Posts: n/a
Quote:
Originally Posted by sraeG View Post
Fuck reading books.
UC is a dangerous wasteland filled with traps around every corner.

Reply With Quote

Old 09-09-2010, 07:12 AM   #12
n00bie

sraeG's Avatar

Join Date: Mar 2009
Location: UK
Posts: 21
Reputation: 599
Rep Power: 41
sraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wall
Why read a book that covers every aspect of asm, or even windows coding for that matter, when in reality we need a very tiny portion of it? Efficiency my friend.

Sure, if you later want to get more advanced then pick up a book or read more advanced tutorials, but that's not really where to start. If you already understand the flow of programs, specifically trainers, and already have knowledge of another language, then really all you need to look up is ASM syntax..
__________________
I was once called eVoByTe.. Then I grew up.
sraeG is offline

Reply With Quote

Old 09-09-2010, 07:32 AM   #13
Super Moderator

Kiwinz's Avatar

Join Date: Jan 2008
Location: New Zealand
Posts: 2,553
Reputation: 73932
Rep Power: 840
Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!Kiwinz has a huge epeen!
Points: 47,223, Level: 32
Points: 47,223, Level: 32 Points: 47,223, Level: 32 Points: 47,223, Level: 32
Activity: 26.4%
Activity: 26.4% Activity: 26.4% Activity: 26.4%
Last Achievements
Some people learn differently. I personally cannot open my ASM Interpreter and start pumping out code just by looking at it with no previous knowledge for ASM.

Theres only so far the 'hands on' approach can go.
__________________



"Those who seek revenge must dig two graves, one for his enemy and another for himself."


On the internet I will - in no shape or form - take personal offence to peoples comments, idea's or views, I assume the people who I reply to won't either.
Kiwinz is online now

Reply With Quote

Old 09-09-2010, 03:01 PM   #14
SEGnosis
Guest

Posts: n/a
Quote:
Originally Posted by sraeG View Post
Why read a book that covers every aspect of asm, or even windows coding for that matter, when in reality we need a very tiny portion of it? Efficiency my friend.

Sure, if you later want to get more advanced then pick up a book or read more advanced tutorials, but that's not really where to start. If you already understand the flow of programs, specifically trainers, and already have knowledge of another language, then really all you need to look up is ASM syntax..
Quote:
we need a very tiny portion of it?
This is the book I have read for understanding asm


Im 150 pages in and even though I have learned alot, its not enough. But every page was full of useful information.

Sure if you wana be a dumbass and just only know how to use jmp and push while a crippled upside down turtle to everything else then your advice would be gold I'm sure.

But telling people to deliberately be a lazy fuck has never been a life lesson in my book.

Reply With Quote

Old 09-09-2010, 05:04 PM   #15
n00bie

sraeG's Avatar

Join Date: Mar 2009
Location: UK
Posts: 21
Reputation: 599
Rep Power: 41
sraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wallsraeG Just put a down payment on his fire-wall
Ah, the old pcasm book.. How did you find the section on API in there, you know, the lovely windows staple that we pretty much NEED (unless you're taking the complicated route) to program trainers and memory hacks? Oh, nvm, doesn't have one.. fantastic. So, as with most books out there, you'll finish 150 pages and know how to program a fairly average calculator that probably uses printf or something to bang your answer on the command prompt. How useful!

As said, my advice was for people coming from a different language (such as C++). Therefore, you should know most of that stuff besides the syntax. If you don't know what an array is, a function, structures, and what variables are then you don't know another language. If you do, then reading 150 pages of text showing what they are and why they are needed when all you actually need to do is pick up the syntax change is pretty stupid, no?

ASM is also a lot of common sense when it comes to the program flow, as it emphasises the need for having a thorough understanding for why you are doing most things. This is the part that takes the longest to learn, and IMO cannot be learnt from books; this comes from practice by either setting challenges to yourself, and/or my personal favourite of re-writing your old programs in the new language.

Telling people to be an inefficient fuck has never been a lesson in mine

Code:
include 'win32ax.inc'

        IDD_MAINDLG     =       101
        IDC_EXIT        =       40001

.data
        hInstance       dd      ?
        hwnd            dd      ?
        pId             dd      ?
        pHandle         dd      ?

.code
        start:
                invoke  GetModuleHandle, 0
                mov     [hInstance], eax
                invoke  DialogBoxParam, [hInstance], IDD_MAINDLG, 0, dlgProc, 0
                invoke  ExitProcess, 0
        .end start

proc    dlgProc, hDlg, uMsg, wParam, lParam
        push    ebx esi edi
        cmp     [uMsg], WM_COMMAND
        je      .wmcommand
        cmp     [uMsg], WM_CLOSE
        je      .wmclose
        cmp     [uMsg], WM_INITDIALOG
        je      .wminitdlg
        cmp     [uMsg], WM_DESTROY
        je      .wmclose
        cmp     [uMsg], WM_COMMAND
        je      .wmcommand
        cmp     [uMsg], WM_TIMER
        je      .wmtimer
        xor     eax, eax
        jmp     .finish

        .wminitdlg:
                invoke  SetTimer, [hDlg], 1, 100, NULL
                mov     eax, 1
                jmp     .finish

        .wmclose:
                invoke  EndDialog, [hDlg], 0
                mov     eax, 1
                jmp     .finish

        .wmcommand:
                mov     eax, [wParam]
                and     eax, 0x0FFFF

                cmp     eax, IDC_EXIT
                je      .wmclose

                mov     eax, 0
                jmp     .finish

        .wmtimer:
                invoke  GetAsyncKeyState, 0x61
                cmp     eax, 0
                je      .finish

                invoke  FindWindow, 0, "Minesweeper"
                mov     [hwnd], eax
                cmp     eax, 0
                je      .finish
                invoke  GetWindowThreadProcessId, [hwnd], pId
                invoke  OpenProcess, PROCESS_ALL_ACCESS, 0, [pId]
                mov     [pHandle], eax
                invoke  WriteProcessMemory, [pHandle], 0xF76B4 , 0x909090, 3, 0
                mov     eax, 0
                jmp     .finish

        .finish:
                pop     edi esi ebx
                ret
endp

section '.rsrc' data readable resource from 'resource.res'
Just need to make a res with the dialog as 101 and an exit button as 40001 to work... simples.
__________________
I was once called eVoByTe.. Then I grew up.

Last edited by sraeG; 09-09-2010 at 06:39 PM.
sraeG is offline

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
1st, asm, learning, problem, slight, time
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 03:20 PM.