home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume16 / nethck31 / part99 < prev    next >
Encoding:
Internet Message Format  |  1993-02-05  |  58.6 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v16i107:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part99/108
  5. Message-ID: <4472@master.CNA.TEK.COM>
  6. Date: 5 Feb 93 22:03:23 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1831
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1658
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 107
  14. Archive-name: nethack31/Part99
  15. Supersedes: nethack3p9: Volume 10, Issue 46-108
  16. Environment: Amiga, Atari, Mac, MS-DOS, OS2, Unix, VMS, X11
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 99 (of 108)."
  27. # Contents:  Porting include/artilist.h include/monflag.h src/explode.c
  28. #   sys/atari/atarifnt.uue sys/atari/tos.c sys/msdos/Makefile.dat
  29. #   sys/os2/os2.c
  30. # Wrapped by billr@saab on Wed Jan 27 16:09:29 1993
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'Porting' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'Porting'\"
  34. else
  35. echo shar: Extracting \"'Porting'\" \(7341 characters\)
  36. sed "s/^X//" >'Porting' <<'END_OF_FILE'
  37. X  NetHack Porting Guidelines        v 3.1            93-01-08
  38. X
  39. X
  40. X     1.0    Introduction
  41. X
  42. X    This document goes through the steps required to port NetHack to a
  43. Xnew machine.  The basic steps in porting the program are:
  44. X
  45. X    1.  Get the code onto your machine.  The parts of the current
  46. X        directory setup you definitely need include src (NetHack code
  47. X        shared by all systems), include (include files), util (code
  48. X        for utility programs), and dat (various data files).  The
  49. X        documentation in doc is strongly recommended.  You already
  50. X        have the files in the top directory since you're reading this
  51. X        one. :-)
  52. X
  53. X        A full list of the distribution files and their associated
  54. X        OSes may be found in the top-level file "Files".
  55. X
  56. X        If your machine uses an OS already supported, you need the sys
  57. X        subdirectory for that OS and possibly sys/share.  Otherwise,
  58. X        get the closest match (say sys/msdos for single-tasking OSes
  59. X        and sys/unix for multi-user OSes, along with sys/share, if
  60. X        nothing else comes to mind).  You may want others for
  61. X        comparison.
  62. X
  63. X        If your machine uses a windowing system already supported,
  64. X        you need the win subdirectory for that system (or the
  65. X        appropriate sys subdirectory if the windowing system was
  66. X        previously considered restricted to one OS).
  67. X
  68. X    2.  Modify the appropriate include files to customize NetHack to
  69. X        your system.  You may need to add a new OS-specific "*conf.h"
  70. X        file (see unixconf.h, pcconf.h, tosconf.h, etc. as examples).
  71. X
  72. X    3.  If your machine uses a new OS instead of a variant of existing
  73. X        OSes, add a new sys subdirectory.  Add, if required, a OS-
  74. X        specific copy of "main.c", "tty.c" and "unix.c".  Possibly
  75. X        add an OS-specific library (see "msdos.c" and "tos.c" as
  76. X        examples) to provide functions NetHack wants and your OS lacks.
  77. X
  78. X    4.  If your machine uses a new windowing system, follow doc/window.doc
  79. X        carefully.  Put files implementing these routines in a win or
  80. X        sys subdirectory as appropriate.
  81. X
  82. X    5.  If your compilation environment isn't close to one already
  83. X        supported, try starting from the UNIX makefiles.  Modify the
  84. X        top level makefile and the src makefile as required.  Then run
  85. X        an initial compile.  You are bound to get some errors.  You
  86. X        should be able to fix them in a fairly simple fashion.  If
  87. X        things seem to be getting too complex, take a step back, and
  88. X        possibly send us some mail.  We might be able to help.
  89. X
  90. X    6.  Mail all of your fixes to us in a contextual form so that we can
  91. X        easily integrate them into the code.
  92. X
  93. X    One general rule of thumb exists.  Always add code.  Don't delete
  94. Xsomebody else's code for yours -- it won't work on their machine if you do.
  95. XAlways add your OS specific code inside #ifdef / #else / #endif constructs
  96. Xso that it will be able to be folded back into the original code easily.
  97. X
  98. X
  99. X     2.0    Include Files
  100. X
  101. X     2.1    config.h
  102. X
  103. X    The file "config.h" is a master configuration file that determines
  104. Xthe basic features of the game, as well as many of the security options.
  105. XIt is intended that end users configure the game by editing "config.h" and
  106. Xan appropriate "*conf.h" file, so any #defines for individual preferences
  107. Xshould be added to those files.  OS-specific #defines that are not intended
  108. Xto be changed should also go in "*conf.h"; try to find the most appropriate
  109. Xplace for other #defines.
  110. X
  111. X    The following sections may require modification:
  112. X
  113. X     -    Section 1:    OS and window system selection.
  114. X            You may have to put a #define for your OS here.
  115. X            If your OS is yet another UNIX variant, put the
  116. X            #define in unixconf.h instead.
  117. X            A unfortunately large amount of stuff shares
  118. X            this section because the #definitions have to
  119. X            be seen before *conf.h is reached.  Don't add
  120. X            to this unless necessary.
  121. X
  122. X     -    Section 2:    Global parameters and filenames.
  123. X            These will have to be customized to your system.
  124. X
  125. X     -    Section 3:    Type definitions and other compiler behavior.
  126. X            These will have to be matched to your compiler.
  127. X
  128. X     2.2    global.h
  129. X
  130. X    This file defines things specific to NetHack that should not
  131. Xrequire modification by an end user.  For a new port, you may have to add
  132. Xautomatic inclusion of another auxiliary config file (*conf.h) which you
  133. Xwrote for your system.
  134. X
  135. X     2.3    extern.h
  136. X
  137. X    If you create any new source modules or new functions in old modules,
  138. Xyou must enter the names of the new external references (the functions defined
  139. Xthere for external use) in this file.
  140. X
  141. X     2.4    system.h
  142. X
  143. X    This file contains references for all hooks into the OS (via the
  144. Xstandard "C" libraries).  Depending on what your standard library looks like,
  145. Xyou may have to put new entries into this file.
  146. X
  147. X
  148. X     3.0    Source files
  149. X
  150. X    The first step in getting the game up is to get the "makedefs"
  151. Xprogram running.  This program is used to create configuration-specific
  152. Xfiles for the game.
  153. X
  154. X    Once "makedefs" has been built, the rest of the game can be compiled.
  155. XYou may have to create an OS-specific module to handle things you want to
  156. Xuse, like a mouse or a ram-disk.
  157. X
  158. X    The utility compilers "dgn_comp" and "lev_comp" may be a better
  159. Xplace to start.  They also require "makedefs" but are independent of
  160. X"nethack".  They are usually the last programs made, but since they are
  161. Xmuch smaller they may be more tractable when first arguing with the include
  162. Xfiles.  These programs create binary data files that "nethack" uses to
  163. Xguide its dungeon creation.
  164. X
  165. X     3.1    Makefiles
  166. X
  167. X    This distribution provides makefiles for several kinds of systems.
  168. XThere are joint makefiles for the various varieties of UNIX, makefiles for
  169. XMSDOS, a makefile for Amigas, and so on.  You may have to create a new
  170. Xmakefile for your specific machine.  You may even have to translate some
  171. Xmakefiles into a form more congenial to your system.  If possible, however,
  172. Xadd to one of those provided.
  173. X
  174. X     3.2    termcap.c
  175. X
  176. X    If your system wants to use tty windowing and it doesn't run off
  177. Xof a termcap or terminfo database, you may have to put the appropriate
  178. Xterminal control strings into termcap.c.  This has already been done for
  179. XMSDOS, and these mods can be used as an example.  You can also consider
  180. Xusing the termcap code from sys/share/termcap.uu or sys/vms/gnutermcap.c,
  181. Xespecially if your system supports multiple kinds of terminals.
  182. X
  183. X     3.3    main.c
  184. X
  185. X    You may need to create a new "main.c" module.  If you do, call it
  186. X[OS]main.c where the [OS] is replaced with the name of the OS you are porting
  187. Xto.  This file contains the mainline module, which reads options from the
  188. Xcommand line (or wherever) and processes them.  It also contains various
  189. Xfunctions associated with game startup.
  190. X
  191. X     3.4    tty.c
  192. X
  193. X    You may need to create a new "tty.c" module.  If you do, call it
  194. X[OS]tty.c where the [OS] is replaced with the name of the OS you are porting
  195. Xto.  This file contains the routines that configure the terminal/console
  196. Xfor raw I/O, etc.
  197. X
  198. X     3.5    unix.c
  199. X
  200. X    You may need to create a new "unix.c" module.  If you do, call it
  201. X[OS]unix.c where the [OS] is replaced with the name of the OS you are porting
  202. Xto.  This file contains some OS dependencies concerning time and filename
  203. Xcreation.
  204. X
  205. X
  206. X    An object of the NetHack development project is to get the game
  207. Xworking on as many different types of hardware and under as many different
  208. Xoperating systems as is practical.  Any assistance will be appreciated.
  209. END_OF_FILE
  210. if test 7341 -ne `wc -c <'Porting'`; then
  211.     echo shar: \"'Porting'\" unpacked with wrong size!
  212. fi
  213. # end of 'Porting'
  214. fi
  215. if test -f 'include/artilist.h' -a "${1}" != "-c" ; then 
  216.   echo shar: Will not clobber existing file \"'include/artilist.h'\"
  217. else
  218. echo shar: Extracting \"'include/artilist.h'\" \(6932 characters\)
  219. sed "s/^X//" >'include/artilist.h' <<'END_OF_FILE'
  220. X/*    SCCS Id: @(#)artilist.h    3.1    92/12/13    */
  221. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  222. X/* NetHack may be freely redistributed.  See license for details. */
  223. X
  224. X#ifdef MAKEDEFS_C
  225. X/* in makedefs.c, all we care about is the list of names */
  226. X
  227. X#define A(nam,typ,s1,s2,mt,atk,dfn,cry,inv,al,cl) nam
  228. X
  229. Xstatic const char *artifact_names[] = {
  230. X#else
  231. X/* in artifact.c, set up the actual artifact list structure */
  232. X
  233. X#define A(nam,typ,s1,s2,mt,atk,dfn,cry,inv,al,cl) \
  234. X { typ, nam, s1, s2, mt, atk, dfn, cry, inv, al, cl }
  235. X
  236. X#define     NO_ATTK    {0,0,0,0}        /* no attack */
  237. X#define     NO_DFNS    {0,0,0,0}        /* no defense */
  238. X#define     NO_CARY    {0,0,0,0}        /* no carry effects */
  239. X#define     DFNS(c)    {0,c,0,0}
  240. X#define     CARY(c)    {0,c,0,0}
  241. X#define     PHYS(a,b)    {0,AD_PHYS,a,b}        /* physical */
  242. X#define     DRLI(a,b)    {0,AD_DRLI,a,b}        /* life drain */
  243. X#define     COLD(a,b)    {0,AD_COLD,a,b}
  244. X#define     FIRE(a,b)    {0,AD_FIRE,a,b}
  245. X#define     ELEC(a,b)    {0,AD_ELEC,a,b}        /* electrical shock */
  246. X#define     STUN(a,b)    {0,AD_STUN,a,b}        /* magical attack */
  247. X
  248. XSTATIC_OVL const struct artifact NEARDATA artilist[] = {
  249. X#endif    /* MAKEDEFS_C */
  250. X
  251. X/*  dummy element #0, so that all interesting indices are non-zero */
  252. XA("",                STRANGE_OBJECT,
  253. X    0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, 0 ),
  254. X
  255. XA("Excalibur",            LONG_SWORD,
  256. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_SEEK|SPFX_DEFN|SPFX_INTEL|SPFX_SEARCH),0,0,
  257. X    PHYS(5,10),    DRLI(0,0),    NO_CARY,    0, A_LAWFUL,    'K' ),
  258. X/*
  259. X *    Stormbringer only has a 2 because it can drain a level,
  260. X *    providing 8 more.
  261. X */
  262. XA("Stormbringer",        RUNESWORD,
  263. X    (SPFX_RESTR|SPFX_ATTK|SPFX_DEFN|SPFX_INTEL|SPFX_DRLI), 0, 0,
  264. X    DRLI(5,2),    DRLI(0,0),    NO_CARY,    0, A_CHAOTIC,     0  ),
  265. X/*
  266. X *    Mjollnir will return to the hand of the wielder when thrown
  267. X *    if the wielder is wearing Gauntlets of Power.
  268. X */
  269. XA("Mjollnir",            WAR_HAMMER,        /* Mjo:llnir */
  270. X    (SPFX_RESTR|SPFX_ATTK),  0, 0,
  271. X    ELEC(5,24),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL,    'V' ),
  272. X
  273. XA("Cleaver",            BATTLE_AXE,
  274. X    SPFX_RESTR, 0, 0,
  275. X    PHYS(3,6),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL,    'B' ),
  276. X
  277. XA("Grimtooth",            ORCISH_DAGGER,
  278. X    SPFX_RESTR, 0, 0,
  279. X    PHYS(2,6),    NO_DFNS,    NO_CARY,    0, A_CHAOTIC,     0  ),
  280. X
  281. XA("Orcrist",            ELVEN_BROADSWORD,
  282. X    SPFX_DFLAG2, 0, M2_ORC,
  283. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,    'E' ),
  284. X
  285. XA("Sting",            ELVEN_DAGGER,
  286. X    (SPFX_WARN|SPFX_DFLAG2), 0, M2_ORC,
  287. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  288. X/*
  289. X *    Magicbane is a bit different!  Its magic fanfare
  290. X *    unbalances victims in addition to doing some damage.
  291. X */
  292. XA("Magicbane",            ATHAME,
  293. X    (SPFX_RESTR|SPFX_ATTK|SPFX_DEFN), 0, 0,
  294. X    STUN(3,4),    DFNS(AD_MAGM),    NO_CARY,    0, A_NEUTRAL,    'W' ),
  295. X
  296. XA("Frost Brand",        LONG_SWORD,
  297. X    (SPFX_RESTR|SPFX_ATTK|SPFX_DEFN), 0, 0,
  298. X    COLD(5,0),    COLD(0,0),    NO_CARY,    0, A_NEUTRAL,     0  ),
  299. X
  300. XA("Fire Brand",            LONG_SWORD,
  301. X    (SPFX_RESTR|SPFX_ATTK|SPFX_DEFN), 0, 0,
  302. X    FIRE(5,0),    FIRE(0,0),    NO_CARY,    0, A_NEUTRAL,     0  ),
  303. X
  304. XA("Dragonbane",            BROADSWORD,
  305. X    (SPFX_RESTR|SPFX_DCLAS), 0, S_DRAGON,
  306. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL,     0  ),
  307. X
  308. XA("Demonbane",            LONG_SWORD,
  309. X    (SPFX_RESTR|SPFX_DFLAG2), 0, M2_DEMON,
  310. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  311. X
  312. XA("Werebane",            SILVER_SABER,
  313. X    (SPFX_RESTR|SPFX_DFLAG2), 0, M2_WERE,
  314. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  315. X
  316. XA("Grayswandir",        SILVER_SABER,
  317. X    (SPFX_RESTR|SPFX_HALRES), 0, 0,
  318. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  319. X
  320. XA("Giantslayer",        LONG_SWORD,
  321. X    (SPFX_RESTR|SPFX_DFLAG2), 0, M2_GIANT,
  322. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL,     0  ),
  323. X
  324. XA("Ogresmasher",        WAR_HAMMER,
  325. X    (SPFX_RESTR|SPFX_DCLAS), 0, S_OGRE,
  326. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  327. X
  328. XA("Trollsbane",            MORNING_STAR,
  329. X    (SPFX_RESTR|SPFX_DCLAS), 0, S_TROLL,
  330. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  331. X/*
  332. X *    Two problems:  1) doesn't let trolls regenerate heads,
  333. X *    2) doesn't give unusual message for 2-headed monsters (but
  334. X *    allowing those at all causes more problems than worth the effort).
  335. X */
  336. XA("Vorpal Blade",        LONG_SWORD,
  337. X    (SPFX_RESTR|SPFX_BEHEAD), 0, 0,
  338. X    PHYS(5,1),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL,     0  ),
  339. X/*
  340. X *    Ah, never shall I forget the cry,
  341. X *        or the shriek that shrieked he,
  342. X *    As I gnashed my teeth, and from my sheath
  343. X *        I drew my Snickersnee!
  344. X *            --Koko, Lord high executioner of Titipu
  345. X *              (From Sir W.S. Gilbert's "The Mikado")
  346. X */
  347. XA("Snickersnee",        KATANA,
  348. X    SPFX_RESTR, 0, 0,
  349. X    PHYS(0,8),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,    'S' ),
  350. X
  351. XA("Sunsword",            LONG_SWORD,
  352. X    (SPFX_RESTR|SPFX_DFLAG2), 0, M2_UNDEAD,
  353. X    PHYS(5,0),    NO_DFNS,    NO_CARY,    0, A_LAWFUL,     0  ),
  354. X
  355. X#ifdef MULDGN
  356. X/*
  357. X *    The artifacts for the quest dungeon, all self-willed.
  358. X */
  359. X
  360. XA("The Orb of Detection",    CRYSTAL_BALL,
  361. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL), (SPFX_ESP|SPFX_HSPDAM), 0,
  362. X    NO_ATTK,    NO_DFNS,    CARY(AD_MAGM),
  363. X    INVIS,        A_LAWFUL,    'A' ),
  364. X
  365. XA("The Heart of Ahriman", LUCKSTONE,
  366. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL), SPFX_STLTH, 0,
  367. X    NO_ATTK,    NO_DFNS,    NO_CARY,
  368. X    LEVITATION,    A_NEUTRAL,    'B' ),
  369. X
  370. XA("The Sceptre of Might",    QUARTERSTAFF,
  371. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_DALIGN), 0, 0,
  372. X    PHYS(0,0),    NO_DFNS,    CARY(AD_MAGM),
  373. X    CONFLICT,    A_LAWFUL,    'C' ),
  374. X
  375. XA("The Palantir of Westernesse",    CRYSTAL_BALL,
  376. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL),
  377. X        (SPFX_ESP|SPFX_REGEN|SPFX_HSPDAM), 0,
  378. X    NO_ATTK,    NO_DFNS,    NO_CARY,
  379. X    TAMING,        A_CHAOTIC,    'E' ),
  380. X
  381. XA("The Staff of Aesculapius",    QUARTERSTAFF,
  382. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_ATTK|SPFX_INTEL|SPFX_DRLI|SPFX_REGEN), 0,0,
  383. X    DRLI(0,0),    NO_DFNS,    NO_CARY,
  384. X    HEALING,    A_NEUTRAL,    'H' ),
  385. X
  386. XA("The Magic Mirror of Merlin",    MIRROR,
  387. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_SPEEK), SPFX_ESP, 0,
  388. X    NO_ATTK,    NO_DFNS,    CARY(AD_MAGM),
  389. X    0,        A_LAWFUL,    'K' ),
  390. X
  391. XA("The Mitre of Holiness",    HELM_OF_BRILLIANCE,
  392. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_DCLAS|SPFX_INTEL), 0, M2_UNDEAD,
  393. X    NO_ATTK,    NO_DFNS,    CARY(AD_FIRE),
  394. X    ENERGY_BOOST,    A_LAWFUL,    'P' ),
  395. X
  396. XA("The Master Key of Thievery", SKELETON_KEY,
  397. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_SPEEK),
  398. X        (SPFX_WARN|SPFX_TCTRL|SPFX_HPHDAM), 0,
  399. X    NO_ATTK,    NO_DFNS,    NO_CARY,
  400. X    UNTRAP,        A_CHAOTIC,    'R' ),
  401. X
  402. XA("The Tsurugi of Muramasa",    TSURUGI,
  403. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_BEHEAD|SPFX_LUCK), 0, 0,
  404. X    NO_ATTK,    NO_DFNS,    NO_CARY,
  405. X    0,        A_LAWFUL,    'S' ),
  406. X
  407. X# ifdef TOURIST
  408. XA("The Platinum Yendorian Express Card", CREDIT_CARD,
  409. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_DEFN),
  410. X        (SPFX_ESP|SPFX_HSPDAM), 0,
  411. X    NO_ATTK,    NO_DFNS,    CARY(AD_MAGM),
  412. X    CHARGE_OBJ,    A_NEUTRAL,    'T' ),
  413. X# endif
  414. X
  415. XA("The Orb of Fate",        CRYSTAL_BALL,
  416. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_LUCK),
  417. X        (SPFX_WARN|SPFX_HSPDAM|SPFX_HPHDAM), 0,
  418. X    NO_ATTK,    NO_DFNS,    NO_CARY,
  419. X    LEV_TELE,    A_NEUTRAL,    'V' ),
  420. X
  421. XA("The Eye of the Aethiopica",    AMULET_OF_ESP,
  422. X    (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL), (SPFX_EREGEN|SPFX_HSPDAM), 0,
  423. X    NO_ATTK,    NO_DFNS,    CARY(AD_MAGM),
  424. X    CREATE_PORTAL,    A_NEUTRAL,    'W' ),
  425. X#endif    /* MULDGN */
  426. X/*
  427. X *  terminator; otyp must be zero
  428. X */
  429. XA(0, 0, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, 0 )
  430. X
  431. X};    /* artilist[] (or artifact_names[]) */
  432. X
  433. X#undef    A
  434. X
  435. X#ifndef MAKEDEFS_C
  436. X#undef    NO_ATTK
  437. X#undef    NO_DFNS
  438. X#undef    DFNS
  439. X#undef    PHYS
  440. X#undef    DRLI
  441. X#undef    COLD
  442. X#undef    FIRE
  443. X#undef    ELEC
  444. X#undef    STUN
  445. X#endif
  446. X
  447. X/*artilist.h*/
  448. END_OF_FILE
  449. if test 6932 -ne `wc -c <'include/artilist.h'`; then
  450.     echo shar: \"'include/artilist.h'\" unpacked with wrong size!
  451. fi
  452. # end of 'include/artilist.h'
  453. fi
  454. if test -f 'include/monflag.h' -a "${1}" != "-c" ; then 
  455.   echo shar: Will not clobber existing file \"'include/monflag.h'\"
  456. else
  457. echo shar: Extracting \"'include/monflag.h'\" \(7000 characters\)
  458. sed "s/^X//" >'include/monflag.h' <<'END_OF_FILE'
  459. X/*    SCCS Id: @(#)monflag.h    3.1    92/11/25    */
  460. X/* Copyright (c) 1989 Mike Threepoint                  */
  461. X/* NetHack may be freely redistributed.  See license for details. */
  462. X
  463. X#ifndef MONFLAG_H
  464. X#define MONFLAG_H
  465. X
  466. X#define MS_SILENT    0    /* makes no sound */
  467. X#define MS_SQEEK    1    /* squeaks, as a rodent */
  468. X#define MS_SQAWK    2    /* squawks, as a bird */
  469. X#define MS_HISS        3    /* hisses */
  470. X#define MS_BUZZ        4    /* buzzes (killer bee) */
  471. X#define MS_GRUNT    5    /* grunts (or speaks own language) */
  472. X#define MS_GROWL    6    /* growls */
  473. X#define MS_BARK        7    /* if full moon, may howl */
  474. X#define MS_MEW        8    /* mews or hisses */
  475. X#define MS_ROAR        9    /* roars */
  476. X#define MS_NEIGH    10    /* neighs, as an equine */
  477. X#define MS_WAIL        11    /* wails, as a tortured soul */
  478. X#define MS_GURGLE    12    /* gurgles, as liquid or through saliva */
  479. X#define MS_BURBLE    13    /* burbles (jabberwock) */
  480. X#define MS_SHRIEK    15    /* wakes up others */
  481. X#define MS_LAUGH    17    /* grins, smiles, giggles, and laughs */
  482. X#define MS_MUMBLE    18    /* says something or other */
  483. X#define MS_IMITATE    19    /* imitates others (leocrotta) */
  484. X#define MS_SEDUCE    20    /* "Hello, sailor." (Nymphs) */
  485. X#define MS_VAMPIRE    21    /* vampiric seduction, Vlad's exclamations */
  486. X#define MS_ORC        MS_GRUNT    /* intelligent brutes */
  487. X#define MS_BRIBE    25    /* asks for money, or berates you */
  488. X#define MS_CUSS        26    /* berates (demons) or intimidates (Wiz) */
  489. X#define MS_NURSE    27    /* "Take off your shirt, please." */
  490. X#define MS_DJINNI    28    /* "Thank you for freeing me!" */
  491. X#define MS_HUMANOID    29    /* generic traveling companion */
  492. X#define MS_GUARD    30    /* "Please drop that gold and follow me." */
  493. X#define MS_SELL        31    /* demand payment, complain about shoplifters */
  494. X#define MS_ORACLE    32    /* do a consultation */
  495. X#define MS_PRIEST    33    /* ask for contribution; do cleansing */
  496. X#ifdef KOPS
  497. X#define MS_ARREST    34    /* "Stop in the name of the law!" (Kops) */
  498. X#endif
  499. X#define MS_SOLDIER    35    /* army and watchmen expressions */
  500. X#ifdef MULDGN
  501. X#define MS_LEADER    36    /* your class leader */
  502. X#define MS_NEMESIS    37    /* your nemesis */
  503. X#define MS_GUARDIAN    38    /* your leader's guards */
  504. X#endif
  505. X#define MS_BONES    39    /* rattles bones (skeleton) */
  506. X#define MS_DEATH    40    /* \                */
  507. X#define MS_PESTILENCE    41    /*  |- astral level special monsters */
  508. X#define MS_FAMINE    42    /* /                */
  509. X
  510. X
  511. X#define MR_FIRE         0x01    /* resists fire */
  512. X#define MR_COLD         0x02    /* resists cold */
  513. X#define MR_SLEEP        0x04    /* resists sleep */
  514. X#define MR_DISINT       0x08    /* resists disintegration */
  515. X#define MR_ELEC         0x10    /* resists electricity */
  516. X#define MR_POISON       0x20    /* resists poison */
  517. X#define MR_ACID         0x40    /* resists acid */
  518. X#define MR_STONE        0x80    /* resists petrification */
  519. X/* other resistances: magic, sickness */
  520. X/* other conveyances: teleport, teleport control, telepathy */
  521. X
  522. X
  523. X#define M1_FLY        0x00000001L    /* can fly or float */
  524. X#define M1_SWIM        0x00000002L    /* can traverse water */
  525. X#define M1_AMORPHOUS    0x00000004L    /* can flow under doors */
  526. X#define M1_WALLWALK    0x00000008L    /* can phase thru rock */
  527. X#define M1_CLING    0x00000010L    /* can cling to ceiling */
  528. X#define M1_TUNNEL    0x00000020L    /* can tunnel thru rock */
  529. X#define M1_NEEDPICK    0x00000040L    /* needs pick to tunnel */
  530. X#define M1_CONCEAL    0x00000080L    /* hides under objects */
  531. X#define M1_HIDE        0x00000100L    /* mimics, blends in with ceiling */
  532. X#define M1_AMPHIBIOUS    0x00000200L    /* can survive underwater */
  533. X#define M1_BREATHLESS    0x00000200L    /* doesn't need to breathe */
  534. X#define M1_NOEYES    0x00001000L    /* no eyes to gaze into or blind */
  535. X#define M1_NOHANDS    0x00002000L    /* no hands to handle things */
  536. X#define M1_NOLIMBS    0x00006000L    /* no arms/legs to kick/wear on */
  537. X#define M1_NOHEAD    0x00008000L    /* no head to behead */
  538. X#define M1_MINDLESS    0x00010000L    /* has no mind--golem, zombie, mold */
  539. X#define M1_HUMANOID    0x00020000L    /* has humanoid head/arms/torso */
  540. X#define M1_ANIMAL    0x00040000L    /* has animal body */
  541. X#define M1_SLITHY    0x00080000L    /* has serpent body */
  542. X#define M1_UNSOLID    0x00100000L    /* has no solid or liquid body */
  543. X#define M1_THICK_HIDE    0x00200000L    /* has thick hide or scales */
  544. X#define M1_OVIPAROUS    0x00400000L    /* can lay eggs */
  545. X#define M1_REGEN    0x00800000L    /* regenerates hit points */
  546. X#define M1_SEE_INVIS    0x01000000L    /* can see invisible creatures */
  547. X#define M1_TPORT    0x02000000L    /* can teleport */
  548. X#define M1_TPORT_CNTRL    0x04000000L    /* controls where it teleports to */
  549. X#define M1_ACID        0x08000000L    /* acidic to eat */
  550. X#define M1_POIS        0x10000000L    /* poisonous to eat */
  551. X#define M1_CARNIVORE    0x20000000L    /* eats corpses */
  552. X#define M1_HERBIVORE    0x40000000L    /* eats fruits */
  553. X#define M1_OMNIVORE    0x60000000L    /* eats both */
  554. X#define M1_METALLIVORE    0x80000000L    /* eats metal */
  555. X
  556. X#define M2_NOPOLY    0x00000001L    /* players mayn't poly into one */
  557. X#define M2_UNDEAD    0x00000002L    /* is walking dead */
  558. X#define M2_WERE        0x00000004L    /* is a lycanthrope */
  559. X#define M2_ELF        0x00000008L    /* is an elf */
  560. X#define M2_DWARF    0x00000010L    /* is a dwarf */
  561. X#define M2_GIANT    0x00000020L    /* is a giant */
  562. X#define M2_ORC        0x00000040L    /* is an orc */
  563. X#define M2_HUMAN    0x00000080L    /* is a human */
  564. X#define M2_DEMON    0x00000100L    /* is a demon */
  565. X#define M2_MERC        0x00000200L    /* is a guard or soldier */
  566. X#define M2_LORD        0x00000400L    /* is a lord to its kind */
  567. X#define M2_PRINCE    0x00000800L    /* is an overlord to its kind */
  568. X#define M2_MINION    0x00001000L    /* is a minion of a deity */
  569. X#define M2_MALE        0x00010000L    /* always male */
  570. X#define M2_FEMALE    0x00020000L    /* always female */
  571. X#define M2_NEUTER    0x00040000L    /* neither male nor female */
  572. X#define M2_PNAME    0x00080000L    /* monster name is a proper name */
  573. X#define M2_HOSTILE    0x00100000L    /* always starts hostile */
  574. X#define M2_PEACEFUL    0x00200000L    /* always starts peaceful */
  575. X#define M2_DOMESTIC    0x00400000L    /* can be tamed by feeding */
  576. X#define M2_WANDER    0x00800000L    /* wanders randomly */
  577. X#define M2_STALK    0x01000000L    /* follows you to other levels */
  578. X#define M2_NASTY    0x02000000L    /* extra-nasty monster (more xp) */
  579. X#define M2_STRONG    0x04000000L    /* strong (or big) monster */
  580. X#define M2_ROCKTHROW    0x08000000L    /* throws boulders */
  581. X#define M2_GREEDY    0x10000000L    /* likes gold */
  582. X#define M2_JEWELS    0x20000000L    /* likes gems */
  583. X#define M2_COLLECT    0x40000000L    /* picks up weapons and food */
  584. X#define M2_MAGIC    0x80000000L    /* picks up magic items */
  585. X
  586. X#define M3_WANTSAMUL    0x01        /* would like to steal the amulet */
  587. X#define M3_WANTSBELL    0x02        /* wants the bell */
  588. X#define M3_WANTSBOOK    0x04        /* wants the book */
  589. X#define M3_WANTSCAND    0x08        /* wants the candelabrum */
  590. X#ifdef MULDGN
  591. X#define M3_WANTSARTI    0x10        /* wants the quest artifact */
  592. X#endif
  593. X#define M3_WAITFORU    0x40        /* waits to see you or get attacked */
  594. X#define M3_CLOSE    0x80        /* lets you close unless attacked */
  595. X
  596. X#define M3_COVETOUS    0x1f        /* wants something */
  597. X#define M3_WAITMASK    0xc0        /* waiting... */
  598. X
  599. X#define MZ_TINY        0        /* < 2' */
  600. X#define MZ_SMALL    1        /* 2-4' */
  601. X#define MZ_MEDIUM    2        /* 4-7' */
  602. X#define MZ_HUMAN    MZ_MEDIUM    /* human-sized */
  603. X#define MZ_LARGE    3        /* 7-12' */
  604. X#define MZ_HUGE        4        /* 12-25' */
  605. X#define MZ_GIGANTIC    7        /* off the scale */
  606. X
  607. X#endif /* MONFLAG_H */
  608. END_OF_FILE
  609. if test 7000 -ne `wc -c <'include/monflag.h'`; then
  610.     echo shar: \"'include/monflag.h'\" unpacked with wrong size!
  611. fi
  612. # end of 'include/monflag.h'
  613. fi
  614. if test -f 'src/explode.c' -a "${1}" != "-c" ; then 
  615.   echo shar: Will not clobber existing file \"'src/explode.c'\"
  616. else
  617. echo shar: Extracting \"'src/explode.c'\" \(6827 characters\)
  618. sed "s/^X//" >'src/explode.c' <<'END_OF_FILE'
  619. X/*    SCCS Id: @(#)explode.c 3.1    90/11/06
  620. X/*    Copyright (C) 1990 by Ken Arromdee */
  621. X/* NetHack may be freely redistributed.  See license for details. */
  622. X
  623. X#include "hack.h"
  624. X
  625. X/* Note: Arrays are column first, while the screen is row first */
  626. Xstatic int expl[3][3] = 
  627. X{ S_explode1, S_explode4, S_explode7,
  628. X  S_explode2, S_explode5, S_explode8,
  629. X  S_explode3, S_explode6, S_explode9 };
  630. X
  631. X/* Note: I had to choose one of three possible kinds of "type" when writing
  632. X * this function: a wand type (like in zap.c), an adtyp, or an object type.
  633. X * Wand types get complex because they must be converted to adtyps for
  634. X * determining such things as fire resistance.  Adtyps get complex in that
  635. X * they don't supply enough information--was it a player or a monster that
  636. X * did it, and with a wand, spell, or breath weapon?  Object types share both
  637. X * these disadvantages....
  638. X */
  639. Xvoid
  640. Xexplode(x, y, type, dam, olet)
  641. Xint x, y;
  642. Xint type; /* the same as in zap.c */
  643. Xint dam;
  644. Xchar olet;
  645. X{
  646. X    int i, j, k;
  647. X    boolean starting = 1;
  648. X    boolean visible, any_shield;
  649. X    int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */
  650. X    const char *str;
  651. X    int idamres, idamnonres;
  652. X    struct monst *mtmp;
  653. X    uchar adtyp;
  654. X    int explmask[3][3];
  655. X        /* 0=normal explosion, 1=do shieldeff, 2=do nothing */
  656. X    boolean shopdamage = FALSE;
  657. X
  658. X    switch(abs(type) % 10) {
  659. X        default: impossible("explosion base type %d?", type); return;
  660. X
  661. X        case 1: str = (olet == SCROLL_CLASS ? "tower of flame" : "fireball"); adtyp = AD_FIRE; break;
  662. X        /* case 3: str = "ball of cold"; adtyp = AD_COLD; break; */
  663. X        /* case 5: str = "ball lightning"; adtyp = AD_ELEC; break; */
  664. X        /* case 7: str = "acid ball"; adtyp = AD_ACID; break; */
  665. X    }
  666. X
  667. X    any_shield = visible = FALSE;
  668. X    for(i=0; i<3; i++) for(j=0; j<3; j++) {
  669. X        if (!isok(i+x-1, j+y-1)) {
  670. X            explmask[i][j] = 2;
  671. X            continue;
  672. X        }
  673. X        if (i+x-1 == u.ux && j+y-1 == u.uy) {
  674. X            switch(adtyp) {
  675. X            case AD_FIRE:
  676. X                explmask[i][j] = Fire_resistance ? 1 : 0;
  677. X                break;
  678. X            /* case AD_COLD: */
  679. X            /* case AD_ELEC: */
  680. X            /* case AD_DISN: */
  681. X            /* case AD_ACID: */
  682. X            default:
  683. X                impossible("explosion type %d?", adtyp);
  684. X                explmask[i][j] = 0;
  685. X                break;
  686. X            }
  687. X        }
  688. X        /* can be both you and mtmp if you're swallowed */
  689. X        if (mtmp = m_at(i+x-1, j+y-1)) {
  690. X            switch(adtyp) {
  691. X            case AD_FIRE:
  692. X                explmask[i][j] = resists_fire(mtmp->data)
  693. X                    ? 1 : 0;
  694. X                break;
  695. X            /* case AD_COLD: */
  696. X            /* case AD_ELEC: */
  697. X            /* case AD_DISN: */
  698. X            /* case AD_ACID: */
  699. X            default:
  700. X                impossible("explosion type %d?", adtyp);
  701. X                explmask[i][j] = 0;
  702. X                break;
  703. X            }
  704. X        } else if (i+x-1 != u.ux || j+j-1 != u.uy)
  705. X            explmask[i][j] = 0;
  706. X
  707. X        if (cansee(i+x-1, j+y-1)) visible = TRUE;
  708. X        if (explmask[i][j] == 1) any_shield = TRUE;
  709. X    }
  710. X
  711. X    if (visible) {
  712. X        /* Start the explosion */
  713. X        for(i=0; i<3; i++) for(j=0; j<3; j++) {
  714. X            if (explmask[i][j] == 2) continue;
  715. X            tmp_at(starting ? DISP_BEAM : DISP_CHANGE,
  716. X                        cmap_to_glyph(expl[i][j]));
  717. X            tmp_at(i+x-1, j+y-1);
  718. X            starting = 0;
  719. X        }
  720. X        curs_on_u();    /* will flush screen and output */
  721. X
  722. X        if (any_shield) {    /* simulate a shield effect */
  723. X            for (k = 0; k < SHIELD_COUNT; k++) {
  724. X            for(i=0; i<3; i++) for(j=0; j<3; j++) {
  725. X                if (explmask[i][j] == 1)
  726. X                /*
  727. X                 * Bypass tmp_at() and send the shield glyphs
  728. X                 * directly to the buffered screen.  tmp_at()
  729. X                 * will clean up the location for us later.
  730. X                 */
  731. X                show_glyph(i+x-1, j+y-1,
  732. X                    cmap_to_glyph(shield_static[k]));
  733. X            }
  734. X            curs_on_u();    /* will flush screen and output */
  735. X            delay_output();
  736. X            }
  737. X
  738. X            /* Cover last shield glyph with blast symbol. */
  739. X            for(i=0; i<3; i++) for(j=0; j<3; j++) {
  740. X            if (explmask[i][j] == 1)
  741. X                show_glyph(i+x-1,j+y-1,cmap_to_glyph(expl[i][j]));
  742. X            }
  743. X
  744. X        } else {        /* delay a little bit. */
  745. X            delay_output();
  746. X            delay_output();
  747. X        }
  748. X
  749. X    } else You("hear a blast.");
  750. X
  751. X
  752. X    for(i=0; i<3; i++) for(j=0; j<3; j++) {
  753. X        if (explmask[i][j] == 2) continue;
  754. X        if (i+x-1 == u.ux && j+y-1 == u.uy)
  755. X            uhurt = (explmask[i][j] == 1) ? 1 : 2;
  756. X        idamres = idamnonres = 0;
  757. X        (void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1),
  758. X                     type, &shopdamage);
  759. X
  760. X        mtmp = m_at(i+x-1, j+y-1);
  761. X        if (!mtmp) continue;
  762. X        if (u.uswallow && mtmp == u.ustuck) {
  763. X            if (is_animal(u.ustuck->data))
  764. X                pline("%s gets heartburn!",
  765. X                      Monnam(u.ustuck));
  766. X            else
  767. X                pline("%s gets toasted slightly!",
  768. X                      Monnam(u.ustuck));
  769. X        } else
  770. X        pline("%s is caught in the %s!",
  771. X            cansee(i+x-1, j+y-1) ? Monnam(mtmp) : "It", str);
  772. X
  773. X        idamres += destroy_mitem(mtmp, SCROLL_CLASS, (int) adtyp);
  774. X        idamres += destroy_mitem(mtmp, SPBOOK_CLASS, (int) adtyp);
  775. X        /* Fire resistance protects monsters from burning scrolls, */
  776. X        /* but not from exploding potions. */
  777. X        idamnonres += destroy_mitem(mtmp, POTION_CLASS, (int) adtyp);
  778. X/*
  779. X        idamnonres += destroy_mitem(mtmp, WAND_CLASS, (int) adtyp);
  780. X        idamnonres += destroy_mitem(mtmp, RING_CLASS, (int) adtyp);
  781. X*/
  782. X        if (explmask[i][j] == 1) {
  783. X            golemeffects(mtmp, (int) adtyp, dam + idamres);
  784. X            mtmp->mhp -= idamnonres;
  785. X        } else {
  786. X        /* call resist with 0 and do damage manually so 1) we can
  787. X         * get out the message before doing the damage, and 2) we can
  788. X         * call mondied, not killed, if it's not your blast
  789. X         */
  790. X            int mdam = dam;
  791. X
  792. X            if (resist(mtmp, olet, 0, FALSE)) {
  793. X                pline("%s resists the magical blast!",
  794. X                    cansee(i+x-1,j+y-1) ? Monnam(mtmp)
  795. X                    : "It");
  796. X                mdam = dam/2;
  797. X            }
  798. X            if (mtmp == u.ustuck)
  799. X                mdam *= 2;
  800. X            if (resists_cold(mtmp->data) /* && adtyp == AD_FIRE */)
  801. X                mdam *= 2;
  802. X            mtmp->mhp -= mdam;
  803. X            mtmp->mhp -= (idamres + idamnonres);
  804. X        }
  805. X        if (mtmp->mhp <= 0) {
  806. X            if (type >= 0) killed(mtmp);
  807. X            else mondied(mtmp);
  808. X        }
  809. X    }
  810. X
  811. X    if (visible) tmp_at(DISP_END, 0); /* clear the explosion */
  812. X
  813. X    /* Do your injury last */
  814. X    if (uhurt) {
  815. X            if (type >= 0 && flags.verbose && olet != SCROLL_CLASS)
  816. X            You("are caught in the %s!", str);
  817. X        if (uhurt == 2) u.uhp -= dam;
  818. X        if (u.uhp <= 0) {
  819. X            char buf[BUFSZ];
  820. X
  821. X            if (type >= 0 && olet != SCROLL_CLASS) {
  822. X                killer_format = NO_KILLER_PREFIX;
  823. X                Sprintf(buf, "caught %sself in %s own %s.",
  824. X                flags.female ? "her" : "him",
  825. X                flags.female ? "her" : "his", str);
  826. X            } else {
  827. X                killer_format = KILLED_BY;
  828. X                Strcpy(buf, str);
  829. X            }
  830. X            killer = buf;
  831. X            /* done(adtyp == AD_FIRE ? BURNING : DIED); */
  832. X            done(BURNING);
  833. X        }
  834. X        exercise(A_STR, FALSE);
  835. X#if defined(POLYSELF)
  836. X        ugolemeffects((int) adtyp, dam);
  837. X#endif
  838. X        destroy_item(SCROLL_CLASS, (int) adtyp);
  839. X        destroy_item(SPBOOK_CLASS, (int) adtyp);
  840. X        destroy_item(POTION_CLASS, (int) adtyp);
  841. X/*
  842. X        destroy_item(RING_CLASS, (int) adtyp);
  843. X        destroy_item(WAND_CLASS, (int) adtyp);
  844. X*/
  845. X    }
  846. X    if (shopdamage) {
  847. X        pay_for_damage("burn away");
  848. X/* (only if we ever add non-fire balls)
  849. X        pay_for_damage(adtyp == AD_FIRE ? "burn away" :
  850. X                   adtyp == AD_COLD ? "shatter" :
  851. X                   adtyp == AD_DISN ? "disintegrate" : "destroy");
  852. X*/
  853. X    }
  854. X}
  855. X
  856. X/*explode.c*/
  857. END_OF_FILE
  858. if test 6827 -ne `wc -c <'src/explode.c'`; then
  859.     echo shar: \"'src/explode.c'\" unpacked with wrong size!
  860. fi
  861. # end of 'src/explode.c'
  862. fi
  863. if test -f 'sys/atari/atarifnt.uue' -a "${1}" != "-c" ; then 
  864.   echo shar: Will not clobber existing file \"'sys/atari/atarifnt.uue'\"
  865. else
  866. echo shar: Extracting \"'sys/atari/atarifnt.uue'\" \(7164 characters\)
  867. sed "s/^X//" >'sys/atari/atarifnt.uue' <<'END_OF_FILE'
  868. Xtable
  869. X !"#$%&'()*+,-./0123456789:;<=>?
  870. X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
  871. Xbegin 644 hackfnt.arc
  872. XM&@A(04-+1DY4+E!21P  E!,  #\48JO>BQ\=   ,8#0  #" S4 ,! ! &@!Bz
  873. XM8 "#D!2 > .  !Q_P%!5= 'D!0(GN10.X('EB9,Z1L+0"<,&1!DY<M[(T0$By
  874. XMC9LY=<R823,F31DW=$"T*=-&9IX&"@8B.<<#APF*($8L&[@!CY*0 #8 ,J-@x
  875. XM!+^!"1=J?;$ I$-.)@" 6 . 0;1U "B\!< A"3P< TPPP,//&"$0*RI" K *w
  876. XM  (1 PP$&MA0$B B@4HJ"401@#<0.:@BD@((#P%8A,18&0<(QPX$!ISL R( v
  877. XM0%(/ %0 H ' !XH!V HC&$%L8,$1P32#,>*5L<@-B,#H(!<(N' 8XIH'SYK<u
  878. XM!(@ Y  Y=DX=#(:KFME N X-*_(1P#2_ <,WF7E$(!(#<@@@K;7W(!9 &R0Bt
  879. XM, '%__P##@"R -*XL\<TP5@E1Q L#D/5# 3\0X$00WGS%0%J=./-"9ED1s
  880. XM\B%5<(R8%1UF 2" -!FVA4<"*O @$@8O4&AA$%P\D18>3.CQSX057EA26DQ\r
  881. XMPP$/)REU#@XPB$ 1!G0 0$(: &!033IT8:&$"0KPY1<)0XR@#%5_4<F"$A"<q
  882. XMX00#$  0A!D\,( " %( $( 9-,@)P!$JFL&"GE809 8)>O90D1D<"*$)%H((p
  883. XM\1T&9O C)HDD(,.H$I#R \9 B%1Z::9HFB&+HHQ*\Q4@$&2 !" R (!$,"!Lo
  884. XMB<0;",#!#S"!4 -(-<!H.6E6<)#PE9V:0"$(& 1(D<04@3 0@5IG&. L  G@n
  885. XM.9D;[(#APK0@G$'!M-5J  8#W$8+KAD(,*OLM>P(L0$8"*1J 3#1,GNM,T),m
  886. XM8$< (PQ#%1UHGB%!I5*81\>GD8;JCA"2@"  %H 4R0 ')RW% P@\ZO " !H l
  887. XM>>.0 !1) ))U+(4#""D*H,^.3/PP0)!!@"PRQ76  @!Z5/%1,5,HZ_(//"#Dk
  888. XMD3,#:   P3_2<!4"'[[!\8\Z8(@0]-!%(X"TTDP#,('34"N !!XJ.N$S("5-j
  889. XMG14>)LS)@#4:4< V708,0A\>,3@X(80P0Z%CR-^,G"0D)$00%@$8 ("#0CD i
  890. XMH9 +/!B@4 E@R- J) ;$PX.,"_&PD$(&M E) 0B(=+E"&Q0."08%@,(T'ZM_h
  891. XMKA !"\P)">$ , W)#6UN"HD&#F PX.P&% X&!U4"L"D&8.C$0&W"(P^ 3@ Xg
  892. XM()(!LTNN4 %@Z#Z Y &(!(,>>IC1N4A;C)[Y["3$-E D(N%#EPT#F>] UAY(f
  893. XM#PD"A1M^^.?^>,\ '_YP1_<,@P<<I$X7 M"!#@2!"USH8G-@ T #L%$EG?C e
  894. XM#&S @ &2]SH#\  #// # _S  3^8KP!-P0 ?>( '/_CA@GXP #/ 8 PXK1 ?d
  895. XM/O"#3FIH!C]X@#UM@H/Q . XZ7F' <#87^\P (/XF8$!/# ##. 711C R8H?c
  896. XM!( )I<@#*RX$ QXP P8<P(#9@>\@C&G(0L!G*"UB@ E,>"(?],"Z+YAO).@#b
  897. XM !5:PSX9@0,$/O!! $PH(S^X@7A?[%__%@*!IOC  Q#P0=; 8(#>#80-68,!a
  898. XM#/#0/Q#B@ ,X\(<Q B C!P !"*DS!O4&8 Q@ ,,8FU,<$><$J1YB$ ,,L*+Iz
  899. XM$N,'#+APA"'<7/0   X_K-"%?/##0GHH0QKV<"'\<.$.=>)#]ASN<)MR'&R.y
  900. XMF$2%',!TP6/B0'182PP03R?E7(@? ( /=(K1# ?! 9P\@('9P1&-:@%!_N"Xx
  901. XM3@ LDG 04(8QC%&%.VJ. .E306O6N4YPQ& ,-A@ (;7H!OAE;IW]4Q$$_- 2w
  902. XM"&RTDW!P0 8P@ $!$"%K>$!"_GA  A;00!?^L,8 Q/@ .* 2%*I<2"M?N3DAv
  903. XM N  T*C@/\# !AR8$P=97(@!S"#/B8$!#DL5HSG]  <SF$.'9G #&):I06R u
  904. XMP1UFF-T,:\E#!B / X<C7C:+MRD  ,-TW^0<29OX/(4TX'+KI"#EHMA%='+Nt
  905. XMCB,8@>D(8(;N84-S QA(0 4AB"@85)WPI,(9W+A.6&3 !S:XX.ATTBHSB,&Ss
  906. XM @ #;(QI!F/ @'7@,$8O/UDZ#/@ DTH1Y_-(8(XS2((?DAC ,'B0@%,V !8Yr
  907. XM9:4K83D /LC2!6V"U% 98-3,[9(!3'TB![(759+BP _R%$98";#5F7;UJW8(q
  908. XMZP#&NL,HFA4&&# (%%?H@P]*$@<,8$9Z+\<'2>9PFCV<JQAJJ;D$X$"=?@"#p
  909. XM'0Z[3,CZP8IB; I?S9##_)D@+9F+8@_\@ UE)M9HRM"%+J+P WX< !P!ZO _o
  910. XMSA&;,_# #KX$ "8:D%D^F.$?//B'&5 ,@7O8PPQ@.+ \^R($8V# &M9X92]!n
  911. XM6;K:X>!P'T ">@<R#!(,(AC6X(<N#! )'B  "#CXK2 2J -=-% 0&O9#!',Pm
  912. XMH%KR 0-PJ.< _L'0MHC1K#S@P[A"2%(A<H !VNAA\ECGAEX: !Y@\$=X%\*,l
  913. XM-)?W@TQ,;T5RF,S/P9<;&/"',@^ 7^RB51[(ZZ$/9M?H ?QWICC^@S<L'%8#k
  914. XMP("</KBN+9>:/Q:P  ,:@$4.^_P/;XA7L<H0A2H T.$'P"/$_/B'OZA0#A]Hj
  915. XMX;IM.8 -;! ,/\#X'W9H+P0RP0T<\R.]805 HXS! TE(XI5:=$":?:DX1B(!i
  916. XM#$@82"#.\61CX ,'5+;R0#J BX'PP76L<]Q"#E=!!J-9S6S68I7<@$L0&A.*h
  917. XM/B#I@,AH#3/(V>%\Z+,& 6T-'4+3J#JQ!@CK20!C#&2IR;/EF_$1Z;!BKY;6g
  918. XM,"\\P.@+'H2<>MP5KYIUPH<-V/I^8(!!G&,(J85$6XP'68@-L+%4-YAA&S>_f
  919. XM<$!%(0M>\^,#^ #V/XRF@EJ8 \8R(L !,#L(9\?8#@Y@:B80(6=4,*"&,!"$e
  920. XM'VKH[;ZX$)0D]4-K%@*-K]'U'(&HK37TH0M&=(*%'N! #CBQ95SH8"$(U(4.d
  921. XM*GD >,P( /\PM3>JM/$9H1B7;#! +\4W$#B0\,<Z3%[VT&D KU;<EOC@ ,KGc
  922. XMJF:/UP;'[GSSRAL^NZ>B/(H86+D'.$&"D&\ZYE\$,!_VT$Z<^P-2KNVY1'5(b
  923. XM5QC((+ULN* =W+"-"NM0)'H0A2X  '41_RC8 $ !%7HQ#QGS "/?R&P.GVV a
  924. XMI>+@'8C ,0K.+L5&L8%AMU4M6E5?.!^()*B?0P+#X%*2( ^2P B!P /X  $2z
  925. XMD >>H$K L$JJI$I^  $/X#Y?!'D&8 .31U))-0"ZA'FLQGF&8VG<$'HX%G+?y
  926. XM90Q&YV+8T#LZX0\?A%YF)1(HN'DC]V/;!08?%(/(9U2' WO*A#T6IF8N! ;_x
  927. XM4'P)<&IBM'F0)44N9'08@ TVH$-VX ??8'WPM! *H N[YFO>)V+#  $JP $[w
  928. XMH 4]A!' L&S)Q'X>Q 9F4&U@@ (8@':-@@+X!VYHUCL+D348  770P),Q0&Zv
  929. XM8 _6@ W#0%4<P %QX @0*($&H$I/] 'L<#VVQ R4)U55HDM6%$-2)#XD13QIu
  930. XM!@P[J()F,$,L"'O,$#QP(H-G58/+!'O>@4X,@ TZ6'LP>'Y5-%< ( 0ZD3RUt
  931. XM-SLSAV/8@ UAA0 'AGSOM!!&!V#3X S0)UX#9HR;PX6,]5/@$(;!1F)4@ 'Ss
  932. XMX ;#\ _^  _P@%G!\&(QUGZ*=F-S" -H5T.J8 9 )F3($SRV*$L\($0!V$7,r
  933. XM90[&@ 4O9C04T(B/J%.1N%0"@!"6Z&*8"$KP5#B9QD0B9T5+)#T#(@[BI56Fq
  934. XMB(J_J :K""D\ %9G%3PB\8LXYDMO)E\U5'NL&)(AA%[B- PF&8R$$XM@4(PFp
  935. XMAU5=I$+*.#O21$D&H $8,'3;A9/5.  *,%"BLSEX!4\J\ ]7%8Y\0(XV\ >#o
  936. XM "<RTGY,X'%B(&<H0%1_  +)Y [&Q >IM4Y?I%<CHT8HE#]\X [N  <\T"8,n
  937. XM& :&@$"&ET")IP.?%Q8#D#^%TS^YA$;(HTP$,$('9D(D-2,ZA$P!UIAKMW9Zm
  938. XMQ@?ZUTLUY$L>8 !@TS]#Z%IPP@#.P ,U9&$YY@&6R6"])$YL!@D+@%C45&M#l
  939. XMF$.]] ?IY4LAA%7M%6#2\GRQ9ICB2$TBH0"LLY2)A5CI0P4OY&S_P ?\P \Vk
  940. XM, 8Y-#KMQP:NQP:;X@\XT 5&PP-L,)<;Y7%%B FO8SH-T$3[,P!!( BKLYZUj
  941. XMLT)&XY> "0!V0$1M!9$\Z$)Q<CDZ9U2[!$(.QT(!%D4FI%HUY'(V8 QG]D&"i
  942. XMT(29N9FU45]?M%1QPFT%6E]@P <.D' +JGF\"  \L&D*X)H])&J(%4@>]$'_h
  943. XM@#QPT%X?"CT>2DD8\ /YTUZ\P M_H)/!>3V(Y:$+D5"7LPQLQIS\$$C)))T&g
  944. XM<)Y@X'C]DQZ>,P#P$$G@^47Z* $-X3D1X &8XP!-! E:JA KT$^V@SWZ=@#Kf
  945. XMU#L#TA:<LSR0L%'7 P2ZHWEH.0 ?D)"O PCSP:4[:IQZM$Z)4%<!8@,<D![Fe
  946. XM<P#E1@#S83L#\#MQ!0DG< %4H! .H$:1ZJ4H=3V4Y$VV<Z2<LS\08#LID*>8d
  947. XM8P"A T\!8ACS83Y"J1!PYH$C-D@D18ZIPP<&P#H(ZCIXT'B"4T'%8U3B=CT"c
  948. XM\$$A!$P3143&<SDJ!* O!"<@5Z%Q%D*5Y@% @ =-NE9J15)@H$2]HX\S9592b
  949. XM!)&?&)'+(Z/=ZD5_R0&(X@%E1  T0!N?HY0;@ WKVAH \ <PL*Y/! !ZX$)Ya
  950. XM\%@(]3K^ DTS@$@C@3D#(#WP1#S^)#H#<6>U(2-,M#R+>60#<601Q%*@E G"z
  951. XMIEL\$*C D$H2Z$J1Z'%@<(&Q4T'1=TL.N4ON)UW4A4ZX!  (%D48U%UB9 #6y
  952. XMZ0Z#5@!DI1/!XQV'DQYKU41MY1W>!$YJYAT.^Y"%\Y#/0U>%@P</"71?I -Fx
  953. XM8 /H-3M8@ 7&.A#,(%\VP 99RP.M88M96R4!-0S#\ +\FE "D$,(("/PL '+w
  954. XM-@,3Y0<VL $U!@ VT#]F !M5<CDV@ $04%6]M!!+) .P!0!LP 8,P+<D8 ]Ov
  955. XM, S^D D&, T\8 '^\ T>JU,@.U L1(D35$'^0%3--1+/17#!$V?C@D[JI$%&u
  956. XM)XM<I9F!9G'<15;FE6@&P8/L%6?OA7SLL$+U55]8Q4.%.P"8MH4C$3\>.IZ^t
  957. XM1&&6R%<ZYW"<LU0B48R*"S_/$T(4M+PP@ /*T N]\*D$BU@CID<G, Z(LD[<s
  958. XM\ !WX /,@)7/8P--D0GA90;^T+ULL$5F4$ /IT6Y5&1,(+$/D$'\-@SL%@SGr
  959. XMP \\P B6"P'8L V_96_X)JO>\1^TI+@?)$0D%7#KA $H1BZ9EZ#^![-MP0!Jq
  960. XMX'![%G%^!@=@<'HNMD*K]T&SXW$P '(Z@6 DE4'^8'*S6%KF18.>0 /)<SDGp
  961. XMRH-P\FF7 P8VYYJ?<Z$JM)]1Y&(7Y%I\L&Q3N &7XP;4YPTD!4\8%@JEP'WXo
  962. XMX&M2![,J4 =[\ ]5" #&\ >8I47/9@?FR@;4Q@=BD$&+"RDZQ U4<'K%6SIHn
  963. XM23AL  /+ P#G, Q/-@SYD D/7('>\ ^_59"L=) NA!! 53R9!P,=6'D+$8*:m
  964. XMMU16%#R;0U)])HLJ*+NI*&"95TNN2(.[=$')<V NBP>WR%T]*(_(-SL,0 /4l
  965. XM9  ^T'XY%GR@Q@=_4'P(D'-5Q(H^=\.$O 8$QP8VL%1V8 =9>#E># %Z$ HAk
  966. XMX6M05\9(0 7=@+[R.XYKZ -TRW[090SO@ PX-LAY+%[,T,<<]+!3" "M4B78j
  967. XM@$D1)(B0FPGS, QP,(9IY@$9@ F2/(&L!@$$@%PBX0\,21?R)$X1:470]8EFi
  968. XMA4L'9CSB99VF:)T\1%3N%))BY!TD:9,X!@-37)LKR5TMR5Y7FUAB$$4YUD,Fh
  969. XMU%U&&&!&60 7=$60<FK*YP;ME7,,, P:][46AQO4J'0*T NM0)P>&F/G  ,Jg
  970. XMX%I^, ;+R0_E> ?O*YU0M*!R"(=Y'$4DP XX8 V$.R.VR 0'H8\%0 (;BU3Gf
  971. XM< X@, PXL'(;X("RFF]ZO4(>@*5DALD88 3SV:LDC % <)OYV45- ;..XQT7e
  972. XMM$(M! ::): %"@8V "?)=YD^)  .*DD?VD42"I(5Z@,7FJ'8IGG9JD4(T%Z_d
  973. XM][:40TU86**__*&^I$*2?3D[/1!2Q "&\ D8\*[MI4XW>GU<B+9.K:?("0##c
  974. XM\ ?+^0_."3\3)2W;:P=RQ@;829O^B0>G=4%:)*6#M:5M68T$4(%MU8BJZJC[b
  975. XMTP"ZHP-9P]:7"@D'X(<BL3\EW:GXI#L'L*, \  E30"GI-MP$IPN=-P]JKS+a
  976. XM-!!3A[!WI*U@@ _IYE:-)!)@X#DEO0!DH -<< 9N4 =<P 9S5P!G, 9C\ 5Cz
  977. XM\ 9M  <?_@5?, <K(0=T$ -S-S)?  =A( =S4 8U/G<#$ "<\ 4U?@;SN1#=y
  978. XM(Q9PX.-R$.(B,>0#L %T@ 9A, 9KD%5TX (Z+@"X$.(C7N(G7N6XH.)B$ 8Wx
  979. XM3A]B@0<JW@9A8!,#4>72\ 4+P1(V409*O@%\H.)E@ =I$"4J(A)63N)OP 9Rw
  980. XM\ 5D$ 9^N35L/@!$4 1&$ 15$.> H.)H@.-P\.5^61 JSN(U'B4I7A1N\ : v
  981. XM+N@B,0!%7@9T4.=XKN.4_A-VD 8QX09Q3@B53@=K, =IH =QC@A?\!)RL.EBu
  982. XMON2,<.MV'B4+P>5?8.9H'NQZK@]?8!-WKN=Z#@^W'N@K 1;'$>IN0 :O$^>#t
  983. XM(1(0$,T,@  Z@ +2H@ *X  (H  &H  0( .KQ !"8*)6P  ZP $0X #C3@$ s
  984. X# !H r
  985. X q
  986. Xend
  987. END_OF_FILE
  988. if test 7164 -ne `wc -c <'sys/atari/atarifnt.uue'`; then
  989.     echo shar: \"'sys/atari/atarifnt.uue'\" unpacked with wrong size!
  990. fi
  991. # end of 'sys/atari/atarifnt.uue'
  992. fi
  993. if test -f 'sys/atari/tos.c' -a "${1}" != "-c" ; then 
  994.   echo shar: Will not clobber existing file \"'sys/atari/tos.c'\"
  995. else
  996. echo shar: Extracting \"'sys/atari/tos.c'\" \(6913 characters\)
  997. sed "s/^X//" >'sys/atari/tos.c' <<'END_OF_FILE'
  998. X/*    SCCS Id: @(#)tos.c    3.1    90/14/08
  999. X/* NetHack may be freely redistributed.  See license for details. */
  1000. X
  1001. X/*
  1002. X *  TOS system functions.
  1003. X */
  1004. X
  1005. X#define NEED_VARARGS
  1006. X#include "hack.h"
  1007. X#include "termcap.h"
  1008. X
  1009. X#ifdef TOS
  1010. X
  1011. X# include <osbind.h>
  1012. X# ifndef WORD
  1013. X#  define WORD short        /* 16 bits -- redefine if necessary */
  1014. X# endif
  1015. X
  1016. X#include <ctype.h>
  1017. X
  1018. Xstatic char NDECL(DOSgetch);
  1019. Xstatic char NDECL(BIOSgetch);
  1020. Xstatic void NDECL(init_aline);
  1021. Xchar *_a_line;            /* for Line A variables */
  1022. X# ifdef TEXTCOLOR
  1023. Xboolean colors_changed = FALSE;
  1024. X# endif
  1025. X
  1026. Xint
  1027. Xtgetch()
  1028. X{
  1029. X    char ch;
  1030. X
  1031. X    /* BIOSgetch can use the numeric key pad on IBM compatibles. */
  1032. X    if (flags.BIOS)
  1033. X        ch = BIOSgetch();
  1034. X    else
  1035. X        ch = DOSgetch();
  1036. X    return ((ch == '\r') ? '\n' : ch);
  1037. X}
  1038. X
  1039. X/*
  1040. X *  Keyboard translation tables.
  1041. X */
  1042. X#define KEYPADLO    0x61
  1043. X#define KEYPADHI    0x71
  1044. X
  1045. X#define PADKEYS     (KEYPADHI - KEYPADLO + 1)
  1046. X#define iskeypad(x)    (KEYPADLO <= (x) && (x) <= KEYPADHI)
  1047. X
  1048. X/*
  1049. X * Keypad keys are translated to the normal values below.
  1050. X * When flags.BIOS is active, shifted keypad keys are translated to the
  1051. X *    shift values below.
  1052. X */
  1053. Xstatic const struct pad {
  1054. X    char normal, shift, cntrl;
  1055. X} keypad[PADKEYS] = {
  1056. X            {C('['), 'Q', C('[')},        /* UNDO */
  1057. X            {'?', '/', '?'},        /* HELP */
  1058. X            {'(', 'a', '('},        /* ( */
  1059. X            {')', 'w', ')'},        /* ) */
  1060. X            {'/', '/', '/'},        /* / */
  1061. X            {C('p'), '$', C('p')},        /* * */
  1062. X            {'y', 'Y', C('y')},        /* 7 */
  1063. X            {'k', 'K', C('k')},        /* 8 */
  1064. X            {'u', 'U', C('u')},        /* 9 */
  1065. X            {'h', 'H', C('h')},        /* 4 */
  1066. X            {'.', '.', '.'},
  1067. X            {'l', 'L', C('l')},        /* 6 */
  1068. X            {'b', 'B', C('b')},        /* 1 */
  1069. X            {'j', 'J', C('j')},        /* 2 */
  1070. X            {'n', 'N', C('n')},        /* 3 */
  1071. X            {'i', 'I', C('i')},        /* Ins */
  1072. X            {'.', ':', ':'}            /* Del */
  1073. X}, numpad[PADKEYS] = {
  1074. X            {C('['), 'Q', C('[')}    ,    /* UNDO */
  1075. X            {'?', '/', '?'},        /* HELP */
  1076. X            {'(', 'a', '('},        /* ( */
  1077. X            {')', 'w', ')'},        /* ) */
  1078. X            {'/', '/', '/'},        /* / */
  1079. X            {C('p'), '$', C('p')},        /* * */
  1080. X            {'7', M('7'), '7'},        /* 7 */
  1081. X            {'8', M('8'), '8'},        /* 8 */
  1082. X            {'9', M('9'), '9'},        /* 9 */
  1083. X            {'4', M('4'), '4'},        /* 4 */
  1084. X            {'.', '.', '.'},        /* 5 */
  1085. X            {'6', M('6'), '6'},        /* 6 */
  1086. X            {'1', M('1'), '1'},        /* 1 */
  1087. X            {'2', M('2'), '2'},        /* 2 */
  1088. X            {'3', M('3'), '3'},        /* 3 */
  1089. X            {'i', 'I', C('i')},        /* Ins */
  1090. X            {'.', ':', ':'}            /* Del */
  1091. X};
  1092. X
  1093. X/*
  1094. X * Unlike Ctrl-letter, the Alt-letter keystrokes have no specific ASCII
  1095. X * meaning unless assigned one by a keyboard conversion table, so the
  1096. X * keyboard BIOS normally does not return a character code when Alt-letter
  1097. X * is pressed.    So, to interpret unassigned Alt-letters, we must use a
  1098. X * scan code table to translate the scan code into a letter, then set the
  1099. X * "meta" bit for it.  -3.
  1100. X */
  1101. X#define SCANLO        0x10
  1102. X#define SCANHI        0x32
  1103. X#define SCANKEYS    (SCANHI - SCANLO + 1)
  1104. X#define inmap(x)    (SCANLO <= (x) && (x) <= SCANHI)
  1105. X
  1106. Xstatic const char scanmap[SCANKEYS] = {     /* ... */
  1107. X    'q','w','e','r','t','y','u','i','o','p','[',']', '\n',
  1108. X    0, 'a','s','d','f','g','h','j','k','l',';','\'', '`',
  1109. X    0, '\\', 'z','x','c','v','b','N','m'     /* ... */
  1110. X};
  1111. X
  1112. X/*
  1113. X * BIOSgetch gets keys directly with a BIOS call.
  1114. X */
  1115. X#define SHIFT        (0x1 | 0x2)
  1116. X#define CTRL        0x4
  1117. X#define ALT        0x8
  1118. X
  1119. Xstatic char
  1120. XBIOSgetch()
  1121. X{
  1122. X    unsigned char scan, shift, ch;
  1123. X    const struct pad *kpad;
  1124. X
  1125. X    long  x;
  1126. X
  1127. X    /* Get scan code.
  1128. X     */
  1129. X    x = Crawcin();
  1130. X    ch = x & 0x0ff;
  1131. X    scan = (x & 0x00ff0000L) >> 16;
  1132. X    /* Get shift status.
  1133. X     */
  1134. X    shift = Kbshift(-1);
  1135. X
  1136. X    /* Translate keypad keys */
  1137. X    if (iskeypad(scan)) {
  1138. X        kpad = flags.num_pad ? numpad : keypad;
  1139. X        if (shift & SHIFT)
  1140. X            ch = kpad[scan - KEYPADLO].shift;
  1141. X        else if (shift & CTRL)
  1142. X            ch = kpad[scan - KEYPADLO].cntrl;
  1143. X        else
  1144. X            ch = kpad[scan - KEYPADLO].normal;
  1145. X    }
  1146. X    /* Translate unassigned Alt-letters */
  1147. X    if ((shift & ALT) && !ch) {
  1148. X        if (inmap(scan))
  1149. X            ch = scanmap[scan - SCANLO];
  1150. X        return (isprint(ch) ? M(ch) : ch);
  1151. X    }
  1152. X    return ch;
  1153. X}
  1154. X
  1155. Xstatic char
  1156. XDOSgetch()
  1157. X{
  1158. X    return (Crawcin() & 0x007f);
  1159. X}
  1160. X
  1161. X
  1162. Xlong
  1163. Xfreediskspace(path)
  1164. Xchar *path;
  1165. X{
  1166. X    int drive = 0;
  1167. X    struct {
  1168. X        long freal; /*free allocation units*/
  1169. X        long total; /*total number of allocation units*/
  1170. X        long bps;   /*bytes per sector*/
  1171. X        long pspal; /*physical sectors per allocation unit*/
  1172. X    } freespace;
  1173. X    if (path[0] && path[1] == ':')
  1174. X        drive = (toupper(path[0]) - 'A') + 1;
  1175. X    if (Dfree(&freespace,drive)<0) return -1;
  1176. X    return freespace.freal*freespace.bps*freespace.pspal;
  1177. X}
  1178. X
  1179. X/*
  1180. X * Functions to get filenames using wildcards
  1181. X */
  1182. Xint
  1183. Xfindfirst(path)
  1184. Xchar *path;
  1185. X{
  1186. X    return (Fsfirst(path, 0) == 0);
  1187. X}
  1188. X
  1189. Xint
  1190. Xfindnext()
  1191. X{
  1192. X    return (Fsnext() == 0);
  1193. X}
  1194. X
  1195. Xchar *
  1196. Xfoundfile_buffer()
  1197. X{
  1198. X    return (char *)Fgetdta() + 30;
  1199. X}
  1200. X
  1201. Xlong
  1202. Xfilesize(file)
  1203. Xchar *file;
  1204. X{
  1205. X    if (findfirst(file))
  1206. X        return  (* (long *) ((char *)Fgetdta() + 26));
  1207. X    else
  1208. X        return -1L;
  1209. X}
  1210. X
  1211. X/*
  1212. X * Chdrive() changes the default drive.
  1213. X */
  1214. Xvoid
  1215. Xchdrive(str)
  1216. Xchar *str;
  1217. X{
  1218. X    char *ptr;
  1219. X    char drive;
  1220. X
  1221. X    if ((ptr = index(str, ':')) != NULL) {
  1222. X        drive = toupper(*(ptr - 1));
  1223. X        (void)Dsetdrv(drive - 'A');
  1224. X    }
  1225. X    return;
  1226. X}
  1227. X
  1228. X
  1229. Xvoid
  1230. Xget_scr_size()
  1231. X{
  1232. X    init_aline();
  1233. X    LI = (*((WORD  *)(_a_line + -42L))) + 1;
  1234. X    CO = (*((WORD  *)(_a_line + -44L))) + 1;
  1235. X}
  1236. X
  1237. X# define BIGBUF  8192
  1238. X
  1239. Xint
  1240. X_copyfile(from, to)
  1241. Xchar *from, *to;
  1242. X{
  1243. X    int fromfd, tofd, r;
  1244. X    char *buf;
  1245. X
  1246. X    if ((fromfd = open(from, O_RDONLY|O_BINARY, 0)) < 0)
  1247. X        return -1;
  1248. X    if ((tofd = open(to, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, FCMASK)) < 0)
  1249. X        return -1;
  1250. X    buf = (char *)alloc((size_t)BIGBUF);
  1251. X    while ( (r = read(fromfd, buf, BIGBUF)) > 0)
  1252. X        write(tofd, buf, r);
  1253. X    close(fromfd);
  1254. X    close(tofd);
  1255. X    free(buf);
  1256. X    return 0;    /* successful */
  1257. X}
  1258. X
  1259. Xint kbhit()
  1260. X{
  1261. X    return Cconis();
  1262. X}
  1263. X
  1264. Xstatic void
  1265. Xinit_aline()
  1266. X{
  1267. X# ifdef __GNUC__
  1268. X/* line A calls nuke registers d0-d2,a0-a2; not all compilers regard these
  1269. X   as scratch registers, though, so we save them
  1270. X */
  1271. X    asm(" moveml d0-d2/a0-a2, sp@-");
  1272. X    asm(" .word 0xa000; movel d0, __a_line");
  1273. X    asm(" moveml sp@+, d0-d2/a0-a2");
  1274. X# else
  1275. X    asm(" movem.l d0-d2/a0-a2, -(sp)");
  1276. X    asm(" .dc.w 0xa000");    /* tweak as necessary for your compiler */
  1277. X    asm(" move.l d0, __a_line");
  1278. X    asm(" movem.l (sp)+, d0-d2/a0-a2");
  1279. X# endif
  1280. X}
  1281. X
  1282. X# ifdef TEXTCOLOR
  1283. X/* used in termcap.c to decide how to set up the hilites */
  1284. Xunsigned long tos_numcolors = 2;
  1285. X
  1286. Xvoid
  1287. Xset_colors()
  1288. X{
  1289. X    if (!flags.BIOS)
  1290. X        return;
  1291. X    init_aline();
  1292. X    tos_numcolors = 1 << (((unsigned char *) _a_line)[1]);
  1293. X    if (tos_numcolors <= 2) {            /* mono */
  1294. X        flags.use_color = FALSE;
  1295. X        return;
  1296. X    } else {
  1297. X        colors_changed = TRUE;
  1298. X    }
  1299. X}
  1300. X
  1301. Xvoid
  1302. Xrestore_colors()
  1303. X{
  1304. X    colors_changed = FALSE;
  1305. X}
  1306. X# endif /* TEXTCOLOR */
  1307. X
  1308. X# ifdef SUSPEND
  1309. X
  1310. X#include    <signal.h>
  1311. X
  1312. X#   ifdef MINT
  1313. Xextern int __mint;
  1314. X#   endif
  1315. X
  1316. Xint
  1317. Xdosuspend() {
  1318. X#   ifdef MINT
  1319. X    extern int kill();
  1320. X    if (__mint == 0) {
  1321. X#   endif
  1322. X        pline("Sorry, it seems we have no SIGTSTP here.  Try ! or S.");
  1323. X#   ifdef MINT
  1324. X    }
  1325. X    else if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
  1326. X        suspend_nhwindows(NULL);
  1327. X        (void) signal(SIGTSTP, SIG_DFL);
  1328. X        (void) kill(0, SIGTSTP);
  1329. X        get_scr_size();
  1330. X        resume_nhwindows();
  1331. X    } else {
  1332. X        pline("I don't think your shell has job control.");
  1333. X    }
  1334. X#   endif /* MINT */
  1335. X    return(0);
  1336. X}
  1337. X# endif /* SUSPEND */
  1338. X
  1339. X#endif /* TOS */
  1340. END_OF_FILE
  1341. if test 6913 -ne `wc -c <'sys/atari/tos.c'`; then
  1342.     echo shar: \"'sys/atari/tos.c'\" unpacked with wrong size!
  1343. fi
  1344. # end of 'sys/atari/tos.c'
  1345. fi
  1346. if test -f 'sys/msdos/Makefile.dat' -a "${1}" != "-c" ; then 
  1347.   echo shar: Will not clobber existing file \"'sys/msdos/Makefile.dat'\"
  1348. else
  1349. echo shar: Extracting \"'sys/msdos/Makefile.dat'\" \(3965 characters\)
  1350. sed "s/^X//" >'sys/msdos/Makefile.dat' <<'END_OF_FILE'
  1351. X#    SCCS Id: @(#)Makefile.dat  3.1   93/01/18
  1352. X#    Copyright (c) NetHack PC Development Team 1992, 1993.
  1353. X#    NetHack may be freely redistributed.  See license for details.
  1354. X#
  1355. X# PC NetHack 3.1 Data Files Makefile for NDMAKE and MSC >= 6.0ax
  1356. X# or DGJPP 1.9.
  1357. X
  1358. XDAT    = ..\dat
  1359. XINCL    = ..\include
  1360. XUTL    = ..\util
  1361. X
  1362. Xdefault: all
  1363. X
  1364. Xall:    $(DAT)\data        $(DAT)\rumors    $(DAT)\dungeon \
  1365. X    $(DAT)\oracles        $(DAT)\quest.dat    $(DAT)\sp_lev.tag
  1366. X
  1367. X$(UTL)\utility.tag: $(UTL)\*.c $(UTL)\*.l $(UTL)\*.y $(INCL)\*.h
  1368. X    @echo You must "make all" in $(UTL) first.
  1369. X    @attrib .foo
  1370. X
  1371. X$(DAT)\data:     $(UTL)\utility.tag    $(DAT)\data.base
  1372. X    $(UTL)\makedefs -d
  1373. X
  1374. X$(DAT)\rumors:    $(UTL)\utility.tag    $(DAT)\rumors.tru   $(DAT)\rumors.fal
  1375. X    $(UTL)\makedefs -r
  1376. X
  1377. X$(DAT)\quest.dat: $(UTL)\utility.tag  $(DAT)\quest.txt
  1378. X    $(UTL)\makedefs -q
  1379. X
  1380. X$(DAT)\oracles:    $(UTL)\utility.tag    $(DAT)\oracles.txt
  1381. X    $(UTL)\makedefs -h
  1382. X
  1383. X#
  1384. X# Note: `options` should be created via date.h target in ..\src\makefile
  1385. X#
  1386. X$(DAT)\options: $(UTL)\utility.tag    $(INCL)\config.h    $(INCL)\pcconf.h
  1387. X    $(UTL)\makedefs -v
  1388. X
  1389. X$(DAT)\sp_lev.tag: $(UTL)\utility.tag $(DAT)\bigroom.des  $(DAT)\castle.des \
  1390. X    $(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des   \
  1391. X    $(DAT)\medusa.des  $(DAT)\oracle.des   $(DAT)\tower.des  \
  1392. X    $(DAT)\yendor.des  $(DAT)\arch.des     $(DAT)\barb.des   \
  1393. X    $(DAT)\caveman.des $(DAT)\elf.des      $(DAT)\healer.des \
  1394. X    $(DAT)\knight.des  $(DAT)\priest.des   $(DAT)\rogue.des  \
  1395. X    $(DAT)\samurai.des $(DAT)\tourist.des  $(DAT)\valkyrie.des \
  1396. X    $(DAT)\wizard.des
  1397. X    $(UTL)\lev_comp $(DAT)\bigroom.des
  1398. X    $(UTL)\lev_comp $(DAT)\castle.des
  1399. X    $(UTL)\lev_comp $(DAT)\endgame.des
  1400. X    $(UTL)\lev_comp $(DAT)\gehennom.des
  1401. X    $(UTL)\lev_comp $(DAT)\knox.des
  1402. X    $(UTL)\lev_comp $(DAT)\mines.des
  1403. X    $(UTL)\lev_comp $(DAT)\medusa.des
  1404. X    $(UTL)\lev_comp $(DAT)\oracle.des
  1405. X    $(UTL)\lev_comp $(DAT)\tower.des
  1406. X    $(UTL)\lev_comp $(DAT)\yendor.des
  1407. X    $(UTL)\lev_comp $(DAT)\arch.des
  1408. X    $(UTL)\lev_comp $(DAT)\barb.des
  1409. X    $(UTL)\lev_comp $(DAT)\caveman.des
  1410. X    $(UTL)\lev_comp $(DAT)\elf.des
  1411. X    $(UTL)\lev_comp $(DAT)\healer.des
  1412. X    $(UTL)\lev_comp $(DAT)\knight.des
  1413. X    $(UTL)\lev_comp $(DAT)\priest.des
  1414. X    $(UTL)\lev_comp $(DAT)\rogue.des
  1415. X    $(UTL)\lev_comp $(DAT)\samurai.des
  1416. X    $(UTL)\lev_comp $(DAT)\tourist.des
  1417. X    $(UTL)\lev_comp $(DAT)\valkyrie.des
  1418. X    $(UTL)\lev_comp $(DAT)\wizard.des
  1419. X    echo sp_levs done > $(DAT)\sp_lev.tag
  1420. X
  1421. X$(DAT)\dungeon:    $(UTL)\utility.tag  $(DAT)\dungeon.def
  1422. X    $(UTL)\makedefs -e
  1423. X    $(UTL)\dgn_comp $(DAT)\dungeon.pdf
  1424. X
  1425. Xclean: spotless
  1426. X
  1427. Xspotless:
  1428. X    if exist $(DAT)\?-fill?.lev    del $(DAT)\?-fill?.lev
  1429. X    if exist $(DAT)\?-goal.lev    del $(DAT)\?-goal.lev
  1430. X    if exist $(DAT)\?-locate.lev    del $(DAT)\?-locate
  1431. X    if exist $(DAT)\?-start.lev    del $(DAT)\?-start.lev
  1432. X    if exist $(DAT)\air.lev        del $(DAT)\air.lev
  1433. X    if exist $(DAT)\asmodeus.lev    del $(DAT)\asmodeus.lev
  1434. X    if exist $(DAT)\astral.lev    del $(DAT)\astral.lev
  1435. X    if exist $(DAT)\baalz.lev    del $(DAT)\baalz.lev
  1436. X    if exist $(DAT)\bigroom.lev    del $(DAT)\bigroom.lev
  1437. X    if exist $(DAT)\castle.lev    del $(DAT)\castle.lev
  1438. X    if exist $(DAT)\data        del $(DAT)\data
  1439. X    if exist $(DAT)\dungeon        del $(DAT)\dungeon
  1440. X    if exist $(DAT)\dungeon.pdf    del $(DAT)\dungeon.pdf
  1441. X    if exist $(DAT)\earth.lev    del $(DAT)\earth.lev
  1442. X    if exist $(DAT)\fakewiz?.lev    del $(DAT)\fakewiz?.lev
  1443. X    if exist $(DAT)\fire.lev    del $(DAT)\fire.lev
  1444. X    if exist $(DAT)\juiblex.lev    del $(DAT)\juiblex.lev
  1445. X    if exist $(DAT)\medusa-?.lev    del $(DAT)\medusa-?.lev
  1446. X    if exist $(DAT)\mine*.lev    del $(DAT)\mine*.lev
  1447. X    if exist $(DAT)\options        del $(DAT)\options
  1448. X    if exist $(DAT)\oracle.lev    del $(DAT)\oracle.lev
  1449. X    if exist $(DAT)\oracles        del $(DAT)\oracles
  1450. X    if exist $(DAT)\orcus.lev    del $(DAT)\orcus.lev
  1451. X    if exist $(DAT)\rumors        del $(DAT)\rumors
  1452. X    if exist $(DAT)\quest.dat    del $(DAT)\quest.dat
  1453. X    if exist $(DAT)\sanctum.lev    del $(DAT)\sanctum.lev
  1454. X    if exist $(DAT)\tower?.lev    del $(DAT)\tower?.lev
  1455. X    if exist $(DAT)\valley.lev    del $(DAT)\valley.lev
  1456. X    if exist $(DAT)\water.lev    del $(DAT)\water.lev
  1457. X    if exist $(DAT)\wizard?.lev    del $(DAT)\wizard?.lev
  1458. X    if exist $(DAT)\sp_lev.tag    del $(DAT)\sp_lev.tag
  1459. END_OF_FILE
  1460. if test 3965 -ne `wc -c <'sys/msdos/Makefile.dat'`; then
  1461.     echo shar: \"'sys/msdos/Makefile.dat'\" unpacked with wrong size!
  1462. fi
  1463. # end of 'sys/msdos/Makefile.dat'
  1464. fi
  1465. if test -f 'sys/os2/os2.c' -a "${1}" != "-c" ; then 
  1466.   echo shar: Will not clobber existing file \"'sys/os2/os2.c'\"
  1467. else
  1468. echo shar: Extracting \"'sys/os2/os2.c'\" \(6879 characters\)
  1469. sed "s/^X//" >'sys/os2/os2.c' <<'END_OF_FILE'
  1470. X/*    SCCS Id: @(#)os2.c    3.1    93/01/18 */
  1471. X/*    Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993. */
  1472. X/*    NetHack may be freely redistributed.  See license for details. */
  1473. X
  1474. X/*
  1475. X *  OS/2 system functions.
  1476. X */
  1477. X
  1478. X#define NEED_VARARGS
  1479. X#include "hack.h"
  1480. X
  1481. X#ifdef OS2
  1482. X
  1483. X#include "termcap.h"
  1484. X
  1485. X/* OS/2 system definitions */
  1486. X
  1487. X#include "def_os2.h"
  1488. X
  1489. X#include <ctype.h>
  1490. X
  1491. Xstatic char NDECL(DOSgetch);
  1492. Xstatic char NDECL(BIOSgetch);
  1493. X
  1494. Xint
  1495. Xtgetch()
  1496. X{
  1497. X    char ch;
  1498. X
  1499. X    /* BIOSgetch can use the numeric key pad on IBM compatibles. */
  1500. X    if (flags.BIOS)
  1501. X        ch = BIOSgetch();
  1502. X    else
  1503. X        ch = DOSgetch();
  1504. X    return ((ch == '\r') ? '\n' : ch);
  1505. X}
  1506. X
  1507. X/*
  1508. X *  Keyboard translation tables.
  1509. X */
  1510. X#define KEYPADLO    0x47
  1511. X#define KEYPADHI    0x53
  1512. X
  1513. X#define PADKEYS     (KEYPADHI - KEYPADLO + 1)
  1514. X#define iskeypad(x)    (KEYPADLO <= (x) && (x) <= KEYPADHI)
  1515. X
  1516. X/*
  1517. X * Keypad keys are translated to the normal values below.
  1518. X * When flags.BIOS is active, shifted keypad keys are translated to the
  1519. X *    shift values below.
  1520. X */
  1521. Xstatic const struct pad {
  1522. X    char normal, shift, cntrl;
  1523. X} keypad[PADKEYS] = {
  1524. X            {'y', 'Y', C('y')},        /* 7 */
  1525. X            {'k', 'K', C('k')},        /* 8 */
  1526. X            {'u', 'U', C('u')},        /* 9 */
  1527. X            {'m', C('p'), C('p')},        /* - */
  1528. X            {'h', 'H', C('h')},        /* 4 */
  1529. X            {'g', 'g', 'g'},        /* 5 */
  1530. X            {'l', 'L', C('l')},        /* 6 */
  1531. X            {'p', 'P', C('p')},        /* + */
  1532. X            {'b', 'B', C('b')},        /* 1 */
  1533. X            {'j', 'J', C('j')},        /* 2 */
  1534. X            {'n', 'N', C('n')},        /* 3 */
  1535. X            {'i', 'I', C('i')},        /* Ins */
  1536. X            {'.', ':', ':'}            /* Del */
  1537. X}, numpad[PADKEYS] = {
  1538. X            {'7', M('7'), '7'},        /* 7 */
  1539. X            {'8', M('8'), '8'},        /* 8 */
  1540. X            {'9', M('9'), '9'},        /* 9 */
  1541. X            {'m', C('p'), C('p')},        /* - */
  1542. X            {'4', M('4'), '4'},        /* 4 */
  1543. X            {'g', 'G', 'g'},        /* 5 */
  1544. X            {'6', M('6'), '6'},        /* 6 */
  1545. X            {'p', 'P', C('p')},        /* + */
  1546. X            {'1', M('1'), '1'},        /* 1 */
  1547. X            {'2', M('2'), '2'},        /* 2 */
  1548. X            {'3', M('3'), '3'},        /* 3 */
  1549. X            {'i', 'I', C('i')},        /* Ins */
  1550. X            {'.', ':', ':'}            /* Del */
  1551. X};
  1552. X
  1553. X/*
  1554. X * Unlike Ctrl-letter, the Alt-letter keystrokes have no specific ASCII
  1555. X * meaning unless assigned one by a keyboard conversion table, so the
  1556. X * keyboard BIOS normally does not return a character code when Alt-letter
  1557. X * is pressed.    So, to interpret unassigned Alt-letters, we must use a
  1558. X * scan code table to translate the scan code into a letter, then set the
  1559. X * "meta" bit for it.  -3.
  1560. X */
  1561. X#define SCANLO        0x10
  1562. X#define SCANHI        0x32
  1563. X#define SCANKEYS    (SCANHI - SCANLO + 1)
  1564. X#define inmap(x)    (SCANLO <= (x) && (x) <= SCANHI)
  1565. X
  1566. Xstatic const char scanmap[SCANKEYS] = {     /* ... */
  1567. X    'q','w','e','r','t','y','u','i','o','p','[',']', '\n',
  1568. X    0, 'a','s','d','f','g','h','j','k','l',';','\'', '`',
  1569. X    0, '\\', 'z','x','c','v','b','N','m'     /* ... */
  1570. X};
  1571. X
  1572. X/*
  1573. X * BIOSgetch emulates the MSDOS way of getting keys directly with a BIOS call.
  1574. X */
  1575. X#define SHIFT_KEY    (0x1 | 0x2)
  1576. X#define CTRL_KEY    0x4
  1577. X#define ALT_KEY        0x8
  1578. X
  1579. Xstatic char
  1580. XBIOSgetch()
  1581. X{
  1582. X    unsigned char scan, shift, ch;
  1583. X    const struct pad *kpad;
  1584. X
  1585. X    KBDKEYINFO CharData;
  1586. X    USHORT IOWait = 0;
  1587. X    HKBD KbdHandle = 0;
  1588. X
  1589. X    KbdCharIn(&CharData,IOWait,KbdHandle);
  1590. X    ch = CharData.chChar;
  1591. X    scan = CharData.chScan;
  1592. X    shift = CharData.fsState;
  1593. X
  1594. X    /* Translate keypad keys */
  1595. X    if (iskeypad(scan)) {
  1596. X        kpad = flags.num_pad ? numpad : keypad;
  1597. X        if (shift & SHIFT_KEY)
  1598. X            ch = kpad[scan - KEYPADLO].shift;
  1599. X        else if (shift & CTRL_KEY)
  1600. X            ch = kpad[scan - KEYPADLO].cntrl;
  1601. X        else
  1602. X            ch = kpad[scan - KEYPADLO].normal;
  1603. X    }
  1604. X    /* Translate unassigned Alt-letters */
  1605. X    if ((shift & ALT_KEY) && !ch) {
  1606. X        if (inmap(scan))
  1607. X            ch = scanmap[scan - SCANLO];
  1608. X        return (isprint(ch) ? M(ch) : ch);
  1609. X    }
  1610. X    return ch;
  1611. X}
  1612. X
  1613. Xstatic char
  1614. XDOSgetch()
  1615. X{
  1616. X    KBDKEYINFO CharData;
  1617. X    USHORT IOWait = 0;
  1618. X    HKBD KbdHandle = 0;
  1619. X
  1620. X    KbdCharIn(&CharData,IOWait,KbdHandle);
  1621. X    if (CharData.chChar == 0) {    /* an extended code -- not yet supported */
  1622. X        KbdCharIn(&CharData,IOWait,KbdHandle);       /* eat the next character */
  1623. X        CharData.chChar = 0;        /* and return a 0 */
  1624. X    }
  1625. X    return (CharData.chChar);
  1626. X}
  1627. X
  1628. Xchar
  1629. Xswitchar()
  1630. X{
  1631. X    return '/';
  1632. X}
  1633. X
  1634. Xint
  1635. Xkbhit()
  1636. X{
  1637. X    KBDKEYINFO CharData;
  1638. X    HKBD KbdHandle = 0;
  1639. X
  1640. X    KbdPeek(&CharData,KbdHandle);
  1641. X    return (CharData.fbStatus & (1 << 6));
  1642. X}
  1643. X
  1644. Xlong
  1645. Xfreediskspace(path)
  1646. Xchar *path;
  1647. X{
  1648. X    FSALLOCATE FSInfoBuf;
  1649. X#ifdef OS2_32BITAPI
  1650. X    ULONG
  1651. X#else
  1652. X    USHORT
  1653. X#endif
  1654. X        DriveNumber, FSInfoLevel = 1, res;
  1655. X
  1656. X    if (path[0] && path[1] == ':')
  1657. X        DriveNumber = (toupper(path[0]) - 'A') + 1;
  1658. X    else
  1659. X        DriveNumber = 0;
  1660. X    res =
  1661. X#ifdef OS2_32BITAPI
  1662. X        DosQueryFSInfo(DriveNumber,FSInfoLevel,(PVOID)&FSInfoBuf,(ULONG)sizeof(FSInfoBuf));
  1663. X#else
  1664. X        DosQFSInfo(DriveNumber,FSInfoLevel,(PBYTE)&FSInfoBuf,(USHORT)sizeof(FSInfoBuf));
  1665. X#endif
  1666. X    if (res)
  1667. X        return -1L;        /* error */
  1668. X    else
  1669. X        return ((long) FSInfoBuf.cSectorUnit * FSInfoBuf.cUnitAvail *
  1670. X                   FSInfoBuf.cbSector);
  1671. X}
  1672. X
  1673. X/*
  1674. X * Functions to get filenames using wildcards
  1675. X */
  1676. X
  1677. X#ifdef OS2_32BITAPI
  1678. Xstatic FILEFINDBUF3 ResultBuf;
  1679. X#else
  1680. Xstatic FILEFINDBUF ResultBuf;
  1681. X#endif
  1682. Xstatic HDIR DirHandle;
  1683. X
  1684. Xint
  1685. Xfindfirst(path)
  1686. Xchar *path;
  1687. X{
  1688. X#ifdef OS2_32BITAPI
  1689. X    ULONG
  1690. X#else
  1691. X    USHORT
  1692. X#endif
  1693. X        res, SearchCount = 1;
  1694. X
  1695. X    DirHandle = 1;
  1696. X    res =
  1697. X#ifdef OS2_32BITAPI
  1698. X        DosFindFirst((PSZ)path,&DirHandle,0L,(PVOID)&ResultBuf,(ULONG)sizeof(ResultBuf),&SearchCount,1L);
  1699. X#else
  1700. X        DosFindFirst((PSZ)path,&DirHandle,0,&ResultBuf,(USHORT)sizeof(ResultBuf),&SearchCount,0L);
  1701. X#endif
  1702. X    return(!res);
  1703. X}
  1704. X
  1705. Xint
  1706. Xfindnext()
  1707. X{
  1708. X#ifdef OS2_32BITAPI
  1709. X    ULONG
  1710. X#else
  1711. X    USHORT
  1712. X#endif
  1713. X        res, SearchCount = 1;
  1714. X
  1715. X    res =
  1716. X#ifdef OS2_32BITAPI
  1717. X        DosFindNext(DirHandle,(PVOID)&ResultBuf,(ULONG)sizeof(ResultBuf),&SearchCount);
  1718. X#else
  1719. X        DosFindNext(DirHandle,&ResultBuf,(USHORT)sizeof(ResultBuf),&SearchCount);
  1720. X#endif
  1721. X    return(!res);
  1722. X}
  1723. X
  1724. Xchar *
  1725. Xfoundfile_buffer()
  1726. X{
  1727. X    return(ResultBuf.achName);
  1728. X}
  1729. X
  1730. Xlong
  1731. Xfilesize(file)
  1732. Xchar *file;
  1733. X{
  1734. X    if (findfirst(file)) {
  1735. X        return  (* (long *) (ResultBuf.cbFileAlloc));
  1736. X    } else
  1737. X        return -1L;
  1738. X}
  1739. X
  1740. X/*
  1741. X * Chdrive() changes the default drive.
  1742. X */
  1743. Xvoid
  1744. Xchdrive(str)
  1745. Xchar *str;
  1746. X{
  1747. X    char *ptr;
  1748. X    char drive;
  1749. X
  1750. X    if ((ptr = index(str, ':')) != NULL) {
  1751. X        drive = toupper(*(ptr - 1));
  1752. X#ifdef OS2_32BITAPI
  1753. X        DosSetDefaultDisk((ULONG)(drive - 'A' + 1));
  1754. X#else
  1755. X        DosSelectDisk((USHORT)(drive - 'A' + 1));
  1756. X#endif
  1757. X    }
  1758. X}
  1759. X
  1760. Xvoid
  1761. Xdisable_ctrlP()
  1762. X{
  1763. X    KBDINFO KbdInfo;
  1764. X    HKBD KbdHandle = 0;
  1765. X
  1766. X    if (!flags.rawio) return;
  1767. X    KbdInfo.cb = sizeof(KbdInfo);
  1768. X    KbdGetStatus(&KbdInfo,KbdHandle);
  1769. X    KbdInfo.fsMask &= 0xFFF7; /* ASCII off */
  1770. X    KbdInfo.fsMask |= 0x0004; /* BINARY on */
  1771. X    KbdSetStatus(&KbdInfo,KbdHandle);
  1772. X}
  1773. X
  1774. Xvoid
  1775. Xenable_ctrlP()
  1776. X{
  1777. X    KBDINFO KbdInfo;
  1778. X    HKBD KbdHandle = 0;
  1779. X
  1780. X    if (!flags.rawio) return;
  1781. X    KbdInfo.cb = sizeof(KbdInfo);
  1782. X    KbdGetStatus(&KbdInfo,KbdHandle);
  1783. X    KbdInfo.fsMask &= 0xFFFB; /* BINARY off */
  1784. X    KbdInfo.fsMask |= 0x0008; /* ASCII on */
  1785. X    KbdSetStatus(&KbdInfo,KbdHandle);
  1786. X}
  1787. X
  1788. Xvoid
  1789. Xget_scr_size()
  1790. X{
  1791. X    VIOMODEINFO ModeInfo;
  1792. X    HVIO VideoHandle = 0;
  1793. X
  1794. X    ModeInfo.cb = sizeof(ModeInfo);
  1795. X
  1796. X    (void) VioGetMode(&ModeInfo,VideoHandle);
  1797. X
  1798. X    CO = ModeInfo.col;
  1799. X    LI = ModeInfo.row;
  1800. X}
  1801. X
  1802. Xvoid
  1803. Xgotoxy(x,y)
  1804. Xint x,y;
  1805. X{
  1806. X    HVIO VideoHandle = 0;
  1807. X
  1808. X    x--; y--;            /* (0,0) is upper right corner */
  1809. X
  1810. X    (void) VioSetCurPos(x, y, VideoHandle);
  1811. X}
  1812. X
  1813. X#endif /* OS2 */
  1814. END_OF_FILE
  1815. if test 6879 -ne `wc -c <'sys/os2/os2.c'`; then
  1816.     echo shar: \"'sys/os2/os2.c'\" unpacked with wrong size!
  1817. fi
  1818. # end of 'sys/os2/os2.c'
  1819. fi
  1820. echo shar: End of archive 99 \(of 108\).
  1821. cp /dev/null ark99isdone
  1822. MISSING=""
  1823. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1824. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  1825. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  1826. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  1827. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  1828. 101 102 103 104 105 106 107 108 ; do
  1829.     if test ! -f ark${I}isdone ; then
  1830.     MISSING="${MISSING} ${I}"
  1831.     fi
  1832. done
  1833. if test "${MISSING}" = "" ; then
  1834.     echo You have unpacked all 108 archives.
  1835.     echo "Now execute 'rebuild.sh'"
  1836.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  1837. else
  1838.     echo You still need to unpack the following archives:
  1839.     echo "        " ${MISSING}
  1840. fi
  1841. ##  End of shell archive.
  1842. exit 0
  1843.