Board index » delphi » Direct memory access?

Direct memory access?

Hi, I have a board installed in my PC. The board has 256 adresses
of memory.

In Borland pascal 7.0 i could read an write the ram on the board as
an array defined like this:

var Ats : array[0..255] of byte absolute $A000:$C000;

Now i am beginning to use Borland Delphi 2.0 / win95.

Does anybody know how to access memory at an absolute adress
in Delphi, cause sure can't figure it out!

+------------------------+----------------------------------------+
| M.Sc.E.E               | Phone/Fax                +45 7562 5945 |
| Kristian Ehrenreich    | Phone/Voice-mail         +45 2088 6950 |
| Emil Bojsensgade 54,1  | E-mail     ehrenre...@vip.{*word*104}city.dk |
| 8700 Horsens           | E-mail, work        k...@kirktelecom.dk |
| DENMARK                | http://www.{*word*104}city.dk/users/ccc12546 |
+------------------------+----------------------------------------+

 

Re:Direct memory access?


Kristian,

Search for TVicHW_95 component (hwport95.zip) from Delphi Super Page.

Victor Ishikeev

On Mon, 28 Apr 1997 16:01:39 -0700, Kristian Ehrenreich

Quote
<ehrenre...@vip.{*word*104}city.dk> wrote:
>Hi, I have a board installed in my PC. The board has 256 adresses
>of memory.

>In Borland pascal 7.0 i could read an write the ram on the board as
>an array defined like this:

>var Ats : array[0..255] of byte absolute $A000:$C000;

>Now i am beginning to use Borland Delphi 2.0 / win95.

>Does anybody know how to access memory at an absolute adress
>in Delphi, cause sure can't figure it out!

>+------------------------+----------------------------------------+
>| M.Sc.E.E               | Phone/Fax                +45 7562 5945 |
>| Kristian Ehrenreich    | Phone/Voice-mail         +45 2088 6950 |
>| Emil Bojsensgade 54,1  | E-mail     ehrenre...@vip.{*word*104}city.dk |
>| 8700 Horsens           | E-mail, work        k...@kirktelecom.dk |
>| DENMARK                | http://www.{*word*104}city.dk/users/ccc12546 |
>+------------------------+----------------------------------------+

Re:Direct memory access?


Quote
Kristian Ehrenreich wrote:

> Hi, I have a board installed in my PC. The board has 256 adresses
> of memory.

> In Borland pascal 7.0 i could read an write the ram on the board as
> an array defined like this:

> var Ats : array[0..255] of byte absolute $A000:$C000;

> Now i am beginning to use Borland Delphi 2.0 / win95.

> Does anybody know how to access memory at an absolute adress
> in Delphi, cause sure can't figure it out!

Look up the topic Direct Memory Access in Delphi Help; it's there (at
least in ---> Delphi 1.0 <---, which is what I'm using).  The old Mem,
MemW, and MemL pseudo-arrays still work.

HOWEVER (this is important!), you must refer to memory with a selector,
not a segement.  In other words, looking at the system clock at
   MemW[$40:$6c]
will not work, because $40 is a segment address, and the selector with
the number $40, if it exists at all, probably points to somewhere
entirely different.  You need to use the selector instead:
   MemW[Seg0040:$6c]
Delphi predefines Seg0040 as the serial number of the selector that
points to memory beginning at address $0400, which is what you want.

Now, if you have a hardware board at some address, you need to create a
selector for it, but I'm unable to quickly find the name of the proper
routine in the Delphi 1.0 help.

Under Delphi 2.0, this may be simpler, because of the flat address
space. It's technically possible to create a selector that addresses the
entire machine, but if you do so, you lose the protection against
accidently addressing memory that you don't intend to address.  Perhaps
someone with Delphi 2 experience can provide more details.

--
Howard L. Kaplan
Psychopharmacology and Dependence Research Unit
Women's College Hospital
76 Grenville Street, 9'th floor
Toronto, Ontario
Canada  M5S 1B2
(416)323-6400, ext 4915
howard.kap...@utoronto.ca

Other Threads