Contents

Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 561 (Keyboard and mouse input)

Overview

This page describes the content of item 561 found in the graphics.dat file from:

  • Dungeon Master for Atari ST versions 1.0 English (1987-12-08), 1.0 English (1987-12-11), 1.1 English, 1.2 English, 1.2 German and 1.3 French.
  • Chaos Strikes Back for Atari ST versions 2.0 English and 2.1 English.
  • Dungeon Master for Amiga version 2.0 English.

This item is not found in any other version of the games (even in other Dungeon Master for Amiga 2.x versions).
There are two variations in the content of this item with two possible sizes:

  • Dungeon Master for Atari ST versions 1.0 English (1987-12-08), 1.0 English (1987-12-11), 1.1 English, 1.2 English, 1.2 German and 1.3 French. (2004 bytes)
  • Chaos Strikes Back for Atari ST versions 2.0 English and 2.1 English, Dungeon Master for Amiga version 2.0 English. (2052 bytes)

This item is only used in Atari ST versions. All Amiga versions contain the equivalent data in the executable file itself and never read any data from this item.
It contains initialization data for global variables that was not included in the source code as an optimization to reduce the executable file size. This was because of the special way the C compiler worked on Atari ST, and this trick was not used on any other platform.

You may consult the names, values and usage of all these variables in the source code of ReDMCSB http://dmweb.free.fr/Stuff/ReDMCSB_WIP20210206.7z (search the source code for variable names containing "_Graphic558_", "_Graphic559_", "_Graphic560_", "_Graphic561_" and "_Graphic562_").
You may extract all values to text files with the data file decoder script at DM, CSB and DMII Data Files and Animations Decoders for PC.

All the notes below are the results of older research by credited people. They are incomplete and presented "as-is".

Credits

Paul Stevens (CSBwin source code)
rain` (ADGE source code)

Detailed structure

000h (0000) 336 bytes, Buttons for dialog boxes

Structure: 28x12 bytes
A button is defined by the coordinates of an on-screen rectangle area from (x1, y1) to (x2, y2), a mouse button (left or right) and a command type. If you click in the corresponding area with the specified mouse button then the associated command is triggered.
Each button is made of 6 words:

  • 1 word (big endian): Command type (a number) that is generated when clicking on the button. Each command (no list available yet) will trigger a specific action.
  • 1 word (big endian): x1
  • 1 word (big endian): x2
  • 1 word (big endian): y1
  • 1 word (big endian): y2
  • 1 word (big endian): mouse button. Allowed values are '2' for the left button and '1' for the right button.

This section contains 8 lists of buttons. Each list is terminated by an 'null button' where all 6 words are 0000h.
Here is the list of the 28 buttons in this section, including 'null buttons':

Event                   Mouse
type  x1   x2   y1   y2 button  Description
210   63  148  101  115    2    Dialog box in center of screen with 4 buttons, Top left button
211  170  254  101  115    2    Dialog box in center of screen with 4 buttons, Top right button
212   63  148  138  152    2    Dialog box in center of screen with 4 buttons, Lower left button
213  170  254  138  152    2    Dialog box in center of screen with 4 buttons, Lower right button
  0    0    0    0    0    0    Dialog box in center of screen with 4 buttons, Null button
210  63   254  101  115    2    Dialog box in center of screen with 3 buttons, Top button
211  63   148  138  152    2    Dialog box in center of screen with 3 buttons, Lower left button
212  170  254  138  152    2    Dialog box in center of screen with 3 buttons, Lower right button
  0    0    0    0    0    0    Dialog box in center of screen with 3 buttons, Null button
210  63   254  101  115    2    Dialog box in center of screen with 2 buttons, Top button
211  63   254  138  152    2    Dialog box in center of screen with 2 buttons, Bottom button
  0    0    0    0    0    0    Dialog box in center of screen with 2 buttons, Null button
210  63   254  138  152    2    Dialog box in center of screen with 1 button, Bottom button
  0    0    0    0    0    0    Dialog box in center of screen with 1 button, Null button
210  16   101  101  115    2    Dialog box in the viewport (left of screen) with 4 buttons, Top left button
211  123  207  101  115    2    Dialog box in the viewport (left of screen) with 4 buttons, Top right button
212  16   101  138  152    2    Dialog box in the viewport (left of screen) with 4 buttons, Lower left button
213  123  207  138  152    2    Dialog box in the viewport (left of screen) with 4 buttons, Lower right button
  0    0    0    0    0    0    Dialog box in the viewport (left of screen) with 4 buttons, Null button
210  16   207  101  115    2    Dialog box in the viewport (left of screen) with 3 buttons, Top button
211  16   101  138  152    2    Dialog box in the viewport (left of screen) with 3 buttons, Lower left button
212  123  207  138  152    2    Dialog box in the viewport (left of screen) with 3 buttons, Lower right button
  0    0    0    0    0    0    Dialog box in the viewport (left of screen) with 3 buttons, Null button
210  16   207  101  115    2    Dialog box in the viewport (left of screen) with 2 buttons, Top button
211  16   207  138  152    2    Dialog box in the viewport (left of screen) with 2 buttons, Bottom button
  0    0    0    0    0    0    Dialog box in the viewport (left of screen) with 2 buttons, Null button
210  16   207  138  152    2    Dialog box in the viewport (left of screen) with 1 buttons, Bottom button
  0    0    0    0    0    0    Dialog box in the viewport (left of screen) with 1 buttons, Null button

150h (0336) 32 bytes, Rectangle areas

Structure: 4x8 bytes
A rectangle is defined by the coordinates of an on-screen rectangle area from (x1, y1) to (x2, y2).
Each rectangle is made of 4 words:

  • 1 word (big endian): x1
  • 1 word (big endian): x2
  • 1 word (big endian): y1
  • 1 word (big endian): y2

This section contains 4 rectangles used by the function that displays dialog boxes on screen. In the graphics.dat file, only one base dialog image with 3 buttons is stored. When a dialog box with 1, 2 or 4 options is required, parts of the base image are duplicated as necessary. These rectangles define the areas of the base dialog image that need to be duplicated.

170h (0368) 8 bytes, Steps to the right for movement

Structure: 4 words (big endian, signed)
This table gives the number of steps to the right that the party has to take for each movement direction (note that directions are not absolute but relative to the current party direction). These values are only used when the player moves the party.
Values: 0, 1, 0, -1 for Forward, Right, Backward, Left
When you move the party by pressing an arrow on the keyboard or by clicking with the mouse on one of the movement arrows on screen, this table indicates the number of steps to the right that the party will take.
The game engine calls a function with this number of steps as a parameter to update the actual party coordinates.

178h (0376) 8 bytes, Steps forward for movement

Structure: 4 words (big endian, signed)
This table gives the number of steps forward that the party has to take for each movement direction (note that directions are not absolute but relative to the current party direction). These values are only used when the player moves the party.
Values: 1, 0, -1, 0 for Forward, Right, Backward, Left
When you move the party by pressing an arrow on the keyboard or by clicking with the mouse on one of the movement arrows on screen, this table indicates the number of steps forward that the party will take.
The game engine calls a function with this number of steps as a parameter to update the actual party coordinates.

180h (0384) 56 bytes, Rectangle areas for spell casting

Structure: 7x8 bytes
This section contains a list of 7 rectangles. These coordinates correspond to the 6 symbol positions and the undo button.

1B8h (0440) 32 bytes, Rectangle areas for movement

Structure: 4x8 bytes
This section contains a list of 4 rectangles. These coordinates correspond to the 4 arrows used to move (not the two arrows to turn left or right):
Move Forward, Move Right, Move Backward, Move Left

1D8h (0472) 16 bytes, Drop areas on floor

Structure: 4x4 bytes
This section defines the screen coordinates of the four areas on floor where you can drop or take items, in this order: bottom left, bottom right, top right, top left. For each area, there are four bytes:

  • 1 byte: x1
  • 1 byte: x2
  • 1 byte: y1
  • 1 byte: y2

1E8h (0488) 76 bytes, Keyboard commands

In the game, everything can be done with the mouse. However, there are some commands that can be triggered using keyboard shortcuts.
The tables below are used to translate keyboard shortcuts with command types.

Each entry in the tables contains two words:

  • 1 word: Command type. These types are coded in the engine.
  • 1 word: Value returned by the BIOS when a key or key combination is pressed.
    If the BIOS can translate the scan code of the pressed key to an ASCII code, then the first byte is set to 00 and the second byte contains the ASCII code.
    If the BIOS cannot translate the scan code of the pressed key to an ASCII code, then the first byte contains the scan code value and the second byte is set to 00.

This section contains four lists. Each list is terminated by an entry where both words are set to 0000h.
Values:

List A, 1 entry

00 94 00 1B: ASCII code of 'Escape' (1Bh) is translated to command type 0094h (148) which is 'Unfreeze game'.
00 00 00 00

List B, 2 entries

00 92 00 0D: ASCII code of 'Carriage return' (0Dh) is translated to command type 0092h (146) which is 'Wake up'.
00 93 00 1B: ASCII code of 'Escape' (1Bh) is translated to command type 0093h (147) which is 'Freeze game'.
00 00 00 00

List C, 6 entries

00 01 52 00: Scan code of the 'Insert' key (52h) is translated to command type 0001h which is 'Turn left'.
00 03 48 00: Scan code of the 'Up arrow' key (48h) is translated to command type 0003h which is 'Move forward'.
00 02 47 00: Scan code of the 'Clr/Home' key (47h) is translated to command type 0002h which is 'Turn right'.
00 06 4B 00: Scan code of the 'Left arrow' key (4Bh) is translated to command type 0006h which is 'Move left'.
00 05 50 00: Scan code of the 'Down arrow' key (50h) is translated to command type 0005h which is 'Move backward'.
00 04 4D 00: Scan code of the 'Right arrow' key (4Dh) is translated to command type 0004h which is 'Move right'.
00 00 00 00

List D, 6 entries

00 07 3B 00: Scan code of the 'F1' key (3Bh) is translated to command type 0007h which is 'Toggle champion 1 inventory display'.
00 08 3C 00: Scan code of the 'F2' key (3Ch) is translated to command type 0008h which is 'Toggle champion 2 inventory display'.
00 09 3D 00: Scan code of the 'F3' key (3Dh) is translated to command type 0009h which is 'Toggle champion 3 inventory display'.
00 0A 3E 00: Scan code of the 'F4' key (3Eh) is translated to command type 000Ah (10) which is 'Toggle champion 4 inventory display'.
00 8C 00 13: ASCII code of 'CTRL-S' (13h) is translated to command type 008Ch (140) which is 'Display disk menu'.
00 93 00 1B: ASCII code of 'Escape' (1Bh) is translated to command type 0093h (147) which is 'Freeze game'.
00 00 00 00

234h (0564) 1488 bytes, Other buttons

Structure: 124x12 bytes
This section contains lists of buttons.
In Dungeon Master there are 16 buttons in List K. In Chaos Strikes Back there are 20 buttons in that list: 4 buttons were added to allow clicks on the bars in champion status boxes. Each list is terminated by an 'null button' where all 6 words are 0000h.
Here is the list of the 120/124 buttons in this section, including 'null buttons':

Event                   Mouse
type  x1   x2   y1   y2 button Description
160  104  158  86   142  2     List A (3 buttons), Choose champion: Resurrect
161  163  217  86   142  2     List A (3 buttons), Choose champion: Reincarnate
162  104  217  146  156  2     List A (3 buttons), Choose champion: Cancel
0    0    0    0    0    0     List A (3 buttons), Null button
58   117  132  92   107  2     List B (8 buttons), Carry location in open chest area: Chest item 1
59   106  121  109  124  2     List B (8 buttons), Carry location in open chest area: Chest item 2
60   111  126  126  141  2     List B (8 buttons), Carry location in open chest area: Chest item 3
61   128  143  131  146  2     List B (8 buttons), Carry location in open chest area: Chest item 4
62   145  160  134  149  2     List B (8 buttons), Carry location in open chest area: Chest item 5
63   162  177  136  151  2     List B (8 buttons), Carry location in open chest area: Chest item 6
64   179  194  137  152  2     List B (8 buttons), Carry location in open chest area: Chest item 7
65   196  211  138  153  2     List B (8 buttons), Carry location in open chest area: Chest item 8
0    0    0    0    0    0     List B (8 buttons), Null button
16   0    42   0    6    2     List C (12 buttons), Champion status box: Champion 1 name, select party leader
17   69   111  0    6    2     List C (12 buttons), Champion status box: Champion 2 name, select party leader
18   138  180  0    6    2     List C (12 buttons), Champion status box: Champion 3 name, select party leader
19   207  249  0    6    2     List C (12 buttons), Champion status box: Champion 4 name, select party leader
20   4    19   10   25   2     List C (12 buttons), Champion status box: Champion 1 left hand
21   24   39   10   25   2     List C (12 buttons), Champion status box: Champion 1 right hand
22   73   88   10   25   2     List C (12 buttons), Champion status box: Champion 2 left hand
23   93   108  10   25   2     List C (12 buttons), Champion status box: Champion 2 right hand
24   142  157  10   25   2     List C (12 buttons), Champion status box: Champion 3 left hand
25   162  177  10   25   2     List C (12 buttons), Champion status box: Champion 3 right hand
26   211  226  10   25   2     List C (12 buttons), Champion status box: Champion 4 left hand
27   231  246  10   25   2     List C (12 buttons), Champion status box: Champion 4 right hand
0    0    0    0    0    0     List C (12 buttons), Null button
101  235  247  51   61   2     List D (8 buttons), Spell area: Rune 1
102  249  261  51   61   2     List D (8 buttons), Spell area: Rune 2
103  263  275  51   61   2     List D (8 buttons), Spell area: Rune 3
104  277  289  51   61   2     List D (8 buttons), Spell area: Rune 4
105  291  303  51   61   2     List D (8 buttons), Spell area: Rune 5
106  305  317  51   61   2     List D (8 buttons), Spell area: Rune 6
108  234  303  63   73   2     List D (8 buttons), Spell area: Cast spell
107  305  318  63   73   2     List D (8 buttons), Spell area: Delete rune
0    0    0    0    0    0     List D (8 buttons), Null button
116  233  252  86   120  2     List E (4 buttons), Action area: Champion 1 action
117  255  274  86   120  2     List E (4 buttons), Action area: Champion 2 action
118  277  296  86   120  2     List E (4 buttons), Action area: Champion 3 action
119  299  318  86   120  2     List E (4 buttons), Action area: Champion 4 action
0    0    0    0    0    0     List E (4 buttons), Null button
112  285  318  77   83   2     List F (4 buttons), Action area: Cancel action
113  234  318  86   96   2     List F (4 buttons), Action area: Action 1
114  234  318  98   108  2     List F (4 buttons), Action area: Action 2
115  234  318  110  120  2     List F (4 buttons), Action area: Action 3
0    0    0    0    0    0     List F (4 buttons), Null button
148  0    319  0    199  2     List G (2 buttons), Unfreeze game (left click)
148  0    319  0    199  1     List G (2 buttons), Unfreeze game (right click)
0    0    0    0    0    0     List G (2 buttons), Null button
146  0    223  33   168  2     List H (2 buttons), Wake up (left click)
146  0    223  33   168  1     List H (2 buttons), Wake up (right click)
0    0    0    0    0    0     List H (2 buttons), Null button
11   0    319  0    199  1     List I (37 buttons), Close inventory (right click)
140  174  182  36   44   2     List I (37 buttons), Display disk menu
145  188  204  36   44   2     List I (37 buttons), Sleep
11   210  218  36   44   2     List I (37 buttons), Close inventory button
28   6    21   86   101  2     List I (37 buttons), Carry location: Left hand
29   62   77   86   101  2     List I (37 buttons), Carry location: Right hand
30   34   49   59   74   2     List I (37 buttons), Carry location: Head
31   34   49   79   94   2     List I (37 buttons), Carry location: Torso
32   34   49   99   114  2     List I (37 buttons), Carry location: Legs
33   34   49   119  134  2     List I (37 buttons), Carry location: Feet
34   6    21   123  138  2     List I (37 buttons), Carry location: Pouch 2
70   56   71   46   61   2     List I (37 buttons), Feed champion
71   12   27   46   61   2     List I (37 buttons), Press champion eye
35   79   94   106  121  2     List I (37 buttons), Carry location: Quiver 2,1
36   62   77   123  138  2     List I (37 buttons), Carry location: Quiver 1,2
37   79   94   123  138  2     List I (37 buttons), Carry location: Quiver 2,2
38   6    21   66   81   2     List I (37 buttons), Carry location: Necklace
39   6    21   106  121  2     List I (37 buttons), Carry location: Pouch 1
40   62   77   106  121  2     List I (37 buttons), Carry location: Quiver 1,1
41   66   81   66   81   2     List I (37 buttons), Carry location: Backpack 1,1
42   83   98   49   64   2     List I (37 buttons), Carry location: Backpack 2,2
43   100  115  49   64   2     List I (37 buttons), Carry location: Backpack 2,3
44   117  132  49   64   2     List I (37 buttons), Carry location: Backpack 2,4
45   134  149  49   64   2     List I (37 buttons), Carry location: Backpack 2,5
46   151  166  49   64   2     List I (37 buttons), Carry location: Backpack 2,6
47   168  183  49   64   2     List I (37 buttons), Carry location: Backpack 2,7
48   185  200  49   64   2     List I (37 buttons), Carry location: Backpack 2,8
49   202  217  49   64   2     List I (37 buttons), Carry location: Backpack 2,9
50   83   98   66   81   2     List I (37 buttons), Carry location: Backpack 1,2
51   100  115  66   81   2     List I (37 buttons), Carry location: Backpack 1,3
52   117  132  66   81   2     List I (37 buttons), Carry location: Backpack 1,4
53   134  149  66   81   2     List I (37 buttons), Carry location: Backpack 1,5
54   151  166  66   81   2     List I (37 buttons), Carry location: Backpack 1,6
55   168  183  66   81   2     List I (37 buttons), Carry location: Backpack 1,7
56   185  200  66   81   2     List I (37 buttons), Carry location: Backpack 1,8
57   202  217  66   81   2     List I (37 buttons), Carry location: Backpack 1,9
81   96   223  83   167  2     List I (37 buttons), Click in open chest area (lower right part of inventory)
0    0    0    0    0    0     List I (37 buttons), Null button
1    234  261  125  145  2     List J (8 buttons), Party movement: Turn left
3    263  289  125  145  2     List J (8 buttons), Party movement: Move forward
2    291  318  125  145  2     List J (8 buttons), Party movement: Turn right
6    234  261  147  167  2     List J (8 buttons), Party movement: Move left
5    263  289  147  167  2     List J (8 buttons), Party movement: Move backward
4    291  318  147  167  2     List J (8 buttons), Party movement: Move right
80   0    223  33   168  2     List J (8 buttons), Click in viewport
83   0    319  33   199  1     List J (8 buttons), Display party leader inventory (right click)
0    0    0    0    0    0     List J (8 buttons), Null button
12   0    42   0    28   2     List K (19 buttons), Click in left part of Champion 1 status box: select party leader
13   69   111  0    28   2     List K (19 buttons), Click in left part of Champion 2 status box: select party leader
14   138  180  0    28   2     List K (19 buttons), Click in left part of Champion 3 status box: select party leader
15   207  249  0    28   2     List K (19 buttons), Click in left part of Champion 4 status box: select party leader
125  274  299  0    13   2     List K (19 buttons), Drag top left champion position icon
126  301  319  0    13   2     List K (19 buttons), Drag top right champion position icon
127  301  319  15   28   2     List K (19 buttons), Drag lower right champion position icon
128  274  299  15   28   2     List K (19 buttons), Drag lower left champion position icon
7    0    66   0    28   1     List K (19 buttons), Champion status box: Champion 1 (right click), toggle inventory display
8    69   135  0    28   1     List K (19 buttons), Champion status box: Champion 2 (right click), toggle inventory display
9    138  204  0    28   1     List K (19 buttons), Champion status box: Champion 3 (right click), toggle inventory display
10   207  273  0    28   1     List K (19 buttons), Champion status box: Champion 4 (right click), toggle inventory display
7    44   66   0    28   2     List K (19 buttons), Champion status box: Champion 1 bars, toggle inventory display
8    113  135  0    28   2     List K (19 buttons), Champion status box: Champion 2 bars, toggle inventory display
9    182  204  0    28   2     List K (19 buttons), Champion status box: Champion 3 bars, toggle inventory display
10   251  273  0    28   2     List K (19 buttons), Champion status box: Champion 4 bars, toggle inventory display
100  233  319  42   73   2     List K (19 buttons), Click in spell area
111  233  319  77   121  2     List K (19 buttons), Click in action area
147  0    1    198  199  2     List K (19 buttons), Freeze game
0    0    0    0    0    0     List K (19 buttons), Null button
215  103  217  145  159  2     List L (1 buttons), Restart game (after party has died)
0    0    0    0    0    0     List L (1 buttons), Null button
200  244  298  45   58   2     List M (3 buttons), Entrance menu: Enter dungeon
201  244  298  76   93   2     List M (3 buttons), Entrance menu: Resume
202  248  293  187  199  2     List M (3 buttons), Entrance menu: Credits
0    0    0    0    0    0     List M (3 buttons), Null button