03-19-2003, 08:40 PM
I'm learning ASM from some book I got out of a library.
I have a few questions about memory addressing:
1. What defines a memory segment? Is it virtual, or is it actually physical chunk of memory?
2. I read that an variable's OFFSET is the distance from the beginning of a segment to the variable. That's fine, except when you're reading a variable from SEGMENT:OFFSET, how does the reader know where to stop reading? I mean, with this bit of ASM:
That code displays a message (assembled in MASM 6.11).
I understand all of it, except:
To display a string with INT 21h, function 9, DSX points to the segment:offset of the string. That's fine. But, how does INT 21h know where to stop reading the variable inside the data segment? Wouldn't it just keep reading other data in that segment?
These questions haven't been letting me sleep :evil:
So *someone* answer!!!
I have a few questions about memory addressing:
1. What defines a memory segment? Is it virtual, or is it actually physical chunk of memory?
2. I read that an variable's OFFSET is the distance from the beginning of a segment to the variable. That's fine, except when you're reading a variable from SEGMENT:OFFSET, how does the reader know where to stop reading? I mean, with this bit of ASM:
Code:
.model small
.stack 100h
.data
message db "Hello How Are You",'$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
mov dx, offset message
int 21h
mov ah,4Ch
int 21h
main endp
end main
I understand all of it, except:
To display a string with INT 21h, function 9, DSX points to the segment:offset of the string. That's fine. But, how does INT 21h know where to stop reading the variable inside the data segment? Wouldn't it just keep reading other data in that segment?
These questions haven't been letting me sleep :evil:
So *someone* answer!!!