comp.lang.ada
 help / color / mirror / Atom feed
* Help: accessing Bios param from Ada
@ 1999-04-13  0:00 Alain Senjean
  1999-04-14  0:00 ` Jerry van Dijk
  0 siblings, 1 reply; 9+ messages in thread
From: Alain Senjean @ 1999-04-13  0:00 UTC (permalink / raw)


Hello,

I am using AdaObjet 7.1.2 under Win98 and i want to develop an application
software using the LPT port for managing an external HW equipment.

I need to identify the port base address and then use registers of the I/O
controller.

I know How, I have a working model of the port driver in Borland C++ (C
language under dos window) using inportb, outportb.

1) identification
   --------------
   I just need to read four 'words' at address 0000:0408 providing LPT ports
base address.
   I am used to target cross developments using motorola memory model but
not to PC memory organisation (segment, offset).
   So, I have tried something simple:

      type T_Lpt_Bios_Table is array (T_Lpt_Port) of Basic_Types.Word;
      Lpt_Bios_Table : T_Lpt_Bios_Table;
      for Lpt_Bios_Table use at Basic_Types.Int_To_Addr(16#0000_0408#);

      -- memory image
      Lpt_Table : T_Lpt_Bios_Table := Lpt_Bios_Table;

      where : Word: 0 .. 2**16,   T_Lpt_Port: Lpt1 .. Lpt4

   very optimistic I think because AdaObject is blocked upon previous line
execution and sometimes the PC itself!

   I there any standard service to access Bios segment and retrieve
parameters.
   I know this is system specific but It should be something available to
interface with low-level without using C langage (I hope).
   Typically I want to avoid introducing a second language just for two or
three services.

2) management
   ----------
   After, I want to manage this port using the base address found in the
previous BIOS table.
   Again, first idea, simply by mapping at this address a three fields
volatile record (too simple I think).
   Is there any defined service with parameters like (segment, offset, size,
value) for accessing HW ports like inportb, outportb in C ?


   Please help me.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-14  0:00   ` Alain Senjean
@ 1999-04-14  0:00     ` Tom Moran
  1999-04-15  0:00       ` Alain Senjean
  1999-04-15  0:00     ` Jerry van Dijk
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Moran @ 1999-04-14  0:00 UTC (permalink / raw)


> I am defining a Dos Ada program
but originally you said
>I am using AdaObjet 7.1.2 under Win98
Are you cross compiling from Win98 to DOS?  Then your compiler should
have libraries supplied that give you access to IO ports and physical
memory addresses.  In fact, any compiler targetted to DOS, regardless
of where it compiles, should do that.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-13  0:00 Help: accessing Bios param from Ada Alain Senjean
@ 1999-04-14  0:00 ` Jerry van Dijk
  1999-04-14  0:00   ` Alain Senjean
  0 siblings, 1 reply; 9+ messages in thread
From: Jerry van Dijk @ 1999-04-14  0:00 UTC (permalink / raw)


Alain Senjean (senjean@club-internet.fr) wrote:

: I am using AdaObjet 7.1.2 under Win98 and i want to develop an application
: software using the LPT port for managing an external HW equipment.

:    I just need to read four 'words' at address 0000:0408 providing LPT ports
: base address.

Using a windows compiler, you have, in the Win32 environment, no access to
this memory, you need to either use a DOS compiler or write/get an Win9X/NT
device driver for this. This is not Ada related but a feature of the OS you
are using.

:    Is there any defined service with parameters like (segment, offset, size,
: value) for accessing HW ports like inportb, outportb in C ?

No, the I/O ports are not in the memory address space. And again, you have
no access to them from a user program.

--
-- Jerry van Dijk | Leiden, Holland
-- Team Ada       | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-14  0:00 ` Jerry van Dijk
@ 1999-04-14  0:00   ` Alain Senjean
  1999-04-14  0:00     ` Tom Moran
  1999-04-15  0:00     ` Jerry van Dijk
  0 siblings, 2 replies; 9+ messages in thread
From: Alain Senjean @ 1999-04-14  0:00 UTC (permalink / raw)




Jerry van Dijk wrote:
> 
> Using a windows compiler, you have, in the Win32 environment, no access to
> this memory, you need to either use a DOS compiler or write/get an Win9X/NT
> device driver for this. This is not Ada related but a feature of the OS you
> are using.
> 
> :    Is there any defined service with parameters like (segment, offset, size,
> : value) for accessing HW ports like inportb, outportb in C ?
> 
> No, the I/O ports are not in the memory address space. And again, you have
> no access to them from a user program.
> 
I don't understand because I am defining a Dos Ada program at project level,
so Win32 restriction should not apply (Dos windowed).

Otherwise, I should get identical limitation for the C model.

A. SENJEAN




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-14  0:00   ` Alain Senjean
  1999-04-14  0:00     ` Tom Moran
@ 1999-04-15  0:00     ` Jerry van Dijk
  1999-04-17  0:00       ` Alain Senjean
  1 sibling, 1 reply; 9+ messages in thread
From: Jerry van Dijk @ 1999-04-15  0:00 UTC (permalink / raw)


Alain Senjean (senjean@club-internet.fr) wrote:

: I don't understand because I am defining a Dos Ada program at project level,
: so Win32 restriction should not apply (Dos windowed).

It seems you are confusing a Win32 console (text) mode application with a DOS 
application. Althought they look alike, and are run from the same shell, they
are two different beasts:

When you are in a text console window (aka 'dos box') you can run two types 
of console applications: DOS or Win32.

Since you are using a Windows compiler, the console applications it generates
are running in the Win32 environment. To get a DOS console application you
need to use a DOS compiler (either the DOS port of GNAT or buy the Pharlap
DOS extender for OA).

--
-- Jerry van Dijk | Leiden, Holland
-- Team Ada       | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-15  0:00       ` Alain Senjean
@ 1999-04-15  0:00         ` Ed Falis
  1999-04-16  0:00           ` Alain Senjean
  0 siblings, 1 reply; 9+ messages in thread
From: Ed Falis @ 1999-04-15  0:00 UTC (permalink / raw)


On Thu, 15 Apr 1999 08:41:35 +0200, Alain Senjean <senjean@club-internet.fr> wrote:
> What I feel for solving this problem is:
> 1) there is a package MACHINE_CODE_386 in AdaObject that could solve the
> problem (as stated in ANNEX M --> specific to AONIX) but I have found its
> specification nowhere !!

Look in the <objectada>\lib\SRC\m386r.ads

- Ed





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-14  0:00     ` Tom Moran
@ 1999-04-15  0:00       ` Alain Senjean
  1999-04-15  0:00         ` Ed Falis
  0 siblings, 1 reply; 9+ messages in thread
From: Alain Senjean @ 1999-04-15  0:00 UTC (permalink / raw)


Tom Moran wrote:
> 
> > I am defining a Dos Ada program
> but originally you said
> >I am using AdaObjet 7.1.2 under Win98
> Are you cross compiling from Win98 to DOS?  Then your compiler should
> have libraries supplied that give you access to IO ports and physical
> memory addresses.  In fact, any compiler targetted to DOS, regardless
> of where it compiles, should do that.

I fully agree.

Yes, I am using ObjectAda under Win98 to develop a Dos Application SW.

Yes, I fully agree that a native compiler SHALL provide even 'basic'
interface to access 'standard' I/O ressources of a machine (BIOS, LPT and
COM are) even in a not event driven way.

I konw that it is not the main concern of an Ada Compiler, but you need
access to the environment which is not reduced to windows and for this you
need basic constructs to access resources.
With those basic constructs you can build your own abstract level.

What I can not agree with is to buy a C compiler to complete my standard
native environment access (several people could discuss this, but it is not
the aim).

What I feel for solving this problem is:
1) there is a package MACHINE_CODE_386 in AdaObject that could solve the
problem (as stated in ANNEX M --> specific to AONIX) but I have found its
specification nowhere !!

2) there is a binding to Ms SDK and within the 5000 items there is a service
that solves my problem. In this case I shall use a win32 application.

But today I am blocked by this parallel port nibble mode management problem.

Best regards.


A. SENJEAN




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-15  0:00         ` Ed Falis
@ 1999-04-16  0:00           ` Alain Senjean
  0 siblings, 0 replies; 9+ messages in thread
From: Alain Senjean @ 1999-04-16  0:00 UTC (permalink / raw)


Ed Falis wrote:
> 
> Look in the <objectada>\lib\SRC\m386r.ads
> 
> - Ed

Thank You, I missed It.

I have solved my parallel port access problem with this package.

Now, I'm looking for the BIOS table access (0000:0408).
Not found the good assembler synthax from Win32 Dos console but searching.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Help: accessing Bios param from Ada
  1999-04-15  0:00     ` Jerry van Dijk
@ 1999-04-17  0:00       ` Alain Senjean
  0 siblings, 0 replies; 9+ messages in thread
From: Alain Senjean @ 1999-04-17  0:00 UTC (permalink / raw)


Jerry van Dijk wrote:
> 
> It seems you are confusing a Win32 console (text) mode application with a DOS application.
It's very likely because I am not used to this environment.
 
> Since you are using a Windows compiler, the console applications it generates
> are running in the Win32 environment. To get a DOS console application you
> need to use a DOS compiler (either the DOS port of GNAT or buy the Pharlap
> DOS extender for OA).
> 
You are right but it is not my real problem.

In fact, I want two things:
1) access parallel port registers in order to implement a nibble mode
protocol (details don't matter)
   It's done with info from Ed Falis in this group (Machine_Code_386
package) using just some pseudo-assembler lines:
   
   function In_Port8
      (Port : in Basic_Types.Int_16)
      return Basic_Types.Byte is
   Offset : constant Basic_Types.Int_16 := Port; 
   Data   : Basic_Types.Byte;
   begin
      -- save used regsiters
      ...
      -- Retrieve Offset Parameter
      Mov(Dx,Ptr_On_Int_16(Offset));
      -- Get current port value as 8 bits
      I_In(Al,Dx);
      -- Copy port value to local data
      Mov(Ptr_On_Byte(Data),Al);
      -- Restore used registers
      ...
      -- return port value      
      return Data;
   end In_Port8;

2) Access a four word table located at address (0000:0408) in BIOS and
giving LPT ports base address.
   To do this job, I don't care about the environment.
   But, in fact I'm looking for the assembler/Ada synthax (as I found no
service) to access this table.
   Of course, restrictions can differ between Dos and Windows but I can't
imagine a system restricting (read) access to its own configuration. It
would be against potability between machines.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-04-17  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-13  0:00 Help: accessing Bios param from Ada Alain Senjean
1999-04-14  0:00 ` Jerry van Dijk
1999-04-14  0:00   ` Alain Senjean
1999-04-14  0:00     ` Tom Moran
1999-04-15  0:00       ` Alain Senjean
1999-04-15  0:00         ` Ed Falis
1999-04-16  0:00           ` Alain Senjean
1999-04-15  0:00     ` Jerry van Dijk
1999-04-17  0:00       ` Alain Senjean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox