Updated interpreters
[projects/chimara/chimara.git] / interpreters / frotz / frotz.h
1 /*
2  * frotz.h
3  *
4  * Global declarations and definitions
5  *
6  */
7
8 typedef int bool;
9
10 #ifndef TRUE
11 #define TRUE 1
12 #endif
13
14 #ifndef FALSE
15 #define FALSE 0
16 #endif
17
18 #include <stdlib.h>
19 #include <string.h>
20
21 typedef unsigned char zbyte;
22 typedef unsigned short zword;
23
24 /*** Glk needs a 32-bit integer type for Unicode characters ***/
25 #include <limits.h>
26 #if (USHORT_MAX == 4294967295)
27 typedef unsigned short zchar;
28 #elif (UINT_MAX   == 4294967295)
29 typedef unsigned int zchar;
30 #elif (ULONG_MAX == 4294967295)
31 typedef unsigned long zchar;
32 #else
33 #error No 32-bit integer type found.
34 #endif
35
36 enum story
37 {
38     BEYOND_ZORK,
39     SHERLOCK,
40     ZORK_ZERO,
41     SHOGUN,
42     ARTHUR,
43     JOURNEY,
44     LURKING_HORROR,
45     UNKNOWN
46 };
47
48 /*** Constants that may be set at compile time ***/
49
50 #ifndef MAX_UNDO_SLOTS
51 #define MAX_UNDO_SLOTS 500
52 #endif
53 #ifndef MAX_FILE_NAME
54 #define MAX_FILE_NAME 256
55 #endif
56 #ifndef TEXT_BUFFER_SIZE
57 #define TEXT_BUFFER_SIZE 200
58 #endif
59 #ifndef INPUT_BUFFER_SIZE
60 #define INPUT_BUFFER_SIZE 200
61 #endif
62 #ifndef STACK_SIZE
63 #define STACK_SIZE 61440
64 #endif
65
66 #ifndef DEFAULT_SAVE_NAME
67 #define DEFAULT_SAVE_NAME "story.sav"
68 #endif
69 #ifndef DEFAULT_SCRIPT_NAME
70 #define DEFAULT_SCRIPT_NAME "story.scr"
71 #endif
72 #ifndef DEFAULT_COMMAND_NAME
73 #define DEFAULT_COMMAND_NAME "story.rec"
74 #endif
75 #ifndef DEFAULT_AUXILARY_NAME
76 #define DEFAULT_AUXILARY_NAME "story.aux"
77 #endif
78 #ifndef DEFAULT_SAVE_DIR        /* DG */
79 #define DEFAULT_SAVE_DIR ".frotz-saves"
80 #endif
81
82 /*** Story file header format ***/
83
84 #define H_VERSION 0
85 #define H_CONFIG 1
86 #define H_RELEASE 2
87 #define H_RESIDENT_SIZE 4
88 #define H_START_PC 6
89 #define H_DICTIONARY 8
90 #define H_OBJECTS 10
91 #define H_GLOBALS 12
92 #define H_DYNAMIC_SIZE 14
93 #define H_FLAGS 16
94 #define H_SERIAL 18
95 #define H_ABBREVIATIONS 24
96 #define H_FILE_SIZE 26
97 #define H_CHECKSUM 28
98 #define H_INTERPRETER_NUMBER 30
99 #define H_INTERPRETER_VERSION 31
100 #define H_SCREEN_ROWS 32
101 #define H_SCREEN_COLS 33
102 #define H_SCREEN_WIDTH 34
103 #define H_SCREEN_HEIGHT 36
104 #define H_FONT_HEIGHT 38 /* this is the font width in V5 */
105 #define H_FONT_WIDTH 39 /* this is the font height in V5 */
106 #define H_FUNCTIONS_OFFSET 40
107 #define H_STRINGS_OFFSET 42
108 #define H_DEFAULT_BACKGROUND 44
109 #define H_DEFAULT_FOREGROUND 45
110 #define H_TERMINATING_KEYS 46
111 #define H_LINE_WIDTH 48
112 #define H_STANDARD_HIGH 50
113 #define H_STANDARD_LOW 51
114 #define H_ALPHABET 52
115 #define H_EXTENSION_TABLE 54
116 #define H_USER_NAME 56
117
118 #define HX_TABLE_SIZE 0
119 #define HX_MOUSE_X 1
120 #define HX_MOUSE_Y 2
121 #define HX_UNICODE_TABLE 3
122 #define HX_FLAGS 4
123 #define HX_FORE_COLOUR 5
124 #define HX_BACK_COLOUR 6
125
126 /*** Various Z-machine constants ***/
127
128 #define V1 1
129 #define V2 2
130 #define V3 3
131 #define V4 4
132 #define V5 5
133 #define V6 6
134 #define V7 7
135 #define V8 8
136 #define V9 9
137
138 #define CONFIG_BYTE_SWAPPED 0x01 /* Story file is byte swapped         - V3  */
139 #define CONFIG_TIME         0x02 /* Status line displays time          - V3  */
140 #define CONFIG_TWODISKS     0x04 /* Story file occupied two disks      - V3  */
141 #define CONFIG_TANDY        0x08 /* Tandy licensed game                - V3  */
142 #define CONFIG_NOSTATUSLINE 0x10 /* Interpr can't support status lines - V3  */
143 #define CONFIG_SPLITSCREEN  0x20 /* Interpr supports split screen mode - V3  */
144 #define CONFIG_PROPORTIONAL 0x40 /* Interpr uses proportional font     - V3  */
145
146 #define CONFIG_COLOUR       0x01 /* Interpr supports colour            - V5+ */
147 #define CONFIG_PICTURES     0x02 /* Interpr supports pictures          - V6  */
148 #define CONFIG_BOLDFACE     0x04 /* Interpr supports boldface style    - V4+ */
149 #define CONFIG_EMPHASIS     0x08 /* Interpr supports emphasis style    - V4+ */
150 #define CONFIG_FIXED        0x10 /* Interpr supports fixed width style - V4+ */
151 #define CONFIG_SOUND        0x20 /* Interpr supports sound             - V6  */
152 #define CONFIG_TIMEDINPUT   0x80 /* Interpr supports timed input       - V4+ */
153
154 #define SCRIPTING_FLAG    0x0001 /* Outputting to transscription file  - V1+ */
155 #define FIXED_FONT_FLAG   0x0002 /* Use fixed width font               - V3+ */
156 #define REFRESH_FLAG      0x0004 /* Refresh the screen                 - V6  */
157 #define GRAPHICS_FLAG     0x0008 /* Game wants to use graphics         - V5+ */
158 #define OLD_SOUND_FLAG    0x0010 /* Game wants to use sound effects    - V3  */
159 #define UNDO_FLAG         0x0010 /* Game wants to use UNDO feature     - V5+ */
160 #define MOUSE_FLAG        0x0020 /* Game wants to use a mouse          - V5+ */
161 #define COLOUR_FLAG       0x0040 /* Game wants to use colours          - V5+ */
162 #define SOUND_FLAG        0x0080 /* Game wants to use sound effects    - V5+ */
163 #define MENU_FLAG         0x0100 /* Game wants to use menus            - V6  */
164
165 #define TRANSPARENT_FLAG  0x0001 /* Game wants to use transparency     - V6  */
166
167 #define INTERP_DEFAULT 0
168 #define INTERP_DEC_20 1
169 #define INTERP_APPLE_IIE 2
170 #define INTERP_MACINTOSH 3
171 #define INTERP_AMIGA 4
172 #define INTERP_ATARI_ST 5
173 #define INTERP_MSDOS 6
174 #define INTERP_CBM_128 7
175 #define INTERP_CBM_64 8
176 #define INTERP_APPLE_IIC 9
177 #define INTERP_APPLE_IIGS 10
178 #define INTERP_TANDY 11
179
180 #define BLACK_COLOUR 2
181 #define RED_COLOUR 3
182 #define GREEN_COLOUR 4
183 #define YELLOW_COLOUR 5
184 #define BLUE_COLOUR 6
185 #define MAGENTA_COLOUR 7
186 #define CYAN_COLOUR 8
187 #define WHITE_COLOUR 9
188 #define GREY_COLOUR 10          /* INTERP_MSDOS only */
189 #define LIGHTGREY_COLOUR 10     /* INTERP_AMIGA only */
190 #define MEDIUMGREY_COLOUR 11    /* INTERP_AMIGA only */
191 #define DARKGREY_COLOUR 12      /* INTERP_AMIGA only */
192 #define TRANSPARENT_COLOUR 15 /* ZSpec 1.1 */
193
194 #define REVERSE_STYLE 1
195 #define BOLDFACE_STYLE 2
196 #define EMPHASIS_STYLE 4
197 #define FIXED_WIDTH_STYLE 8
198
199 #define TEXT_FONT 1
200 #define PICTURE_FONT 2
201 #define GRAPHICS_FONT 3
202 #define FIXED_WIDTH_FONT 4
203
204 /*** Constants for os_beep */
205
206 #define BEEP_HIGH       1
207 #define BEEP_LOW        2
208
209 /*** Constants for os_restart_game */
210
211 #define RESTART_BEGIN 0
212 #define RESTART_WPROP_SET 1
213 #define RESTART_END 2
214
215 /*** Constants for os_menu */
216
217 #define MENU_NEW 0
218 #define MENU_ADD 1
219 #define MENU_REMOVE 2
220
221 /*** Character codes ***/
222
223 #define ZC_TIME_OUT 0x00
224 #define ZC_NEW_STYLE 0x01
225 #define ZC_NEW_FONT 0x02
226 #define ZC_BACKSPACE 0x08
227 #define ZC_INDENT 0x09
228 #define ZC_GAP 0x0b
229 #define ZC_RETURN 0x0d
230 #define ZC_HKEY_MIN 0x0e
231 #define ZC_HKEY_RECORD 0x0e
232 #define ZC_HKEY_PLAYBACK 0x0f
233 #define ZC_HKEY_SEED 0x10
234 #define ZC_HKEY_UNDO 0x11
235 #define ZC_HKEY_RESTART 0x12
236 #define ZC_HKEY_QUIT 0x13
237 #define ZC_HKEY_DEBUG 0x14
238 #define ZC_HKEY_HELP 0x15
239 #define ZC_HKEY_MAX 0x15
240 #define ZC_ESCAPE 0x1b
241 #define ZC_ASCII_MIN 0x20
242 #define ZC_ASCII_MAX 0x7e
243 #define ZC_BAD 0x7f
244 #define ZC_ARROW_MIN 0x81
245 #define ZC_ARROW_UP 0x81
246 #define ZC_ARROW_DOWN 0x82
247 #define ZC_ARROW_LEFT 0x83
248 #define ZC_ARROW_RIGHT 0x84
249 #define ZC_ARROW_MAX 0x84
250 #define ZC_FKEY_MIN 0x85
251 #define ZC_FKEY_MAX 0x90
252 #define ZC_NUMPAD_MIN 0x91
253 #define ZC_NUMPAD_MAX 0x9a
254 #define ZC_SINGLE_CLICK 0x9b
255 #define ZC_DOUBLE_CLICK 0x9c
256 #define ZC_MENU_CLICK 0x9d
257 #define ZC_LATIN1_MIN 0xa0
258 #define ZC_LATIN1_MAX 0xff
259
260 /*** File types ***/
261
262 #define FILE_RESTORE 0
263 #define FILE_SAVE 1
264 #define FILE_SCRIPT 2
265 #define FILE_PLAYBACK 3
266 #define FILE_RECORD 4
267 #define FILE_LOAD_AUX 5
268 #define FILE_SAVE_AUX 6
269
270 /*** Data access macros ***/
271
272 #define SET_BYTE(addr,v)  { zmp[addr] = v; }
273 #define LOW_BYTE(addr,v)  { v = zmp[addr]; }
274 #define CODE_BYTE(v)      { v = *pcp++;    }
275
276 #if defined (AMIGA)
277
278 extern zbyte *pcp;
279 extern zbyte *zmp;
280
281 #define lo(v)           ((zbyte *)&v)[1]
282 #define hi(v)           ((zbyte *)&v)[0]
283
284 #define SET_WORD(addr,v)  { zmp[addr] = hi(v); zmp[addr+1] = lo(v); }
285 #define LOW_WORD(addr,v)  { hi(v) = zmp[addr]; lo(v) = zmp[addr+1]; }
286 #define HIGH_WORD(addr,v) { hi(v) = zmp[addr]; lo(v) = zmp[addr+1]; }
287 #define CODE_WORD(v)      { hi(v) = *pcp++; lo(v) = *pcp++; }
288 #define GET_PC(v)         { v = pcp - zmp; }
289 #define SET_PC(v)         { pcp = zmp + v; }
290
291 #endif
292
293 /* A bunch of x86 assembly code previously appeared here. */
294
295 #if !defined (AMIGA) && !defined (MSDOS_16BIT)
296
297 extern zbyte *pcp;
298 extern zbyte *zmp;
299
300 #define lo(v)   (v & 0xff)
301 #define hi(v)   (v >> 8)
302
303 #define SET_WORD(addr,v)  { zmp[addr] = hi(v); zmp[addr+1] = lo(v); }
304 #define LOW_WORD(addr,v)  { v = ((zword) zmp[addr] << 8) | zmp[addr+1]; }
305 #define HIGH_WORD(addr,v) { v = ((zword) zmp[addr] << 8) | zmp[addr+1]; }
306 #define HIGH_LONG(addr,v) { v = ((zword) zmp[addr]   << 24) | \
307                                 ((zword) zmp[addr+1] << 16) | \
308                                 ((zword) zmp[addr+2] <<  8) | zmp[addr+3]; }
309 #define CODE_WORD(v)      { v = ((zword) pcp[0] << 8) | pcp[1]; pcp += 2; }
310 #define CODE_IDX_WORD(v,i){ v = ((zword) pcp[i] << 8) | pcp[i+1]; }
311 #define GET_PC(v)         { v = pcp - zmp; }
312 #define SET_PC(v)         { pcp = zmp + v; }
313
314 #endif
315
316
317 /*** Story file header data ***/
318
319 extern zbyte h_version;
320 extern zbyte h_config;
321 extern zword h_release;
322 extern zword h_resident_size;
323 extern zword h_start_pc;
324 extern zword h_dictionary;
325 extern zword h_objects;
326 extern zword h_globals;
327 extern zword h_dynamic_size;
328 extern zword h_flags;
329 extern zbyte h_serial[6];
330 extern zword h_abbreviations;
331 extern zword h_file_size;
332 extern zword h_checksum;
333 extern zbyte h_interpreter_number;
334 extern zbyte h_interpreter_version;
335 extern zbyte h_screen_rows;
336 extern zbyte h_screen_cols;
337 extern zword h_screen_width;
338 extern zword h_screen_height;
339 extern zbyte h_font_height;
340 extern zbyte h_font_width;
341 extern zword h_functions_offset;
342 extern zword h_strings_offset;
343 extern zbyte h_default_background;
344 extern zbyte h_default_foreground;
345 extern zword h_terminating_keys;
346 extern zword h_line_width;
347 extern zbyte h_standard_high;
348 extern zbyte h_standard_low;
349 extern zword h_alphabet;
350 extern zword h_extension_table;
351 extern zbyte h_user_name[8];
352
353 extern zword hx_table_size;
354 extern zword hx_mouse_x;
355 extern zword hx_mouse_y;
356 extern zword hx_unicode_table;
357 extern zword hx_flags;
358 extern zword hx_fore_colour;
359 extern zword hx_back_colour;
360
361 /*** Various data ***/
362
363 extern char *story_name;
364
365 extern enum story story_id;
366 extern long story_size;
367
368 extern zword stack[STACK_SIZE];
369 extern zword *sp;
370 extern zword *fp;
371 extern zword frame_count;
372
373 extern zword zargs[8];
374 extern int zargc;
375
376 extern bool ostream_screen;
377 extern bool ostream_script;
378 extern bool ostream_memory;
379 extern bool ostream_record;
380 extern bool istream_replay;
381 extern bool message;
382
383 extern int cwin;
384 extern int mwin;
385
386 extern int mouse_x;
387 extern int mouse_y;
388 extern int menu_selected;
389
390 extern bool enable_wrapping;
391 extern bool enable_scripting;
392 extern bool enable_scrolling;
393 extern bool enable_buffering;
394
395 extern int option_attribute_assignment;
396 extern int option_attribute_testing;
397 extern int option_object_locating;
398 extern int option_object_movement;
399 extern int option_context_lines;
400 extern int option_left_margin;
401 extern int option_right_margin;
402 extern int option_ignore_errors;
403 extern int option_piracy;
404 extern int option_undo_slots;
405 extern int option_expand_abbreviations;
406 extern int option_script_cols;
407 extern int option_save_quetzal;
408 extern int option_sound;        /* dg */
409 extern int option_err_report_mode;
410 extern char *option_zcode_path; /* dg */
411
412 extern long reserve_mem;
413
414 /*** Z-machine opcodes ***/
415
416 void    z_add (void);
417 void    z_and (void);
418 void    z_art_shift (void);
419 void    z_buffer_mode (void);
420 void    z_buffer_screen (void);
421 void    z_call_n (void);
422 void    z_call_s (void);
423 void    z_catch (void);
424 void    z_check_arg_count (void);
425 void    z_check_unicode (void);
426 void    z_clear_attr (void);
427 void    z_copy_table (void);
428 void    z_dec (void);
429 void    z_dec_chk (void);
430 void    z_div (void);
431 void    z_draw_picture (void);
432 void    z_encode_text (void);
433 void    z_erase_line (void);
434 void    z_erase_picture (void);
435 void    z_erase_window (void);
436 void    z_get_child (void);
437 void    z_get_cursor (void);
438 void    z_get_next_prop (void);
439 void    z_get_parent (void);
440 void    z_get_prop (void);
441 void    z_get_prop_addr (void);
442 void    z_get_prop_len (void);
443 void    z_get_sibling (void);
444 void    z_get_wind_prop (void);
445 void    z_inc (void);
446 void    z_inc_chk (void);
447 void    z_input_stream (void);
448 void    z_insert_obj (void);
449 void    z_je (void);
450 void    z_jg (void);
451 void    z_jin (void);
452 void    z_jl (void);
453 void    z_jump (void);
454 void    z_jz (void);
455 void    z_load (void);
456 void    z_loadb (void);
457 void    z_loadw (void);
458 void    z_log_shift (void);
459 void    z_make_menu (void);
460 void    z_mod (void);
461 void    z_mouse_window (void);
462 void    z_move_window (void);
463 void    z_mul (void);
464 void    z_new_line (void);
465 void    z_nop (void);
466 void    z_not (void);
467 void    z_or (void);
468 void    z_output_stream (void);
469 void    z_picture_data (void);
470 void    z_picture_table (void);
471 void    z_piracy (void);
472 void    z_pop (void);
473 void    z_pop_stack (void);
474 void    z_print (void);
475 void    z_print_addr (void);
476 void    z_print_char (void);
477 void    z_print_form (void);
478 void    z_print_num (void);
479 void    z_print_obj (void);
480 void    z_print_paddr (void);
481 void    z_print_ret (void);
482 void    z_print_table (void);
483 void    z_print_unicode (void);
484 void    z_pull (void);
485 void    z_push (void);
486 void    z_push_stack (void);
487 void    z_put_prop (void);
488 void    z_put_wind_prop (void);
489 void    z_quit (void);
490 void    z_random (void);
491 void    z_read (void);
492 void    z_read_char (void);
493 void    z_read_mouse (void);
494 void    z_remove_obj (void);
495 void    z_restart (void);
496 void    z_restore (void);
497 void    z_restore_undo (void);
498 void    z_ret (void);
499 void    z_ret_popped (void);
500 void    z_rfalse (void);
501 void    z_rtrue (void);
502 void    z_save (void);
503 void    z_save_undo (void);
504 void    z_scan_table (void);
505 void    z_scroll_window (void);
506 void    z_set_attr (void);
507 void    z_set_font (void);
508 void    z_set_colour (void);
509 void    z_set_cursor (void);
510 void    z_set_margins (void);
511 void    z_set_window (void);
512 void    z_set_text_style (void);
513 void    z_set_true_colour (void);
514 void    z_show_status (void);
515 void    z_sound_effect (void);
516 void    z_split_window (void);
517 void    z_store (void);
518 void    z_storeb (void);
519 void    z_storew (void);
520 void    z_sub (void);
521 void    z_test (void);
522 void    z_test_attr (void);
523 void    z_throw (void);
524 void    z_tokenise (void);
525 void    z_verify (void);
526 void    z_window_size (void);
527 void    z_window_style (void);
528
529 /* Definitions for error handling functions and error codes. */
530
531 /* extern int err_report_mode; */
532
533 void    init_err (void);
534 void    runtime_error (int);
535  
536 /* Error codes */
537 #define ERR_TEXT_BUF_OVF 1      /* Text buffer overflow */
538 #define ERR_STORE_RANGE 2       /* Store out of dynamic memory */
539 #define ERR_DIV_ZERO 3          /* Division by zero */
540 #define ERR_ILL_OBJ 4           /* Illegal object */
541 #define ERR_ILL_ATTR 5          /* Illegal attribute */
542 #define ERR_NO_PROP 6           /* No such property */
543 #define ERR_STK_OVF 7           /* Stack overflow */
544 #define ERR_ILL_CALL_ADDR 8     /* Call to illegal address */
545 #define ERR_CALL_NON_RTN 9      /* Call to non-routine */
546 #define ERR_STK_UNDF 10         /* Stack underflow */
547 #define ERR_ILL_OPCODE 11       /* Illegal opcode */
548 #define ERR_BAD_FRAME 12        /* Bad stack frame */
549 #define ERR_ILL_JUMP_ADDR 13    /* Jump to illegal address */
550 #define ERR_SAVE_IN_INTER 14    /* Can't save while in interrupt */
551 #define ERR_STR3_NESTING 15     /* Nesting stream #3 too deep */
552 #define ERR_ILL_WIN 16          /* Illegal window */
553 #define ERR_ILL_WIN_PROP 17     /* Illegal window property */
554 #define ERR_ILL_PRINT_ADDR 18   /* Print at illegal address */
555 #define ERR_DICT_LEN 19 /* Illegal dictionary word length */
556 #define ERR_MAX_FATAL 19
557
558 /* Less serious errors */
559 #define ERR_JIN_0 20            /* @jin called with object 0 */
560 #define ERR_GET_CHILD_0 21      /* @get_child called with object 0 */
561 #define ERR_GET_PARENT_0 22     /* @get_parent called with object 0 */
562 #define ERR_GET_SIBLING_0 23    /* @get_sibling called with object 0 */
563 #define ERR_GET_PROP_ADDR_0 24  /* @get_prop_addr called with object 0 */
564 #define ERR_GET_PROP_0 25       /* @get_prop called with object 0 */
565 #define ERR_PUT_PROP_0 26       /* @put_prop called with object 0 */
566 #define ERR_CLEAR_ATTR_0 27     /* @clear_attr called with object 0 */
567 #define ERR_SET_ATTR_0 28       /* @set_attr called with object 0 */
568 #define ERR_TEST_ATTR_0 29      /* @test_attr called with object 0 */
569 #define ERR_MOVE_OBJECT_0 30    /* @move_object called moving object 0 */
570 #define ERR_MOVE_OBJECT_TO_0 31 /* @move_object called moving into object 0 */
571 #define ERR_REMOVE_OBJECT_0 32  /* @remove_object called with object 0 */
572 #define ERR_GET_NEXT_PROP_0 33  /* @get_next_prop called with object 0 */
573 #define ERR_NUM_ERRORS (33)
574  
575 /* There are four error reporting modes: never report errors;
576   report only the first time a given error type occurs; report
577   every time an error occurs; or treat all errors as fatal
578   errors, killing the interpreter. I strongly recommend
579   "report once" as the default. But you can compile in a
580   different default by changing the definition of
581   ERR_DEFAULT_REPORT_MODE. In any case, the player can
582   specify a report mode on the command line by typing "-Z 0"
583   through "-Z 3". */
584
585 #define ERR_REPORT_NEVER (0)
586 #define ERR_REPORT_ONCE (1)
587 #define ERR_REPORT_ALWAYS (2)
588 #define ERR_REPORT_FATAL (3)
589
590 #define ERR_DEFAULT_REPORT_MODE ERR_REPORT_NEVER
591
592
593 /*** Various global functions ***/
594
595 zchar   translate_from_zscii (zbyte);
596 zbyte   translate_to_zscii (zchar);
597
598 void    flush_buffer (void);
599 void    new_line (void);
600 void    print_char (zchar);
601 void    print_num (zword);
602 void    print_object (zword);
603 void    print_string (const char *);
604
605 void    stream_mssg_on (void);
606 void    stream_mssg_off (void);
607
608 void    ret (zword);
609 void    store (zword);
610 void    branch (bool);
611
612 void    storeb (zword, zbyte);
613 void    storew (zword, zword);
614
615 /*** Interface functions ***/
616
617 void    os_beep (int);
618 int     os_buffer_screen (int);
619 int     os_char_width (zchar);
620 int     os_check_unicode (int, zchar);
621 void    os_display_char (zchar);
622 void    os_display_string (const zchar *);
623 void    os_display_cstring (const char *);
624 void    os_draw_picture (int, int, int);
625 void    os_erase_area (int, int, int, int, int);
626 void    os_fatal (const char *);
627 void    os_finish_with_sample (int);
628 int     os_font_data (int, int *, int *);
629 int     os_from_true_colour (zword);
630 void    os_init_screen (void);
631 void    os_menu(int, int, const zword *);
632 void    os_more_prompt (void);
633 int     os_peek_colour (void);
634 int     os_picture_data (int, int *, int *);
635 void    os_prepare_sample (int);
636 void    os_process_arguments (int, char *[]);
637 int     os_random_seed (void);
638 int     os_read_file_name (char *, const char *, int);
639 zchar   os_read_key (int, int);
640 zchar   os_read_line (int, zchar *, int, int, int);
641 zword   os_read_mouse (void);
642 void    os_reset_screen (void);
643 void    os_restart_game (int);
644 void    os_scroll_area (int, int, int, int, int);
645 void    os_scrollback_char (zchar);
646 void    os_scrollback_erase (int);
647 void    os_set_colour (int, int);
648 void    os_set_cursor (int, int);
649 void    os_set_font (int);
650 void    os_set_text_style (int);
651 void    os_start_sample (int, int, int, zword);
652 void    os_stop_sample (int);
653 int     os_string_width (const zchar *);
654 int     os_string_length (zchar *);
655 void    os_tick (void);
656 zword   os_to_true_colour (int);
657 int     os_wrap_window (int);
658 void    os_window_height (int, int);
659
660 void seed_random (int);
661 void restart_screen (void);
662 void refresh_text_style (void);
663 void call (zword, int, zword *, int);
664 void split_window (zword);
665 void script_open (void);
666 void script_close (void);
667
668 //FILE *os_path_open (const char *, const char *, long *);
669
670 //zword save_quetzal (FILE *, zbyte *);
671 //zword restore_quetzal (FILE *, zbyte *);
672
673 void erase_window (zword);
674
675 extern void (*op0_opcodes[]) (void);
676 extern void (*op1_opcodes[]) (void);
677 extern void (*op2_opcodes[]) (void);
678 extern void (*var_opcodes[]) (void);
679
680 extern zchar* decoded;
681 extern zchar* encoded;