Tuesday, May 13, 2014

Shamus Keyboard Woes Explained

My previous post contains copious amounts of whinging about the keyboard controls in this game, but as it turns out, the issue isn't with the game as such - it's about the environment.  Recently it was pointed out to me that Shamus uses a buffered input routine (it isn't the BIOS INT 9 handler, but a custom handler that similarly buffers keystrokes), and as such, it's sensitive to the typematic rate and delay set for the keyboard.

For the unfamiliar, these parameters control how long a key must be held down before a repeated keypress is signaled, and then the rate at which the keypress is repeated.  Older PC/XT-class machines (which is what this game was targeted at) always booted up with a default delay of 500ms and repeat rate of 10 characters per second; this is what the game assumes, and under these conditions keyboard control isn't a problem.

Trouble starts when these values are altered: newer BIOSes (circa 1986 and onwards) allow changing the typematic parameters by calling INT 16h function 3, and some offer the ability to modify the default values in the CMOS settings; DOS 4+ offers a convenient way of doing that via the MODE command.  Specifying lower values results in keyboard events coming in at a faster rate than this particular game can handle them - including key releases, hence the little guy's unfortunate penchant for suicidal runs into the walls.

DOSBox, too, starts up with a repeat rate of 00h = 30 cps, the fastest possible. An elegant solution (besides the aforementioned joystick method) is to change this back to what the game expects, e.g. using the FreeDOS MODE command or a custom program, and run a DOS conversion of the game rather than the booter.

Yet another approach is running the game with the PCjr machine type.  Apparently, Shamus specifically detects the PCjr and handles the keyboard differently on that machine - differently enough that the issue doesn't exist, at any rate.  Incidentally, it also expects you to combine two cursor keys for diagonal movement on the PCjr, instead of using the "corner" keys on the keypad as you normally would (of course, this may be either a pro or a con... depending on your preference).

No comments: