Results 1 to 6 of 6

Thread: I am newbie. Help with this "hello world" app please!!

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    I am newbie. Help with this "hello world" app please!!

    I just read a tutorial on writting "hello world" app in asm but I am confused on this code

    Code:
    mov ax, SEG msg
    mov ds, ax

    Why can't I directly put the segment of msg into ds instead of copying it first to ax and then retrieving it in ds?
    Baaaaaaaaah

  2. #2
    Knight_Vision
    Guest
    Ok, DS stands for DATA SEGMENT. It's a pointer. It's not the Accumilator like AX is. You can tell the pointer to point to something else, but it's not a DIRECT RECIEVER of instructions.

    This is how it works.. You tell AX where the message is at. Then AX tells DS - "Ok cheif, when the message is accessed, you are to POINT to that position. But ONLY when your called." So DS understands that and when there is a string to be fed, it then points to the DATA (OR STRING INFO) that you have.

    Hence, this is why you MUST declare WHERE your data is by saying things like :

    message DB "Your string here"

    The word "message" can be anything you want. Even a memory address like 07C0h. It's just a label that DS will point too. The DB means a DATA BYTE. So when DS points to it, it will READ only 1 BYTE of DATA at a time.

    Hope this helps...

  3. #3
    ChimpFace9000
    Guest
    In other words, you just can't.

  4. #4
    Knight_Vision
    Guest
    Hahaha... I could have said it that simply, but I felt he wanted an explanation..

    Knight

  5. #5

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Thanks knight

    Now asm programming is more harder because it is not happening what I expected
    Baaaaaaaaah

  6. #6
    Knight_Vision
    Guest
    Yea, I remember when I was just learning this too. Man I didn't realize how used to HLL's I was. (HLL - High Level Languages. ASM is a Low Level Language)

    When I realized that I could have to create my own routines at first I was like, "No way am I going to get this.. err.." But after a while I started to SLOWLY make my own routines. And as I made more of them my life became easier. So now, I am learning how to REPLACE all of MS's INT numbers.

    I still have a long way to go, but i'm getting there..

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