Forums

controlling C31 DSK with BC++ builder 6 pro applications ;-)

Started by baghli June 4, 2004
Hi Keith

I red the "Building Host Side Projects " section in your DSK3V202.exe
tools
I am trying to compile a simple access from the PC W2000 pro to the
DSK to download .out , access memory and so..
I started with your simple.cpp and all the cpp you mentionned to add
to the project
my pb is that I use Builder 6 Pro (under console application) and not
MSVC nor BC4.5 :-( I got DIRECTIO to access // port

I give you a sample of my tiny project file in attachement (but it
doesn't work)

ok, I bypass the routine that reads the keyboard (old DOS bios.h that
doesnt' work, I will replace it later by Virtual key check...)

But it still doesn't compile :-(

it stops in Driver.cpp not knowing what is the functions : _outp,
_inp and so ...
these are special // port access ? in what include file definition ???

Also, I replaced the header type
#define WINDOWS_LINK_ALL 1

is _WIN32 defined by default ?
have I to compile a particular DLL ??? your Dsk3dll ???

I didn't til now did the :
"Creating New Folder and New Project in that folder"
"DSK3DLL Project"
"Building"
in the "Building Host Side Projects"

Thanks in advance,
Yours sincerely
L. BAGHLI.




Hello Baghli

I dont have BC builder so I wont be able to open these projects, but I think I can help.  And, I think you are on the right track if this is to succeed.

The first thing that needs to be established is if one of the existing DOS/Console applications work with DIRECTIO.  If DIRECTIO does not work in this case, Im not sure where to go.  My understanding (at least with older NT versions) is that  DIRECTIO is supposed to give a legacy application access to the PC's IO channel by disabling the GPF mechnanism for a particular location. The *new* DIRECTIO may require something else like linking into some kind of library.  I just dont know.

Here is how the GPF is supposed to work and how, at least the older DIRECTIO got around the GPF.

- Each IO location in the PC has a IO Protection Map (IOPM) bit, an interrupt enable bit, associated with it. You can think of this like as being something like the Interrup Enable (IE) register in the C3x. If an IO access is made to a location whose IOPM bit is set, a GPF is generated telling the OS that a non-handled acccess has been made.  Windows either generates a GPF message or goes back doing nothing.  In either case, the IO access is aborted. If the IOPM bit for say the printer port is disabled, no GPF will be generated and IO access proceeds just like it did in the days before Windows.  Basically this allows ANY legacy code to work with Windows NT, which is something has been trying to stamp out for years.  So now I am told that the new versions of Windows continually update the IOPM so this is not as easy as it used to be.

The new DSK software (by the way the most recent version available for download is 2.05) has taken the great leap out of the Window so to speak.  Therefor if you cant find a way around this (using an older version of Windows, or hopefully DIRECTIO), you are destined to learn how to program Windows.  EG lif is no longer easy. Anyhow, the new Windows NT based OS's (NT, 2K and XP) are supported through third party DLL's whose functions are called indirectly.  In this case the NT support nonsense is handled by the third party.  Nice, but the catch is that we are stuck with Windows programming and simple applications like "HELLO WORLD" become complex.

Back to DIRECTIO
---------------------
If DIRECTIO works, you should be able to call the inport and outport IO functions directly.  Which functions are linked and used in the build are determined by the OS detection mechanisms in TYPDEFS.H  Basically in this header you will find the #ifdef statements that figure out if the application is being built using Borland 3.1 (old DOS apps), Borland 4.5 in 16b mode, Borland 4.5 in 32b mode, or MSVC.

Untill now I had not considered what it would take to build a DOS/Console application, but with the __WIN32__ and WINDOWS_LINK_ALL attributes set I think you are ultimately on the right track.   I am thinking this because you will eventually want to include the following function(s).  You may want to do a grep on DRIVER.CPP to find this.

#if __WIN32__  // Borland Win32 build
void outportb(WORD port, unsigned char value)
{
  _asm push dx
  _asm push ax
  _asm mov  dx,port
  _asm mov  al,value
  _asm out  dx,al
  _asm pop  ax
  _asm pop  dx
}

When you set the WINDOWS_LINK_ALL attribute you are essentially NOT building a DLL but rather linking all of the needed sources in with the main applicaion.  You get a bigger executable, and the driver code is replicated for every application, but it is simple.

Hope this helps
Keith Larson

DSP and Analog Consultant
Lincoln, Ma

baghli wrote:
Hi Keith

I red the "Building Host Side Projects " section in your DSK3V202.exe tools I am trying to compile a simple access from the PC W2000 pro to the DSK to download .out , access memory and so.. I started with your simple.cpp and all the cpp you mentionned to add  to the project my pb is that I use Builder 6 Pro (under console application) and not MSVC nor BC4.5 :-( I got DIRECTIO to access // port

I give you a sample of my tiny project file in attachement (but it doesn't work)

ok, I bypass the routine that reads the keyboard (old DOS bios.h that doesnt' work, I will replace it later by Virtual key check...)

But it still doesn't compile :-(

it stops in Driver.cpp not knowing what is the functions : _outp, _inp and so ...
these are special // port access ? in what include file definition ???

Also, I replaced the header type
#define WINDOWS_LINK_ALL   1

is _WIN32 defined by default ?
have I to compile a particular DLL ??? your Dsk3dll ???

I didn't til now did the :
"Creating New Folder and New Project in that folder"
"DSK3DLL Project"
"Building"
in the "Building Host Side Projects"

Thanks in advance,
Yours sincerely
L. BAGHLI.