The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Assembly


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 08-05-2007, 01:29 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Icon8 Do you use Assembly programming?

Why do you want to use Assembly programming for?
I haven't actually touched assembly at all, but it seems like the closest language to machine... What do people usually use assembly programming for? I've heard about embedded system, but I also have been told that people mostly are using C...

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 08-05-2007, 02:16 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 615
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
I have never made a program that uses it though i have learnt about it in class a little on the basic commands and what they do, i know programs such as keygens that are used to unlock software illegally often use ASM, i think in general reverse software engineering of programs uses ASM to do things if you get what i mean?

Reverse software engineering has been something i am interested in but it seems and i have been told its very hard to understand sometimes so really i am focusing on other things before looking into this.
Reply With Quote
  #3 (permalink)  
Old 08-05-2007, 10:39 PM
rpgfan3233 rpgfan3233 is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jul 2007
Posts: 118
iTrader: (0)
rpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura aboutrpgfan3233 has a spectacular aura about
Quote:
Originally Posted by Lee View Post
Reverse software engineering has been something i am interested in but it seems and i have been told its very hard to understand sometimes so really i am focusing on other things before looking into this.
When you say "its very hard to understand sometimes", are you referring to ASM or reverse engineering? I've never tried the latter other than converting simple file formats. As for ASM, the most important thing you can do is comment. A simple factorial function in ASM (note - using Intel syntax with the NASM assembler):
Code:
global _factorial ;let a linker know this function exists

;C prototype - int factorial (int argument);
_factorial:
    push    ebp
    mov     ebp, esp    ;preserve the stack pointer
    sub     esp, 4      ;reserve 4 bytes for local storage

    mov     eax, dword [ebp + 8] ;copy 1st function argument into EBX
    cmp     eax, 1
    jg      factorial_run        ;if (EAX > 1) goto factorial_run
    mov     eax, 1               ;set EAX to 1 (our return value can't be less than 1)
    jmp     factorial_end        ;goto factorial_end

factorial_run:
    mov     dword [esp], eax    ;copy EAX onto the top of the stack
    dec     eax                 ;eax = eax - 1 (or eax--)
    push    eax
    call    _factorial          ;factorial(EAX)
    ;return value of the the function is stored in EAX

    add     esp, 4        ;set the stack pointer back to our saved value
    imul    dword [esp]   ;if we omit the destination, it is assumed to be EAX, which is convenient in this case

factorial_end:
    mov     esp, ebp    ;restore the stack pointer
    pop     ebp         ;finish restoring the original stuff
    ret                 ;return (EAX)
Simple, right?

All of that code in ASM is equivalent to:
PHP Code:
int factorial (int argument) {
    if (
argument 1)
        return (
argument factorial(argument 1));
    return 
1;

Care to compare the file sizes of the object files (compiled (if necessary) and assembled, but not linked with libraries)? The file size of the C function alone is 575 bytes for me. The file size of an entire ASM program that demonstrates the ASM version of the function is 483 bytes. While that's a little less than 100 bytes, that amount of saved space can really come in handy for making things run faster, especially for things like games. My ASM version could be structured differently, but I figured I'd add something in to make things more logical when something like -14 was passed to the factorial function. Typically, I don't even check for that because I am just writing it to get it done with.

__________________
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."
-- Bjarne Stroustrup, creator of what is now known as C++
For more quotes by Bjarne Stroustrup, check out http://www.research.att.com/~bs/bs_faq.html#really-say-that.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by rpgfan3233 : 08-05-2007 at 10:50 PM.
Reply With Quote
The Following User Says Thank You to rpgfan3233 For This Useful Post:
HelloWorld (08-05-2007)
  #4 (permalink)  
Old 08-05-2007, 11:17 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
keygens that are used to unlock software illegally often use ASM
Can't you just use Brute Force if you're using another language
well, it's slow, but wouldn't that work? I never actually done it, but my discrete mathematics class gives me some imagination how to crack software too lol...

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

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



All times are GMT -7. The time now is 06:21 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50