1. Rob: questions

If Causeway allows a 0..640k map. How come when I allocate_low with my
    first instruction in a program, I don't get back a low address near
    zero ?

Can I assume that this 0..640k address space is at segment 0 ?

When I am trying to use real mode dos interrupts, the segments are required
  to placed into registers and other structures. If I use the technique in
  hardint.ex, how do I know the returned segment # is the same as the
  segment # of some buffer that I allocated or allocated_low.

Do I assume the Euphoria CODE and DATA segments are the same segments ?

It dosn't matter where you allocate memory but We need to have detailed
information about it in order to use it without crashing the system.

PS I agree with Dan. I wish you would bring out another version of Euphoria
   that used WDOSX.

new topic     » topic index » view message » categorize

2. Re: Rob: questions

Bernie Ryan writes:
> If Causeway allows a 0..640k map. How come when I allocate_low
> with my first instruction in a program, I don't get back a low address
> near zero ?

The operating system reserves important memory locations
near zero for itself.

> When I am trying to use real mode dos interrupts, the segments are
> required to placed into registers and other structures.

If you want to do dos *software* interrupts, you should look at
demo\dos32\dosint.ex, not hardint.ex which shows *hardware*
interrupts.

When you call dos_interrupt() you switch from the 32-bit world,
of 16-bit segments and 32-bit offsets, into the old 16-bit world
of 16-bit segments, and 16-bit offsets.

Addresses in the 16-bit world (real mode) are represented by
segments and offsets. The actual physical address equals
the segment value times 16 (*not* times 64K as you might expect!),
plus the offset. The same address can be represented by
many possible combinations of segment value and offset value
(for example, add 16 to the offset and subtract 1 from the segment,
and you get the same physical address).

This code, taken from dosint.ex, shows one way to convert a
flat address returned by allocate_low() into a segment
and offset to be stored in the data segment register and another
register...

low_buff = allocate_low(100)

reg_list[REG_DS] = floor(low_buff / 16)           -- segment
reg_list[REG_SI] = remainder(low_buff, 16)    -- offset
...
dos_interrupt(....)


Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Rob: questions

Rob writes:
> low_buff = allocate_low(100)
>
> reg_list[REG_DS] = floor(low_buff / 16)           -- segment
> reg_list[REG_SI] = remainder(low_buff, 16)    --
> offset...dos_interrupt(....)

Ohhhh, yeah.... seeing this completely disagrees with the code I posted
earlier today, I think I had better revise the alloc_low function.

function alloc_low(atom amount)
-- allocates some amount of low memory and returns { segment, offset }
  atom lmem
  lmem = allocate_low(amount)
  return { floor(lmem / #10), and_bits(lmem, #F) }
end function

Segments are aligned on 16-byte boundaries, not 64k... even though a
segment can address a total of 64k bytes.

Sorry about the stupid mistake.. wonder where my brain went on that one..
I really hope I don't do stuff like this on upcoming finals.

Later,
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu