home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / funadv / part05 < prev    next >
Encoding:
Internet Message Format  |  1992-03-07  |  47.9 KB

  1. Path: uunet!think.com!yale.edu!heifetz!emory!dragon.com!cts
  2. From: cts@dragon.com
  3. Newsgroups: vmsnet.sources.games
  4. Subject: funadv Part 05/08
  5. Message-ID: <1992Mar7.222151.828@dragon.com>
  6. Date: 8 Mar 92 03:21:51 GMT
  7. Organization: Computer Projects Unlimited
  8. Lines: 1154
  9.  
  10. -+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
  11. X<1E0000ABA1000265F0F9020BFDFAF4F5E5E4EFF0F7F7DF0219FDE7FAF7FAF7F80203FDDE2B
  12. X<1E0000ABBF00FBF7B50218FDF8FDF2FCFEF8F6DAD0D7D3F30203FB0203D7BFF3F8FAF8F735
  13. X<1E0000ABDD00F6ECFBF6EAF3F3F0F2F2DF0205E6F7FDFD0201E0F7E4F7F5F6F1E5E5F702D2
  14. X<1E0000ABFB0001F7F60201E1F7FAFA0204FDE7F8EDFAEDF5FBFA0201C6E7FA0206F2F8F251
  15. X<1E0000AC1900F30204FDE6F7FA0218FD0201BDE7F5F8E7F8FBFBFAF3FBFAEDF6E5FBFAF33E
  16. X<1E0000AC37000207FDF0C2B9F5E3FAFAFBF8F8F60248FD0215EFF0FDEDECFC0201E4EFFC00
  17. X<1D0000AC5500F8E90234FDF3F0DDF3EFEFF2DFF5E5F20201FDFAEFDEF7F50E0609660664
  18. X<1E0000AC7300CFF7F7F70201FD0201D5F7F7F6EC0201FDD3F7F7E3E6D2F7F30201FEE8F741
  19. X<1E0000AC91000201FEF1E0E8EC0E00095D0600F5F3EAE3F7EFE1030C02FDE9FBF0EAF70244
  20. X<1E0000ACAF0003FDF9020CFDF3F4F4F40201FDFA0E0809380400FC035604F6FC0204CD023F
  21. X<1E0000ACCD0001E0FCEBF1EDF70203FDF8F9FB0203FDE1DADAE4E4E4E40E5D090D0600022E
  22. X<1E0000ACEB0001E003E502FD0201EA0208FDF8FA0201FDFAF7C2B9F7F70E33096D0700E3A2
  23. X<1E0000AD0900E4F1FA039701FC0235FDFAFAE10207B2F5E5EC0E0B09BC0400ECF7F3F5F59A
  24. X<1E0000AD2700F5F5F5F8F902AAF4F7F3F8F8FCFBECEBFCF10203F4F0F2F40205F4F7FE0248
  25. X<1E0000AD450001EA0E0509830500F5F5F50E03096B0500EEEE0E03095D0500F8E2F80201CB
  26. X<1E0000AD6300FDF7F50201FDF80E0309530500ECFAFAF20E0309350500F2EBF9F7FCF6F7A3
  27. X<1E0000AD81000201FDDCF8F5F5CBF9FE0201FDFAFEF70201FDE4F30E0809C80400F0DFF9BB
  28. X<1E0000AD9F00FE02C3FEF4EFEFE7EDE5E9F2F70E0309CE0400EEF4EEF50207E4F2D1020114
  29. X<1E0000ADBD00FDEAECF2C2B9F5E5F90204FDF4EE0205F0EBDCF9F70205FDF60207FDF0F0F2
  30. X<1D0000ADDB00F6F7E5EAD8F7F90201FDE8F3ECF7F5F5F7F5FAF0F90204FD0E0609D30469
  31. X<1E0000ADF900EDFEEBF7F9024BFDE8F6F3F7FB0201FDF7F7E7031F04FDF8F8EFFC0201CAC9
  32. X<1E0000AE1700D8FAFDEFFBFAFDD6FA0E0309AD04000201DE039404FCF8F80201E00219FD6F
  33. X<1E0000AE3500EEF6F9D40203F7FDF7F7F7FDFAF80203FA0201E00E0309C00800EAECEDF703
  34. X<1E0000AE53000201FEF9E6F5FA0203FDED035501F70E0C09D408000201EA0201F70203F7F1
  35. X<1E0000AE7100E6F8F3FBF7F3ED0203FD0E0709E408000201EA74B90201FDFBF7F3EDFDF536
  36. X<1E0000AE8F000201EAFD0201E7F70208FDF8020EFDEDFDE7EDF7FDFFEDF90204F4F9F3FE53
  37. X<1D0000AEAD00EBF50E0009170900F5F5F70206FD0201F1F80201F0F7F8FE020100F80EB6
  38. X<1E0000AECB00093A0400033B06F40203C4FA0201EAF90204F9EDF5F4F9F40202D80201FEA2
  39. X<1D0000AEE9000E1B097F0A000201EA021100F701EF0006BF004652000001BD0ABC0001C8
  40. X<1D0000AF0900034255470ABE00487E03000342554709B9000219FE0203E0F906BF002931
  41. X<1E0000AF290001BD0CBC00010000000543415252590CBE00747E030005434152525912B9ED
  42. X<1D0000AF4800020AFEEFEFFAFCF4F4FFF7F7FAFEF0FF06BF007200000001BD0BBC000195
  43. X<1E0000AF68000444524F500BBE00E87E03000444524F500EB9000209FEEFECF5FEF5F7F0AD
  44. X<1E0000AF8600F6FF06BF006300000001BD0CBC000100000005474554494E0CBE004C7F03F5
  45. X<1E0000AFA50005474554494E44B900020EE7F9F90201E3FCF70203F5FDF3F0F9FBF4F6F7A4
  46. X<1E0000AFC300F2FD0205FEECF4F6FEFAF2F1F1F0F4FCF6F0FD0E0209240000FCF70E0209CE
  47. X<1C0000AFE1001600000201D90220F5F8E30201D7FF06BF00E701000001BD10BC00015F
  48. X<1D0000B0000009494D4147455F44495210BE003481030009494D4147455F44495217B989
  49. X<1E0000B01E000219EFF7F1F60201F70201F2FAF30201FD0201F5FF06BF006C00000001BD6A
  50. X<1E0000B03C000DBC0001000000064A5547474C450DBE00A0810300064A5547474C450AB9F2
  51. X<1E0000B05B000209F7F4F7F3EBFF06BF004100000001BD0DBC0001000000064C44434F4D0A
  52. X<1E0000B079004E0DBE00E4810300064C44434F4D4E25B9000211F70201F8FC0201D50202BA
  53. X<1C0000B09700F20202F2E60201D3F80205FFE5E50E0709230000F5E5FF06BF00100141
  54. X<1E0000B0B50001BD0EBC0001000000074D494E504D49440EBE00F4820300074D494E504D12
  55. X<1E0000B0D300494406B9000204F7E806BF002100000001BD0BBC0001000000044D4F564587
  56. X<1D0000B0F1000BBE0018830300044D4F56450CB900020AF7F6F4FEF1E3EEFF06BF00600A
  57. X<1E0000B1110001BD0DBC00010000000650535045414B0DBE00788303000650535045414B3B
  58. X<1C0000B12F000EB9000212F7F4FBFBF7E5EBFCF5FF06BF006800000001BD0ABC0001DF
  59. X<1D0000B14E00035055540ABE00E08303000350555409B9000206F70201EFF606BF00242C
  60. X<1E0000B16E0001BD0DBC00010000000652414E444F4D0DBE00048403000652414E444F4D57
  61. X<1E0000B18C0006B900020AF7EB06BF001E00000001BD0DBC00010000000652535045414BC1
  62. X<1E0000B1AA000DBE00248403000652535045414B07B9000206F7E7FF06BF002300000001B7
  63. X<1D0000B1C800BD0CBC000100000005535045414B0CBE004884030005535045414B13B98D
  64. X<1E0000B1E6000216F7F9E00201E30201F90201CCFEEBFF06BF00A000000001BD0DBC0001DD
  65. X<1E0000B20700065356434F4D4E0DBE00E8840300065356434F4D4E18B900020BF7FC020163
  66. X<1D0000B22500D50202F20202F5E8D3F8FFF70201EAFF06BF00BF00000001BD0CBC0001A8
  67. X<1E0000B2450005564F4341420CBE00A885030005564F43414217B900020EEFFAE7F7ECF08E
  68. X<1E0000B26300FC0201F8FCF5E50201F8F7EAFB06BF00BF00000001BD0DBC00010000000617
  69. X<1E0000B2810057495A4152440DBE00688603000657495A41524458B9000208F7FD0201EA4F
  70. X<1E0000B29F000201DAF8E9F30203F00201F8F8FC021DF00203EA0E04091C0000FA0201EAE0
  71. X<1E0000B2BD00D0F8F8EAE3F0F00202EADAF8E60201EADAF8F3FC0203EA0205FC0203E302D6
  72. X<1E0000B2DB0003E50202EAFD0201E90E03091200000201E7FD06BF00C502000001BD0ABC73
  73. X<1E0000B2FA0001000000035945530ABE0030890300035945532CB9000209F7EEFCF9F8FA0D
  74. X<1D0000B318000201E9FCFD0202E7FCFD0201DEF8E9E90201EAEE0203FEFDEE0E030921A0
  75. X<1E0000B33700FCEEFC06BF002601000001BD11BC00060000000A5348494654244D41494EC4
  76. X<1E0000B3550006B910968A030034B9090000020CFC0205EB0201FBDE0201F90201F902011F
  77. X<1E0000B37300EB0201DB0201ED0202D50201FC0203F80201F10201DC0201F00203E80E0469
  78. X<1E0000B3910010B800588A03000524434F44456F0100000CBE00988A0300055348494654CB
  79. X<1E0000B3AF0006BF002F01000001BD0EBC0006000000074745545553455206B910C88B03B2
  80. X<1E0000B3CE0012B90900000212FE020200F9FAF8F5F7E00E0110B800C88B03000524434FD8
  81. X<1E0000B3EC0044454C00000011B800DC2D000006244C4F43414C180000000BBE00C88B03D0
  82. X<0E0000B40B00045553455206BF004C00000001BD21
  83. X<000000B600004A
  84. X<000000B600FA50
  85. X<00000000000000
  86. $ CALL UNPACK FUNADV.HEX;1 1045702204
  87. $ create 'f'
  88. X        .TITLE  DEHEX
  89. X        .SBTTL  Stuart Hecht and Eric McQueen, Stevens Inst of Technology
  90. X
  91. X        .LIBRARY /SYS$LIBRARY:STARLET/
  92. X        .LIBRARY /SYS$LIBRARY:LIB/
  93. X        .IDENT   /1.1.02/
  94. X;++
  95. X;1.1.01
  96. X;Updated March 9, 1898, by Susan Webb and Jerry Holliday of Lockheed Aircraf
  97. Vt
  98. X;Systems Co, Marietta, GA, to work for files longer than 64K.  Added lines
  99. X;marked with ";JH".
  100. X;--
  101. X;++
  102. X;1.1.02
  103. X;Updated March 15, 1989, by Tom Allebrandi of Advanced Computer Consulting,
  104. X;Inc, Charlottesville, VA. (ta2@acci.com)
  105. X;
  106. X;On March 14, 1989, I pulled this file and VMSMIT.HEX from Columbia via
  107. X;KERMSRV. After compiling, this utility would not decode the VMSMIT file.
  108. X;The problem was the 1.1.01 fix noted above.
  109. X;
  110. X;I have removed the 1.1.01 fix and coded it so that it works correctly.
  111. X;My changes are marked ";ta2"
  112. X;--
  113. X
  114. X;++
  115. X;This will take a set hexidecimal strings created by the hexify program and
  116. X;  recreate the source file(s).
  117. X;--
  118. X
  119. X        .EXTRN  LIB$GET_INPUT
  120. X        .EXTRN  LIB$PUT_OUTPUT
  121. X        .EXTRN  DSC$K_DTYPE_T
  122. X        .EXTRN  DSC$K_CLASS_S
  123. X        .EXTRN  SS$_NORMAL
  124. X        .MCALL  $FAB                            ; RMS calls
  125. X        .MCALL  $RAB
  126. X        .MCALL  $CLOSE
  127. X        .MCALL  $CONNECT
  128. X        .MCALL  $CREATE
  129. X        .MCALL  $DISCONNECT
  130. X        .MCALL  $GET
  131. X        .MCALL  $OPEN
  132. X        .MCALL  $WRITE
  133. X        .MCALL  $RAB_STORE
  134. X        .MCALL  $FAB_STORE
  135. X
  136. X        .SBTTL  Definitions of symbols
  137. X
  138. XDWRLUN  =1                              ; Disk read LUN
  139. XDWWLUN  =5                              ; Disk write LUN
  140. XTRUE    =1                              ; True
  141. XFALSE   =0                              ; False
  142. XKNORMAL =0                              ; No error
  143. XLEFTBYTE=`5EO377*`5EO400                    ; All ones in left byte
  144. XHEXOFFSET=7                             ; Offset to get to 'A from '9+1
  145. XCR      =13.                            ; Carriage return
  146. XLF      =10.                            ; Line feed
  147. XMAX.MSG =256.                           ; Maximum number of chars from XK
  148. XRCV.SOH =`5EA/:/                          ; Receive start of packet
  149. XRCV.EOL =13.                            ; End of line character
  150. XMSB     =128.                           ; Most significant bit
  151. X; Packet types currently supported
  152. XPKDATA  =00                             ; Data packet code
  153. XPKRFM   =255.                           ; Record format
  154. XPKRAT   =254.                           ; Record attributes
  155. XPKMRS   =253.                           ; Maximum record size
  156. XPKALQ   =252.                           ; File length(blocks)
  157. XPKFILNM =251.                           ; File name
  158. XPKEOF   =250.                           ; End of task file
  159. X;
  160. X
  161. X
  162. X        .SBTTL  RMS Data
  163. X
  164. X        .PSECT  $PLIT$,LONG
  165. X
  166. XDEFALT: .ASCIZ  'SYS$DISK:'             ; System default.
  167. XDEFALN  =.-DEFALT                       ; Size of the default device.
  168. X        .EVEN
  169. X
  170. X        .SBTTL  Data
  171. X
  172. X
  173. XM$FILE: .BYTE   CR,LF
  174. X        .ASCII  'Please type the file name: '
  175. XL$FILE= .-M$FILE
  176. X
  177. XM$CRLF: .BYTE   CR,LF                   ; Data for carriage return/line feed
  178. XL$CRLF  =.-M$CRLF
  179. X
  180. X;M$AK:
  181. X;       .ASCII  'Y'                     ; Data for aknowledged
  182. X
  183. XM$NAK:
  184. X        ;.ASCII 'N'                     ; Data for not aknowledged
  185. X        .ASCII  'BAD CHECK SUM'         ; Data for not aknowledged
  186. XL$NAK   =.-M$NAK
  187. X
  188. XM$UN:
  189. X        ;.ASCII 'U'                     ; Data for unrecognized code
  190. X        .ASCII  'UNKNOWN BLOCK TYPE'    ; Data for unrecognized code
  191. XL$UN    =.-M$UN
  192. X
  193. XM$RMS:  .BYTE   CR,LF,LF
  194. X        .ASCII  'RMS ERROR'
  195. XL$RMS   =.-M$RMS
  196. X
  197. XM$REC:  .BYTE   CR,LF,LF
  198. X        .ASCII  'RECEIVE ERROR - Try again.'
  199. XL$REC   =.-M$REC
  200. X        .EVEN
  201. X
  202. X
  203. X        .SBTTL  Storage locations
  204. X
  205. X        .PSECT  $OWN$,LONG
  206. X        .ALIGN  LONG
  207. X
  208. XMSGDSC: .BLKW   1                       ; Data block for terminal output
  209. X        .BYTE   DSC$K_DTYPE_T
  210. X        .BYTE   DSC$K_CLASS_S
  211. XADDR:   .ADDRESS ADDR
  212. XLNGADR: .BLKL   1
  213. X
  214. XINP_STR_D:                              ; Key string desciptor
  215. X         .BLKL  1
  216. XINP_BUF: .ADDRESS ADDR
  217. X
  218. XINP_STR_LEN: .BLKL 1                    ; Key string length
  219. X
  220. XWTCOUNT: .BLKL  1                       ; Number of characters written
  221. XLENGTH: .BLKL   1                       ; Length of data portion of packet
  222. XOPENFL: .BLKL   1                       ; Tells us if the file is open
  223. X
  224. XCHKSUM: .BLKL   1                       ; Checksum for the line
  225. XADDRESS: .BLKL  1                       ; Current address
  226. XALQLOC: .BLKW   2                       ; Storage for allocation
  227. X
  228. XOUT.N:  .BLKB   28.                     ; Space for output file name
  229. XOUT.L   =.-OUT.N                        ; Length of output file name
  230. X
  231. XINP.N:  .BLKB   28.                     ; Space for input file name
  232. XINP.L   =.-INP.N                        ; Length of input file name
  233. X
  234. X        .EVEN                           ; Need to start RDBUF on even bounda
  235. Vry
  236. XRDBUF:  .BLKB   MAX.MSG                 ; XK read buffer
  237. X        .EVEN
  238. XWTBUF:  .BLKB   512.                    ; Disk write buffer
  239. X        .EVEN
  240. X
  241. X
  242. X
  243. X        .SBTTL  RMS Data structures
  244. X        .ALIGN  LONG
  245. X
  246. XRDFAB:: $FAB    DNA=DEFALT,DNS=DEFALN,FNA=INP.N,FNS=INP.L,-
  247. X                LCH=DWRLUN,FAC=GET,SHR=GET
  248. X
  249. X        .ALIGN  LONG
  250. XRDRAB:: $RAB    FAB=RDFAB,RAC=SEQ ; Beginning of RAB block.
  251. X
  252. X        .ALIGN  LONG
  253. XWTFAB:: $FAB    DNA=DEFALT,DNS=DEFALN,FNA=OUT.N,FNS=OUT.L,-
  254. X                LCH=DWWLUN,FAC=PUT,SHR=NIL
  255. X
  256. XWTRAB:: $RAB    FAB=WTFAB,RAC=SEQ ; Beginning of RAB block.
  257. X
  258. X
  259. X        .SBTTL  Start of program
  260. X
  261. X        .PSECT  $CODE$,LONG,EXE
  262. X
  263. XDEHEX:: .WORD   `5EM<>
  264. XFILE:   MOVAB   M$FILE,R11              ; Output the get file name message
  265. X        MOVZBL  #L$FILE,R12
  266. X        MOVAB   INP.N,R10               ; Get the file name
  267. X        MOVZBL  #INP.L,R1
  268. X        JSB     READ
  269. X        TSTL    R0                      ; Check for no input
  270. X        BEQL    FILE                    ; Go back and get some
  271. X;Open the file
  272. X        MOVAL   RDFAB,R1                ; Put address of FAB into R1.
  273. X        $FAB_STORE FAB=R1,FNS=R0        ; Tell RMS file name length
  274. X        $OPEN   #RDFAB                  ; Open the file
  275. X        JSB     RMSERR                  ; Check for file error
  276. X        MOVAL   RDRAB,R1                ; Put address of RAB into R1.
  277. X; Put address of user buffer and size and record buffer and size in RAB.
  278. X        $RAB_STORE RAB=R1,UBF=RDBUF,RBF=RDBUF,USZ=#MAX.MSG,RSZ=#MAX.MSG
  279. X        $CONNECT #RDRAB                 ; Connect to record.
  280. X        JSB     RMSERR                  ; Check for file error
  281. X
  282. X
  283. X        .SBTTL  Do the real work
  284. X;++
  285. X; Do the actual work
  286. X;--
  287. XBEGIN:  MOVAL   M$CRLF,R10              ; Get a return/linefeed and output t
  288. Vhem
  289. X        MOVZBL  #L$CRLF,R1
  290. X        JSB     WRITE
  291. X
  292. X20$:    CLRL    WTCOUNT                 ; Initialize the pointer
  293. X        CLRL    ADDRESS                 ; Initialize the address
  294. X        CLRL    OPENFL                  ; Set the file to not open
  295. X
  296. X        .SBTTL  Main loop
  297. X
  298. X; Main loop to get data
  299. XDOLIN:
  300. X        CLRL    CHKSUM                  ; Clear the checksum
  301. X        JSB     RECEIVE                 ; Get the line
  302. X        JSB     CVTBIN                  ; Convert it to a real number
  303. X        MOVL    R10,LENGTH              ; Save the length
  304. XNAB:    JSB     CVTBIN                  ;
  305. X        BISL    R10,R3                  ; Save a byte of the address
  306. X        ASHL    #8.,R3,R3               ; Make room for next byte
  307. X        SOBGEQ  LNGADR,NAB              ; If there are more than 2 bytes
  308. X        JSB     CVTBIN                  ;
  309. X        BISL    R10,R3                  ; Fill in the low byte of address
  310. X
  311. X;ta2 The fix for 1.1.01 converted two more hex values here. As of March
  312. X;    1989, this doesn't appear to be required. The conversion has been
  313. X;    removed.
  314. X
  315. X        JSB     CVTBIN                  ;ta2 Pick up the record type code
  316. X
  317. X        CMPL    #PKDATA,R10             ; Check to see if this is regular da
  318. Vta
  319. X        BNEQ    NOTDAT                  ; If not then check the special case
  320. Vs
  321. X; Check for end of hex file
  322. X        TSTL    R3                      ; Check to see if the address is all
  323. X        BNEQ    DATST                   ;  zero, if not then branch
  324. X        TSTL    LENGTH                  ; Check to see if the length is zero
  325. X        BNEQ    DATST                   ;  also, if not then branch
  326. X        JMP     FINISH                  ; Must be end of hex file so finish
  327. V up
  328. X; Regular data to put into the file
  329. XDATST:  TSTL    OPENFL                  ; Check to see if the file is open y
  330. Vet
  331. X        BNEQ    DAT1                    ; If it is then skip the open
  332. X        JSB     OPEN                    ; Open the file
  333. XDAT1:   CMPL    R3,ADDRESS              ; Check for null compression
  334. X        BEQL    10$                     ; If none compressed then continue p
  335. Vast
  336. X        CLRL    R10                     ; Make a null
  337. X        JSB     PUT                     ;  and put it into the file
  338. X        INCL    ADDRESS                 ; Point to next address
  339. X        BRW     DAT1                    ; Go see if there are any more nulls
  340. X; Go to work on the HEX we got on the line
  341. X10$:    MOVL    LENGTH,R2               ; Get the length
  342. X        TSTL    R2                      ; See if there is any data
  343. X        BEQL    30$                     ; If not then branch
  344. X25$:    JSB     CVTBIN                  ; Convert it
  345. X        JSB     PUT                     ; Put the character in the file
  346. X        INCL    ADDRESS                 ; Increment the address
  347. X        SOBGTR  R2,25$                  ; Repeat until all done
  348. X30$:    BRW     LINDON                  ; Go finish this line
  349. X
  350. X
  351. X
  352. XNOTDAT: MOVAL   WTFAB,R5                ; Get the FAB address
  353. X        CMPL    #PKRFM,R10              ; Check to see if this is record fmt
  354. X        BNEQ    NOTRFM                  ; If not then don't do this stuff
  355. X; Store the Record format (FIX, VAR, ...)
  356. X        JSB     CVTBIN                  ;
  357. X        $FAB_STORE FAB=R5,RFM=R10       ; Store the record format
  358. X        BRW     LINDON                  ; Go finish this line
  359. X
  360. XNOTRFM: CMPL    #PKRAT,R10              ; Check to see if this is record typ
  361. Ve
  362. X        BNEQ    NOTRAT                  ; If not then branch
  363. X; Store the record type (CR, ...)
  364. X        JSB     CVTBIN                  ;
  365. X        $FAB_STORE FAB=R5,RAT=R10       ; Store the record type
  366. X        BRW     LINDON                  ; Go finish this line
  367. X
  368. XNOTRAT: CMPL    #PKMRS,R10              ; Check to see if this is max record
  369. X        BNEQ    NOTMRS                  ;  size, branch if not
  370. X; Get the maximum record size (512. for tasks)
  371. X        JSB     CVTBIN                  ; Convert high order byte
  372. X        MOVL    R10,R3                  ; Save it
  373. X        ASHL    #8.,R3,R3               ; Shift it to the high order byte
  374. X        JSB     CVTBIN                  ; Convert low order byte
  375. X        BISL    R10,R3                  ; Put low order word into R3 also
  376. X        $FAB_STORE FAB=R5,MRS=R3        ; Store the maximum record size
  377. X        BRW     LINDON                  ; Go finish this line
  378. X
  379. XNOTMRS: CMPL    #PKALQ,R10              ; Check to see if this is allocation
  380. X        BNEQ    NOTALQ                  ; If not then branch
  381. X; Get the file length (in blocks)
  382. X        JSB     CVTBIN                  ; Convert high order byte
  383. X        MOVL    R10,R3                  ; Save it
  384. X        ASHL    #8.,R3,R3               ; Shift it to the high order byte
  385. X        JSB     CVTBIN                  ; Convert low order byte
  386. X        BISL    R10,R3                  ; Put low order word into R3 also
  387. X        MOVZWL  R3,ALQLOC               ; Save it
  388. X        $FAB_STORE FAB=R5,ALQ=ALQLOC    ; Store the allocation
  389. X        BRW     LINDON                  ; Go finish this line
  390. X
  391. XNOTALQ: CMPL    #PKFILNM,R10            ; Check to see if this is file name
  392. X        BNEQ    NOTFILNM                ; If not then branch
  393. X; Get the file name
  394. X        MOVL    LENGTH,R2               ; Get the length
  395. X        $FAB_STORE FAB=R5,FNS=R2        ; Store the file name length
  396. X        MOVAB   OUT.N,R3                ; Get the output file name address
  397. X25$:    JSB     CVTBIN                  ; Convert next character of the name
  398. X        MOVB    R10,(R3)+               ; Save the character
  399. X        SOBGTR  R2,25$                  ; Repeat until all done
  400. X        MOVAB   M$CRLF,R10              ;
  401. X        MOVZBL  #L$CRLF,R1              ;
  402. X        JSB     WRITE                   ; Output a return/line feed
  403. X        MOVAB   OUT.N,R10               ;
  404. X        MOVL    LENGTH,R1               ;
  405. X        JSB     WRITE                   ; Output the file name
  406. X        MOVAB   M$CRLF,R10              ;
  407. X        MOVZBL  #L$CRLF,R1              ;
  408. X        JSB     WRITE                   ; Output a return/line feed
  409. X        BRW     LINDON                  ; Go finish this line
  410. X
  411. X
  412. X
  413. XNOTFILNM:
  414. X        CMPL    #PKEOF,R10              ; Check to see if this is end of tas
  415. Vk
  416. X        BNEQ    NOTPKEOF                ; If not then branch
  417. X; End of ouput file record found
  418. X        JSB     CLTSK                   ; Close the task file
  419. X        CLRL    WTCOUNT                 ; Initialize the pointer
  420. X        CLRL    ADDRESS                 ; Initialize the address
  421. X        JMP     LINDON                  ; Go finish this line
  422. X
  423. X; Unknown code
  424. XNOTPKEOF:                               ; Since we don't know what the code
  425. X        MOVAB   M$UN,R10                ;   just send the unknown code text
  426. V to
  427. X        MOVZBL  #L$UN,R1                ;   the terminal
  428. X        JSB     WRITE                   ;
  429. X        JMP     DOLIN                   ; Go do next input line
  430. X
  431. X
  432. X        .SBTTL  Finished with this line
  433. X
  434. X; Line processed without a problem
  435. XLINDON:
  436. X;       MOVAB   M$AK,R10                ; Get the data address of the
  437. X                                        ;  single character
  438. X;       MOVZBL  #1,R1                   ; Only write single char to terminal
  439. X;       JSB     WRITE                   ; Write to the terminal
  440. X        JMP     DOLIN                   ; Good so do next line
  441. X
  442. X
  443. X        .SBTTL  Finish up
  444. X;++
  445. X;Finish up
  446. X;--
  447. XFINISH:
  448. X; Close the file(s)
  449. X        JSB     CLTSK                   ; Close the task file if it isn't ye
  450. Vt
  451. X        MOVAL   RDFAB,R1                ; Get FAB for input file
  452. X        $CLOSE  R1                      ; Close the input file
  453. X        JSB     RMSERR                  ; Check for file error
  454. XEND:    MOVL    #SS$_NORMAL,R0          ; Set up successful completion
  455. X        RET
  456. X
  457. X        .SBTTL  Close file
  458. X
  459. X;++
  460. X; Close the output file if there is one open
  461. X;
  462. X; If there is an error the program stops with an RMS error
  463. X;
  464. X; Registers destroyed:  R0, R1
  465. X; The OPENFL state is changed to file not open (OPENFL=0).
  466. X;--
  467. X
  468. XCLTSK:  TSTL    OPENFL                  ; See if the task file is open
  469. X        BEQL    10$                     ; If not then just return
  470. X
  471. X; Write last buffer if needed
  472. X        TSTL    WTCOUNT                 ; See if there is any data not writt
  473. Ven
  474. X        BEQL    8$                      ; If not then branch
  475. X        MOVAL   WTRAB,R1                ; Get the RAB address
  476. X        $RAB_STORE RAB=R1,RSZ=WTCOUNT   ; Put its size into the RAB.
  477. X        $WRITE  R1                      ; Put the buffer of data.
  478. X        JSB     RMSERR                  ; Check for file error
  479. X
  480. X; Close the file
  481. X8$:     MOVAL   WTFAB,R1                ; Get FAB for output file
  482. X        $CLOSE  R1                      ; Close output file
  483. X        JSB     RMSERR                  ; Check for file error
  484. X        CLRL    OPENFL                  ; Set the state to file not open
  485. X10$:    RSB                             ; Return to sender
  486. X
  487. X
  488. X        .SBTTL  Output and input to/from terminal
  489. X;++
  490. X; Write data to terminal.
  491. X;       R10     Address of data to output
  492. X;       R1      Length of data
  493. X;--
  494. XWRITE:
  495. X        MOVW    R1,MSGDSC               ; Store the length in the descript b
  496. Vlk
  497. X        MOVL    R10,ADDR                ; Store the address of the ASCII
  498. X        PUSHAQ  MSGDSC                  ; Push the descriptor block address
  499. X        CALLS   #1,G`5ELIB$PUT_OUTPUT     ; Do the output
  500. X        RSB                             ; Return to sender
  501. X
  502. X;++
  503. X; Read from the terminal
  504. X;       R10     Address of buffer
  505. X;       R1      Number of characters to read
  506. X;       R11     Input prompt address
  507. X;       R12     Length of prompt
  508. X;
  509. X;Returned:
  510. X;       R0      Number of characters read
  511. X;--
  512. XREAD:
  513. X        MOVL    R1,INP_STR_D            ; Store the buffer length in desc bl
  514. Vock
  515. X        MOVL    R10,INP_BUF             ; Store the buffer address in desc b
  516. Vlk
  517. X        MOVL    R11,ADDR                ; Store prompt address in desc block
  518. X        MOVW    R12,MSGDSC              ; Store length in desctriptor block
  519. X        PUSHAB  INP_STR_LEN             ; Address for string length
  520. X        PUSHAQ  MSGDSC                  ; Push address of prompt descriptor
  521. V blk
  522. X        PUSHAB  INP_STR_D               ; String buffer descriptor
  523. X        CALLS   #3,G`5ELIB$GET_INPUT      ; Get input string value
  524. X        MOVL    INP_STR_LEN,R0          ; Get actual input length back
  525. X        RSB                             ; Return to sender
  526. X
  527. X
  528. X        .SBTTL  RMS error routine
  529. X;++
  530. X;Check for RMS error
  531. X; Call with:            R0      Status of last RMS call (automatically store
  532. Vd
  533. X;                                 in R0 by RMS after an operation)
  534. X;
  535. X; Returned:             R0      Status
  536. X; Registers destroyed:  R0
  537. X; Program stops after error message is displayed if there is any type of err
  538. Vor.
  539. X;--
  540. XRMSERR:
  541. X        BLBC    R0,60$                  ; If error, go check it out
  542. X        MOVL    #KNORMAL,R0             ; Set up a successful return code.
  543. X        RSB                             ; Return to caller
  544. X
  545. X; Here if there is an RMS error we don't know how to handle
  546. X60$:    PUSHL   R0                      ; Save the error code
  547. X        MOVAB   M$RMS,R10               ; Get the address and length of the
  548. X        MOVL    #L$RMS,R1               ;   message to output
  549. X        JSB     WRITE                   ; Output it
  550. X        POPL    R0                      ; Get the error code back
  551. X        RET                             ; Exit program
  552. X
  553. X
  554. X        .SBTTL  Open the output file
  555. X;++
  556. X; Create and open the output file and set the file open flag
  557. X;
  558. X; Registers destroyed:  R0, R1
  559. X; Program stops after error message is displayed if there is any type of err
  560. Vor.
  561. X;--
  562. X
  563. XOPEN:   MOVL    #TRUE,OPENFL            ; State that the file is open
  564. X        MOVAL   WTFAB,R1                ; Put address of FAB into R1.
  565. X        $FAB_STORE FAB=R1,FAC=<BIO,GET> ; Set the block I/O in FAB.
  566. X        ;$FAB_STORE FAB=R1,FOP=CTG      ; Tell RMS to make the task contiguo
  567. Vus
  568. X        $CREATE #WTFAB                  ; Create the file
  569. X        JSB     RMSERR                  ; Check for file error
  570. X        MOVAL   WTRAB,R1                ; Put address of RAB into R1.
  571. X; Put address of user buffer and record buffer and sizes into RAB
  572. X        $RAB_STORE RAB=R1,UBF=WTBUF,RBF=WTBUF,USZ=#512.,RSZ=#512.
  573. X        $CONNECT #WTRAB                 ; Connect to record.
  574. X        JSB     RMSERR                  ; Check for file error
  575. X        RSB                             ; Return to sender
  576. X
  577. X        .SBTTL  Put a character to the file
  578. X;++
  579. X; Put a character to the output file.
  580. X; The buffer is only written when 512. characters have been sent to the rout
  581. Vine
  582. X; If the file does not end on a boundary then the buffer will have to be
  583. X; written by some other routine.
  584. X;
  585. X; Call with:            R10     Contains the character to be put into file
  586. X; Registers destroyed:  R1, R10
  587. X;
  588. X; Program stops after error message is displayed if there is any type of err
  589. Vor.
  590. X;--
  591. X
  592. XPUT:    PUSHL   R10                     ; Save the character
  593. X        MOVL    WTCOUNT,R10             ; Get the offset into the buffer
  594. X        MOVB    (SP),WTBUF(R10)         ; Put the character
  595. X        TSTL    (SP)+                   ; Restore the stack
  596. X        INCL    WTCOUNT                 ; Increment the offset into the buff
  597. Ver
  598. X        CMPL    WTCOUNT,#512.           ; Check to see if we are past the en
  599. Vd
  600. X        BNEQ    10$                     ; If not then branch
  601. X        MOVAL   WTRAB,R1                ; Get the RAB address
  602. X        $RAB_STORE RAB=R1,RSZ=WTCOUNT   ; Put its size into the RAB.
  603. X        $WRITE  R1                      ; Put the buffer of data.
  604. X        JSB     RMSERR                  ; Check for file error
  605. X        CLRL    WTCOUNT                 ; Clear the pointer
  606. X10$:    RSB                             ; Return to sender
  607. X
  608. X        .SBTTL   Convert to binary
  609. X;++
  610. X; Convert 2 hexidecimal digits to binary
  611. X; Input is from the input buffer pointed to by R4 (it is incremented twice)
  612. X;
  613. X; Call with:            R4      The pointer into the input buffer
  614. X; Returned:             R10     The binary walue
  615. X; Registers destroyed:  R10,R1
  616. X;--
  617. X
  618. XCVTBIN:
  619. X        CLRL    R10                     ; Clear R10 for the BISB
  620. X        BISB    (R4)+,R10               ; Get the next digit
  621. X        JSB     BIN                     ;   in place and convert to binary
  622. X        ASHL    #4,R10,R10              ; Multiply the result by 16
  623. X        MOVL    R10,R1                  ;  and save it
  624. X        CLRL    R10                     ; Clear R10
  625. X        BISB    (R4)+,R10               ; Get the next digit
  626. X        JSB     BIN                     ; Convert to binary
  627. X        BISL    R1,R10                  ; Set the correct bits for high orde
  628. Vr
  629. X        ADDL2   R10,CHKSUM              ; Add the value to the checksum
  630. X        RSB                             ; Return to sender
  631. X
  632. XBIN:    CMPL    R10,#`5EA/9/              ; Check to see if above '9
  633. X        BLEQ    1$                      ; If not then branch
  634. X        SUBL2   #HEXOFFSET,R10          ; Subtract offset to alphabet
  635. X1$:     SUBL2   #48.,R10                ; Make binary
  636. X        RSB                             ; Return to sender
  637. X
  638. X
  639. X        .SBTTL  Receive a line of data
  640. X
  641. X;++
  642. X; This will get a line of data from the input device
  643. X;
  644. X; Returned:             R4      Address of start of data buffer
  645. X; Registers destroyed:  R0, R1, R3, R4
  646. X;
  647. X; A checksum error will cause a NAK to be sent and input to be read again
  648. X; A real error will cause an error message to be output and the program to s
  649. Vtop
  650. X;--
  651. X
  652. XRECEIVE:
  653. X; Here to read from a file
  654. X        MOVAL   RDRAB,R1                ; Get the RAB address
  655. X        $GET    R1                      ; Get the record
  656. X        JSB     RMSERR                  ; Check for file error
  657. X        MOVZWL  #MAX.MSG,R3             ; Assume we got a full buffer
  658. X; Here to check the data we got
  659. XRECCHK: MOVAL   RDBUF,R4                ; Get the address of the information
  660. X        CLRL    R1                      ; Clear the data start address
  661. X80$:    BICB    #MSB,(R4)               ; Clear parity bit
  662. X        SUBB3   #RCV.SOH,(R4)+,R0       ; Check for start of header
  663. X        BLSS    81$                     ; If not, just keep going
  664. X        CMPB    R0,#2                   ; There are 3 possible headers
  665. X        BGTR    81$                     ; Not a header
  666. X        MOVZBL  R0,LNGADR               ; Amount of extra bytes in the addre
  667. Vss
  668. X        MOVL    R4,R1                   ; Start of header so save it
  669. X81$:    SOBGTR  R3,80$                  ; Repeat until done
  670. X        TSTL    R1                      ; Check to see if we got a SOH
  671. X        BNEQ    85$                     ; If good then skip the jump
  672. X        JMP     RECEIVE                 ; If not then re-read
  673. X85$:    MOVL    R1,R4                   ; Move to R4 for use
  674. X        PUSHL   R4                      ; Save SOH pointer on stack
  675. X
  676. X        JSB     CVTBIN                  ; Convert all to binary to see if
  677. X                                        ;   checksum is correct
  678. X        MOVL    R10,R3                  ; Get the length of data
  679. X        ADDL2   #4,R3                   ; Add the length of address and fiel
  680. Vd
  681. X                                        ;   type and checksum
  682. X        ADDL2   LNGADR,R3               ; If long address, skip more bytes
  683. X        BLSS    94$                     ; If we have a negative number then
  684. X                                        ;   must have been a bad length
  685. X        CMPL    R3,#MAX.MSG/2-1         ; If we got some length that is out
  686. V of
  687. X        BGEQ    94$                     ;   range then NAK right away
  688. X92$:    JSB     CVTBIN                  ; Convert all to binary to see if
  689. X        SOBGTR  R3,92$                  ;   the checksum is OK
  690. X93$:    BICL    #LEFTBYTE,CHKSUM        ; We only want an 8 bit checksum
  691. X        TSTL    CHKSUM                  ; Test for a zero checksum
  692. X        BEQL    95$                     ; If OK then exit normally
  693. X94$:    CLRL    CHKSUM                  ; Clear the checksum for the line
  694. X        MOVAL   M$NAK,R10               ; Get the address of the message
  695. X        MOVZBL  #L$NAK,R1               ; Only write the first character to
  696. X        JSB     WRITE                   ;   the terminal
  697. X        TSTL    (SP)+                   ; Pull the pointer off the stack
  698. X        JMP     RECEIVE                 ; Try to get the line again
  699. X
  700. X; Return to sender
  701. X95$:    POPL    R4                      ; Get the pointer back
  702. X        RSB                             ; Return to sender
  703. X
  704. X
  705. X        .SBTTL  End of the Dehexify
  706. X
  707. X        .END    DEHEX
  708. $ CALL UNPACK VMSDEH.MAR;1 53467680
  709. $ create 'f'
  710. X$`09if p1 .eqs. "LINK" then goto 10$
  711. X$`09fortran 'p1' funadv
  712. X$`09fortran 'p1' bug
  713. X$`09fortran 'p1' carry
  714. X$`09fortran 'p1' drop
  715. X$`09fortran 'p1' getin
  716. X$`09fortran 'p1' image_dir
  717. X$`09fortran 'p1' juggle
  718. X$`09fortran 'p1' ldcomn
  719. X$`09fortran 'p1' minpmid
  720. X$`09fortran 'p1' move
  721. X$`09fortran 'p1' pspeak
  722. X$`09fortran 'p1' put
  723. X$`09fortran 'p1' random
  724. X$`09fortran 'p1' rspeak
  725. X$`09fortran 'p1' speak
  726. X$`09fortran 'p1' svcomn
  727. X$`09fortran 'p1' vocab
  728. X$`09fortran 'p1' wizard
  729. X$`09fortran 'p1' yes
  730. X$`09pascal 'p1' shift
  731. X$`09pascal 'p1' user
  732. X$ 10$:
  733. X$`09link 'p2' funadv,bug,carry,drop,getin,image_dir,juggle,ldcomn,minpmid,-
  734. Xmove,pspeak,put,random,rspeak,speak,svcomn,vocab,wizard,yes,shift,user
  735. $ CALL UNPACK [.SRC]$BUILD.COM;1 1095441941
  736. $ create 'f'
  737. X      SUBROUTINE BUG(NUM)`20
  738. X `20
  739. X `20
  740. X*  THE FOLLOWING CONDITIONS ARE CURRENTLY CONSIDERED FATAL BUGS.  NUMBER
  741. X*  ARE DETECTED WHILE READING THE DATABASE; THE OTHERS OCCUR AT 'RUN TIM
  742. X*       0       MESSAGE LINE > 70 CHARACTERS
  743. X*       1       NULL LINE IN MESSAGE
  744. X*       2       TOO MANY WORDS OF MESSAGES
  745. X*       3       TOO MANY TRAVEL OPTIONS`20
  746. X*       4       TOO MANY VOCABULARY WORDS`20
  747. X*       5       REQUIRED VOCABULARY WORD NOT FOUND
  748. X*       6       TOO MANY RTEXT OR MTEXT MESSAGES
  749. X*       7       TOO MANY HINTS
  750. X*       8       LOCATION HAS COND BIT BEING SET TWICE`20
  751. X*       9       INVALID SECTION NUMBER IN DATABASE
  752. X*      20       SPECIAL TRAVEL (500>L>300) EXCEEDS GOTO LIST
  753. X*      21       RAN OFF END OF VOCABULARY TABLE`20
  754. X*      22       VOCABULARY TYPE (N/1000) NOT BETWEEN 0 AND 3
  755. X*      23       INTRANSITIVE ACTION VERB EXCEEDS GOTO LIST
  756. X*      24       TRANSITIVE ACTION VERB EXCEEDS GOTO LIST
  757. X*      25       CONDITIONAL TRAVEL ENTRY WITH NO ALTERNATIVE
  758. X*      26       LOCATION HAS NO TRAVEL ENTRIES
  759. X*      27       HINT NUMBER EXCEEDS GOTO LIST`20
  760. X*      28       INVALID MONTH RETURNED BY DATE FUNCTION`20
  761. X*`20
  762. X `20
  763. X      WRITE(6,1)NUM`20
  764. X    1 FORMAT (' FATAL ERROR, See source code for interpretation.',/`20
  765. X     $' Probably cause: Erroneous info in database.',/
  766. X     $' Error code =',I2/)
  767. X      STOP
  768. X      END`20
  769. $ CALL UNPACK [.SRC]BUG.FOR;2 1901143241
  770. $ create 'f'
  771. X      SUBROUTINE CARRY(OBJECT,WHERE)
  772. X `20
  773. X*  START TOTING AN OBJECT, REMOVING IT FROM THE LIST OF THINGS AT ITS FO
  774. X*  LOCATION.  INCR HOLDNG UNLESS IT WAS ALREADY BEING TOTED.  IF OBJECT>
  775. X*  (MOVING 'FIXED' SECOND LOC), DON'T CHANGE PLACE OR HOLDNG.`20
  776. X `20
  777. X      IMPLICIT INTEGER(A-Z)`20
  778. X      COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,COND,PROP,LOC,LAMP,HOLDNG
  779. X      DIMENSION PROP(100), LINK(200), PLACE(100), FIXED(100)
  780. X      DIMENSION ATLOC(220), COND(220)`20
  781. X `20
  782. X      IF(OBJECT.GT.100)GOTO 5`20
  783. X      IF(PLACE(OBJECT).EQ.-1)RETURN`20
  784. X      PLACE(OBJECT)=-1
  785. X      HOLDNG=HOLDNG+1`20
  786. X    5 IF(ATLOC(WHERE).NE.OBJECT)GOTO 6
  787. X      ATLOC(WHERE)=LINK(OBJECT)`20
  788. X      RETURN
  789. X    6 TEMP=ATLOC(WHERE)`20
  790. X    7 IF(LINK(TEMP).EQ.OBJECT)GOTO 8
  791. X      TEMP=LINK(TEMP)`20
  792. X      GOTO 7
  793. X    8 LINK(TEMP)=LINK(OBJECT)`20
  794. X      RETURN
  795. X      END`20
  796. $ CALL UNPACK [.SRC]CARRY.FOR;1 1177761983
  797. $ create 'f'
  798. X      SUBROUTINE DROP(OBJECT,WHERE)`20
  799. X `20
  800. X*  PLACE AN OBJECT AT A GIVEN LOC, PREFIXING IT ONTO THE ATLOC LIST. DECREAS
  801. VING`20
  802. X*  HOLDNG IF THE OBJECT WAS BEING TOTED.
  803. X `20
  804. X      IMPLICIT INTEGER(A-Z)`20
  805. X      COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,COND,PROP,LOC,LAMP,HOLDNG
  806. X      DIMENSION PROP(100), LINK(200), PLACE(100), FIXED(100)
  807. X      DIMENSION ATLOC(220), COND(220)`20
  808. X `20
  809. X      IF(OBJECT.GT.100)GOTO 1`20
  810. X      IF(PLACE(OBJECT).EQ.-1)HOLDNG=HOLDNG-1
  811. X      PLACE(OBJECT)=WHERE`20
  812. X      GOTO 2
  813. X    1 FIXED(OBJECT-100)=WHERE`20
  814. X    2 IF(WHERE.LE.0)RETURN
  815. X      LINK(OBJECT)=ATLOC(WHERE)`20
  816. X      ATLOC(WHERE)=OBJECT`20
  817. X      RETURN
  818. X      END`20
  819. $ CALL UNPACK [.SRC]DROP.FOR;1 476067950
  820. $ create 'f'
  821. X***        ******  *      *** ****** ***      * ******* ***   * ******  ****
  822. V**
  823. X****       ***   *  *     *** ***    ****     *   ***   ***   * ***   * ***`
  824. V20
  825. X*** *      ***   *   *    *** ***    *** *    *   ***   ***   * ***   * ***`
  826. V20
  827. X***  *     ***   *    *   *** ***    ***  *   *   ***   ***   * ***   * ***`
  828. V20
  829. X*******    ***   *     *  *** ****** ***   *  *   ***   ***   * ******  ****
  830. V**
  831. X***    *   ***   *      * *** ***    ***    * *   ***   ***   * *** *   ***`
  832. V20
  833. X***     *  ***   *       **** ***    ***     **   ***   ***   * ***  *  ***`
  834. V20
  835. X***      * ******         *** ****** ***      *   ***    *****  ***   * ****
  836. V**
  837. X `20
  838. X `20
  839. X      PROGRAM FunAdv
  840. X
  841. X***** FunAdv for VAX/VMS.
  842. X*     C. T. Smith, Jr.    89/02/24.
  843. X*
  844. X*     This version of Adventure has passed through many hand, including
  845. X*     Gary M. Palter (MIT), Charles B. Fulghum (GIT), John West (GIT),
  846. X*     and most recently Neal White III, who added quite a few differences
  847. X*     between the original program and this new version.
  848. X*
  849. X*     Computer lore has it that adventure was originally developed at MIT
  850. X*     under MULTICS.  A version was translated to fortran, which since has
  851. X*     since spread throughout the computer world, from mainframes to PCs.`20
  852. X*     Many years ago, a copy made its way to Georgia Tech, and was hacked`20
  853. X*     to run on the CDC Cyber systems installed there about 1975.
  854. X*
  855. X*     The sources came into Neal's hands some years later.  He changed the
  856. X*     code a bit, changed some features, added others, modified the database
  857. X*     format slightly...still, the basic design of the program was not chang
  858. Ved
  859. X*     very much.  The original source was written back in the good old days
  860. X*     before fortran had things like a character type and strings, and all
  861. X*     text was stored as integers.  It was clear from the source that at
  862. X*     one point, the program had been implemented on a machine that packed
  863. X*     five characers to a word.  The cyber systems packed 10 characters to
  864. X*     the word - sixbit characters.  Both of these implementations still
  865. X*     were clearly present in the source I started from.
  866. X*
  867. X*     As of this writing, there is still no conversiosn guide, and again,
  868. X*     the programs have seen quite a few changes while being moved to the Va
  869. Vx.
  870. X*     In particular, the game text is no longer stored in an integer`20
  871. X*     array, though the data structure holding the text still has`20
  872. X*     similarities to the integer implementation.  Also, when we deal
  873. X*     with alpha data, the fortran CHARACTER type is used, rather than
  874. X*     integer.  These changes should make it easier to transport the`20
  875. X*     program, as the major hassle in doing this conversion were removing
  876. X*     all the places where so many characters could be packed in an`20
  877. X*     integer.  Due to it's cyber heritage, words can be up to 10
  878. X*     characters long.  From the source I started with, its also apparent
  879. X*     that this program passed through a machine with 5 characters`20
  880. X*     per integer, but much of this has been smoothed out in moving things
  881. X*     to a character data type.
  882. X*
  883. X*     Also, along the way, the text in the data base and program was
  884. X*     changed to mixed case from upper case only.`20
  885. X*
  886. X*     Questions, problems, and bug reports should be sent to:
  887. X*
  888. X*         Charles T. Smith, Jr.
  889. X*
  890. X*         Internet:    cts@dragon.com
  891. X*         U.S. Mail:   2710 Regal Way  \  Tucker, GA  30084  \  USA
  892. X*
  893. X*     And, if you happen to have a copy of the conversion guide, or`20
  894. X*     other versions of adventure, especally versions with greater than
  895. X*     500 points, I'd love to have a copy for my collection.
  896. X*
  897. X*     Enjoy!
  898. X*
  899. X
  900. X***   Original Author info.
  901. X*
  902. X*     FURTHER INFORMATION WILL BE FOUND IN THE CONVERSION GUIDE ACCOMPANYING
  903. V`20
  904. X*     THIS PROGRAM.  FOR STILL FURTHER INFORMATION, CONTACT:`20
  905. X*         GARY M. PALTER, MIT    (617) 253-7728`20
  906. X*                (PALTER@MIT-MULTICS)`20
  907. X*`20
  908. X*     SINCE THERE IS NO CONVERSION GUIDE, AND I HAVE CHANGED THIS PROGRAM
  909. X*     IN MANY OBSCURE WAYS. TRY CONTACTING: `20
  910. X*         NEAL WHITE III, GIT    (404) 436-1789`20
  911. X*         P. O. BOX 31011`20
  912. X*         GEORGIA TECH
  913. X*         ATLANTA, GEORGIA 30332
  914. X `20
  915. X
  916. X
  917. X**    Things to do:
  918. X*
  919. X*      1)  Disable control C/Y.
  920. X*
  921. X
  922. X
  923. X`0C
  924. X***   ADVENTURE
  925. X*`20
  926. X*     CURRENT LIMITS: `20
  927. X*
  928. X*        2000 LINES OF MESSAGE TEXT (LINES, LINSIZ).
  929. X*        1500 TRAVEL OPTIONS (TRAVEL, TRVSIZ)`20
  930. X*         400 VOCABULARY WORDS (KTAB, ATAB, TABSIZ).
  931. X*         220 LOCATIONS (LTEXT, STEXT, KEY, COND, ABB, ATLOC, LOCSIZ).
  932. X*         100 OBJECTS (PLAC, PLACE, FIXD, FIXED, LINK (TWICE), PTEXT, PROP).
  933. X*          35 'ACTION' VERBS (ACTSPK, VRBSIZ).
  934. X*         250 RANDOM MESSAGES (RTEXT, RTXSIZ).
  935. X*          12 DIFFERENT PLAYER CLASSIFICATIONS (CTEXT, CVAL, CLSMAX).`20
  936. X*          20 HINTS, LESS 3 (HINTLC, HINTED, HINTS, HNTSIZ).
  937. X*           2 OBJECTS WHICH MAY BE WORN (WEARING).
  938. X*
  939. X*     THERE ARE ALSO LIMITS WHICH CANNOT BE EXCEEDED DUE TO THE STRUCTURE OF
  940. V`20
  941. X*     THE DATABASE.  (E.G., THE VOCABULARY USES N/1000 TO DETERMINE WORD TYP
  942. VE,`20
  943. X*     SO THERE CAN'T BE MORE THAN 1000 WORDS.)  THESE UPPER LIMITS ARE: `20
  944. X*
  945. X*        1000 NON-SYNONYMOUS VOCABULARY WORDS`20
  946. X*         300 LOCATIONS`20
  947. X*         100 OBJECTS`20
  948. X*
  949. X`0C
  950. X `20
  951. X      IMPLICIT INTEGER(A-Z)`20
  952. X
  953. X      STRUCTURE /TEXTYPE/
  954. X        Integer*4 count
  955. X        Character*80 string
  956. X      end structure
  957. X
  958. X      LOGICAL DSEEN,BLKLIN,HINTED,YES`20
  959. X      LOGICAL WIZARD
  960. X      LOGICAL TOTING,HERE,AT,BITSET,DARK,WZDARK,LMWARN,CLOSNG,PANIC,
  961. X     $CLOSED,GAVEUP,SCORNG,FORCED,PCT`20
  962. X      LOGICAL WIZKID,LOOSE,ROW,LIT,BFULL,ONCE,WEARING(2),YESCALL
  963. X
  964. X      record /textype/ lines`20
  965. X
  966. X      Character*80 text, incheck `20
  967. X      Character*10 Atab
  968. X      Character*10 WD1, WD2
  969. X      Character*128 filedir
  970. X      Real Secnds
  971. X
  972. X**    Note.
  973. X*
  974. X*     All information to be "saved" between games must be in common
  975. X*     blocks and between /AAAAAA/ and /ZZZZZZ/!
  976. X*
  977. X
  978. X      COMMON /AAAAAA/ CORE(1)`20
  979. X      COMMON /TXTCOM/ RTEXT,LINES,LINUSE
  980. X      COMMON /VOCCOM/ TABSIZ,KTAB,ATAB
  981. X      COMMON /PLACOM/ ATLOC,LINK,PLACE,FIXED,COND,PROP,LOC,LAMP,HOLDNG
  982. X      COMMON /PTXCOM/ PTEXT`20
  983. X      COMMON /STXCOM/ TEXT
  984. X      COMMON /IOSCOM/ BLKLIN,YESCALL
  985. X      COMMON /VARCOM/ WIZKID,ABB,ABBNUM,ACTSPK,ATTACK,AXE,BACK,BATTER,
  986. X     $BEAR,BFULL,BOAT,BOATPOS,BOOK,BOTTLE,CAVE,CHAIN,CHAIR,
  987. X     $CHASM,CHEST,CHLOC,CHLOC2,CLAM,
  988. X     $CLOCK1,CLOCK2,CLOSED,CLOSNG,CLSMAX,CLSSES,COAL,COINS,CTEXT,CVAL,
  989. X     $DALTLC,DETAIL,DFLAG,DKILL,DLOC,DOOR,
  990. X     $DPRSSN,DRAGON,DSEEN,DTOTAL,DWARF,
  991. X     $EGGS,EMRALD,ENTRNC,FIND,FISSUR,FIXD,FOOBAR,FOOD,FOUNTN,GAVEUP,
  992. X     $GO2,GRATE,HINT,HINTED,HINTLC,HINTM3,HINTS,HLDMAX,HNTMAX,HNTSIZ,`20
  993. X     $INVENT,IWEST,KEY,KEYS,KNFLOC,KNIFE,K1,K2,
  994. X     $LIMIT,LISTING,LIT,LL,LMWARN,LOCK,
  995. X     $LOCSIZ,LOOK,LOOSE,LTEXT,MAGZIN,MAIL,MAXTRS,MESSAG,MIRROR,MISTS,
  996. X     $MONGOOS,NEWLOC,NUGGET,NULL,NUMDIE,MAXDIE,ODLOC,OFF,OIL,OLDLC2,
  997. X     $OLDLOC,ON,ONCE,OOPS,OYSTER,PANIC,PEARL,PILLOW,PLAC,PLANT,PLANT2,
  998. X     $POTION,PYRAM,RING,RINGLOC,RIVLOC,
  999. X     $ROD,ROD2,ROPE,ROW,RTXSIZ,RUG,RUNES,SACK,
  1000. X     $SAVED,SAY,SCORE,SCORNG,SETUP,SHIT,sit,SNAKE,SPICES,SPK,STEPS,STEXT,`20
  1001. X     $STICK,SUSPND,SWITCH,TABLET,TABNDX,TALLY,TALLY2,THROW,TRAP,TRAVEL,
  1002. X     $TRIDNT,TROLL,TROLL2,TRSURE,TRVS,TRVSIZ,TURNS,VASE,VEND,VRBSIZ,
  1003. X     $WAITNG,WATER,WEARING,WHERE,WZDARK,XXM,YYM
  1004. X
  1005. X      common /seed/ seed
  1006. X      COMMON /USER/   USERNUM`20
  1007. X      COMMON /ZZZZZZ/ THEEND
  1008. X
  1009. X      DIMENSION LINES(2000), TRAVEL(1500), RIVLOC(8)`20
  1010. X      DIMENSION KTAB(400), ATAB(400)
  1011. X      DIMENSION LTEXT(220), STEXT(220), KEY(220), COND(220), ABB(220),
  1012. X     $ATLOC(220)
  1013. X      DIMENSION PLAC(100),PLACE(100),FIXD(100),FIXED(100),LINK(200),
  1014. X     $PTEXT(100),PROP(100)
  1015. X      DIMENSION ACTSPK(35), RTEXT(250)
  1016. X      DIMENSION CTEXT(12),CVAL(12)
  1017. X      DIMENSION HINTLC(20),HINTED(20),HINTS(20,4)`20
  1018. X      DIMENSION TK(20),DSEEN(8),DLOC(8),ODLOC(8)
  1019. X `20
  1020. X      DATA LINSIZ/2000/, TRVSIZ/1500/, LOCSIZ/220/, VRBSIZ/35/,
  1021. X     $RTXSIZ/250/, CLSMAX/12/, HNTSIZ/20/`20
  1022. X
  1023. X`0C `20
  1024. X**    STATEMENT FUNCTIONS
  1025. X*`20
  1026. X*     TOTING(OBJ)  = TRUE IF THE OBJ IS BEING CARRIED
  1027. X*     HERE(OBJ)    = TRUE IF THE OBJ IS AT 'LOC' (OR IS BEING CARRIED)`20
  1028. X*     AT(OBJ)      = TRUE IF ON EITHER SIDE OF TWO-PLACED OBJECT`20
  1029. X*     LIQ(DUMMY)   = OBJECT NUMBER OF LIQUID IN BOTTLE`20
  1030. X*     LIQLOC(LOC)  = OBJECT NUMBER OF LIQUID (IF ANY) AT LOC`20
  1031. X*     BITSET(L,N)  = TRUE IF COND(L) HAS BIT N SET (BIT 0 IS UNITS BIT)
  1032. X*     FORCED(LOC)  = TRUE IF LOC MOVES WITHOUT ASKING FOR INPUT (COND=2)`20
  1033. X*     DARK(DUMMY)  = TRUE IF LOCATION 'LOC' IS DARK
  1034. X*     PCT(N)       = TRUE N% OF THE TIME (N INTEGER FROM 0 TO 100)`20
  1035. X `20
  1036. X      TOTING(OBJ)=PLACE(OBJ).EQ.-1
  1037. X      HERE(OBJ)=PLACE(OBJ).EQ.LOC.OR.PLACE(OBJ).LT.0
  1038. X      AT(OBJ)=PLACE(OBJ).EQ.LOC.OR.FIXED(OBJ).EQ.LOC
  1039. X      LIQ2(PBOTL)=(1-PBOTL)*WATER+(PBOTL/2)*(WATER+OIL)`20
  1040. X      LIQ(DUMMY)=LIQ2(MAX0(PROP(BOTTLE),-1-PROP(BOTTLE)))`20
  1041. X      LIQLOC(LOC)=LIQ2((MOD(COND(LOC)/2*2,8)-5)*MOD(COND(LOC)/4,2)+1)`20
  1042. X      BITSET(L,N)=(COND(L).AND.SHIFT(1,N)).NE.0
  1043. X      FORCED(LOC)=COND(LOC).EQ.2
  1044. X      DARK(DUMMY)=MOD(COND(LOC),2).EQ.0.AND.(PROP(LAMP).EQ.0.OR.
  1045. X     $.NOT.HERE(LAMP)).AND. .NOT. LIT`20
  1046. X      PCT(N)=random(100).LT.N
  1047. X
  1048. X`0C `20
  1049. X**    LOAD 'SYSTEM' COMMON BLOCKS.  THESE COMMON BLOCKS DEFINE THE STATE`20
  1050. X*     OF A GAME WHICH HAS YET TO BE STARTED...`20
  1051. X*`20
  1052. X*     NOTE: SETUP=0 MEANS READ IN THE DATABASE.
  1053. X*`20
  1054. X*`20
  1055. X      SETUP=0`20
  1056. X      CALL LDCOMN(.TRUE.,FLNAME)
  1057. X `20
  1058. X*     READ IN THE DATABASE IF WE HAVE NOT YET DONE SO.`20
  1059. X `20
  1060. X      IF(SETUP.NE.0) GOTO 1100
  1061. X
  1062. X`0C `20
  1063. X***   DESCRIPTION OF THE DATABASE FORMAT`20
  1064. X*`20
  1065. X*`20
  1066. X*     THE DATA FILE CONTAINS SEVERAL SECTIONS. EACH BEGINS WITH A LINE CONTA
  1067. VINING
  1068. X*     A NUMBER IDENTIFYING THE SECTION, AND ENDS WITH A LINE CONTAINING '-1'
  1069. V.
  1070. X*`20
  1071. X*
  1072. X*
  1073. X*     SECTION 1: LONG FORM DESCRIPTIONS.  EACH LINE CONTAINS A LOCATION NUMB
  1074. VER,
  1075. X*        A TAB, AND A LINE OF TEXT.  THE SET OF (NECESSARILY ADJACENT) LINES
  1076. V.
  1077. X*        WHOSE NUMBERS ARE X FORM THE LONG DESCRIPTION OF LOCATION X.
  1078. X*
  1079. X*
  1080. X*     SECTION 2: SHORT FORM DESCRIPTIONS.  SAME FORMAT AS LONG FORM.  NOT AL
  1081. VL
  1082. X*        PLACES HAVE SHORT DESCRIPTIONS.`20
  1083. X*
  1084. X*
  1085. X*     SECTION 3: TRAVEL TABLE. EACH LINE CONTAINS A LOCATION NUMBER (X), A S
  1086. VECOND
  1087. X*        LOCATION NUMBER (Y), AND A LIST OF MOTION NUMBERS (SEE SECTION 4).
  1088. X*        EACH MOTION REPRESENTS A VERB WHICH WILL GO TO Y IF CURRENTLY AT X.
  1089. V`20
  1090. X*        Y, IN TURN, IS INTERPRETED AS FOLLOWS.  LET M=Y/1000, N=Y MOD 1000.
  1091. V`20
  1092. X*
  1093. X*               IF N<=300       IT IS THE LOCATION TO GO TO.
  1094. X*               IF 300<N<=500   N-300 IS USED IN A COMPUTED GOTO TO`20
  1095. X*                                       A SECTION OF SPECIAL CODE.
  1096. X*               IF N>500        MESSAGE N-500 FROM SECTION 6 IS PRINTED,
  1097. X*                                       AND HE STAYS WHEREVER HE IS.
  1098. X*
  1099. X*        MEANWHILE, M SPECIFIES THE CONDITIONS ON THE MOTION.
  1100. X*
  1101. X*               IF M=0          IT'S UNCONDITIONAL.`20
  1102. X*               IF 0<M<100      IT IS DONE WITH M% PROBABILITY.`20
  1103. X*               IF M=100        UNCONDITIONAL, BUT FORBIDDEN TO DWARVES.
  1104. X*               IF 100<M<=200   HE MUST BE CARRYING OBJECT M-100.`20
  1105. X*               IF 200<M<=300   MUST BE CARRYING OR IN SAME ROOM AS M-200.
  1106. X*               IF 300<M<=400   PROP(M MOD 100) MUST *NOT* BE 0.
  1107. X*               IF 400<M<=500   PROP(M MOD 100) MUST *NOT* BE 1.
  1108. X*               IF 500<M<=600   PROP(M MOD 100) MUST *NOT* BE 2, ETC.`20
  1109. X*
  1110. X*        IF THE CONDITION (IF ANY) IS NOT MET, THEN THE NEXT *DIFFERENT*`20
  1111. X*        'DESTINATION' VALUE IS USED (UNLESS IT FAILS TO MEET *ITS* CONDITIO
  1112. VNS,
  1113. X*        IN WHICH CASE THE NEXT IS FOUND, ETC.).  TYPICALLY, THE NEXT DEST W
  1114. VILL
  1115. X*        BE FOR ONE OF THE SAME VERBS, SO THAT ITS ONLY USE IS AS THE ALTERN
  1116. VATE
  1117. X*        DESTINATION FOR THOSE VERBS.  FOR INSTANCE:`20
  1118. X*
  1119. X*               15  110022      29      31      34      35      23
  1120. X*               15      14      29
  1121. X*
  1122. X*        THIS SAYS THAT, FROM LOC 15, ANY OF THE VERBS 29, 31, ETC., WILL TA
  1123. VKE`20
  1124. X*        HIM TO 22 IF HE'S CARRYING OBJECT 10, AND OTHERWISE WILL GO TO 14.
  1125. X*
  1126. X*               11  303008      49
  1127. X*               11       9      50
  1128. X*
  1129. X*        THIS SAYS THAT, FROM 11, 49 TAKES HIM TO 8 UNLESS PROP(3)=0, IN WHI
  1130. VCH`20
  1131. X*        CASE HE GOES TO 9.  VERB 50 TAKES HIM TO 9 REGARDLESS OF PROP(3).`2
  1132. V0
  1133. X*
  1134. X*
  1135. X*     SECTION 4: VOCABULARY.  EACH LINE CONTAINS A NUMBER (N), A TAB, AND A
  1136. X*        FIVE-LETTER WORD.  CALL M=N/1000.  IF M=0, THEN THE WORD IS A MOTIO
  1137. VN
  1138. X*        VERB FOR USE IN TRAVELLING (SEE SECTION 3).  ELSE, IF M=1, THE WORD
  1139. V IS
  1140. X*        AN OBJECT.  ELSE, IF M=2, THE WORD IS AN ACTION VERB (SUCH AS 'CARR
  1141. VY'`20
  1142. X*        OR 'ATTACK').  ELSE, IF M=3, THE WORD IS A SPECIAL CASE VERB (SUCH
  1143. V AS`20
  1144. X*        'DIG') AND N MOD 1000 IS AN INDEX INTO SECTION 6.  OBJECTS FROM 50
  1145. V TO`20
  1146. X*        (CURRENTLY, ANYWAY) 79 ARE CONSIDERED TREASURES(FOR PIRATE, CLOSEOU
  1147. VT).
  1148. X*        IF M=1 (OBJECT) THERE IS AN OBJECT LOCATION TABLE ATTACHED.  EACH L
  1149. VINE
  1150. X*        CONTAINS AN OBJECT'S INITIAL LOCATION (ZERO IF NONE).  IF AN OBJECT
  1151. V IS
  1152. X*        IMMOVABLE, THE LOCATION IS FOLLOWED BY A '-1'.  IF THE OBJECT HAS T
  1153. VWO`20
  1154. X*        LOCATIONS IT IS FOLLOWED BY THE SECOND LOCATION; IT IS ASSUMED TO B
  1155. VE
  1156. X*        IMMOVABLE.
  1157. X*
  1158. X*
  1159. X*     SECTION 5: OBJECT DESCRIPTIONS.  EACH LINE CONTAINS A NUMBER (N), A TA
  1160. VB,`20
  1161. X*        AND A MESSAGE.  IF N IS FROM 1 TO 100, THE MESSAGE IS THE 'INVENTOR
  1162. VY'`20
  1163. +-+-+-+-+-+-+-+-  END  OF PART 5 +-+-+-+-+-+-+-+-
  1164.