Re: referring to segments other than DS - how?
- From: Pop Tart <morespamsREMOVE@xxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 16:08:12 -0600
New Question, but it relates to the above.
In a 16 bit real address mode assembly program - using masm 6.11 here -
If I have the following labels declared in ".data?" (BSS):
COUNT equ 500
..data?
InputBuffer BYTE COUNT DUP(?)
OpenFileHandle WORD ?
EncFileHandle WORD ?
and later.....
;read file into input buffer
mov ah, 3Fh ; read array of bytes
mov bx, OpenFileHandle ; src file handle
mov cx, COUNT ; max bytes to read
mov di, OFFSET _bss ; set DS to BSS
mov ds, di
mov dx, OFFSET InputBuffer ; addr to rcv bytes
int 21h ; AX = bytes read
the assembler produces an offset from logical _data for "OpenFileHandle",
but then it produces an offset from logical _bss for "InputBuffer". Both
are declared in ".data?" (bss).
I had to move the offset to _bss into DS for the function 3Fh, so at
first I thought that was the reason. So I inserted some test code like
this:
;--------------------------
;test segments begin
mov di, OFFSET _bss
mov ds, di
mov bx, OpenFileHandle ; src file handle
mov di, @data
mov ds, di
mov bx, OpenFileHandle
;test segments end
;------------------------
the same offset was used in both cases, (0384h in my current debug
session). The offset is only valid from the original, regular data
segment that DS is initialized with when the program starts.
This is *not* a case where the segments overlap and actually refer to the
same physical location.
Thanks for your input!
--
Regards,
Pop Tart
.
- Follow-Ups:
- Re: referring to segments other than DS - how?
- From: Frank Kotler
- Re: referring to segments other than DS - how?
- References:
- referring to segments other than DS - how?
- From: Pop Tart
- referring to segments other than DS - how?
- Prev by Date: Re: [OT] the lack of humility
- Next by Date: Re: for the close of all fission nuclear reactor in the world
- Previous by thread: Re: referring to segments other than DS - how?
- Next by thread: Re: referring to segments other than DS - how?
- Index(es):
Relevant Pages
|