home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / GAMES / infocom_src.lha / globals.c < prev    next >
Text File  |  1993-03-03  |  9KB  |  308 lines

  1. /*
  2. **    File:    globals.c
  3. **
  4. **    (C)opyright 1987-1992 InfoTaskforce.
  5. */
  6.  
  7. #include        "infocom.h"
  8.  
  9. /*
  10. **    Global Variables
  11. */
  12.  
  13. word            random1 ;
  14. word            random2 ;
  15. word            pc_offset ;
  16. word            pc_page ;
  17. byte_ptr        pc ;
  18. boolean            stop                = FALSE ;
  19. int                sig_async            = SH_INIT ;
  20. int                sig_action            = SH_NO_SIGNAL ;
  21.  
  22. /*
  23. **    Print Parameters
  24. */
  25.  
  26. int                screen_width        = SCREEN_WIDTH ;
  27. int                screen_height        = SCREEN_HEIGHT ;
  28. int                linecount            = 0 ;
  29. boolean            enable_screen        = TRUE ;
  30. boolean            disable_script        = FALSE ;
  31. boolean            script_on            = FALSE ;
  32. proc_ptr        PrintChar ;
  33.  
  34. /*
  35. **    Enhanced Function Globals
  36. */
  37.  
  38. boolean            windowing_enabled    = FALSE ;
  39. word            top_screen_line        = STD_TOP_SCREEN_LINE ;
  40. word            current_window        = 0 ;
  41. word            window_height ;
  42.  
  43. /*
  44. **    Plus Function Globals
  45. */
  46.  
  47. word            random3 ;
  48. word            random4 ;
  49.  
  50. boolean            use_buffered_io        = TRUE ;
  51. boolean            use_internal_buffer    = FALSE ;
  52. byte_ptr        internal_io_buffer ;
  53. byte_ptr        internal_io_ptr ;
  54. word            int_io_buff_length ;
  55.  
  56. /*
  57. **    Advanced Function Globals
  58. */
  59.  
  60. byte            local_params        = 0 ;
  61. byte_ptr        main_vocab_list        = (byte_ptr)0 ;
  62.  
  63. /*
  64. **    Game Constants
  65. */
  66.  
  67. byte_ptr        base_ptr            = (byte_ptr)0 ;
  68. byte_ptr        global_ptr ;
  69. byte_ptr        common_word_ptr ;
  70. byte_ptr        prog_block_ptr ;
  71. std_object_ptr    std_obj_list ;
  72. plus_object_ptr    plus_obj_list ;
  73. header            data_head ;
  74. word            resident_blocks ;
  75. word            save_blocks ;
  76.  
  77. /*
  78. **    Stack Variables
  79. */
  80.  
  81. word            param_stack[MAX_PARAMS+1] ;
  82. word            default_param_stack[MAX_PARAMS+1] ;
  83. word            stack_space[STACK_SIZE] ;
  84. word            *stack_base = &stack_space[STACK_SIZE] ;
  85. word            *stack_var_ptr ;
  86. word            *stack ;
  87.  
  88. /*
  89. **    Game Options
  90. */
  91.  
  92. boolean            attribute    = FALSE ;
  93. boolean            echo_in        = FALSE ;
  94. boolean            enhanced    = FALSE ;
  95. boolean            page_out    = FALSE ;
  96. boolean            pre_load    = FALSE ;
  97. boolean            xfer        = FALSE ;
  98.  
  99. /*
  100. **    Opcode Jump Tables
  101. */
  102.  
  103. proc_ptr    jmp_op0[] =    {
  104.                             ret_true,
  105.                             ret_false,
  106.                             wrt,
  107.                             writeln,
  108.                             null,
  109.                             save_game,
  110.                             restore_game,
  111.                             restart,
  112.                             rts,
  113.                             std_pop_stack,
  114.                             quit,
  115.                             new_line,
  116.                             illegal_opcode,
  117.                             illegal_opcode,
  118.                             illegal_opcode,
  119.                             illegal_opcode
  120.                         } ;
  121.  
  122. proc_ptr    jmp_op1[] =    {
  123.                             cp_zero,
  124.                             std_get_link,
  125.                             std_get_holds,
  126.                             std_get_loc,
  127.                             std_get_p_len,
  128.                             inc_var,
  129.                             dec_var,
  130.                             print1,
  131.                             illegal_opcode,
  132.                             std_remove_obj,
  133.                             std_p_obj,
  134.                             std_rtn,
  135.                             jump,
  136.                             std_print2,
  137.                             get_var,
  138.                             not
  139.                         };
  140.  
  141. proc_ptr    jmp_op2[] =    {
  142.                             illegal_opcode,            /*    Opcode:    00    */
  143.                             compare,                /*    Opcode:    01    */
  144.                             less_than,                /*    Opcode:    02    */
  145.                             greater_than,            /*    Opcode:    03    */
  146.                             dec_chk,                /*    Opcode:    04    */
  147.                             inc_chk,                /*    Opcode:    05    */
  148.                             std_check_loc,            /*    Opcode:    06    */
  149.                             bit,                    /*    Opcode:    07    */
  150.                             or,                        /*    Opcode:    08    */
  151.                             and,                    /*    Opcode:    09    */
  152.                             std_test_attr,            /*    Opcode:    0A    */
  153.                             std_set_attr,            /*    Opcode:    0B    */
  154.                             std_clr_attr,            /*    Opcode:    0C    */
  155.                             put_var,                /*    Opcode:    0D    */
  156.                             std_transfer,            /*    Opcode:    0E    */
  157.                             load_word_array,        /*    Opcode:    0F    */
  158.                             load_byte_array,        /*    Opcode:    10    */
  159.                             std_getprop,            /*    Opcode:    11    */
  160.                             std_get_prop_addr,        /*    Opcode:    12    */
  161.                             std_get_next_prop,        /*    Opcode:    13    */
  162.                             plus,                    /*    Opcode:    14    */
  163.                             minus,                    /*    Opcode:    15    */
  164.                             multiply,                /*    Opcode:    16    */
  165.                             divide,                    /*    Opcode:    17    */
  166.                             mod,                    /*    Opcode:    18    */
  167.                             illegal_opcode,            /*    Opcode:    19    */
  168.                             illegal_opcode,            /*    Opcode:    1A    */
  169.                             illegal_opcode,            /*    Opcode:    1B    */
  170.                             illegal_opcode,            /*    Opcode:    1C    */
  171.                             illegal_opcode,            /*    Opcode:    1D    */
  172.                             illegal_opcode,            /*    Opcode:    1E    */
  173.                             illegal_opcode,            /*    Opcode:    1F    */
  174.                             std_gosub,                /*    Opcode:    20    */
  175.                             save_word_array,        /*    Opcode:    21    */
  176.                             save_byte_array,        /*    Opcode:    22    */
  177.                             std_put_prop,            /*    Opcode:    23    */
  178.                             input,                    /*    Opcode:    24    */
  179.                             print_char,                /*    Opcode:    25    */
  180.                             print_num,                /*    Opcode:    26    */
  181.                             std_random,                /*    Opcode:    27    */
  182.                             push,                    /*    Opcode:    28    */
  183.                             pop,                    /*    Opcode:    29    */
  184.                             illegal_opcode,            /*    Opcode:    2A    */
  185.                             illegal_opcode,            /*    Opcode:    2B    */
  186.                             illegal_opcode,            /*    Opcode:    2C    */
  187.                             illegal_opcode,            /*    Opcode:    2D    */
  188.                             illegal_opcode,            /*    Opcode:    2E    */
  189.                             illegal_opcode,            /*    Opcode:    2F    */
  190.                             illegal_opcode,            /*    Opcode:    30    */
  191.                             illegal_opcode,            /*    Opcode:    31    */
  192.                             illegal_opcode,            /*    Opcode:    32    */
  193.                             illegal_opcode,            /*    Opcode:    33    */
  194.                             illegal_opcode,            /*    Opcode:    34    */
  195.                             illegal_opcode,            /*    Opcode:    35    */
  196.                             illegal_opcode,            /*    Opcode:    36    */
  197.                             illegal_opcode,            /*    Opcode:    37    */
  198.                             illegal_opcode,            /*    Opcode:    38    */
  199.                             illegal_opcode,            /*    Opcode:    39    */
  200.                             illegal_opcode,            /*    Opcode:    3A    */
  201.                             illegal_opcode,            /*    Opcode:    3B    */
  202.                             illegal_opcode,            /*    Opcode:    3C    */
  203.                             illegal_opcode,            /*    Opcode:    3D    */
  204.                             illegal_opcode,            /*    Opcode:    3E    */
  205.                             illegal_opcode,            /*    Opcode:    3F    */
  206.                             illegal_opcode,            /*    Opcode:    40    */
  207.                             illegal_opcode,            /*    Opcode:    41    */
  208.                             illegal_opcode,            /*    Opcode:    42    */
  209.                             illegal_opcode,            /*    Opcode:    43    */
  210.                             illegal_opcode,            /*    Opcode:    44    */
  211.                             illegal_opcode,            /*    Opcode:    45    */
  212.                             illegal_opcode,            /*    Opcode:    46    */
  213.                             illegal_opcode,            /*    Opcode:    47    */
  214.                             illegal_opcode,            /*    Opcode:    48    */
  215.                             illegal_opcode,            /*    Opcode:    49    */
  216.                             illegal_opcode,            /*    Opcode:    4A    */
  217.                             illegal_opcode,            /*    Opcode:    4B    */
  218.                             illegal_opcode,            /*    Opcode:    4C    */
  219.                             illegal_opcode,            /*    Opcode:    4D    */
  220.                             illegal_opcode,            /*    Opcode:    4E    */
  221.                             illegal_opcode,            /*    Opcode:    4F    */
  222.                             illegal_opcode            /*    Opcode:    50    */
  223.                         } ;
  224.  
  225. int        operands[] =    {
  226.                             0,        /*    illegal_opcode            : Opcode 00    */
  227.                             0,        /*    compare                    : Opcode 01    */
  228.                             2,        /*    less_than                : Opcode 02    */
  229.                             2,        /*    greater_than            : Opcode 03    */
  230.                             2,        /*    dec_chk                    : Opcode 04    */
  231.                             2,        /*    inc_chk                    : Opcode 05    */
  232.                             2,        /*    std_check_loc            : Opcode 06    */
  233.                             2,        /*    bit                        : Opcode 07    */
  234.                             2,        /*    or                        : Opcode 08    */
  235.                             2,        /*    and                        : Opcode 09    */
  236.                             2,        /*    std_test_attr            : Opcode 0A    */
  237.                             2,        /*    std_set_attr            : Opcode 0B    */
  238.                             2,        /*    std_clr_attr            : Opcode 0C    */
  239.                             2,        /*    put_var                    : Opcode 0D    */
  240.                             2,        /*    std_transfer            : Opcode 0E    */
  241.                             2,        /*    load_word_array            : Opcode 0F    */
  242.                             2,        /*    load_byte_array            : Opcode 10    */
  243.                             2,        /*    std_getprop                : Opcode 11    */
  244.                             2,        /*    std_get_prop_addr        : Opcode 12    */
  245.                             2,        /*    std_get_next_prop        : Opcode 13    */
  246.                             2,        /*    plus                    : Opcode 14    */
  247.                             2,        /*    minus                    : Opcode 15    */
  248.                             2,        /*    multiply                : Opcode 16    */
  249.                             2,        /*    divide                    : Opcode 17    */
  250.                             2,        /*    mod                        : Opcode 18    */
  251.                             0,        /*    illegal_opcode            : Opcode 19    */
  252.                             0,        /*    illegal_opcode            : Opcode 1A    */
  253.                             0,        /*    illegal_opcode            : Opcode 1B    */
  254.                             0,        /*    illegal_opcode            : Opcode 1C    */
  255.                             0,        /*    illegal_opcode            : Opcode 1D    */
  256.                             0,        /*    illegal_opcode            : Opcode 1E    */
  257.                             0,        /*    illegal_opcode            : Opcode 1F    */
  258.                             0,        /*    std_gosub                : Opcode 20    */
  259.                             3,        /*    save_word_array            : Opcode 21    */
  260.                             3,        /*    save_byte_array            : Opcode 22    */
  261.                             3,        /*    std_put_prop            : Opcode 23    */
  262.                             0,        /*    input                    : Opcode 24    */
  263.                             1,        /*    print_char                : Opcode 25    */
  264.                             1,        /*    print_num                : Opcode 26    */
  265.                             1,        /*    std_random                : Opcode 27    */
  266.                             1,        /*    push                    : Opcode 28    */
  267.                             1,        /*    pop                        : Opcode 29    */
  268.                             0,        /*    illegal_opcode            : Opcode 2A    */
  269.                             0,        /*    illegal_opcode            : Opcode 2B    */
  270.                             0,        /*    illegal_opcode            : Opcode 2C    */
  271.                             0,        /*    illegal_opcode            : Opcode 2D    */
  272.                             0,        /*    illegal_opcode            : Opcode 2E    */
  273.                             0,        /*    illegal_opcode            : Opcode 2F    */
  274.                             0,        /*    illegal_opcode            : Opcode 30    */
  275.                             0,        /*    illegal_opcode            : Opcode 31    */
  276.                             0,        /*    illegal_opcode            : Opcode 32    */
  277.                             0,        /*    illegal_opcode            : Opcode 33    */
  278.                             0,        /*    illegal_opcode            : Opcode 34    */
  279.                             0,        /*    illegal_opcode            : Opcode 35    */
  280.                             0,        /*    illegal_opcode            : Opcode 36    */
  281.                             0,        /*    illegal_opcode            : Opcode 37    */
  282.                             0,        /*    illegal_opcode            : Opcode 38    */
  283.                             0,        /*    illegal_opcode            : Opcode 39    */
  284.                             0,        /*    illegal_opcode            : Opcode 3A    */
  285.                             0,        /*    illegal_opcode            : Opcode 3B    */
  286.                             0,        /*    illegal_opcode            : Opcode 3C    */
  287.                             0,        /*    illegal_opcode            : Opcode 3D    */
  288.                             0,        /*    illegal_opcode            : Opcode 3E    */
  289.                             0,        /*    illegal_opcode            : Opcode 3F    */
  290.                             0,        /*    illegal_opcode            : Opcode 40    */
  291.                             0,        /*    illegal_opcode            : Opcode 41    */
  292.                             0,        /*    illegal_opcode            : Opcode 42    */
  293.                             0,        /*    illegal_opcode            : Opcode 43    */
  294.                             0,        /*    illegal_opcode            : Opcode 44    */
  295.                             0,        /*    illegal_opcode            : Opcode 45    */
  296.                             0,        /*    illegal_opcode            : Opcode 46    */
  297.                             0,        /*    illegal_opcode            : Opcode 47    */
  298.                             0,        /*    illegal_opcode            : Opcode 48    */
  299.                             0,        /*    illegal_opcode            : Opcode 49    */
  300.                             0,        /*    illegal_opcode            : Opcode 4A    */
  301.                             0,        /*    illegal_opcode            : Opcode 4B    */
  302.                             0,        /*    illegal_opcode            : Opcode 4C    */
  303.                             0,        /*    illegal_opcode            : Opcode 4D    */
  304.                             0,        /*    illegal_opcode            : Opcode 4E    */
  305.                             0,        /*    illegal_opcode            : Opcode 4F    */
  306.                             0        /*    illegal_opcode            : Opcode 50    */
  307.                         } ;
  308.