Patch:B800 text screens

From KeenWiki
(Redirected from Patch:DOS screens)
Jump to navigation Jump to search

DOS screens or B800 text screens are text-mode screen dumps most often used to display the final text screen after quitting a game, with the DOS prompt appearing on the last line once the game has terminated.

Since the file format is just a direct dump of video memory, this would more accurately be termed the "CGA text mode format." The file is almost always 4000 bytes long, as this is the exact amount of space required to store a standard 80x25 text screen (80 columns * 25 rows * two bytes per cell = 4000 bytes.)

The data is arranged in cells, with each cell being two bytes long (one byte for the ASCII character to display, followed by an attribute byte indicating the color of the character.) The data appears starting at the top-left of the screen (1,1) and works its way across to the right (80,1) and then wraps down to the next line (1,2).

The attribute byte contains two nybbles of data. The most significant four bits are the background color, and the least significant bits are the foreground color. This means the background and foreground colors can each be assigned a color value between zero (black) and 15.

The background color is slightly different however. Since the original CGA hardware was not designed to produce high intensity background colors the intensity bit is used to cause the text to flash instead. This means setting the background color to 14 won't produce a bright-yellow background, but instead will produce a normal yellow background (color #6) with blinking text. The VGA standard includes a toggle bit that allows this flashing to be switched off, thus allowing the full 16 background colors to be used (without any flashing of course.)

In Keen there are several screens. Keen Vorticons has the expected screen when the game is exited, showing ordering information. while Galaxy has a screen loaded as the game starts, which displays memory information and the title of the episode. (This is thus usually patched.) All of these screens are found in the executable and can be patched using a %patchfile command. The Keen galaxy games also have a further two screens, dumped by the game before it exits. These exist as compressed files in EGAGRAPH.CKx which can be extracted by Keengraph.

Once extracted B800 files can be modified with a number of programs. (It is suggested that the modder visit the b800 page on ModdingWiki in the external links section.)


Location of files in Keen games

The B800 screens in all Keen episodes (excepting Dreams) are their own individual executable segment read and dumped into memory. A single patch file command suffices to replace the screen. (The file in EGAGRAPH.CKx as noted above do not need to be patched.) Keen Dreams is a special case.

While the entire file can be patched, quite often only the first part of it is modified using a special utility to convert the files.

Keen B800 text patches

#B800 screen patches
%patchfile $12080 "B800.CK1" #Keen 1
%patchfile $11780 "B800.CK2" #Keen 2
%patchfile $12AC0 "B800.CK3" #Keen 3
%patchfile $1FE47 "B800.CK4" #Keen 4
%patchfile $20CD7 "B800.CK5" #Keen 5
%patchfile $1FCA7 "B800.CK6" #Keen 6


Changing screen location

In some cases it is possible to alter the location of the B800 screen to better accommodate other patches. The first line of each episode's patch gives the location /$10, the second is the location. As such screens must always be located at $xxxx0.

Keen B800 screen location patches

#Keen 3
%patch $120A $12ACRW
%patchfile $12AC0 "B800.CK3"


Keen Vorticons

In Vorticons the screen of interest is the 'exit to DOS' screen displayed when the game has ended.


Change location of screen

This patch alters the location of the screen segment in the executable. The screen will always be the same size, but can be repositioned, useful if the modder wishes to give another segment more space.

B800 screen location patches

#B800 screen locations
%patch $120A $12ACRW #Keen 3


Don't display screen

This patch stops the screen being shown when the game ends; instead the screen is simply black. This frees up significant space in the executable for other uses at the cost of a screen not often noticed in any case.

Don't show B800 screen patches

#Don't show B800 screen - Keen 1
%patch $1298 $EB

#Don't show B800 screen - Keen 2
%patch $1252 $EB

#Don't show B800 screen - Keen 3
%patch $11F5 $EB


Keen Galaxy

In Galaxy the screen of interest is the 'initialization screen' displayed as the game gathers information about its environment (the amount of memory it has, etc.) The other B800 screens cannot be affected by patches in any appreciable manner.


Initialization screen

The patches in this section stop various parts of the initialization screen from being displayed or altered. This often frees up code space and, ad the initialization screen is not important of fast modern systems, is often a useful shortcut.


Skip initialization screen

This patch (actually a combination of several patches below.) completely skips the initialization screen (although there is a pause as the game initializes.)

Keen 4

#Skip initialization screen (Frees $19AAA-$19FE9)
%patch $38AD $90 $90 $90 $90 $90 #Don't load B800
%patch $38D0 $90 $90 $90 $90 $90 #Don't display game info, 'Loading...' text
%patch $39B2 $90 $90 $90 $90 $90 #Don't wait for key, show 'Ready' text

Keen 5

#Skip initialization screen (Frees $1AA48-$1AEE9)
%patch $38AD $90 $90 $90 $90 $90 #Don't load B800
%patch $38D0 $90 $90 $90 $90 $90 #Don't display game info, 'Loading...' text
%patch $39B2 $90 $90 $90 $90 $90 #Don't wait for key, show 'Ready' text

Keen 6

#Skip initialization screen
%patch $388E $90 $90 $90 $90 $90 #Don't load B800
%patch $38B1 $90 $90 $90 $90 $90 #Don't display game info, 'Loading...' text
%patch $3993 $90 $90 $90 $90 $90 #Don't wait for key, show 'Ready' text


Don't load B800 screen

This patch stops the B800 screen from being loaded into memory. On its own this looks very messy, all the screen alterations are displayed over the screen anyway (and these should thus be disabled.) In DOS this is a black screen but in DosBox (the usual method of playing Keen on modern systems.) this is the DosBox loading screen.

It is possible to run the game from a batch file displayed onscreen, using the batch file as a sort of stand-in. This has interesting results.

Keen 4

#Don't load initialization screen (Frees ?-?)
%patch $38AD $90 $90 $90 $90 $90


Don't display game information

This patch removes all of the game information alterations, such as what input devices are available and the amount of memory the game has. The only thing that is altered about the initialization screen is the 'loading\press any key' texts.

Keen 4

#Don't show game information (Frees $19C21 - $19F4B)
%patch $38D0 $90 $90 $90 $90 $90

Keen 5

#Don't show game information
%patch $38D0 $90 $90 $90 $90 $90


Don't highlight input devices

This patch stops the game showing (by highlighting in white) what input devices are available. Game memory is still shown.

Keen 4

#Don't highlight input devices (Frees $19B2F-$19BC0)
%patch $19B2E $CB


Don't show game memory

This patch stops the game showing (by printing on the screen) how much memory is available to it. Game input devices are still shown.

Keen 4

#Don't display memory information
%patch $19BC0 $CB


NOWAIT - Skip initialization screen

There is a variable that, if passed to the game (E.g. KEEN4E.EXE -NOWAIT.) will cause the game not to pause when it has loaded with the message 'Press any key', but instead to go directly to the 'terminator text'. (The screen however is still displayed.) The case of this text does not matter, but it can be patched. If the text is set to just $00 then the game will always skip the screen.

Keen Galaxy Nowait text

#Keen 4 :
%patch $33453 "NOWAIT" $00

#Keen 5 :
%patch $33F75 "NOWAIT" $00

#Keen 6 :
%patch $34D13 "NOWAIT" $00


Skip initialization screen without NOWAIT

This patch removes the call to the 'wait for a key' code at the initialization screen. This has exactly the same effect as the NOWAIT switch except it only affects the initialization screen (Instead of the A 2 Enter cheat code and other variables and also frees up some code space.

Skip initialization screen without NOWAIT in Keen 4

#Don't wait at initialization screen (Frees 19F4C-19FE9)
%patch $39B2 $90 $90 $90 $90 $90

Skip initialization screen without NOWAIT in Keen 5

#Don't wait at initialization screen
%patch $39B2 $90 $90 $90 $90 $90


Text

There are two basic lines of text displayed over the galaxy initialization screen; the first is 'loading' text, used as the game initializes (and not displayed for very long on modern systems.) and the 'Ready' text displayed when the game is ready t play. Like all things on the screen the text is a direct modification of video memory.


Loading text

This text is displayed while the game gathers information about its environment. When it is done it is replaced with the text in the next section.

Keen Galaxy initialization screen loading text

#Keen 4 :
%patch $19F38 [$0016W] #Vertical position of text
%patch $19F3C [$001BW] #Horizontal position of text
%patch $19F34 [$46DDW] #Text called from
%patch $3354D "  Loading...   " $00


#Keen 5 :
%patch $1AED6 [$0016W] #Vertical position of text
%patch $1AEDA [$001BW] #Horizontal position of text
%patch $1AED2 [$3D12W] #Text called from
%patch $34052 "  Loading...   " $00


#Keen 6 :
%patch $19BA4 [$40DDW] #Text called from
%patch $34E0D "  Loading...   " $00


Don't show text

This patch stops the loading text from being displayed; this is not often noticeable unless the 'Press any key' text is removed as well.

Don't show loading text

#Don't display 'Loading...' text: Keen 4
%patch $19F40 $90 $90 $90

#Don't show 'Loading...' text: Keen 5
%patch $1AEDE $90 $90 $90

#Don't show 'Loading...' text: Keen 6
%patch $19BB0 $90 $90 $90


Press any key text

In Keen Galaxy after the game has initialized a line of text is written over the screen. (In actuality the video memory is altered and then dumped again.) This appears as the 'Loading, please wait' text being replaced by 'Ready - Press a key' and the player being allowed to proceed. This text is stored in the executable and called when needed.

Keen 4 and 6 have a second string of text that also seems to be used in a related manner, but the exact circumstances are not known (except that they are both called in the same code segment.) Keen 5 is more efficient.

Press any key text

#Keen 4 :
%patch $19F9E [$0016W] #Vertical position of text
%patch $19FA2 [$001DW] #Horizontal position of text
%patch $19F9A [$46EDW] #Text called from
%patch $3355D " Ready - Press a Key     " $00

%patch $19FC9 [$4707W] #Text called from
%patch $33577 " Ready - Press a Key     " $00


#Keen 5 :
%patch $1AF3C [$0016W] #Vertical position of text
%patch $1AF40 [$001DW] #Horizontal position of text
%patch $1AF38 [$3D22W] #Text called from
%patch $34062 " Ready - Press a Key     " $00


#Keen 6 :
%patch $19C0A [$40EDW] #Text called from
%patch $34E1D " Ready - Press a Key     " $00

%patch $19C39 [$4107W] #Text called from
%patch $34E37 " Ready - Press a Key     " $00


Don't show text

This patch stops the Press any key text from being displayed; this leaves the 'Loading...' text in place unless this too is removed.

Don't show press any key text in Keen 4

#Don't display 'Ready...' text
%patch $19FA6 $90 $90 $90

Don't show press any key text in Keen 5

#Don't display 'Ready...' text
%patch $1AF44 $90 $90 $90


Quitting screens

Two possible screens may appear when the game is ended, one is the 'normal' screen which thanks you for playing. The other is an 'error' screen that informs players that something has gone wrong. Both of these screens are stored in the EGAGRAPH file and so require the game to startup correctly.


Screen chunks in EGAGRAPH

These are the entries (chunks) in EGAGRAPH.CKx that are used for the two B800 screens not held in the executable. The first is used every time the game is exited normally, the second appears when the game initializes and finds it does not have enough memory to run. (Something that should not happen in this day and age.)

B800 chunks in Keen 4

#B800 screens
%patch $3A13 $127FW #Exiting game
%patch $3B4C $1282W #Not enough memory


Never show quitting screens

Under certain circumstances, such as when the -NOWAIT switch is used, the screen will remain blank instead of displaying the B800 screen. These patches ensure this always occurs.

Never show quitting screens in Keen 4

#B800 screens
%patch $3AA2 $EB     #Exiting game
%patch $3B61 $EB $34 #Not enough memory


Keen Dreams

The Keen Dreams screen(s) are in interesting case. Many are governed by other executables that are run before the game, but if set up correctly then only one appears, similar in function to the loading screen in Galaxy. However it is stored as lines of text in the executable and a section of code that sets the text attributes. This slightly decreases the file size and was important in fitting the game to one floppy disk.

This means that editing it is a more complex affair that requires the conversion of a binary file into two compatible files, the code and the text strings. Keengraph is used for this and the patches produced are as follows:

Keen Dreams

#Patch the loading B800 screen
%patchfile $124B1 "CODE.BIN"	#Screen code
%patchfile $32AD0 "TEXT.BIN"	#Screen text


Don't need to press a key to go to title

Much like the -NOWAIT switch in Keen Galaxy this patch causes the B800 screen to go to the title immediately after the game has finished initializing.

Keen Dreams

#Don't need to press a key to go to title
%patch $13865 $EB


Don't load B800 screen

This patch skips the B800 screen entirely; instead the screen remains black then proceeds to the title. It incorporates the above 'no key' patch since without it strange things happen that may seem obtuse to the player.

Keen Dreams

#Don't show B800 screen
%patch $13865 $EB
%patch $124A6 $CB


Text

This is the patch for the 'ready text' which appears when the game has loaded.

Keen Dreams

#The 'Ready press a key text:
%patch $13852 [$0012W]  #V position, lines
%patch $13856 [$001EW]  #V position, lines
%patch $1384B $9B     #Color
%patch $1384E [$5187W]  #Text call
%patch $28BF7 "   Ready: Press a key!   " $00


External links