1. Segment off-sets of sequences
Hello all. I have a technical question. I am preparing some routines
which use dos interrupts. The routine in question need to know the
seqment address and the segment offset of a sequence that has been
poked into low mem. Here is a portion of the code.
global function get_block (sequence buffer, integer port)
integer getblock,bufferaddress
-- allocate buffer space in mem
bufferaddress = allocate_low(len(buffer))
-- poke the buffer
for i = 0 to (len(buffer) -1) do
poke(bufferaddress+i, buffer[i+1])
end for
regs=repeat(0,10)
regs[REG_AX] = #1800
regs[REG_CX] = len(buffer)
regs[REG_DX] = port
-- this should be the address of the of the seq. in mem ?
regs[REG_ES] = bufferaddress -- this should be the start of the
-- I don't know this one..needs the segment off-set of the sequence
-- in mem. Maybe should be 0 ?
regs[REG_DI] = ?
regs=dos_interrupt(#14, regs)
getblock = regs(REG_AX)
return getblock
free_low(bufferaddress)
end function
I think that the segment address should be the address returned by
the allocate_low() function and the segment offset should be 0.
Can anybody help with this?
Thanks..
Greg.
2. Re: Segment off-sets of sequences
At 01:30 18-01-97 +0000, you wrote:
>---------------------- Information from the mail header -----------------------
>Sender: Euphoria Programming for MS-DOS <EUPHORIA at
>MIAMIU.ACS.MUOHIO.EDU>
>Poster: Greg Harris <blackdog at MAIL.CDC.NET>
>Subject: Segment off-sets of sequences
>-------------------------------------------------------------------------------
>
>Hello all. I have a technical question. I am preparing some routines
>which use dos interrupts. The routine in question need to know the
>seqment address and the segment offset of a sequence that has been
>poked into low mem. Here is a portion of the code.
>
>global function get_block (sequence buffer, integer port)
>integer getblock,bufferaddress
>-- allocate buffer space in mem
>bufferaddress = allocate_low(len(buffer))
>-- poke the buffer
>for i = 0 to (len(buffer) -1) do
>poke(bufferaddress+i, buffer[i+1])
>end for
>regs=repeat(0,10)
>regs[REG_AX] = #1800
>regs[REG_CX] = len(buffer)
>regs[REG_DX] = port
>
>-- this should be the address of the of the seq. in mem ?
>
>regs[REG_ES] = bufferaddress -- this should be the start of the
>
>-- I don't know this one..needs the segment off-set of the sequence
>-- in mem. Maybe should be 0 ?
>
>regs[REG_DI] = ?
>regs=dos_interrupt(#14, regs)
>getblock = regs(REG_AX)
>return getblock
>free_low(bufferaddress)
>end function
>
>I think that the segment address should be the address returned by
>the allocate_low() function and the segment offset should be 0.
>
>Can anybody help with this?
>
>Thanks..
>
>Greg.
>
segment = floor(bufferaddress/16)
offset = remainder(bufferaddress,16)
Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at quebectel.com
3. Re: Segment off-sets of sequences
> segment = floor(bufferaddress/16)
> offset = remainder(bufferaddress,16)
>
> Jacques Deschenes
Thanks again for the help Jacques.
Greg..