From e0193a9425807cc61779c3b8680c5b551685ba65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 23 Feb 2002 17:11:27 +0000 Subject: DOS updates from Daniel Borca --- src/glut/dos/Makefile.DJ | 21 ++++++++- src/glut/dos/PC_HW/pc_irq.S | 6 +-- src/glut/dos/PC_HW/pc_mouse.c | 10 +++- src/glut/dos/init.c | 3 +- src/glut/dos/internal.h | 6 ++- src/glut/dos/state.c | 25 +++++++++- src/glut/dos/window.c | 106 ++++++++++++++++++++++++++++++------------ 7 files changed, 136 insertions(+), 41 deletions(-) (limited to 'src/glut/dos') diff --git a/src/glut/dos/Makefile.DJ b/src/glut/dos/Makefile.DJ index a8d176cbf4..7cacd8d009 100644 --- a/src/glut/dos/Makefile.DJ +++ b/src/glut/dos/Makefile.DJ @@ -20,7 +20,7 @@ # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# DOS/DJGPP glut makefile v0.1 for Mesa 4.0 +# DOS/DJGPP glut makefile v0.2 for Mesa 4.0 # # Copyright (C) 2002 - Borca Daniel # Email : dborca@yahoo.com @@ -78,4 +78,21 @@ clean: -$(RM) *.o -$(RM) PC_HW\*.o -include depend +callback.o: callback.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h +color.o: color.c ../include/GL/glut.h +font.o: font.c ../include/GL/glut.h +globals.o: globals.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h +init.o: init.c ../include/GL/glut.h internal.h PC_HW/pc_hw.h +menu.o: menu.c ../include/GL/glut.h +models.o: models.c ../include/GL/glut.h +overlay.o: overlay.c ../include/GL/glut.h +state.o: state.c ../include/GL/glut.h internal.h pc_hw/pc_hw.h +teapot.o: teapot.c ../include/GL/glut.h +window.o: window.c ../include/GL/glut.h ../include/GL/dmesa.h internal.h \ + PC_HW/pc_hw.h + +PC_HW/pc_hw.o: PC_HW/pc_hw.c PC_HW/pc_hw.h +PC_HW/pc_keyb.o: PC_HW/pc_keyb.c PC_HW/pc_hw.h +PC_HW/pc_mouse.o: PC_HW/pc_mouse.c PC_HW/pc_hw.h +PC_HW/pc_timer.o: PC_HW/pc_timer.c PC_HW/pc_hw.h +PC_HW/pc_irq.o: PC_HW/pc_irq.S diff --git a/src/glut/dos/PC_HW/pc_irq.S b/src/glut/dos/PC_HW/pc_irq.S index 2a6302f71a..8f19f8eb9f 100644 --- a/src/glut/dos/PC_HW/pc_irq.S +++ b/src/glut/dos/PC_HW/pc_irq.S @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v0.1 for DOS/DJGPP + * PC/HW routine collection v0.2 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -129,7 +129,7 @@ __irq_wrapper_##x: ; \ pushl %es ; \ pushl %fs ; \ pushl %gs ; \ - movw %ss, %bx ; \ + movl %ss, %ebx ; \ movl %esp, %esi ; \ movl %cs:___djgpp_ds_alias, %ss ; \ movl %cs:__irq_stack_##x, %esp ; \ @@ -141,7 +141,7 @@ __irq_wrapper_##x: ; \ pushl %fs ; \ popl %gs ; \ call *__irq_hook_##x ; \ - movw %bx, %ss ; \ + movl %ebx, %ss ; \ movl %esi, %esp ; \ testl %eax, %eax ; \ popl %gs ; \ diff --git a/src/glut/dos/PC_HW/pc_mouse.c b/src/glut/dos/PC_HW/pc_mouse.c index cc3396cb21..2a692eceb6 100644 --- a/src/glut/dos/PC_HW/pc_mouse.c +++ b/src/glut/dos/PC_HW/pc_mouse.c @@ -1,5 +1,5 @@ /* - * PC/HW routine collection v0.1 for DOS/DJGPP + * PC/HW routine collection v0.2 for DOS/DJGPP * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -15,6 +15,12 @@ #define MOUSE_STACK_SIZE 16384 +#define CLEAR_MICKEYS() \ + do { \ + __asm__ __volatile__ ("movw $0xb, %%ax; int $0x33":::"%eax", "%ecx", "%edx"); \ + ox = oy = 0; \ + } while (0) + extern void mouse_wrapper (void); extern void mouse_wrapper_end (void); @@ -161,6 +167,8 @@ int pc_install_mouse (void) mouse_regs.x.es = mouse_callback>>16; __dpmi_int(0x33, &mouse_regs); + CLEAR_MICKEYS(); + emulat3 = buttons<3; pc_atexit(pc_remove_mouse); return buttons; diff --git a/src/glut/dos/init.c b/src/glut/dos/init.c index d3f4582170..41170e37c9 100644 --- a/src/glut/dos/init.c +++ b/src/glut/dos/init.c @@ -19,7 +19,7 @@ */ /* - * DOS/DJGPP glut driver v0.1 for Mesa 4.0 + * DOS/DJGPP glut driver v0.2 for Mesa 4.0 * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -45,6 +45,7 @@ static void signal_handler (int num) void APIENTRY glutInit (int *argcp, char **argv) { + glutGet(GLUT_ELAPSED_TIME); /* Hack alert: only SIGINT (but not Ctrl-Break) calls the destructors and will safely clean up diff --git a/src/glut/dos/internal.h b/src/glut/dos/internal.h index f6c2c4d00c..2822c2c5ab 100644 --- a/src/glut/dos/internal.h +++ b/src/glut/dos/internal.h @@ -19,7 +19,7 @@ */ /* - * DOS/DJGPP glut driver v0.1 for Mesa 4.0 + * DOS/DJGPP glut driver v0.2 for Mesa 4.0 * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -35,9 +35,11 @@ #include "pc_hw/pc_hw.h" +#define MAX_WINDOWS 4 + #define DEFAULT_WIDTH 640 #define DEFAULT_HEIGHT 480 -#define COLOR_DEPTH 16 +#define DEFAULT_BPP 16 #define DEPTH_SIZE 16 #define STENCIL_SIZE 8 diff --git a/src/glut/dos/state.c b/src/glut/dos/state.c index 9e5624deb4..94ef0cac79 100644 --- a/src/glut/dos/state.c +++ b/src/glut/dos/state.c @@ -19,7 +19,7 @@ */ /* - * DOS/DJGPP glut driver v0.1 for Mesa 4.0 + * DOS/DJGPP glut driver v0.2 for Mesa 4.0 * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -28,6 +28,21 @@ #include "GL/glut.h" +#include "internal.h" + + +#define FREQUENCY 100 + + +static int timer_installed; +static volatile int ticks; + +static void ticks_timer (void *p) +{ + (void)p; + ticks++; +} ENDOFUNC(ticks_timer) + int APIENTRY glutGet (GLenum type) @@ -35,6 +50,14 @@ int APIENTRY glutGet (GLenum type) switch (type) { case GLUT_WINDOW_RGBA: return 1; + case GLUT_ELAPSED_TIME: + if (!timer_installed) { + timer_installed = !timer_installed; + LOCKDATA(ticks); + LOCKFUNC(ticks_timer); + pc_install_int(ticks_timer, NULL, FREQUENCY); + } + return ticks*1000/FREQUENCY; default: return 0; } diff --git a/src/glut/dos/window.c b/src/glut/dos/window.c index 6d52524dfb..c110715ebb 100644 --- a/src/glut/dos/window.c +++ b/src/glut/dos/window.c @@ -19,7 +19,7 @@ */ /* - * DOS/DJGPP glut driver v0.1 for Mesa 4.0 + * DOS/DJGPP glut driver v0.2 for Mesa 4.0 * * Copyright (C) 2002 - Borca Daniel * Email : dborca@yahoo.com @@ -32,50 +32,89 @@ #include "internal.h" + +static int window; + static DMesaVisual visual = NULL; static DMesaContext context = NULL; -static DMesaBuffer buffer = NULL; +static DMesaBuffer buffer[MAX_WINDOWS]; + static void clean (void) { - __asm__("movw $3, %%ax; int $0x10":::"%eax"); + int i; + + for (i=0; i