passing record address to device in BP 7.0 protected mode 
Author Message
 passing record address to device in BP 7.0 protected mode

I have a TP 7.0 program which I would like to run in BP 7.0 protected
mode, to take advantage of larger arrays.  The program reads data from
two older-style optical WORM drives via a COREL-SCSI "ioctl" interface
operating as part of interrupt 21h.  This works fine in TP, but not at
all in BP protected mode.  

The interrupt call is made using the BP MSDOS call and passes the
address of a Pascal record which contains the "parameter block" which
controls the drive. The segment and offset of the record are passed as
register values.  Therein lies the problem.  In real mode, the address
of the record is determined by SEG and OFF calls.  When these are
called in protected mode, they presumably return a segment selector
and an offset which the ioctl interface cannot deal with.

Is there a way around this problem within BP?

Any hints would be appreciated.  Documentation for protected mode is
fairly slim.

Stuart Anstee



Wed, 18 Jun 1902 08:00:00 GMT  
 passing record address to device in BP 7.0 protected mode
Hi Stuart.

Quote:

>I have a TP 7.0 program which I would like to run in BP 7.0 protected
>mode, to take advantage of larger arrays.  The program reads data from

Firstly, Pmode will not automatically allow you to declare larger
arrays. What it does do is make more memory available to the heap
manager - so you can have more arrays, if they are declared on the
heap. If I am preaching to the converted here, please excuse my
lecture-mode.

Quote:
>two older-style optical WORM drives via a COREL-SCSI "ioctl" interface
>operating as part of interrupt 21h.  This works fine in TP, but not at
>all in BP protected mode.  

Oooooh, you have my sympathies. We battled with this for many a
head-hurting hour! But take a deep breath, count to several million,
and relax. There IS light at the end of the tunnel.

Quote:
>The interrupt call is made using the BP MSDOS call and passes the
>address of a Pascal record which contains the "parameter block" which
>controls the drive. The segment and offset of the record are passed as
>register values.  Therein lies the problem.  In real mode, the address
>of the record is determined by SEG and OFF calls.  When these are
>called in protected mode, they presumably return a segment selector
>and an offset which the ioctl interface cannot deal with.
>Is there a way around this problem within BP?
>Any hints would be appreciated.  Documentation for protected mode is
>fairly slim.

Slim ? Anorexic would be more like it!  I read everything I could lay
my hands on, and still had to work a lot of it out myself. Right, to
get down to business :

First off, scour local bookshops, and buy a *GOOD* DOS programmer's
reference guide. If you don't need it now, you soon will. It *MUST*
include a list of DPMI function calls.

One of these calls - sorry, I don't have the book or source with me -
will allocate a block of low memory to your application, and give you
two references to it. One of these if the Pmode selector-based
address, the other is the Real-Mode segment. As I recall, it ONLY
gives you the segment, the offset will be zero.

This should work out beautifully for you, as it did for us. A few more
comments :

You're lucky that you get to the function via MSDOS, because that
means you can also get there via INT 21H. This appears to be one of
the few which is properly chained from protected to real mode.

Do *NOT* use the MSDOS call to do this. Rather do an INTR(..). Don't
ask me why, just do it.

ZERO any registers you don't specifically need to pass to the
function. This goes for any INTR in Pmode, and especially for segment
registers. I doubt if you'll find it documented anywhere, but the DPMI
manager is most likely to croak if passed non-zero segment registers.

Ensure that the function number passed to INT 21H is not used by DPMI,
otherwise you're in trouble, unless you can change it.

If you are considering porting your application to Windoze, things
change somewhat - you are still in protected mode, and the DPMI
manager is still functional and call-able, but after Windoze has
booted, it takes all the memory for itself. So, you now have to ask
Win for the memory instead. This is done via the GlobalDosAlloc
function.

I'll try to locate my reference book, and get back to you with the
relevant f/call information. Gimme a shout, and lemme know if I'm on
the right track here.

Cheers,

Ken Pemberton

Opinions expressed in this message do not necessarily
reflect those of myself, my organisation or anybody else.
I don't know where they come from... it scares me sometimes.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. BP 7.0 Protected mode and HLT instruction

2. Graphics Device Interface for BP 7.0

3. Multitasking under BP protected mode

4. RTM.EXE - for BP Protected Mode programs.

5. Mouse driver check in DPMI protected mode BP

6. BP protected mode programming books

7. BP 7: Protected Mode, HELP!

8. BP 7 Protected mode memory manager error

9. VESA BIOS calls in BP protected mode programs

10. Using VESA BIOS calls in a BP Protected Mode program

11. Help! VESA under BP protected mode

12. 15, 16, 24, 32bit RGB-Modes in BP 7.0

 

 
Powered by phpBB® Forum Software