Inline assembly question for Watcom 10.6

Hi All,
I am trying to insert some inline assembly code into a C++ program on
an Octagon PC-510 using the Watcom 10.6 compiler under QNX v 4.24. The
assembly code is supposed to let me use expanded int 17h options to
enable a watchdog timer on the board. Right now my program sig segs
when I call “int 17h.” Here’s the code:

extern void doWDEnable(void);
#pragma aux doWDEnable =
“mov ax,0fd01h”
“mov dx,0ffffh”
“int 17h”
modify [ax dx];

The assembly calls are straight out of the PC-510 manual and the #pragma
stuff seems to match the simplest inline assembly examples from the
Watcom documentation. I’ve never done inline assembly in a C/C++
program before and it’s been a looooong time since I have done any
assembly at all, so it seems pretty likely that I am messing up some
kind of setup. Does anyone have any suggestions?

Thank You,

Mark Faust

Well this might work under DOS, but there are
definite reasons to suspect that it won’t work
under QNX. To begin with int 17h will not
point to the Bios code you are expecting it
to. Here are three options that I can think
of.

  1. Get the actual code from the supplier.

  2. Under the DOS debugger, figure out what the
    interrupt code does.

  3. Find some way to emulate the Bios code.


    Mark Faust <mark.faust@sri.com> wrote:

Hi All,
I am trying to insert some inline assembly code into a C++ program on
an Octagon PC-510 using the Watcom 10.6 compiler under QNX v 4.24. The
assembly code is supposed to let me use expanded int 17h options to
enable a watchdog timer on the board. Right now my program sig segs
when I call “int 17h.” Here’s the code:

extern void doWDEnable(void);
#pragma aux doWDEnable =
“mov ax,0fd01h”
“mov dx,0ffffh”
“int 17h”
modify [ax dx];

The assembly calls are straight out of the PC-510 manual and the #pragma
stuff seems to match the simplest inline assembly examples from the
Watcom documentation. I’ve never done inline assembly in a C/C++
program before and it’s been a looooong time since I have done any
assembly at all, so it seems pretty likely that I am messing up some
kind of setup. Does anyone have any suggestions?

Thank You,

Mark Faust


Mitchell Schoenbrun --------- maschoen@pobox.com

Mark Faust <mark.faust@sri.com> wrote:

Hi All,
I am trying to insert some inline assembly code into a C++ program on
an Octagon PC-510 using the Watcom 10.6 compiler under QNX v 4.24. The
assembly code is supposed to let me use expanded int 17h options to
enable a watchdog timer on the board. Right now my program sig segs
when I call “int 17h.” Here’s the code:

Yup. This will probably never work – first question, this is making
a BIOS call, is that code you are jumping into setup to be called from
32-bit protected mode? I would bet not.

The other thing you need for any hardware access, is you must compile
the program -T1. But, even if you do that, this is unlikely to work.
(Due to the BIOS not being callable.)

Can you get more documentation from Octagon as to exactly what the
BIOS code is doing? If so, implement that either in C or in
inline assembly. If not, it may get uglier… you may be able
to access and disassemble the BIOS code to figure out what it is
doing. Hopefully Octagon will be cooperative, and either give
you a copy of the code the BIOS executes to handle the needed
BIOS calls, or will tell you what it actually does.


extern void doWDEnable(void);
#pragma aux doWDEnable =
“mov ax,0fd01h”
“mov dx,0ffffh”
“int 17h”
modify [ax dx];

The assembly calls are straight out of the PC-510 manual and the #pragma
stuff seems to match the simplest inline assembly examples from the
Watcom documentation. I’ve never done inline assembly in a C/C++
program before and it’s been a looooong time since I have done any
assembly at all, so it seems pretty likely that I am messing up some
kind of setup. Does anyone have any suggestions?

The inline assembly looks fine to me (though I’m not an expert
in that either), but as noted above, I don’t think the syntax
for the inline assembly is the problem.

-David

Thank you both for your responses. I spoke to Octagon and they were
able to give me a series of inp() / outp() calls to get at the watchdog
timer settings.

Thanks Again,

Mark Faust