|
-
Jul 31st, 2001, 01:52 AM
#1
Thread Starter
PowerPoster
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?
-
Jul 31st, 2001, 10:54 AM
#2
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...
-
Jul 31st, 2001, 11:02 AM
#3
In other words, you just can't.
-
Jul 31st, 2001, 11:03 AM
#4
Hahaha... I could have said it that simply, but I felt he wanted an explanation.. 
Knight
-
Jul 31st, 2001, 08:00 PM
#5
Thread Starter
PowerPoster
Thanks knight
Now asm programming is more harder because it is not happening what I expected
-
Aug 1st, 2001, 10:21 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|