Error.asm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. include_macros equ 1
  2. include_deb_mac equ 1
  3. include_flags equ 1
  4. include include.asm
  5. erm macro label,text
  6. label db text,".",10,13,"$"
  7. endm
  8. start32data
  9. extrn int8_vector:dword
  10. extrn int9_vector:dword
  11. extrn int24_vector:dword
  12. align 4
  13. no_of_error_messages equ 11
  14. error_messages dd en_int_error ;english
  15. dd en_game_over
  16. dd en_no_vga_card
  17. dd en_invalid_dos
  18. dd en_no_dnr_file
  19. dd en_disk_read_error
  20. dd en_dsk_f_err
  21. dd en_no_memory
  22. dd en_dnr_f_err
  23. dd en_save_game_error
  24. dd en_no_mouse_error
  25. dd gm_int_error ;german
  26. dd gm_game_over
  27. dd gm_no_vga_card
  28. dd gm_invalid_dos
  29. dd gm_no_dnr_file
  30. dd gm_disk_read_error
  31. dd gm_dsk_f_err
  32. dd gm_no_memory
  33. dd gm_dnr_f_err
  34. dd gm_save_game_error
  35. dd gm_no_mouse_error
  36. dd fr_int_error ;french
  37. dd fr_game_over
  38. dd fr_no_vga_card
  39. dd fr_invalid_dos
  40. dd fr_no_dnr_file
  41. dd fr_disk_read_error
  42. dd fr_dsk_f_err
  43. dd fr_no_memory
  44. dd fr_dnr_f_err
  45. dd fr_save_game_error
  46. dd fr_no_mouse_error
  47. dd us_int_error ;us
  48. dd us_game_over
  49. dd us_no_vga_card
  50. dd us_invalid_dos
  51. dd us_no_dnr_file
  52. dd us_disk_read_error
  53. dd us_dsk_f_err
  54. dd us_no_memory
  55. dd us_dnr_f_err
  56. dd us_save_game_error
  57. dd us_no_mouse_error
  58. dd sw_int_error ;sw
  59. dd sw_game_over
  60. dd sw_no_vga_card
  61. dd sw_invalid_dos
  62. dd sw_no_dnr_file
  63. dd sw_disk_read_error
  64. dd sw_dsk_f_err
  65. dd sw_no_memory
  66. dd sw_dnr_f_err
  67. dd sw_save_game_error
  68. dd sw_no_mouse_error
  69. dd it_int_error ;sw
  70. dd it_game_over
  71. dd it_no_vga_card
  72. dd it_invalid_dos
  73. dd it_no_dnr_file
  74. dd it_disk_read_error
  75. dd it_dsk_f_err
  76. dd it_no_memory
  77. dd it_dnr_f_err
  78. dd it_save_game_error
  79. dd it_no_mouse_error
  80. dd pt_int_error ;sw
  81. dd pt_game_over
  82. dd pt_no_vga_card
  83. dd pt_invalid_dos
  84. dd pt_no_dnr_file
  85. dd pt_disk_read_error
  86. dd pt_dsk_f_err
  87. dd pt_no_memory
  88. dd pt_dnr_f_err
  89. dd pt_save_game_error
  90. dd pt_no_mouse_error
  91. dd es_int_error ;sw
  92. dd es_game_over
  93. dd es_no_vga_card
  94. dd es_invalid_dos
  95. dd es_no_dnr_file
  96. dd es_disk_read_error
  97. dd es_dsk_f_err
  98. dd es_no_memory
  99. dd es_dnr_f_err
  100. dd es_save_game_error
  101. dd es_no_mouse_error
  102. ;--------------------------------------------------------------------------------------------------
  103. ; English errors
  104. erm en_int_error,"Internal program error"
  105. ifdef s1_demo
  106. en_game_over db "Thank you for playing 'Beneath A Steel Sky'.",10,13,"Coming soon from Virgin",10,13,"$"
  107. else ;s1_demo
  108. en_game_over db "Game over player one.",10,13,"BE VIGILANT",10,13,"$"
  109. endif ;s1_demo
  110. erm en_no_vga_card,"Game needs VGA/SVGA graphics card"
  111. erm en_no_dnr_file,"Could not find SKY.DNR"
  112. erm en_invalid_dos,"Game needs DOS 2.0 or later"
  113. erm en_disk_read_error,"Error reading data disk"
  114. erm en_dsk_f_err,"Could not find SKY.DSK"
  115. erm en_no_memory,"Insufficient memory or hard disk space to play the game"
  116. erm en_dnr_f_err,"Invalid sky.dnr"
  117. erm en_save_game_error,"Invalid save game version"
  118. erm en_no_mouse_error,"Mouse Driver not found"
  119. ;--------------------------------------------------------------------------------------------------
  120. ; German errors
  121. erm gm_int_error,"Internal program error"
  122. ifdef s1_demo
  123. gm_game_over db "Vielen Dank f�r das Spielen von 'Beneath A Steel Sky'.",10,13,"Demn„chst erh„ltlich von Virgin",10,13,"$"
  124. else ;s1_demo
  125. gm_game_over db "Das Spiel ist aus.",10,13,"SEI WACHSAM",10,13,"$"
  126. endif ;s1_demo
  127. erm gm_no_vga_card,"Dieses Spiel erfordert eine VGA/SVGA-Grafikkarte"
  128. erm gm_no_dnr_file,"Kann SKY.DNR nicht finden"
  129. erm gm_invalid_dos,"Spiel benotigt DOS 2.0 oder hoher"
  130. erm gm_disk_read_error,"Datendiskette fehlerhaft"
  131. erm gm_dsk_f_err,"Kann SKY.DSK nicht finden"
  132. erm gm_no_memory,"Zuwenig Speicher oder freie Festplattenkapazitat vorhanden, um zu spielen"
  133. erm gm_dnr_f_err,"sky.dnr fehlerhaft"
  134. erm gm_save_game_error,"Fehlerhaft Spielstand"
  135. erm gm_no_mouse_error,"Mouse Driver not found"
  136. ;--------------------------------------------------------------------------------------------------
  137. ; French errors
  138. erm fr_int_error,"Erreur interne du programme"
  139. ifdef s1_demo
  140. fr_game_over db "Merci d'avoir jou‚ … "
  141. db '"Beneath a Steel Sky".',10,13,"Bient“t distribu‚ par Virgin",10,13,"$"
  142. else ;s1_demo
  143. fr_game_over db "Game over joueur 1.",10,13,"SOYEZ VIGILANTS",10,13,"$"
  144. endif ;s1_demo
  145. erm fr_no_vga_card,"Carte graphique VGA/SVGA n‚cessaire"
  146. erm fr_no_dnr_file,"Fichier SKY.DNR absent"
  147. erm fr_invalid_dos,"DOS 2.0 ou plus n‚cessaire"
  148. erm fr_disk_read_error,"Erreur de lecture"
  149. erm fr_dsk_f_err,"SKY.DSK non trouv‚"
  150. erm fr_no_memory,"M‚moire ou place sur le disque dur insuffisante"
  151. erm fr_dnr_f_err,"Fichier SKY.DRN invalide"
  152. erm fr_save_game_error,"Version de sauvegarde invalide"
  153. erm fr_no_mouse_error,"Mouse Driver not found"
  154. ;--------------------------------------------------------------------------------------------------
  155. ; US errors
  156. erm us_int_error,"Internal program error"
  157. ifdef s1_demo
  158. us_game_over db "Vielen Dank f�r das Spielen von 'Beneath A Steel Sky'.",10,13,"Demn„chst erh„ltlich von Virgin",10,13,"$"
  159. else ;s1_demo
  160. us_game_over db "Game over player one.",10,13,"BE VIGILANT",10,13,"$"
  161. endif ;s1_demo
  162. erm us_no_vga_card,"Game needs VGA/SVGA graphics card"
  163. erm us_no_dnr_file,"Could not find SKY.DNR"
  164. erm us_invalid_dos,"Game needs DOS 2.0 or later"
  165. erm us_disk_read_error,"Error reading data disk"
  166. erm us_dsk_f_err,"Could not find SKY.DSK"
  167. erm us_no_memory,"Insufficient memory or hard disk space to play the game"
  168. erm us_dnr_f_err,"Invalid sky.dnr"
  169. erm us_save_game_error,"Invalid save game version"
  170. erm us_no_mouse_error,"Mouse Driver not found"
  171. ;--------------------------------------------------------------------------------------------------
  172. ; Swedish errors
  173. erm sw_int_error,"Internal program error"
  174. ifdef s1_demo
  175. sw_game_over db "Vielen Dank f�r das Spielen von 'Beneath A Steel Sky'.",10,13,"Demn„chst erh„ltlich von Virgin",10,13,"$"
  176. else ;s1_demo
  177. sw_game_over db "SPELET ",142,"R SLUT, Agent 1.",10,13,"VAR VAKSAM",10,13,"$"
  178. endif ;s1_demo
  179. erm sw_no_vga_card,"Game needs VGA/SVGA graphics card"
  180. erm sw_no_dnr_file,"Could not find SKY.DNR"
  181. erm sw_invalid_dos,"Game needs DOS 2.0 or later"
  182. erm sw_disk_read_error,"Error reading data disk"
  183. erm sw_dsk_f_err,"Could not find SKY.DSK"
  184. erm sw_no_memory,"Insufficient memory or hard disk space to play the game"
  185. erm sw_dnr_f_err,"Invalid sky.dnr"
  186. erm sw_save_game_error,"Invalid save game version"
  187. erm sw_no_mouse_error,"Mouse Driver not found"
  188. ;--------------------------------------------------------------------------------------------------
  189. ; Italian errors
  190. erm it_int_error,"Internal program error"
  191. ifdef s1_demo
  192. it_game_over db "Vielen Dank f�r das Spielen von 'Beneath A Steel Sky'.",10,13,"Demn„chst erh„ltlich von Virgin",10,13,"$"
  193. else ;s1_demo
  194. it_game_over db "Game over giocatore 1.",10,13,"SIATE VIGILANTI",10,13,"$"
  195. endif ;s1_demo
  196. erm it_no_vga_card,"Game needs VGA/SVGA graphics card"
  197. erm it_no_dnr_file,"Could not find SKY.DNR"
  198. erm it_invalid_dos,"Game needs DOS 2.0 or later"
  199. erm it_disk_read_error,"Error reading data disk"
  200. erm it_dsk_f_err,"Could not find SKY.DSK"
  201. erm it_no_memory,"Insufficient memory or hard disk space to play the game"
  202. erm it_dnr_f_err,"Invalid sky.dnr"
  203. erm it_save_game_error,"Invalid save game version"
  204. erm it_no_mouse_error,"Mouse Driver not found"
  205. ;--------------------------------------------------------------------------------------------------
  206. ; Portuguese errors
  207. erm pt_int_error,"Erro interno do programa"
  208. ifdef s1_demo
  209. pt_game_over db "Obrigado por ter jogado 'Beneath A Steel Sky'.",10,13,"Distribu¡do por Virgin.",10,13,"$"
  210. else ;s1_demo
  211. pt_game_over db "Fim de jogo para o jogador um.",10,13,"BE VIGILANT",10,13,"$"
  212. endif ;s1_demo
  213. erm pt_no_vga_card,"O jogo necessita de uma placa gr fica VGA/SVGA"
  214. erm pt_no_dnr_file,"Ficheiro SKY.DNR ausente"
  215. erm pt_invalid_dos,"O Jogo necessita do DOS 2.0 ou superior"
  216. erm pt_disk_read_error,"Erro na leitura da disquete"
  217. erm pt_dsk_f_err,"Ficheiro SKY.DSK ausente"
  218. erm pt_no_memory,"Insuficiente mem¢ria ou espa‡o em disco"
  219. erm pt_dnr_f_err,"Ficheiro SKY.DRN inv lido"
  220. erm pt_save_game_error,"Vers„o inv lida do jogo gravado"
  221. erm pt_no_mouse_error,"Mouse Driver not found"
  222. ;--------------------------------------------------------------------------------------------------
  223. ; Spanish errors
  224. erm es_int_error,"Internal program error"
  225. ifdef s1_demo
  226. es_game_over db "Gracias por jugar 'Beneath A Steel Sky'.",10,13,"$"
  227. else ;s1_demo
  228. es_game_over db "Game over player one.",10,13,"BE VIGILANT",10,13,"$"
  229. endif ;s1_demo
  230. erm es_no_vga_card,"Game needs VGA/SVGA graphics card"
  231. erm es_no_dnr_file,"Could not find SKY.DNR"
  232. erm es_invalid_dos,"Game needs DOS 2.0 or later"
  233. erm es_disk_read_error,"Error reading data disk"
  234. erm es_dsk_f_err,"Could not find SKY.DSK"
  235. erm es_no_memory,"Insufficient memory or hard disk space to play the game"
  236. erm es_dnr_f_err,"Invalid sky.dnr"
  237. erm es_save_game_error,"Invalid save game version"
  238. erm es_no_mouse_error,"Mouse Driver not found"
  239. ;--------------------------------------------------------------------------------------------------
  240. align 4
  241. ifdef debug_42
  242. error_check dd 0
  243. endif
  244. end32data
  245. start32code
  246. extrn load_file:near
  247. extrn stabilise:near
  248. ifdef mem_check
  249. extrn check_mem:near
  250. endif
  251. error_routine proc
  252. ; Print an error on to the screen
  253. ; eax is error number
  254. ifdef debug_42
  255. pop ecx ;get return address into ebx
  256. push ecx ;and replace it
  257. printf "----error: routine address 0x%x ----",ecx
  258. test [error_check],-1 ;stop recursive errors
  259. jne stop_error
  260. mov [error_check],1
  261. endif
  262. ; Restore the pc status, print the error and quit
  263. call restore_pc_status
  264. mov ebx,[_language] ;offset into language
  265. imul ebx,ebx,no_of_error_messages
  266. add eax,ebx
  267. shl eax,2
  268. add eax,offset error_messages
  269. mov edx,[eax]
  270. ifdef debug_42 ;put error in file
  271. push edx
  272. endif
  273. mov ah,9
  274. dos_int
  275. ifdef debug_42
  276. pop esi
  277. mov edi,esi
  278. sch_lop: cmp bpt[esi],10
  279. je got_dllr
  280. inc esi
  281. jmp sch_lop
  282. got_dllr: mov bpt[esi],0
  283. printf "%s",edi
  284. endif
  285. ifdef mem_check
  286. call check_mem
  287. endif
  288. stop_error: mov ax,4c01h
  289. int 21h
  290. error_routine endp
  291. proc_start _pc_restore__Nv
  292. ; Quit to dos after intercept
  293. call restore_pc_status
  294. proc_end _pc_restore__Nv
  295. restore_pc_status proc private
  296. cld
  297. push eax
  298. bt [system_flags],sf_music_bin
  299. jnc no_music_set
  300. mov ah,6
  301. call music_command
  302. mov ah,3
  303. call music_command
  304. mov ax,100h
  305. call music_command
  306. mov ah,3
  307. call music_command
  308. no_music_set: ;Check if the timer interrupt has been redirected
  309. btr [system_flags],sf_timer
  310. jnc timer_not_set
  311. mov ebx,int8_vector[8] ;reset timer interrupt
  312. push ds
  313. lds edx,fword ptr int8_vector[0]
  314. mov cl,8
  315. mov ax,2507h
  316. int 21h
  317. pop ds
  318. ; Restore the timer to its correct speed
  319. ; What the #@$! is this!!!!
  320. mov cx,-1
  321. mov al,36h
  322. out 43h,al
  323. jmp short f1
  324. f1: jmp short f2
  325. f2: mov al,cl
  326. out 40h,al
  327. jmp short f3
  328. f3: jmp short f4
  329. f4: mov al,ch
  330. out 40h,al
  331. timer_not_set: ;Check if keyboard has been redirected
  332. btr [system_flags],sf_keyboard
  333. jnc keyboard_not_set
  334. mov ebx,int9_vector[8] ;reset timer interrupt
  335. push ds
  336. lds edx,fword ptr int9_vector[0]
  337. mov cl,9
  338. mov ax,2507h
  339. int 21h
  340. pop ds
  341. keyboard_not_set: ;Check if critical error has been redirected
  342. btr [system_flags],sf_crit_err
  343. jnc crit_err_not_set
  344. mov ebx,int24_vector[8] ;reset timer interrupt
  345. push ds
  346. lds edx,fword ptr int24_vector[0]
  347. mov cl,24h
  348. mov ax,2507h
  349. int 21h
  350. pop ds
  351. crit_err_not_set: ;check if the screen mode has been changed
  352. btr [system_flags],sf_graphics
  353. jnc no_graphics
  354. mov al,[original_screen_mode]
  355. xor ah,ah
  356. screen_int
  357. no_graphics: ;reset the mouse regardless
  358. mouse_int 0
  359. pop eax
  360. ret
  361. restore_pc_status endp
  362. end32code
  363. end
  364.