Mail Archives: djgpp/1999/12/14/06:09:43
May I suggest to use a more descriptive Subject next time? This will
draw attention of people who cannot afford to read the entire news
group, and who can help you in your (most complex) task.
I took a liberty of renaming this thread.
On Mon, 13 Dec 1999 Do DOT Taddei AT agora DOT stm DOT it wrote:
> I've used ndisasm and nasm for disassemble and reassemble a 16-bits
> dos freeware tsr screen-reader for visually impaire transforming it in
> opensource.
>
> Now I want export it under protected mode systems as windows and linux.
I don't know about Linux, but in Windows, you could just keep the old
16-bit TSR. Building TSRs with DJGPP is not for the faint of heart,
especially since some of the DPMI functions required for that are
unimplemented by the Windwows' built-in DPMI server.
In any case, I expect the Linux version to be *very* different from
the DJGPP's one, due to radical differences in the protected-mode
environment and in accessing peripheral devices such as video memory.
> I begin with djgpp because the first goal is to obtain a dos
> 32-bits version.
An example of a simple TSR built with DJGPP is available on SimTel:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/djgpptsr.zip
Note that it will probably only work with CWSDPMI, perhaps also with
386Max. Other DPMI servers will probably not do.
> You can help me very much giving me a macro which intercept every
> interrupt and, setting and/or saving correctly all registers, call a
> c function which print interrupt number and execute it in protected
> mode (__dpmi-int):
This is an extremely complex task, unless I don't understand your
goal. In the DPMI environment, hardware interrupts are reflected to a
protected-mode handler, but most software interrupts (which is what I
think you are interested in) are not. So you need to hook the
software interrupts with real-mode callbacks (see the docs of the
DJGPP library function _go32_dpmi_allocate_real_mode_callback_iret),
and this method has many disadvantages. In particular, issuing
interrupts from inside a callback is very tricky if not impossible.
For that matter, I don't know how do you do that in 16-bit real mode,
either. Don't you need to hook each and every interrupt individually
by calling the appropriate function of the DOS interrupt 21h, or by
writing the address of your handler into each slot of the interrupt
vector table? If so, this is not a simple macro, but quite a bit of
code.
> in this way i can debug using gdb debugger.
There's more to debugging with GDB than just hooking real-mode
interrupts. I'd say that debugging a TSR with GDB is next to
impossible, even with the latest, much improved DJGPP debug support.
- Raw text -