Results 1 to 11 of 11

Thread: beginner Assembler question

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    1

    beginner Assembler question

    could someone tell me just what 'space=data', 'align=1' and 'segment my_data' does?
    Yes, it's for schoolwork - unfortunately they didn't bother handing us a book nor explaining it; unless you wanna call 30 lines in notepad an explanation. (and yes, I tried Google, oh Lord how did I try )

    DEFINE my_data,space=data ,align=1,ORG=data_ram

    and segment my_data
    <lots of variables come here>

  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    I know what the segment my_data probably means. That is probably your data segment. This is where you put all of your data (variables and constants) in. I find that different assemblers treat this differently (like MASM and NASM.)

    I am not sure of the others, atm.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    I would assume the DEFINE part is just like the C equivalent. I also assume this is MASM, since DEFINE isn't a valid statement in Turbo Assembler..


    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    The problem is that there are several different assemblers and each has their own take of the syntax.

    This is evident in the differences between MASM and NASM.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    MASM is just different. I like MASM, but its turning into C. They have so many different macros now, that you could almost run a full C file in MASM, and compile it.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  6. #6
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    ( My aside: )
    That is the reason why I cannot see large scale projects written in assembler. Most of the end result looks like C and the rest becomes a jumble of loops. Asssembler, however, is excellent for small bits of code that need to be optimized.
    ( End aside )

    Have you taken a look at HLA? The arguments that you send to the instructions are backwards from the regular 80x86 syntax.

    I founda site that illustrates this:
    http://board.win32asmcommunity.net/p...ddressingModes
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  7. #7
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Ah. I've never actually seen this, thanks for the link.

    I don't think you'll find many people willing to begin a massive project in any type of ASM.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  8. #8
    New Member
    Join Date
    May 2004
    Posts
    13

    Re: beginner Assembler question

    Originally posted by Reck
    could someone tell me just what 'space=data', 'align=1' and 'segment my_data' does?
    Yes, it's for schoolwork - unfortunately they didn't bother handing us a book nor explaining it; unless you wanna call 30 lines in notepad an explanation. (and yes, I tried Google, oh Lord how did I try )

    DEFINE my_data,space=data ,align=1,ORG=data_ram

    and segment my_data
    <lots of variables come here>
    I suspect that the line is saying that you are defining a segment of memory (segments used to be and I assume still are 64k blocks of memory on 64k boundaries 0 - 65535, 65536 - etc...) It's a while since I did any PC assembler language.

    The segment type is data

    The align=1 I suspect means it is Byte aligned rather than word aligned.

    and the ORG tells it that the the space is placed at a memory location referred to by data_ram, usually org would be followed by a memory address eg. ORG $8000 but by using a label, you can change the address of the label to move your data in memory if the preceeding segment gets full.

    Hope I have remembered this stuff correctly and that it helps, although I notice this post is fairly old now... only just joined this forum though... soz.

  9. #9
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    What assembler do you suspect that this code was generated for?
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  10. #10
    New Member
    Join Date
    May 2004
    Posts
    13
    I'm not too sure to be honest, the last time I was doing any assembler on the PC it was in DOS using A86/D86 which was a shareware assembler and it looks similar to what was used then but not identical.

    I could of course be completely wrong with my answer as I am speculating on the terminology. I haven't used any of the Windows based assembler packages and it is several years since I did any PC assembler... actually, come to think of it, it's a lot of years... god I'm too old..

  11. #11
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Hehe. I'm say you are right. I've never seen this in any assembler I've used.

    Tis a stumper

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width