Hi,

> download Cosmo's Cosmic Adventure from 
> http://www.apogee1.com/downloads.html. it goes into 
> infinite loop waiting for global variable to be set to 0 but 
> the int8 timer that increments variable seems to fire at just 
> wrong time. sounds like a PIC problem...but works in NT? 
> :( not a DPMI app either. 
For anyone whose interested, please try Stas' patch at sourceforge and the 
attached one.  Please report any observations and problems with the patches 
(on Cosmo and other programs).

I'm posting this patch here because sf doesn't let you attach files to closed 
bug reports it seems.  You will have to "make clean" before using this patch.

Clarence
--- 1147pr/etc/dosemu.conf	2003-01-23 17:02:07.000000000 +1100
+++ 1147/etc/dosemu.conf	2003-01-24 22:57:31.000000000 +1100
@@ -181,7 +181,10 @@
 #$_pic_watchdog = (off) # try setting this to some positive value (eg. 5)
 #                       # if you get problems with some DOS program
 #			# freezing after some time.
+#$_pit_apogee_trigger = (off)	# set this to 'on' if you want to play certain
+#			# Apogee/ID/Softdisk games (eg. Cosmo & Keen 6)
 #
+#  Joystick settings
 #$_joy_device = "/dev/js0 /dev/js1"     # 1st and 2nd joystick device 
 #                       # e.g. "/dev/js0" or "/dev/js0 /dev/js1"
 #                       #      (or "" if you don't want joystick support)
--- 1147pr/etc/global.conf	2003-01-23 17:02:07.000000000 +1100
+++ 1147/etc/global.conf	2003-01-24 22:58:20.000000000 +1100
@@ -168,7 +168,8 @@
     ## with 'dosemu_' prefixed will overwrite those without the prefix.
 
     checkuservar $_debug,
-      $_features, $_mapping, $_hogthreshold, $_cli_timeout, $_pic_force_count,
+      $_features, $_mapping, $_hogthreshold,
+      $_cli_timeout, $_pic_watchdog, $_pit_apogee_trigger,
       $_timint, $_mathco, $_cpu, $_rdtsc, $_cpuspeed, $_xms, $_ems, $_ems_frame,
       $_dpmi, $_emusys, $_emuini, $_dosmem
     checkuservar
@@ -396,6 +397,7 @@
   ## hacks
   cli_timeout $_cli_timeout
   pic_watchdog $_pic_watchdog
+  pit_apogee_trigger $_pit_apogee_trigger
 
   ## serial
   if (strlen($_ttylocks))
--- 1147pr/src/base/dev/misc/timers.c	2003-01-17 05:19:00.000000000 +1100
+++ 1147/src/base/dev/misc/timers.c	2003-01-24 22:57:05.000000000 +1100
@@ -430,13 +430,21 @@
     pit[port].time.td = GETtickTIME(0);
 
     if (port == 0) {
+      if (config.pit_apogee_trigger) {
+         /* Cosmo, Keen 6,... */
+         if (pit[0].cntr == 1192) {
+            pit[0].cntr = 0x10000; /* 18.2 Hz */
+            error ("PIT: Apogee HACK: Changing from 1000Hz to 18.2Hz\n");
+         }
+      }
+
       ticks_accum   = 0;
       timer_div     = (pit[0].cntr * 10000) / PIT_TICK_RATE;
       if (timer_div == 0)
-	timer_div = 1;
-#if 0
-      i_printf("timer_interrupt_rate requested %.3g Hz, granted %.3g Hz\n",
-	       PIT_TICK_RATE/(double)pit[0].cntr, 10000.0/timer_div);
+         timer_div = 1;
+#if 1
+      i_printf("timer_interrupt_rate count %i, requested %.6g Hz, granted %.6g Hz\n",
+	       pit[0].cntr, PIT_TICK_RATE/(double)pit[0].cntr, 10000.0/timer_div);
 #endif
     }
     else if (port == 2 && config.speaker == SPKR_EMULATED) {
--- 1147pr/src/base/init/config.c	2003-01-23 17:02:08.000000000 +1100
+++ 1147/src/base/init/config.c	2003-01-24 22:58:35.000000000 +1100
@@ -306,6 +306,7 @@
         config.sb_base, config.sb_dma, config.sb_irq, config.mpu401_base, config.sb_dsp, config.sb_mixer);
     (*print)("\ncli_timeout %d\n", config.cli_timeout);
     (*print)("\npic_watchdog %d\n", config.pic_watchdog);
+    (*print)("\npit_apogee_trigger %d\n", config.pit_apogee_trigger);
     (*print)("\nJOYSTICK:\njoy_device0 \"%s\"\njoy_device1 \"%s\"\njoy_dos_min %i\njoy_dos_max %i\njoy_granularity %i\njoy_latency %i\n",
         config.joy_device[0], config.joy_device[1], config.joy_dos_min, config.joy_dos_max, config.joy_granularity, config.joy_latency);
 
--- 1147pr/src/base/init/lexer.l.in	2003-01-23 17:02:08.000000000 +1100
+++ 1147/src/base/init/lexer.l.in	2003-01-24 22:59:12.000000000 +1100
@@ -668,6 +668,7 @@
 	/* hacks */
 cli_timeout		RETURN(CLI_TIMEOUT);
 pic_watchdog		RETURN(PIC_WATCHDOG);
+pit_apogee_trigger	RETURN(PIT_APOGEE_TRIGGER);
 
 	/* strings */
 
--- 1147pr/src/base/init/parser.y.in	2003-01-23 17:02:08.000000000 +1100
+++ 1147/src/base/init/parser.y.in	2003-01-24 23:15:51.000000000 +1100
@@ -305,7 +305,7 @@
 	/* joystick */
 %token JOYSTICK JOY_DEVICE JOY_DOS_MIN JOY_DOS_MAX JOY_GRANULARITY JOY_LATENCY
 	/* Hacks */
-%token CLI_TIMEOUT PIC_WATCHDOG
+%token CLI_TIMEOUT PIC_WATCHDOG PIT_APOGEE_TRIGGER
 
 	/* we know we have 1 shift/reduce conflict :-( 
 	 * and tell the parser to ignore that */
@@ -732,6 +732,11 @@
 		    { config.cli_timeout = $2; }
 		| PIC_WATCHDOG int_bool
 		    { config.pic_watchdog = $2; }
+		| PIT_APOGEE_TRIGGER bool
+		    {
+		    config.pit_apogee_trigger = ($2!=0);
+		    c_printf("CONF: pit_apogee_trigger %s\n", ($2) ? "on" : "off");
+		    }
 		| STRING
 		    { yyerror("unrecognized command '%s'", $1); free($1); }
 		| error
--- 1147pr/src/include/emu.h	2003-01-23 17:02:08.000000000 +1100
+++ 1147/src/include/emu.h	2003-01-24 23:01:37.000000000 +1100
@@ -369,8 +369,10 @@
        int joy_granularity;	/* the higher, the less sensitive - for wobbly joysticks */
        int joy_latency;		/* delay between nonblocking linux joystick reads */
 
+       /* hacks */
        int cli_timeout;		/* cli timeout hack */
-       int pic_watchdog;        /* pic watchdog reschedule hack */      
+       int pic_watchdog;	/* pic watchdog reschedule hack */
+       boolean pit_apogee_trigger;	/* enable trigger for apogee hack */
      }
 
 config_t;

Reply via email to