_asm - what is it?

This is a discussion on _asm - what is it? within the Windows Programming forums, part of the Platform Specific Boards category; Funny, i was just reading that when I saw this reply. But I didn't actually find an answer to my ...

  1. #16
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Funny, i was just reading that when I saw this reply.

    But I didn't actually find an answer to my question if an exe can be translated to asm.
    Last edited by maxorator; 06-27-2006 at 02:38 PM.

  2. #17
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Yes, you can convert machine code to assembly. (Disassembling.) However, you lose comments, notation, variable names, labels, etc - anything to explain what the code actually does, other than the raw commands themselves, making the code very hard to comprehend. (As, I think, already seen in this thread.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #18
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    That code is stupid. I've looked at it many times and cannot fathom why someone would want to do that.

    It uses 3 registers, eax, ecx, and edx. Eax and edx are explicit return registers as well as ecx, but ecx is normally used as a count register in preparation for a string operation - usually using the rep prefix.

    It is far easier to access structures in pure asm code and/or in inline assembly code. Inline assembly will allow you to access structures provided you load the base address of the structure. An example from MSVC help file:

    Code:
    // InlineAssembler_Accessing_C_asm_Blocks.cpp
    // processor: x86
    #include <stdio.h>
    struct first_type
    {
       char *weasel;
       int same_name;
    };
    
    struct second_type
    {
       int wonton;
       long same_name;
    };
    
    int main()
    {
       struct first_type hal;
       struct second_type oat;
    
       __asm
       {
          lea ebx, hal
          mov ecx, [ebx]hal.same_name ; Must use 'hal'
          mov esi, [ebx].weasel       ; Can omit 'hal'
       }
       return 0;
    }
    If you are attempting to access variables in memory based on information from a hack site about hacking Vice City - I think this discussion is over. I won't help you poke around in another process's memory.

  4. #19
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Well, actually, if you've noticed, the program is not made by me and is "Vice City Multiplayer" and I am just trying to understand what it's functions do.

    It just seems that the real coders weren't very smart...
    Last edited by maxorator; 06-28-2006 at 03:24 AM.

  5. #20
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Even without comments and variable names it is possible to understand the code (if it is not too complicated program).

    I just like the idea that I can "change" simple programs. (For example change strings.)
    Last edited by maxorator; 06-28-2006 at 04:24 AM.

  6. #21
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    Well if it's understanding of C++ code you're after, then find something else.

    This is either
    - A half-assed attempt at reverse engineering ASM code back to C++
    - A deliberate attempt at obfuscation by turning what was a C++ program into a mixed-language mess.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #22
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I highly doubt this came out of Rockstar Games. This code is horrible.

  8. #23
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    No, actually Vice City Multiplayer was developed by some other people (some very HORRIBLE coders).
    Code:
    //----------------------------------------------------------
    //
    // VC:MP Multiplayer Modification For GTA:VC
    // Copyright 2004-2005 SA:MP team
    //
    // File Author: kyeman
    //
    //----------------------------------------------------------

  9. #24
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    just a question being as this topic has been mentioned.

    I know _asm is the inline assembly keyword, but can anyone tell me what type/brand of assembly language this is? for example there are many x86 assemblers, masm, tasm, nasm, fasm, etc. so what would this be?

    say for example I want to learn some Assembly soon. just to use inline in my C++ programs (I don't intend on leaving C++ for Assembly, Assembly seems TOO low level for me, languages like Pascal are TOO high level for me, C is just right, for me at least). what assembler do you recommend that I should learn/use?
    Last edited by Bleech; 06-28-2006 at 08:46 PM.

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

  10. #25
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    This is x86 assembly language, otherwise known as 8086 assembly. TASM, MASM, FASM, BASM, NASM - all just assemblers.

    Since this is inline assembly and based on the example, I'd say this is Visual Studio's inline assembler syntax. Note that it does differ from MASM in several ways.

  11. #26
    Registered User
    Join Date
    Nov 2002
    Posts
    3

    Smile

    Hi there,

    For more information about assembler in the Windows environment (or in general) I hope you don't mind pointing out a forum dedicated to it at www.asmcommunity.net/board/ .

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21