Mail Archives: djgpp/1996/12/16/04:00:41
I've been able to modify your code a little to make it semi-stable. It
still needs some work, though. But it appears to time the input, which I
think is what you wanted it to do. I've commented out certain lines with
the C++ style comments that I've replaced, and added comments of my own.
I hope it helps a little.
On Mon, 16 Dec 1996, Jung-mun Kim wrote:
> Hi...
>
> I have some trouble that I can't solve..
>
> The Source files....
>
> =============================================================================
>
> #include <go32.h>
> #include <dpmi.h>
> #include <sys/farptr.h>
> //#include <iostream.h>
> #include <dos.h>
#include <stdio.h> /* you need this */
>
> _go32_dpmi_seginfo old_handler, my_callback;
>
> int counter;
> char *string;
>
> void my_int()
> {
> char *ch = string;
> int addr = 0xA0000;
>
> counter++;
>
/* the following code does nothing on my machine */
> while(*ch)
> {
> _farpokeb(_dos_ds, addr, *ch);
> ch++;
> addr += 2;
/* why +=2 for a byte-sized data type? */
> }
> }
>
> void end_int(){}
>
> void init_handler()
> {
>// _go32_dpmi_lock_data(&counter, sizeof(counter));
_go32_dpmi_lock_data(&counter, sizeof(int));
>// _go32_dpmi_lock_data(&string, sizeof(string));
_go32_dpmi_lock_data(&string, sizeof(char *));
> _go32_dpmi_lock_code(my_int, (long)end_int - (long)my_int);
>
> _go32_dpmi_get_protected_mode_interrupt_handler(8, &old_handler);
>
my_callback.pm_selector = _my_cs(); /* it likes the selector
filled in, too */
> my_callback.pm_offset = (int)my_int;
> _go32_dpmi_allocate_iret_wrapper(&my_callback);
> _go32_dpmi_set_protected_mode_interrupt_handler(8, &my_int);
> }
>
> void done_handler()
> {
> _go32_dpmi_set_protected_mode_interrupt_handler(8, &old_handler);
> _go32_dpmi_free_iret_wrapper(&my_callback);
> }
>
>
> void update_text(char *s)
> {
> int ints = disable();
>
> string = s;
>
> if(ints) enable();
> }
>
> main()
> {
> char buffer[80], temp[80];
> int ints;
>
> counter = 0;
> update_text("");
> init_handler();
>
> // _go32_lock_data(buffer, 80);
_go32_dpmi_lock_data(&buffer, 80);
> printf("\nType some text followed by a CR,\n");
> printf(" or EXIT to quit \n");
>
> do {
> printf("Counter = %d \n", counter);
> // scanf("%s", temp);
fgets(temp, 80, stdin); /* better than scanf() */
> ints = disable(); // clear interrupts
> strcpy(buffer, temp);
> if (ints) enable(); // re-enable interrupts
>// } while (!stricmp(buffer, "EXIT"));
} while (stricmp(buffer, "EXIT\n"));
/* this is what I think you mean (the \n added because fgets()
keeps it */
>
> done_handler();
> }
>
> ---------------------------------------------------------------------------
>
>
> Error Messages:
> ==========================================================================
>
> timer1.c: In function `init_handler':
> timer1.c:35: warning: implicit declaration of function
> `_go32_dpmi_get_protected_mode_interrupt_handler'
> timer1.c:39: warning: implicit declaration of function
> `_go32_dpmi_set_protected_mode_interrupt_handler'
> timer1.c: At top level:
> timer1.c:59: warning: return-type defaults to `int'
> timer1.c: In function `main':
> timer1.c:67: warning: implicit declaration of function `_go32_lock_data'
> timer1.c:68: warning: implicit declaration of function `printf'
> timer1.c:73: warning: implicit declaration of function `scanf'
> timer1.c:77: warning: implicit declaration of function `stricmp'
> timer1.c:80: warning: control reaches end of non-void function
> E:\ccdaaaaa(.text+0x78):timer1.c: undefined reference to
> `_go32_dpmi_get_protected_mode_interrupt_handler'
> E:\ccdaaaaa(.text+0x9b):timer1.c: undefined reference to
> `_go32_dpmi_set_protected_mode_interrupt_handler'
> E:\ccdaaaaa(.text+0xaf):timer1.c: undefined reference to
> `_go32_dpmi_set_protected_mode_interrupt_handler'
> E:\ccdaaaaa(.text+0x161):timer1.c: undefined reference to `_go32_lock_data'
>
> ----------------------------------------------------------------------------
> ---
> How can I remove this messages??
>
> thanks...
>
---Michael Phelps
morphine AT cs DOT jhu DOT edu
CH3
|
N
/ |
______/ |
/ \ CH2
_____/ \__|__
// \\ / | \\
// \\______/___CH2 \\
\ / \ /
\______/ \_____/
/ ------ \ / \
OH \ / OH
O
Morphine
- Raw text -