comp.lang.ada
 help / color / mirror / Atom feed
* Ada and Hardware
@ 2001-05-10 13:02 chris.danx
  2001-05-10 13:36 ` Ted Dennison
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: chris.danx @ 2001-05-10 13:02 UTC (permalink / raw)


Hello folks,
    I'm implementing a program which reads files on a floppy disk which are not
stored via the fat12 file system.  I know this is the most popular format but i
want a simple contigouous fs for the purposes of booting an OS.

I'm implementing basic routines for the management of the fs at the moment but
i've been planning ahead and i've encountered a problem.  It is necessary to
access the disk and write the fs to it.  I was wondering if anyone knew of any
Ada packages or techniques for accessing the disk in such a raw manner?  I need
a way to write and read via blocks, sectors, tracks etc on the floppy.  I'm
developing on windows 98 via GNAT.


Thanks,
Chris Campbell





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

* Re: Ada and Hardware
  2001-05-10 13:02 Ada and Hardware chris.danx
@ 2001-05-10 13:36 ` Ted Dennison
  2001-05-10 14:00   ` chris.danx
  2001-05-10 13:54 ` Tarjei T. Jensen
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Ted Dennison @ 2001-05-10 13:36 UTC (permalink / raw)


In article <BiwK6.3562$po.600977@news6-win.server.ntlworld.com>, chris.danx
says...
>I'm implementing basic routines for the management of the fs at the moment but
>i've been planning ahead and i've encountered a problem.  It is necessary to
>access the disk and write the fs to it.  I was wondering if anyone knew of any
>Ada packages or techniques for accessing the disk in such a raw manner?  I need
>a way to write and read via blocks, sectors, tracks etc on the floppy.  I'm
>developing on windows 98 via GNAT.

This is a system-programming question, not an Ada question. An Ada programmer
won't accomplish this much differently than a C programmer. You'd probably have
better luck asking your question in a Windows programming newsgroup.

Now if you get an answer, but don't know how to translate it to Ada, that's what
we're here for.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



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

* Re: Ada and Hardware
  2001-05-10 13:02 Ada and Hardware chris.danx
  2001-05-10 13:36 ` Ted Dennison
@ 2001-05-10 13:54 ` Tarjei T. Jensen
  2001-05-10 14:10   ` chris.danx
  2001-05-10 17:24 ` Alfred Hilscher
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Tarjei T. Jensen @ 2001-05-10 13:54 UTC (permalink / raw)



chris.danx wrote in message ...
>Hello folks,
>    I'm implementing a program which reads files on a floppy disk which are
not
>stored via the fat12 file system.  I know this is the most popular format
but i
>want a simple contigouous fs for the purposes of booting an OS.

There is a lot of utilities for reading and writing DOS disks. Why change
something which is so standardized?

Booting from such a floppy should be well understood since there are at
least two such systems used in conjunction with Linux and the various BSD
varieties.


Greetings,







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

* Re: Ada and Hardware
  2001-05-10 13:36 ` Ted Dennison
@ 2001-05-10 14:00   ` chris.danx
  2001-05-10 14:52     ` Ted Dennison
  0 siblings, 1 reply; 23+ messages in thread
From: chris.danx @ 2001-05-10 14:00 UTC (permalink / raw)


> This is a system-programming question, not an Ada question. An Ada programmer
> won't accomplish this much differently than a C programmer. You'd probably
have
> better luck asking your question in a Windows programming newsgroup.
>
> Now if you get an answer, but don't know how to translate it to Ada, that's
what
> we're here for.

I know how to do it in C.  Use the biosdisk function!  Which is incredibly
unsafe but is the only way i know of doing this.  I don't know how to do it in
Ada without binding to C, but i want to avoid this if i can.

I don't see how it isn't an Ada question.  Ada supports systems programming, and
all i want to really is to write/read blocks from a floppy not write a floppy
driver (i don't need to do this yet, but i will soon.  in any event i have
decent info on this and i need a PMode OS first.)

Chris Campbell






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

* Re: Ada and Hardware
  2001-05-10 13:54 ` Tarjei T. Jensen
@ 2001-05-10 14:10   ` chris.danx
  2001-05-10 14:34     ` Tarjei T. Jensen
  0 siblings, 1 reply; 23+ messages in thread
From: chris.danx @ 2001-05-10 14:10 UTC (permalink / raw)


> >Hello folks,
> >    I'm implementing a program which reads files on a floppy disk which are
> not
> >stored via the fat12 file system.  I know this is the most popular format
> but i
> >want a simple contigouous fs for the purposes of booting an OS.
>
> There is a lot of utilities for reading and writing DOS disks. Why change
> something which is so standardized?

I don't understand FAT12 yet, and it complicates the boot sector.  Also the fs
can be messed with if it's a fat12 disk easily.  I don't want this.  Would you
want any person coming along and swapping a driver file for another that's got a
similar signiture but does malicious things behind the scenes?  What's more
anyone can come along and delete a critical file easy.  Two clicks and OS is
gone.


> Booting from such a floppy should be well understood since there are at
> least two such systems used in conjunction with Linux and the various BSD
> varieties.

I know how to boot from a floppy for the file system i'm using.  It's really
easy (just look in 2nd inode to get address of primary kernel file, and
calculate offset).  I just need to get the files from my FAT hard disk to my BFS
floppy.  The current driver implements a disk as a file on a HD, and it's really
easy to work with.  The problem is i need to create a bfs enabled disk, write
files to it, read info from it, via an interactive shell.  I don't know how to
do this in Ada (i can do the shell though).  I do know how in C.


Chris Campbell





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

* Re: Ada and Hardware
  2001-05-10 14:10   ` chris.danx
@ 2001-05-10 14:34     ` Tarjei T. Jensen
  2001-05-10 18:28       ` chris.danx
  0 siblings, 1 reply; 23+ messages in thread
From: Tarjei T. Jensen @ 2001-05-10 14:34 UTC (permalink / raw)



chris.danx wrote :
>I don't understand FAT12 yet, and it complicates the boot sector.  Also the
fs
>can be messed with if it's a fat12 disk easily.  I don't want this.  Would
you
>want any person coming along and swapping a driver file for another that's
got a
>similar signiture but does malicious things behind the scenes?  What's more
>anyone can come along and delete a critical file easy.  Two clicks and OS
is
>gone.

That situation is no worse than anything else that boots from a standard
msdos floppy. If I thought it would be a problem II would  make he file(s)
invisible (system).

>I know how to boot from a floppy for the file system i'm using.  It's
really
>easy (just look in 2nd inode to get address of primary kernel file, and
>calculate offset).  I just need to get the files from my FAT hard disk to
my BFS
>floppy.  The current driver implements a disk as a file on a HD, and it's
really
>easy to work with.  The problem is i need to create a bfs enabled disk,
write
>files to it, read info from it, via an interactive shell.  I don't know how
to
>do this in Ada (i can do the shell though).  I do know how in C.

If you know how to do it in C, you know how to do it in Ada.

greetings,






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

* Re: Ada and Hardware
  2001-05-10 14:00   ` chris.danx
@ 2001-05-10 14:52     ` Ted Dennison
  2001-05-10 18:20       ` chris.danx
  0 siblings, 1 reply; 23+ messages in thread
From: Ted Dennison @ 2001-05-10 14:52 UTC (permalink / raw)


In article <G9xK6.4318$577.867642@news2-win.server.ntlworld.com>, chris.danx
says...
>
>I know how to do it in C.  Use the biosdisk function!  Which is incredibly

Well, then the way to do it in Ada is *also* to use the biosdisk function, or to
write something that does what it does. Ada isn't *that* different from C.

>unsafe but is the only way i know of doing this.  I don't know how to do it in
>Ada without binding to C, but i want to avoid this if i can.

There's nothing particularly wrong with binding to an OS utility just because it
uses the C parameter passing interface. Now *writing* something new in C then
linking to it from Ada might be a bit silly, but that's not what you are talking
about, is it?

>I don't see how it isn't an Ada question. Ada supports systems programming, 
True, but so do lots of other languages. If you wanted to find out how to write
your own PC boot manager, that's a system programming question too. But there's
nothing particularly *Ada* about what you have to do to accomplish this, and
this is not the newsgroup that is full of people who are experts in writing PC
boot managers.

This is akin to calling Honda and asking "How do I do a bootlegger turn with my
Honda Accord?", when in fact you don't know how to perform a bootlegger turn
with *any* car. You may luck out and get someone who knows and can tell you, but
its not the best place to ask, and doesn't really change too much just because
you bought a Honda. 

Now if you called Honda and asked, "I'd like to perform bootlegger turns, but
I'm not sure the best way to it in my Accord becuse it uses a pedal for a foot
brake and the catch is on the shifter, which makes it tough because...", that'd
be a different matter.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



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

* Re: Ada and Hardware
  2001-05-10 13:02 Ada and Hardware chris.danx
  2001-05-10 13:36 ` Ted Dennison
  2001-05-10 13:54 ` Tarjei T. Jensen
@ 2001-05-10 17:24 ` Alfred Hilscher
  2001-05-10 20:22   ` Ted Dennison
  2001-05-10 20:53   ` chris.danx
  2001-05-11 21:45 ` GNAT for DOS chris.danx
  2001-05-13 19:52 ` Ada and Hardware chris.danx
  4 siblings, 2 replies; 23+ messages in thread
From: Alfred Hilscher @ 2001-05-10 17:24 UTC (permalink / raw)


Maybe the Windows API calls "CreateFile" and "DeviceIOControl" will be
what you are looking for ? Look for this excerpt from   MS-API
dokumentation.

"You can use the CreateFile function to open a disk drive or a partition
on a disk drive. The function returns a handle to the disk device; that
handle can be used with the DeviceIOControl function. The following
requirements must be met in order for such a call to succeed: 
�	The caller must have administrative privileges for the operation to
succeed on a hard disk drive. 
�	The lpFileName string should be of the form \\.\PHYSICALDRIVEx to open
the hard disk x. Hard disk numbers start at zero. For example: 

String	Meaning
\\.\PHYSICALDRIVE2	Obtains a handle to the third physical drive on the
user's computer.
�	The lpFileName string should be \\.\x: to open a floppy drive x or a
partition x on a hard disk. For example: 

String	Meaning
\\.\A:	Obtains a handle to drive A on the user's computer.
\\.\C:	Obtains a handle to drive C on the user's computer."

"chris.danx" wrote:
> 
> Hello folks,
>     I'm implementing a program which reads files on a floppy disk which are not
> stored via the fat12 file system.  I know this is the most popular format but i
> want a simple contigouous fs for the purposes of booting an OS.
> 
> I'm implementing basic routines for the management of the fs at the moment but
> i've been planning ahead and i've encountered a problem.  It is necessary to
> access the disk and write the fs to it.  I was wondering if anyone knew of any
> Ada packages or techniques for accessing the disk in such a raw manner?  I need
> a way to write and read via blocks, sectors, tracks etc on the floppy.  I'm
> developing on windows 98 via GNAT.
> 
> Thanks,
> Chris Campbell



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

* Re: Ada and Hardware
  2001-05-10 14:52     ` Ted Dennison
@ 2001-05-10 18:20       ` chris.danx
  2001-05-10 20:01         ` Jerry van Dijk
  0 siblings, 1 reply; 23+ messages in thread
From: chris.danx @ 2001-05-10 18:20 UTC (permalink / raw)


> >I know how to do it in C.  Use the biosdisk function!  Which is incredibly
>
> Well, then the way to do it in Ada is *also* to use the biosdisk function, or
to
> write something that does what it does. Ada isn't *that* different from C.
>
> >unsafe but is the only way i know of doing this.  I don't know how to do it
in
> >Ada without binding to C, but i want to avoid this if i can.
>
> There's nothing particularly wrong with binding to an OS utility just because
it
> uses the C parameter passing interface.

I just thought how am i going to write the fs to disk, realised that the only
way would be to bind with C and panicked.  I have always had problems binding
with C.  For some reason my attempts at this have always failed.  A while back i
tried to write a binding to Conio (i didn't know about Jerry Van Dijks!  Where's
the new site i lost the link?) and couldn't do it for a whole host of reasons, i
couldn't fathom.  I used the stuff in Lovelace to do somethings but some things
just weren't happening.  A couple of bad interfacing experiences have put me off
binding with C.

> Now *writing* something new in C then
> linking to it from Ada might be a bit silly, but that's not what you are
talking
> about, is it?

No!  Thankfully i have more sense than that.

>
> >I don't see how it isn't an Ada question. Ada supports systems programming,
> True, but so do lots of other languages. If you wanted to find out how to
write
> your own PC boot manager, that's a system programming question too. But
there's
> nothing particularly *Ada* about what you have to do to accomplish this, and
> this is not the newsgroup that is full of people who are experts in writing PC
> boot managers.

All i wanted to know was if an Ada package existed for raw writing to floppy
disks.  One doesn't exist as far as i and others know so i'll write a binding to
C (or i'll try to).

Chris Campbell





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

* Re: Ada and Hardware
  2001-05-10 14:34     ` Tarjei T. Jensen
@ 2001-05-10 18:28       ` chris.danx
  2001-05-14  7:40         ` Kretschmer, Matthias
  0 siblings, 1 reply; 23+ messages in thread
From: chris.danx @ 2001-05-10 18:28 UTC (permalink / raw)



"Tarjei T. Jensen" <tarjei.jensen@kvaerner.com> wrote in message
news:9de8t0$e1s3@news.kvaerner.com...
>
> chris.danx wrote :
> >I don't understand FAT12 yet, and it complicates the boot sector.  Also the
> fs
> >can be messed with if it's a fat12 disk easily.  I don't want this.  Would
> you
> >want any person coming along and swapping a driver file for another that's
> got a
> >similar signiture but does malicious things behind the scenes?  What's more
> >anyone can come along and delete a critical file easy.  Two clicks and OS
> is
> >gone.
>
> That situation is no worse than anything else that boots from a standard
> msdos floppy. If I thought it would be a problem II would  make he file(s)
> invisible (system).
>

This is true, but my main reason for doing it with BFS instead of FAT12 is the
simplicity of working with the files on it.  The Boot sector is simplified
grately and so too is the secondary loader (a 32bit Ada loader with floppy
driver; the OS will have a new module reconfiguration system which is easier to
manage with Ada than ASM).  I want to limit my use of ASM in the system to the
bootsector if possible.  Everything else stands a good chance of being Ada or
maybe a teensy bit of C.

> >I know how to boot from a floppy for the file system i'm using.  It's
> really
> >easy (just look in 2nd inode to get address of primary kernel file, and
> >calculate offset).  I just need to get the files from my FAT hard disk to
> my BFS
> >floppy.  The current driver implements a disk as a file on a HD, and it's
> really
> >easy to work with.  The problem is i need to create a bfs enabled disk,
> write
> >files to it, read info from it, via an interactive shell.  I don't know how
> to
> >do this in Ada (i can do the shell though).  I do know how in C.
>
> If you know how to do it in C, you know how to do it in Ada.

I'll try a binding to C and see how it goes.






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

* Re: Ada and Hardware
  2001-05-10 18:20       ` chris.danx
@ 2001-05-10 20:01         ` Jerry van Dijk
  2001-05-10 20:54           ` chris.danx
  0 siblings, 1 reply; 23+ messages in thread
From: Jerry van Dijk @ 2001-05-10 20:01 UTC (permalink / raw)



"chris.danx" <chris.danx@ntlworld.com> writes:

> tried to write a binding to Conio (i didn't know about Jerry Van Dijks!  Where's
> the new site i lost the link?)

See signature :-)

BTW: I might be a bit dense, but I don't see what your problem is. If you
want to high-level format a floppy to your own filesystem from your
development machine, use the BIOS functions with the DOS compiler or the
DeviceIOControl functions with the windows compiler.

-- 
--  Jerry van Dijk   | email: jvandyk@attglobal.net
--  Leiden, Holland  | web:   home.trouwweb.nl/Jerry



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

* Re: Ada and Hardware
  2001-05-10 17:24 ` Alfred Hilscher
@ 2001-05-10 20:22   ` Ted Dennison
  2001-05-10 23:35     ` Jeff Creem
  2001-05-10 20:53   ` chris.danx
  1 sibling, 1 reply; 23+ messages in thread
From: Ted Dennison @ 2001-05-10 20:22 UTC (permalink / raw)


In article <3AFACEC7.C2E67357@icn.siemens.de>, Alfred Hilscher says...
>
>Maybe the Windows API calls "CreateFile" and "DeviceIOControl" will be
>what you are looking for ? Look for this excerpt from   MS-API
..
>"You can use the CreateFile function to open a disk drive or a partition
..
>\\.\A:	Obtains a handle to drive A on the user's computer.
>\\.\C:	Obtains a handle to drive C on the user's computer."

Interesting. One has to wonder if this would work with the standard Ada IO
operations (eg: Ada.Streams.Stream_IO)...


---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



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

* Re: Ada and Hardware
  2001-05-10 17:24 ` Alfred Hilscher
  2001-05-10 20:22   ` Ted Dennison
@ 2001-05-10 20:53   ` chris.danx
  1 sibling, 0 replies; 23+ messages in thread
From: chris.danx @ 2001-05-10 20:53 UTC (permalink / raw)



"Alfred Hilscher" <Alfred.Hilscher@icn.siemens.de> wrote in message
news:3AFACEC7.C2E67357@icn.siemens.de...
> Maybe the Windows API calls "CreateFile" and "DeviceIOControl" will be
> what you are looking for ? Look for this excerpt from   MS-API
> dokumentation.
>

This is what i'm looking for thanks.

Chris Campbell





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

* Re: Ada and Hardware
  2001-05-10 20:01         ` Jerry van Dijk
@ 2001-05-10 20:54           ` chris.danx
  0 siblings, 0 replies; 23+ messages in thread
From: chris.danx @ 2001-05-10 20:54 UTC (permalink / raw)



"Jerry van Dijk" <jvandyk@attglobal.net> wrote in message
news:u8zk5nfck.fsf@attglobal.net...
>
> "chris.danx" <chris.danx@ntlworld.com> writes:
>
> > tried to write a binding to Conio (i didn't know about Jerry Van Dijks!
Where's
> > the new site i lost the link?)
>
> See signature :-)
>
> BTW: I might be a bit dense,
> but I don't see what your problem is. If you
> want to high-level format a floppy to your own filesystem from your
> development machine, use the BIOS functions with the DOS compiler or the
> DeviceIOControl functions with the windows compiler.

I didn't know about the DeviceIOControl functions before but i do now.  I'll
probably try doing it this way.

Thanks for the link to the new site Jerry.  It's been bookmarked!

Chris Campbell





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

* Re: Ada and Hardware
  2001-05-10 20:22   ` Ted Dennison
@ 2001-05-10 23:35     ` Jeff Creem
  2001-05-10 23:58       ` Fraser Wilson
  2001-05-11 19:13       ` Randy Brukardt
  0 siblings, 2 replies; 23+ messages in thread
From: Jeff Creem @ 2001-05-10 23:35 UTC (permalink / raw)



"Ted Dennison" <dennison@telepath.com> wrote in message
news:JLCK6.91$j65.11856@www.newsranger.com...
> In article <3AFACEC7.C2E67357@icn.siemens.de>, Alfred Hilscher says...
> >
> >Maybe the Windows API calls "CreateFile" and "DeviceIOControl" will be
> >what you are looking for ? Look for this excerpt from   MS-API
> ..
> >"You can use the CreateFile function to open a disk drive or a partition
> ..
> >\\.\A: Obtains a handle to drive A on the user's computer.
> >\\.\C: Obtains a handle to drive C on the user's computer."
>
> Interesting. One has to wonder if this would work with the standard Ada IO
> operations (eg: Ada.Streams.Stream_IO)...
>

I just had to know to. It looks like it does not work.

with Ada.Streams.Stream_IO;
with Ada.Streams;

procedure Show_It is

  Buffer : Ada.Streams.Stream_Element_Array (1 .. 2048) := (others => 0);


  File : Ada.Streams.Stream_IO.File_Type;

begin
  Ada.Streams.Stream_IO.Open
    (
    File => File,
    Name => "\\.\A:",
    Mode => Ada.Streams.Stream_IO.Out_File);

  Ada.Streams.Stream_IO.Write
    (
    File => File,
    Item => Buffer);

  Ada.Streams.Stream_IO.Write
    (
    File => File,
    Item => Buffer);

  Ada.Streams.Stream_IO.Write
    (
    File => File,
    Item => Buffer);

  Ada.Streams.Stream_IO.Close(File);
end Show_It;


Raises a name error on the open.  I tried a few quick variations on it.
(Including create instead
of open).








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

* Re: Ada and Hardware
  2001-05-10 23:35     ` Jeff Creem
@ 2001-05-10 23:58       ` Fraser Wilson
  2001-05-11  1:54         ` Jeff Creem
  2001-05-11 19:13       ` Randy Brukardt
  1 sibling, 1 reply; 23+ messages in thread
From: Fraser Wilson @ 2001-05-10 23:58 UTC (permalink / raw)


"Jeff Creem" <jeff@thecreems.com> writes:

> "Ted Dennison" <dennison@telepath.com> wrote in message
> news:JLCK6.91$j65.11856@www.newsranger.com...
> > In article <3AFACEC7.C2E67357@icn.siemens.de>, Alfred Hilscher says...
> > >
> > >"You can use the CreateFile function to open a disk drive or a partition
> > ..
> > >\\.\A: Obtains a handle to drive A on the user's computer.
> > >\\.\C: Obtains a handle to drive C on the user's computer."
> >
> > Interesting. One has to wonder if this would work with the standard Ada IO
> > operations (eg: Ada.Streams.Stream_IO)...
> >
> 
> I just had to know to. It looks like it does not work.

Is it possible that the documentation assumes that back slashes are
escaped?  Though I can't imagine what "\A" means in that case.

Fraser.



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

* Re: Ada and Hardware
  2001-05-10 23:58       ` Fraser Wilson
@ 2001-05-11  1:54         ` Jeff Creem
  0 siblings, 0 replies; 23+ messages in thread
From: Jeff Creem @ 2001-05-11  1:54 UTC (permalink / raw)


Anything is possible. Again this does not take away from the original
advice on this (which is to use the given path with the win32
bindings)...This is just a fun
little diversion. It appears that it is somehow looking at the characters in
a special
way since the name error does take a while to come back. In addition, if I
swap out
\\Ada95\Shared\aaa

for the \\.\A: string (and use the create v.s. the open version of the call)
it does indeed
create a file on the win32 server named Ada95 on its shared disk called
Shared with
a filename of aaa....So it is indeed close to working but not quite right.

...back to real work..


"Fraser Wilson" <blancolioni@blancolioni.org> wrote in message
news:fy7y9s4eoz8.fsf@blancolioni.org...
> "Jeff Creem" <jeff@thecreems.com> writes:
>
> > "Ted Dennison" <dennison@telepath.com> wrote in message
> > news:JLCK6.91$j65.11856@www.newsranger.com...
> > > In article <3AFACEC7.C2E67357@icn.siemens.de>, Alfred Hilscher says...
> > > >
> > > >"You can use the CreateFile function to open a disk drive or a
partition
> > > ..
> > > >\\.\A: Obtains a handle to drive A on the user's computer.
> > > >\\.\C: Obtains a handle to drive C on the user's computer."
> > >
> > > Interesting. One has to wonder if this would work with the standard
Ada IO
> > > operations (eg: Ada.Streams.Stream_IO)...
> > >
> >
> > I just had to know to. It looks like it does not work.
>
> Is it possible that the documentation assumes that back slashes are
> escaped?  Though I can't imagine what "\A" means in that case.
>
> Fraser.





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

* Re: Ada and Hardware
  2001-05-10 23:35     ` Jeff Creem
  2001-05-10 23:58       ` Fraser Wilson
@ 2001-05-11 19:13       ` Randy Brukardt
  2001-05-14 10:27         ` Alfred Hilscher
  1 sibling, 1 reply; 23+ messages in thread
From: Randy Brukardt @ 2001-05-11 19:13 UTC (permalink / raw)


Jeff Creem wrote in message
<1BFK6.19477$9j1.4714444@typhoon.ne.mediaone.net>...
>
>"Ted Dennison" <dennison@telepath.com> wrote in message
>news:JLCK6.91$j65.11856@www.newsranger.com...
>> In article <3AFACEC7.C2E67357@icn.siemens.de>, Alfred Hilscher
says...
>> >
>> >Maybe the Windows API calls "CreateFile" and "DeviceIOControl" will
be
>> >what you are looking for ? Look for this excerpt from   MS-API
>> ..
>> >"You can use the CreateFile function to open a disk drive or a
partition
>> ..
>> >\\.\A: Obtains a handle to drive A on the user's computer.
>> >\\.\C: Obtains a handle to drive C on the user's computer."
>>
>> Interesting. One has to wonder if this would work with the standard
Ada IO
>> operations (eg: Ada.Streams.Stream_IO)...
>>
>
>I just had to know to. It looks like it does not work.


That format for the disk name only works with Windows NT and Windows
2000. Did you try it on one of those, or on Windows 95/98/ME? (So says
the platform documentation in the MSDN library, January 2001).

(Note that the original poster's problem cannot be solved with this
syntax, because it doesn't work on Windows 98, which he indicated was
his target.)

            Randy.






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

* GNAT for DOS
  2001-05-10 13:02 Ada and Hardware chris.danx
                   ` (2 preceding siblings ...)
  2001-05-10 17:24 ` Alfred Hilscher
@ 2001-05-11 21:45 ` chris.danx
  2001-05-13 19:52 ` Ada and Hardware chris.danx
  4 siblings, 0 replies; 23+ messages in thread
From: chris.danx @ 2001-05-11 21:45 UTC (permalink / raw)


I've downloaded GNAT for DOS but i'm not sure which version of djgpp i need to
run it.  I've got 3.13alpha and i've checked the current verson of djgpp --
2.03.  Has anyone used it and if so which version of DJGPP do i need?  And where
do i get it?


Thanks,
Chris

p.s. i looked in the windows api ref and win9x doesn't support deviceio thingy.
{ Probably due to it's naff security mechanisms -- which are nothing like
t's!  }  Hence the need for the dos compiler!





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

* Re: Ada and Hardware
  2001-05-10 13:02 Ada and Hardware chris.danx
                   ` (3 preceding siblings ...)
  2001-05-11 21:45 ` GNAT for DOS chris.danx
@ 2001-05-13 19:52 ` chris.danx
  2001-05-14  0:18   ` Jeff Creem
  4 siblings, 1 reply; 23+ messages in thread
From: chris.danx @ 2001-05-13 19:52 UTC (permalink / raw)


Hi,
    I've got a binding to the biosdisk function but i do not know how to tell
GNAT which file it's in.  I tried -I but that's wrong.  I looked in the users
guide and reference manual for GNAT but cannot find it.

I'm linking to the libc.a file a part of the djgpp installation.  (this is GNAT
non-dos i'm using i had major problems trying to get the dos one to compile...)
I hope linking non-dos and dos is possible (win98 i'm on).

This is my binding


with interfaces.c;
with interfaces.c.strings;

package biosf is

   package C renames interfaces.c;

   function biosdisk ( cmd    : in c.int;
                       drive  : in c.int;
                       head   : in c.int;
                       track  : in c.int;
                       sector : in c.int;
                       nsects : in c.int;
                       buffer : in c.strings.chars_ptr) return c.int;
   pragma import (C, biosdisk, "biosdisk");
   pragma linker_options ("d:\djgpp\lib\libc.a");
   -- the above line is wrong...
   -- i don't know what the correct option is!

end biosf;



Thanks,
Chris Campbell





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

* Re: Ada and Hardware
  2001-05-13 19:52 ` Ada and Hardware chris.danx
@ 2001-05-14  0:18   ` Jeff Creem
  0 siblings, 0 replies; 23+ messages in thread
From: Jeff Creem @ 2001-05-14  0:18 UTC (permalink / raw)


When this thread first started, I and several others tried to point out that
this was
not the best group since you are not really asking how to do something in
Ada but
are asking how to do something in windows..

Many of us tried to help but since we are not all win32 gurus  we probably
thew you some curve balls...

So lets try this and try to set things straight (mainly for people who
revisit this
thread someday in deja (ok make that google)

1) The first assertion was that the poster knew how to do this in C so could
we
help in Ada. After following the thread a little and reading a little I
assert that the
poster (and I am not trying to flame here at all) did not know how to "do
it" in C.
The poster DID know how to make a particular BIOS call with a particular C
compiler however
that call IS NOT available to a win32 (32 bit) C compiler. It is available
on 16 bit compilers
or for compilers producing 16 bit executables.

2) An early post recommended opening the disk device with a name like \\.\A:
which would be
correct for a win32 system based on NT code (and will not work for win
95,98,ME).

3) One recommeded approach (which should have worked) was to use GNAT for
DOS so
that you would be able to make these BIOS calls..Note that I think this
could still work but it
is not the greatest long term approach..(although with what the answer
actually is perhaps this
would not be bad to revisit)

3) Now, for what I think is approaching the correct answer. I looked at the
archives of
a few win32 related groups for similar questions (where the question should
have started
in the beginning...Again this is not meant to be a flame, sometimes the
specifics of a question
and what the actual question is really is only clear once you begin to
understand the answer).

Take a look at the link:

http://msdn.microsoft.com/library/psdk/win95/devio_2b1v.htm

This describes how to use the VWIN32.VXD service in windows to do low
level IO (specifically floppy disk read/write....Note that apparently if you
wanted something
as simple as direct hard disk access it would be much more difficult (See
Microsoft
Knowledge base Q137176 and Q137813 )



What is really amazing here is the pain it takes under a 32 bit app on win
95/98/ME to do this stuff and
how different it is from NT.  I always find it amazing how Windows snobs
will talk about
the multiple versions of Linux (or Unix) without realizing how different win
95, 95 OSR 2, 98, 98 SE,
ME, NT, 2000, XP, CE are from each other...Granted several of these are
version
updates and so you can cut them some slack but it is not as if a windows
developer can
ignore the older versions (although it appears finally that the original 95
and
even 95 OSR 2 are now no longer supported well)..




"chris.danx" <chris.danx@ntlworld.com> wrote in message
news:ABBL6.3405$tU6.554354@news2-win.server.ntlworld.com...
> Hi,
>     I've got a binding to the biosdisk function but i do not know how to
tell
> GNAT which file it's in.  I tried -I but that's wrong.  I looked in the
users
> guide and reference manual for GNAT but cannot find it.
>
> I'm linking to the libc.a file a part of the djgpp installation.  (this is
GNAT
> non-dos i'm using i had major problems trying to get the dos one to
compile...)
> I hope linking non-dos and dos is possible (win98 i'm on).
>
> This is my binding
>
>
> with interfaces.c;
> with interfaces.c.strings;
>
> package biosf is
>
>    package C renames interfaces.c;
>
>    function biosdisk ( cmd    : in c.int;
>                        drive  : in c.int;
>                        head   : in c.int;
>                        track  : in c.int;
>                        sector : in c.int;
>                        nsects : in c.int;
>                        buffer : in c.strings.chars_ptr) return c.int;
>    pragma import (C, biosdisk, "biosdisk");
>    pragma linker_options ("d:\djgpp\lib\libc.a");
>    -- the above line is wrong...
>    -- i don't know what the correct option is!
>
> end biosf;
>
>
>
> Thanks,
> Chris Campbell
>
>





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

* Re: Ada and Hardware
  2001-05-10 18:28       ` chris.danx
@ 2001-05-14  7:40         ` Kretschmer, Matthias
  0 siblings, 0 replies; 23+ messages in thread
From: Kretschmer, Matthias @ 2001-05-14  7:40 UTC (permalink / raw)


"chris.danx" wrote:
> 
> "Tarjei T. Jensen" <tarjei.jensen@kvaerner.com> wrote in message
> news:9de8t0$e1s3@news.kvaerner.com...
> >
> > chris.danx wrote :
> > >I don't understand FAT12 yet, and it complicates the boot sector.  Also the
> > fs
> > >can be messed with if it's a fat12 disk easily.  I don't want this.  Would
> > you
> > >want any person coming along and swapping a driver file for another that's
> > got a
> > >similar signiture but does malicious things behind the scenes?  What's more
> > >anyone can come along and delete a critical file easy.  Two clicks and OS
> > is
> > >gone.
> >
> > That situation is no worse than anything else that boots from a standard
> > msdos floppy. If I thought it would be a problem II would  make he file(s)
> > invisible (system).
> >
> 
> This is true, but my main reason for doing it with BFS instead of FAT12 is the
> simplicity of working with the files on it.  The Boot sector is simplified
> grately and so too is the secondary loader (a 32bit Ada loader with floppy
> driver; the OS will have a new module reconfiguration system which is easier to
> manage with Ada than ASM).  I want to limit my use of ASM in the system to the
> bootsector if possible.  Everything else stands a good chance of being Ada or
> maybe a teensy bit of C.
> 

If you want to implement real usefull memory-management you need to
develop at least some glue in Assembler (there are things that can't be
really done in C or has anybody yet seen an LGDTR mnenomic in C?).

> > >I know how to boot from a floppy for the file system i'm using.  It's
> > really
> > >easy (just look in 2nd inode to get address of primary kernel file, and
> > >calculate offset).  I just need to get the files from my FAT hard disk to
> > my BFS
> > >floppy.  The current driver implements a disk as a file on a HD, and it's
> > really
> > >easy to work with.  The problem is i need to create a bfs enabled disk,
> > write
> > >files to it, read info from it, via an interactive shell.  I don't know how
> > to
> > >do this in Ada (i can do the shell though).  I do know how in C.
> >
> > If you know how to do it in C, you know how to do it in Ada.
> 
> I'll try a binding to C and see how it goes.

maybe you work with your disk on the hdd and than just put the image on
floppy? - using your driver you put on your floppy running Win98 should
be a problem, because win32 applications shouldn't be allowed to
directly access hardware (but I am no Windows expert and I wouldn't
wonder if M$ made it possible).

mfg M.K.



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

* Re: Ada and Hardware
  2001-05-11 19:13       ` Randy Brukardt
@ 2001-05-14 10:27         ` Alfred Hilscher
  0 siblings, 0 replies; 23+ messages in thread
From: Alfred Hilscher @ 2001-05-14 10:27 UTC (permalink / raw)




Randy Brukardt wrote:
> >> >\\.\A: Obtains a handle to drive A on the user's computer.
> >> >\\.\C: Obtains a handle to drive C on the user's computer."
> >>
> >> Interesting. One has to wonder if this would work with the standard
> Ada IO
> >> operations (eg: Ada.Streams.Stream_IO)...
> >>
> >
> >I just had to know to. It looks like it does not work.
> 
> That format for the disk name only works with Windows NT and Windows
> 2000. Did you try it on one of those, or on Windows 95/98/ME? (So says
> the platform documentation in the MSDN library, January 2001).
> 
> (Note that the original poster's problem cannot be solved with this
> syntax, because it doesn't work on Windows 98, which he indicated was
> his target.)

Correct:
"Windows 95: This technique does not work for opening a logical drive.
In Windows 95, specifying a string in this form causes CreateFile to
return an error."

On Win NT you must have admin rights (I think).



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

end of thread, other threads:[~2001-05-14 10:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-10 13:02 Ada and Hardware chris.danx
2001-05-10 13:36 ` Ted Dennison
2001-05-10 14:00   ` chris.danx
2001-05-10 14:52     ` Ted Dennison
2001-05-10 18:20       ` chris.danx
2001-05-10 20:01         ` Jerry van Dijk
2001-05-10 20:54           ` chris.danx
2001-05-10 13:54 ` Tarjei T. Jensen
2001-05-10 14:10   ` chris.danx
2001-05-10 14:34     ` Tarjei T. Jensen
2001-05-10 18:28       ` chris.danx
2001-05-14  7:40         ` Kretschmer, Matthias
2001-05-10 17:24 ` Alfred Hilscher
2001-05-10 20:22   ` Ted Dennison
2001-05-10 23:35     ` Jeff Creem
2001-05-10 23:58       ` Fraser Wilson
2001-05-11  1:54         ` Jeff Creem
2001-05-11 19:13       ` Randy Brukardt
2001-05-14 10:27         ` Alfred Hilscher
2001-05-10 20:53   ` chris.danx
2001-05-11 21:45 ` GNAT for DOS chris.danx
2001-05-13 19:52 ` Ada and Hardware chris.danx
2001-05-14  0:18   ` Jeff Creem

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