Re: referring to segments other than DS - how?
- From: japheth <mail@xxxxxxxxxx>
- Date: Wed, 27 Feb 2008 12:51:03 -0800 (PST)
Thanks Frank. Maybe you or someone else can help with this. Assuming I
only have 16-bit registers, and I've got a buffer in BSS, how do I write
the buffer to a file? If I understand correctly, function 40h / int 21h
needs the address of the buffer to be in DS:DX, so I have to move the BSS
segment to DS. However, my program is terminating on the int 21h below -
before even setting error code to AX or setting the Carry Flag.
(I have ES set to BSS below. label 'InputBuffer is an offset into BSS)
mov ax, 40h ; func. write array
mov bx, EncFileHandle ; file handle to bx
mov cx, 500 ; bytes to write from 3fh abv
mov di, es
mov ds, di ; set ds to es for inp.buffer
mov dx,OFFSET InputBuffer
int 21h ;terminates abrubtly here
cmp ax,0 ; did we write anything
je EmptyOutput
Only thing I can think is that EncFileHandle, which is a label to an
offset into the regular Data Segment (not BSS), causes it to screw up...
However, reading a file into this array in the same fashion, with 3Fh /
int 21h, didn't have a problem. If the function *is* interpreting
EncFileHandle to be in *BSS*, how the heck does anyone write to an
uninitialized buffer? !@#$%! :)
Again, I'm trying not to use 32-bit registers. Many thanks in advance.
there's a small typo:
mov ax, 40h ; func. write array
must be
mov ah, 40h ; func. write array
.
- Follow-Ups:
- Re: referring to segments other than DS - how?
- From: Pop Tart
- Re: referring to segments other than DS - how?
- References:
- referring to segments other than DS - how?
- From: Pop Tart
- Re: referring to segments other than DS - how?
- From: Frank Kotler
- Re: referring to segments other than DS - how?
- From: Pop Tart
- referring to segments other than DS - how?
- Prev by Date: Re: referring to segments other than DS - how?
- Next by Date: Re: referring to segments other than DS - how?
- 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
|