Free Pascal and absolute memory 
Author Message
 Free Pascal and absolute memory

I downloaded the Linux flavour of 0.99.14 the other day and started
playing with my favourite DOS-based source code, including a playing
card library that relies on my own random number generator.  My
randomizer in turn bases some of the computations on reading the
clock ticks from memory addresses $40:$6C and $40:6E, so I have
these two declarations in the VAR section:

var
  TickLo: word absolute $40:$6C;
  TickHi: word absolute $40:6E;

ppc386 says: "Error: absolute can only be associated a var or const"

It *is* associated with a var!  This works in unprotected 16-bit DOS
mode; how can I make it work in protected-mode Linux?

Peter B. Steiger
Cheyenne, WY
----
If you reply by email, send it to pbs at com dot
canada (or vice-versa).  All adverti{*filter*}ts will be
returned to your postmaster, eh!



Wed, 11 Dec 2002 03:00:00 GMT  
 Free Pascal and absolute memory
Hi,

Quote:

> var
>   TickLo: word absolute $40:$6C;
>   TickHi: word absolute $40:6E;

> ppc386 says: "Error: absolute can only be associated a var or const"

> It *is* associated with a var!

No, with a memory address. What the compiler is trying to tell you is
that you can only do the following:

   var
      s : shortstring;
      len : byte absolute s;

Quote:
> This works in unprotected 16-bit DOS
> mode; how can I make it work in protected-mode Linux?

Not at all, because that is what the protected mode protects. You
could write a device driver, or even better, use /dev/urandom, which
provides "real" random numbers (not "pseudo").

 - Sebastian



Wed, 11 Dec 2002 03:00:00 GMT  
 Free Pascal and absolute memory

Quote:

> Hi,


> > var
> >   TickLo: word absolute $40:$6C;
> >   TickHi: word absolute $40:6E;

> > ppc386 says: "Error: absolute can only be associated a var or const"

> > It *is* associated with a var!

> No, with a memory address. What the compiler is trying to tell you is
> that you can only do the following:

>    var
>       s : shortstring;
>       len : byte absolute s;

> > This works in unprotected 16-bit DOS
> > mode; how can I make it work in protected-mode Linux?

> Not at all, because that is what the protected mode protects. You
> could write a device driver, or even better, use /dev/urandom, which
> provides "real" random numbers (not "pseudo").

Moreover, the "tick" value is provided by dos, not by the bios/system.
So it won't exist under linux.

--




Wed, 11 Dec 2002 03:00:00 GMT  
 Free Pascal and absolute memory
On Sat, 24 Jun 2000 16:59:56 +0200, Marco van de Voort sez:

Quote:
>Moreover, the "tick" value is provided by dos, not by the bios/system.
>So it won't exist under linux.

{groan} now I feel REALLY stupid.  But it looks like both the built-in
random() function and /dev/urandom provide adequate distribution,
so I don't really need my own random number generators outside of
DOS.

Peter B. Steiger
Cheyenne, WY
----
If you reply by email, send it to pbs at com dot
canada (or vice-versa).  All adverti{*filter*}ts will be
returned to your postmaster, eh!



Wed, 11 Dec 2002 03:00:00 GMT  
 Free Pascal and absolute memory

Quote:

> {groan} now I feel REALLY stupid.  But it looks like both the built-in
> random() function and /dev/urandom provide adequate distribution,
> so I don't really need my own random number generators outside of
> DOS.

Yes, the built-in random generator is quite good (but also quite slow,
if you want some random numbers for a game or so, you better look for
another one).

Jonas



Thu, 12 Dec 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. which pascal for an absolute beginner ?

2. Allocating memory in a C++-DLL - Freeing it in a Delphi 3 Application

3. Freeing TSR memory

4. Help with Pointers and free memory!!

5. ANNOUNCEMENT: OWL Memory streams for BP 7.0 and Windows (free)

6. Free causes a Memory Erro.

7. HELP: BDE doesn't free Memory

8. Closing / Freeing DB & Memory Crashes

9. free pascal vs turbo pascal - range checking

10. free pascal vs turbo pascal - range checking

11. Annoucement: Free Pascal (aka FPK Pascal) 0.99.5

12. Annoucement: Free Pascal (aka FPK Pascal) 0.99.5

 

 
Powered by phpBB® Forum Software