-
Notifications
You must be signed in to change notification settings - Fork 19
/
computerdefs.zil
92 lines (79 loc) · 2.57 KB
/
computerdefs.zil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"COMPUTERDEFS for BUREAUCRACY: Copyright (C)1987 Infocom, Inc.
All rights reserved."
<ZSECTION "COMPUTERDEFS">
<FILE-FLAGS MDL-ZIL?>
<INCLUDE "FORMDEFS">
<USE "NEWSTRUC">
<SET-DEFSTRUCT-FILE-DEFAULTS ('NTH ZGET) ('PUT ZPUT) ('START-OFFSET 0)
'NODECL>
<DEFINE-GLOBALS COMPUTER-GLOBALS
(LAST-LINE-USED:FIX BYTE 0)
(TIMES-THROUGH-LOOP:FIX BYTE 0)
(FILES-ON-SCREEN? BYTE <>)
(TELECOM? BYTE <>)
(EXITED-ALREADY? BYTE <>)
(COMPUTER-DEAD? BYTE <>)
(COMP-X:FIX BYTE 0)
(COMP-Y:FIX BYTE 0)
(CURRENT-TARGET-NAME <>) ; "String for interrupt messages"
(REAL-TARGET-NAME <>) ; "LTABLE for looking stuff up in directory"
(REMAINING-TARGET-TURNS:FIX BYTE 0) ; "Turns left until this one's done"
(LINES-TO-NEXT-TARGET:FIX BYTE 0) ;"Lines to output before select next target"
(TERMINATE-CURRENT:FIX BYTE 0) ; "Lines to output before terminating this one"
(COMMANDS-SINCE-START:FIX BYTE 0); "Command lines read since target started"
(DIE-ON-NEXT-COMMAND BYTE <>) ; "To avoid hair of faking non-local return"
(WILL-WIN? BYTE <>) ; "True if killed computer"
(FERROR-ACTIVE? BYTE <>)>
<MSETG COMPUTER-REAL-WIDTH 40>
<MSETG COMPUTER-WIDTH 38>
<MSETG COMPUTER-HEIGHT 16>
<MSETG COMPUTER-REAL-HEIGHT 19>
<MSETG COMPUTER-FIRST-LINE 3>
<MSETG COMPUTER-COMMAND-LINE 0>
<MSETG COMPUTER-ERROR-LINE 1>
<MSETG DIR-ENTRY-INVISIBLE 1>
<DEFSTRUCT DIR-ENTRY (TABLE ('NTH GETB) ('PUT PUTB))
(DIR-ROUTINE ANY 'NTH ZGET 'PUT ZPUT 'NONE) ; "Routine to call"
(DIR-BITS FIX 'NTH ZGET 'PUT ZPUT 0)
(DIR-HELP ANY 'NTH ZGET 'PUT ZPUT <>) ; "Brief help msg"
(DIR-DUMMY-1 ANY 'NONE)
(DIR-DUMMY-2 ANY 'NONE)
(DIR-DUMMY-3 ANY 'NONE)
(DIR-NAMLEN FIX)
(DIR-DATA ANY 'NONE)>
<MSETG DIR-DATA-OFFSET 7>
<MSETG DIR-HEADER-LEN 6>
; "Build a directory entry"
<DEFINE20 DIR-ENTRY (ROUTINE NAME:STRING HELP:ANY "TUPLE" BITS "AUX" DE (BW 0)
(PURE? T))
<COND (<AND <NOT <EMPTY? .BITS>>
<==? <1 .BITS> IMPURE>>
<SET PURE? <>>
<SET BITS <REST .BITS>>)>
<SET DE <CHTYPE <EVAL <FORM ITABLE <+ 1 ,DIR-HEADER-LEN <LENGTH .NAME>>
<COND (.PURE?
(BYTE PURE))
(T (BYTE))>>>
DIR-ENTRY>>
<MAPF <>
<FUNCTION (BIT)
<COND (<TYPE? .BIT FIX>)
(<AND <GASSIGNED? .BIT>
<TYPE? ,.BIT FIX>>
<SET BIT ,.BIT>)>
<COND (<TYPE? .BIT FIX>
<SET BW <ORB .BW .BIT>>)>>
.BITS>
<MAKE-DIR-ENTRY 'DIR-ENTRY .DE
'DIR-ROUTINE .ROUTINE
'DIR-HELP .HELP
'DIR-BITS .BW
'DIR-NAMLEN <LENGTH .NAME>>
<PROG ((N ,DIR-DATA-OFFSET))
<MAPF <>
<FUNCTION (CHR)
<PUTB .DE .N <ASCII .CHR>>
<SET N <+ .N 1>>>
.NAME>>
.DE>
<ENDSECTION>