DOS 7.1 programming for Intel EP80579

Started by suryakant, March 09, 2010, 05:19:14 AM

Previous topic - Next topic

suryakant

Hi all,

I new to this forum and also after 9 years switching back to MASM (had used in college days).

I have Intel EP80579 board with DOS7.1 on it. I need to write applications on it. As the processor is having PCI, I ll need 32 bit addresses. I am using Visual Studio 2008. Will 32 bit instructions work in DOS? Can somebody provide step by step guide.

Also I would like to know how to write device drivers for DOS. Any good reference would be appreciated.

Thanks in advance.

dedndave

i learned to write DOS device drivers from a book by Ray Duncan
i do not recall the name of the book, nor do i remember how to write the drivers - lol
well - i remember some of the stuff   :bg
i think the book title was something like "Advanced Programming for DOS"
wish i still had that book - lost it in a move or something (probably got "borrowed")

you can use 32-bit registers under windows - i am not sure how well that works with DOS
DOS 7 sounds like it might support it without too much difficulty
use a ".586" directive at the beginning of the program and try it out

welcome to the forum   :U

japheth

Quote from: dedndave on March 09, 2010, 10:57:17 AM
i think the book title was something like "Advanced Programming for DOS"
wish i still had that book - lost it in a move or something (probably got "borrowed")

It's "Advanced MS-DOS Programming". It's available as PDF for free.

http://www.ece.ul.ie/homepage/tom_newe/Modules/CE4204/advdos-Duncan.pdf

suryakant

thanks all,

Keep posting... I ll also update as I move ahead.

dedndave


FORTRANS

Hi,

   32-bit registers and memory variables work in DOS without
problems.  32-bit addressing requires a "DOS extender" or
BIOS system functions.  MS-DOS by itself is mostly real mode
not protected mode.  EMS, XMS, DPMI, and VCPI are terms
you can use to track down information.

Good luck,

Steve

MichaelW

Quote32-bit addressing requires a "DOS extender" or BIOS system functions.

Not necessarily, for limited data access it may be possible to set up an otherwise unused segment register with a 32-bit limit and use it to access the 32-bit addresses. I posted an example here:

http://www.masm32.com/board/index.php?topic=13085.msg101551#msg101551

eschew obfuscation

redskull

First, don't assume that an embedded CPU *based* on an x86 chip will behave exactly like a regular x86 chip.  You defenitly need to read the manual for that specific CPU to see about 32-bit addressing, real-mode, protected-mode, etc.  However, since DOS runs on it, it's a good bet it works very similar.  If that's the case, then you can't use 32-bit ADDRESSESS under real-mode, as it will generate an excepetion (though, as was said, you can use 32-bit REGISTERS if you assemble it correctly).  IMHO, niether XMS nor EMS is worth it, as dos extenders are cheap, plentiful, and easy to use.  As for 'unreal' mode, who knows if it will even work on that CPU?

Second, don't try and test software for your embedded system on your development system (presuambly running NT).  It will randomly not work, and it will drive you to pull out your hair.  Also, using VS2008 to write DOS programs is probably not possible, or at the very least a major headache.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

MichaelW

Quote from: redskull on March 09, 2010, 01:37:01 PM
If that's the case, then you can't use 32-bit ADDRESSESS under real-mode, as it will generate an excepetion

Per the specs the EP80379 has an IA-32 core. For IA-32 there is a well-established method of accessing 32-bit addresses from real mode, without generating an exception. Essentially, you avoid having the access exceed the segment limit by modifying the effective limit for whatever segment register you use to do the access. This basic method saw a lot of use in the early 90's, and it was the method that HIMEM.SYS used to access extended memory from real mode.
eschew obfuscation

redskull

I never really played with that method, but I was under the impression it involved switching into protected mode to load the descriptor, and then switching back to real mode to "dupe" the CPU into continuting to use the original one; other than being able to utilize DOS system services, which is perhaps less of a concern for an embedded project with lots of custom hardware, what would the advantage be?  Basically, if you are already in protected mode, why not just stay there?

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

FORTRANS

Quote from: MichaelW on March 09, 2010, 01:24:19 PM
Not necessarily, for limited data access it may be possible to set up an otherwise unused segment register with a 32-bit limit and use it to access the 32-bit addresses.

Hi,

   Yes, my bad.  Add to the list at least unreal mode or big
real mode.  Was not thinking I guess.

Regards,

Steve N.

MichaelW

QuoteBasically, if you are already in protected mode, why not just stay there?

Only a minimal protected mode setup is necessary to extend the segment limit. The setup necessary to actually run in protected mode would be more complex, and to also access real mode services more complex still. A good DOS Extender will handle most of the complexities, but depending on what the OP needs to do and the details of the system, a real-mode application with an extended segment limit might be easier to code.
eschew obfuscation

suryakant

Thanks all.

I got the idea, how to wrte device driver. Now how application will call the services of the driver? Any example or illustration would help  me better? I will be writing driver for CAN protocol for EP80579.

Also I need to write application software in C. Visual Studio 2008 does not seem to support dos function calls in C... also I could not get proper switches to compile program for 16 bit OS. Shall I go for Turbo C for DOS for application programming and MASM in Visual Studio for Device drivers? Will I need to do some changes?

Thanks in advance.

MichaelW

Take a look at djgpp, and note that the HDPMI DPMI Server included with the HX DOS Extender is compatible with djgpp applications.

As an alternative to a real-mode DOS device driver you might want to consider a Resident Service Provider that operates in protected mode.
eschew obfuscation

suryakant

Hi all,

I have started well. I am facing one problem. I need to write DWORD at 300B1000H location of the processor (32 bit address) which is saved in variable (say BaseAddress). How do I do it in DOS? (i.e. 16 bit mode)