Initiali.asm 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. include_macros equ 1
  2. include_deb_mac equ 1
  3. include_error_codes equ 1
  4. include include.asm
  5. start32data
  6. align 4
  7. system_flags dd 0 ;Lots of lovely flags
  8. computer_speed dd 0 ;computer speed indicator
  9. end32data
  10. start32code
  11. public int_08_off
  12. public int_09_off
  13. extrn timer_handler:far
  14. extrn init_mouse:near
  15. extrn initialise_disk:near
  16. extrn init_script:near
  17. extrn initialise_memory:near
  18. extrn initialise_screen:near
  19. extrn initialise_grids:near
  20. extrn initialise_router:near
  21. extrn initialise_text:near
  22. extrn init_music:near
  23. extrn init_timer:near
  24. extrn load_fixed_items:near
  25. int_08_off dw ? ;Original interrupt 8 offset
  26. int_08_seg dw ? ;Original interrupt 8 segment
  27. int_09_off dw ? ;Original interrupt 09 offset
  28. int_09_seg dw ? ;Original interrupt 09 segment
  29. int_24_off dw ? ;Original interrupt 24 offset
  30. int_24_seg dw ? ;Original interrupt 24 segment
  31. _initialise__Nv proc
  32. ; Called at the very beginning of the program.
  33. call check_vga_dos ;check for a vga card and dos 2.0+
  34. call initialise_memory ;Set up memory control (mem_check set only)
  35. call init_timer ;initialise timer and keyboard interrupts
  36. ifndef final_version
  37. ; Announce any conditional assembly
  38. inform_debug no_timer,"Timer disabled"
  39. inform_debug no_music,"Music disabled"
  40. inform_debug no_keyboard,"Keyboard intercept disabled"
  41. inform_debug mem_check,"Memory check enabled"
  42. inform_debug clicking_optional,"Text clicking optional"
  43. inform_debug debug_42,"Debugging on"
  44. inform_debug cmd_options,"Debug command options enabled"
  45. inform_debug with_voc_editor,"VOC editor installed"
  46. inform_debug file_order_chk,"File order checking on"
  47. inform_debug dont_check_rlnd,"Roland not supported"
  48. inform_debug ar_debug,"Ar debug"
  49. inform_debug selective_intro,"Selective cd intro"
  50. inform_debug language_testing,"LANGUAGE TESTING ONLY"
  51. ifdef inform_debug_on
  52. inform_debug current_version_text2,"%s",offset current_version
  53. inform_debug inform_debug_on,"Press any key..."
  54. extrn fetch_key:near
  55. idb_wait: call fetch_key
  56. je idb_wait
  57. cherror ax,e,27,em_game_over
  58. yo_ho_ho equ 1
  59. inform_debug yo_ho_ho,"Loading..."
  60. endif ;inform_debug_on
  61. endif ;final_version
  62. ifdef debug_42
  63. bts [_debug_flag],31 ;If escape not pressed we can start the debug file
  64. endif
  65. ; Set up anything and everything
  66. ; Music allocates dos memory (16 bit) so allocate it
  67. ; before anything else uses it all up
  68. call init_music
  69. call initialise_screen
  70. call initialise_disk ;Check the data disk exists and load in some things
  71. call init_virgin ;Bring on virgin screen
  72. call init_mouse ;Set up the mouse
  73. call init_script ;load in the script files
  74. call initialise_grids ;Load in the grids
  75. call initialise_router ;set router info
  76. call initialise_text ;load in character set
  77. ;call init_music
  78. call load_fixed_items
  79. ifdef with_replay
  80. call start_up_replay_file
  81. endif
  82. ; Do a simple count to give an idea of how fast the computer is
  83. ifndef no_timer
  84. mov [game_50hz_count],0 ;wait for start of intrpt
  85. wait_start: test [game_50hz_count],-1
  86. je wait_start
  87. mov [game_50hz_count],0 ;wait for next intrpt
  88. clear eax
  89. wait_next: inc eax
  90. test [game_50hz_count],-1
  91. je wait_next
  92. ; eax is the count
  93. mov [computer_speed],eax
  94. else
  95. mov [computer_speed],100000
  96. endif
  97. ret
  98. _initialise__Nv endp
  99. ;critical_error_handler proc private
  100. ;
  101. ; iret
  102. ;
  103. ;critical_error_handler endp
  104. check_vga_dos proc private
  105. ; Check for a vga card
  106. mov ax,1a00h
  107. screen_int
  108. cmp al,1ah ;1a means vga card
  109. jne monitor_nok
  110. ; Check for dos version 2 or upwards
  111. mov ah,30h
  112. dos_int
  113. cmp al,2 ;need dos 2.0 or greater
  114. jc dos_nok
  115. ret
  116. monitor_nok: program_error em_no_vga
  117. dos_nok: program_error em_inv_dos
  118. check_vga_dos endp
  119. end32code
  120. end
  121.