From 33cbdd20408e319e8ffa60382fa9bf6cdbed7207 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Sun, 25 Feb 2024 11:48:35 -0800 Subject: [PATCH] Cowgol Improvements - Replaced COWFIX.COM with updated version - Added Adventure game source to disk image Credit and thanks to Ladislau Szilagyi. Co-Authored-By: ladislau szilagyi <87603175+Laci1953@users.noreply.github.com> --- Source/Images/d_cowgol/Readme.txt | 15 +- Source/Images/d_cowgol/u0/ADVENT.COW | 1284 ++++++++++ Source/Images/d_cowgol/u0/ADVENT.SUB | 2 + Source/Images/d_cowgol/u0/ADVENT1.TXT | 497 ++++ Source/Images/d_cowgol/u0/ADVENT2.TXT | 293 +++ Source/Images/d_cowgol/u0/ADVENT3.TXT | 269 +++ Source/Images/d_cowgol/u0/ADVENT4.TXT | 584 +++++ Source/Images/d_cowgol/u0/ADVMAIN.COW | 3105 +++++++++++++++++++++++++ Source/Images/d_cowgol/u0/COWFIX.COM | Bin 11776 -> 13952 bytes Source/Images/d_cowgol/u0/XRND.AS | 53 + 10 files changed, 6100 insertions(+), 2 deletions(-) create mode 100644 Source/Images/d_cowgol/u0/ADVENT.COW create mode 100644 Source/Images/d_cowgol/u0/ADVENT.SUB create mode 100644 Source/Images/d_cowgol/u0/ADVENT1.TXT create mode 100644 Source/Images/d_cowgol/u0/ADVENT2.TXT create mode 100644 Source/Images/d_cowgol/u0/ADVENT3.TXT create mode 100644 Source/Images/d_cowgol/u0/ADVENT4.TXT create mode 100644 Source/Images/d_cowgol/u0/ADVMAIN.COW create mode 100644 Source/Images/d_cowgol/u0/XRND.AS diff --git a/Source/Images/d_cowgol/Readme.txt b/Source/Images/d_cowgol/Readme.txt index 9ca93a51..ca59df45 100644 --- a/Source/Images/d_cowgol/Readme.txt +++ b/Source/Images/d_cowgol/Readme.txt @@ -39,7 +39,18 @@ applications which can be used as follows: SUBMIT HEXDUMP SUBMIT DYNMSORT --- WBW 12:38 PM 2/10/2024 +-- WBW 12:38 PM 2/10/2024 - +The Adventure game program source has been added. The command to +build the source is: + COWGOL ADVENT.COW ADVMAIN.COW XRND.AS + +or you can use the SUBMIT file: + + SUBMIT ADVENT + +WARNING: You will need to build this application under CP/M 3 because +COWGOL needs more main memory than is available under CP/M 2.2. + +-- WBW 11:43 AM 2/25/2024 diff --git a/Source/Images/d_cowgol/u0/ADVENT.COW b/Source/Images/d_cowgol/u0/ADVENT.COW new file mode 100644 index 00000000..fb3c16f8 --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT.COW @@ -0,0 +1,1284 @@ +## +## This is Daimler's 350-point "Adventure" (circa June 1990, according +## to Russel Dalenberg). Its version information lists +## +## -Conversion to BDS C by J. R. Jaeger +## -Unix standardization by Jerry D. Pohl. +## -OS/2 Conversion by Martin Heller +## -Conversion to TurboC 2.0 by Daimler +## +## It contains Jerry Pohl's original ADVENT.DOC (dated 12 JUNE 1984), +## plus comments from Martin Heller (dated 30-Aug-1988). Strangely for +## an expansion, Daimler's version actually introduces a number of typos +## into the data files, and disables a handful of inessential verbs +## (READ, EAT, FILL) with the comment that there is "no room" for them +## (presumably in the PC's limited memory). +## ------------------------------------------------------------------- +## Adapted for HiTech C Z80 under CP/M by Ladislau Szilagyi, Oct. 2023 +## Uncommented Daimler's disabled verbs - game is complete again ! +## Added a new pseudo-random number generator (Xorshift) +## Adapted to Cowgol language by Ladislau Szilagyi, Feb. 2024 + +@decl sub get_dbugflg(): (ret: uint8) @extern("get_dbugflg"); +@decl sub move(obj: uint16, where: int16) @extern("move"); + +# some utilities -------------------------------------------------------------- + +sub exit() @extern("exit") is + @asm "rst 0"; +end sub; + +sub get_char(): (c: uint8) @extern("get_char") is + @asm "ld c, 1"; + @asm "call 5"; + @asm "ld (", c, "), a"; +end sub; + +# expands LF to CR,LF +sub print_char(c: uint8) @extern("print_char") is + if c == 10 then + @asm "ld e, 13"; + @asm "ld c, 2"; + @asm "call 5"; + end if; + @asm "ld a, (", c, ")"; + @asm "ld e, a"; + @asm "ld c, 2"; + @asm "call 5"; +end sub; + +sub print(ptr: [uint8]) @extern("print") is + loop + var c := [ptr]; + if c == 0 then + return; + end if; + print_char(c); + ptr := ptr + 1; + end loop; +end sub; + +sub print_nl() @extern("print_nl") is + print_char('\n'); +end sub; + +# get up to 80 chars , ended with CR +sub get_line(p: [uint8]) @extern("get_line") is + var n: uint8; + var ch: uint8; + + n := 0; + while n < 80 loop + ch := get_char(); + if ch == '\r' then + print_nl(); + [p] := 0; + return; + end if; + [p] := ch; + p := p + 1; + n := n + 1; + end loop; + [p] := 0; +end sub; + +var pbuf: [uint8] := " "; + +sub itoa(i: int16): (pbuf: [uint8]) @extern("itoa") is + var sign: uint8 := 0; + + if i < 0 then + sign := 1; + end if; + + pbuf := pbuf + 11; # points to terminating zero + [pbuf] := 0; + + loop + pbuf := pbuf - 1; + [pbuf] := '0' + ((i % 10) as uint8); + i := i / 10; + if i == 0 then break; end if; + end loop; + + if sign == 1 then + pbuf := pbuf - 1; + [pbuf] := '-'; + end if; +end sub; + +sub ltoa(i: int32): (pbuf: [uint8]) @extern("ltoa") is + var sign: uint8 := 0; + + if i < 0 then + sign := 1; + end if; + + pbuf := pbuf + 11; # points to terminating zero + [pbuf] := 0; + + loop + pbuf := pbuf - 1; + [pbuf] := '0' + ((i % 10) as uint8); + i := i / 10; + if i == 0 then break; end if; + end loop; + + if sign == 1 then + pbuf := pbuf - 1; + [pbuf] := '-'; + end if; +end sub; + +sub isdigit(ch: uint8): (ret: uint8) @extern("isdigit") is + if ch >= '0' and ch <= '9' then + ret := 1; + else + ret := 0; + end if; +end sub; + +sub atoi(p: [uint8]): (ret: int16) @extern("atoi") is + var sign: uint8 := 0; + + ret := 0; + if [p] == '-' then + sign := 1; + p := p + 1; + end if; + while [p] != 0 loop + if isdigit([p]) == 1 then + ret := ret * 10 + (([p] - '0') as int16); p := p + 1; + else + ret := -1; return; + end if; + end loop; + if sign == 1 then + ret := -ret; + end if; +end sub; + +sub atol(p: [uint8]): (ret: int32) @extern("atol") is + var sign: uint8 := 0; + + ret := 0; + while [p] != 0 loop + if isdigit([p]) == 1 then + ret := ret * 10 + (([p] - '0') as int32); p := p + 1; + else + ret := -1; return; + end if; + end loop; + if sign == 1 then + ret := -ret; + end if; +end sub; + +# Fatal error routine +sub bug(n: uint8) @extern("bug") is + print("Fatal error number "); + print(itoa(n as int16)); + print_nl(); + exit(); +end sub; + +sub strcpy(dest: [uint8], src: [uint8]) @extern("strcpy") is + while [src] != 0 loop + [dest] := [src]; dest := dest + 1; src := src + 1; + end loop; + [dest] := 0; +end sub; + +sub strcmp(s1: [uint8], s2: [uint8]): (ret: int8) @extern("strcmp") is + loop + if [s1] < [s2] then + ret := -1; return; + elseif [s1] > [s2] then + ret := 1; return; + elseif [s1] == 0 then + ret := 0; return; + end if; + s1 := s1 + 1; + s2 := s2 + 1; + end loop; +end sub; + +sub strlen(s: [uint8]): (ret: uint16) @extern("strlen") is + ret := 0; + while [s] != 0 loop + ret := ret + 1; + s := s + 1; + end loop; +end sub; + +sub strcat(dest: [uint8], src: [uint8]) @extern("strcat") is + dest := dest + strlen(dest); + while [src] != 0 loop + [dest] := [src]; dest := dest + 1; src := src + 1; + end loop; + [dest] := 0; +end sub; + +sub rindex(str: [uint8], ch: uint8): (ret: [uint8]) @extern("rindex") is + loop + if [str] == ch then + ret := str; + return; + end if; + str := str + 1; + if [str] == 0 then + ret := 0 as [uint8]; + return; + end if; + end loop; +end sub; + +sub MemSet(buf: [uint8], byte: uint8, len: uint16) @extern("MemSet") is + var bufend := buf + len; + loop + if buf == bufend then + return; + end if; + [buf] := byte; + buf := buf + 1; + end loop; +end sub; + +var argv_pointer: [uint8]; + +sub ArgvInit() @extern("ArgvInit") is + argv_pointer := 0x81 as [uint8]; + [argv_pointer + [0x80 as [uint8]] as intptr] := 0; +end sub; + +# Returns null is there's no next argument. +sub ArgvNext(): (arg: [uint8]) @extern("ArgvNext") is + # No more arguments? + + if argv_pointer == (0 as [uint8]) then + arg := argv_pointer; + return; + end if; + + # Skip leading whitespace. + + var c: uint8; + loop + c := [argv_pointer]; + if c != ' ' then + break; + end if; + argv_pointer := argv_pointer + 1; + end loop; + + arg := argv_pointer; + + # Skip to end of word and terminate. + + loop + c := [argv_pointer]; + if (c == ' ') or (c == '\n') or (c == 0) then + break; + end if; + argv_pointer := argv_pointer + 1; + end loop; + [argv_pointer] := 0; + + if c == ' ' then + argv_pointer := argv_pointer + 1; + else + argv_pointer := 0 as [uint8]; + end if; +end sub; + +# file I/O support --------------------------------------------------------- + +record CpmFCB is + dr: uint8; + f: uint8[11]; + ex: uint8; + s1: uint8; + s2: uint8; + rc: uint8; + d: uint8[16]; + cr: uint8; + r: uint16; + r2: uint8; +end record; + +record FCB is + bufferptr: uint8; # byte just read + dirty: uint8; + cpm: CpmFCB; + buffer: uint8[128]; +end record; + +sub file_i_init(fcb: [FCB], filename: [uint8]) is + sub fill(dest: [uint8], src: [uint8], len: uint8): (srcout: [uint8]) is + loop + var c := [src]; + if (c < 32) or (c == '.') then + c := ' '; + elseif (c == '*') then + c := '?'; + else + src := src + 1; + end if; + if (c >= 'a') and (c <= 'z') then + c := c - ('a' - 'A'); + end if; + [dest] := c; + dest := dest + 1; + + len := len - 1; + if len == 0 then + break; + end if; + end loop; + srcout := src; + end sub; + + MemSet(fcb as [uint8], 0, @bytesof FCB); + MemSet(&fcb.cpm.f[0] as [uint8], ' ', 11); + filename := fill(&fcb.cpm.f[0], filename, 8); + + var c: uint8; + loop + c := [filename]; + if (c < 32) or (c == '.') then + break; + end if; + filename := filename + 1; + end loop; + + if c == '.' then + filename := fill(&fcb.cpm.f[8], filename+1, 3); + end if; + + fcb.cpm.r := 0xffff; + fcb.bufferptr := 127; +end sub; + +sub fcb_i_gbpb(fcb: [FCB], c: uint8) is + var cpmfcb := &fcb.cpm; + var dma := &fcb.buffer[0]; + + @asm "ld c, 26"; # SET DMA + @asm "ld de, (", dma, ")"; + @asm "call 5"; + + @asm "ld a, (", c, ")"; + @asm "ld c, a"; + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; +end sub; + +sub fcb_i_blockin(fcb: [FCB]) is + MemSet(&fcb.buffer[0], 0, 128); + fcb_i_gbpb(fcb, 33); # READ RANDOM + fcb.dirty := 0; +end sub; + +sub fcb_i_blockout(fcb: [FCB]) is + if fcb.dirty != 0 then + fcb_i_gbpb(fcb, 34); # WRITE RANDOM + fcb.dirty := 0; + end if; +end sub; + +sub fcb_i_changeblock(fcb: [FCB], newblock: uint16) is + if newblock != fcb.cpm.r then + fcb_i_blockout(fcb); + fcb.cpm.r := newblock; + fcb_i_blockin(fcb); + end if; +end sub; + +sub fcb_a_to_error() is + @asm "cp 0xff"; + @asm "ld a, 0"; + @asm "ret nz"; + @asm "inc a"; +end sub; + +sub FCBOpenIn(fcb: [FCB], filename: [uint8]): (errno: uint8) @extern("FCBOpenIn") is + file_i_init(fcb, filename); + + var cpmfcb := &fcb.cpm; + @asm "ld c, 15"; # OPEN_FILE + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + @asm "call", fcb_a_to_error; + @asm "ld (", errno, "), a"; +end sub; + +sub FCBOpenUp(fcb: [FCB], filename: [uint8]): (errno: uint8) is + (errno) := FCBOpenIn(fcb, filename); +end sub; + +sub FCBOpenOut(fcb: [FCB], filename: [uint8]): (errno: uint8) is + file_i_init(fcb, filename); + + var cpmfcb := &fcb.cpm; + @asm "ld c, 19"; # DELETE_FILE + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + + @asm "ld c, 22"; # CREATE_FILE + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + @asm "call", fcb_a_to_error; + @asm "ld (", errno, "), a"; +end sub; + +sub FCBClose(fcb: [FCB]): (errno: uint8) @extern("FCBClose") is + fcb_i_blockout(fcb); + + var cpmfcb := &fcb.cpm; + @asm "ld c, 16"; # CLOSE_FILE + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + @asm "call", fcb_a_to_error; + @asm "ld (", errno, "), a"; +end sub; + +sub FCBSeek(fcb: [FCB], pos: uint32) @extern("FCBSeek") is + pos := pos - 1; # seek to *previous* character + var newblock := (pos >> 7) as uint16; + var newptr := (pos as uint8) & 127; + fcb_i_changeblock(fcb, newblock); + fcb.bufferptr := newptr; +end sub; + +sub FCBPos(fcb: [FCB]): (pos: uint32) is + pos := (((fcb.cpm.r as uint32) << 7) | (fcb.bufferptr as uint32)) + 1; +end sub; + +sub FCBExt(fcb: [FCB]): (len: uint32) is + var oldblock := fcb.cpm.r; + var cpmfcb := &fcb.cpm; + + @asm "ld c, 16"; # CLOSE_FILE (actually flushing it to disk) + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + + @asm "ld c, 35"; # COMPUTE FILE SIZE + @asm "ld de, (", cpmfcb, ")"; + @asm "call 5"; + + len := ([&fcb.cpm.r as [uint32]] & 0x00ffffff) << 7; + fcb.cpm.r := oldblock; +end sub; + +sub fcb_i_nextchar(fcb: [FCB]) is + fcb.bufferptr := fcb.bufferptr + 1; + if fcb.bufferptr == 128 then + fcb_i_changeblock(fcb, fcb.cpm.r + 1); + fcb.bufferptr := 0; + end if; +end sub; + +sub FCBGetChar(fcb: [FCB]): (c: uint8) @extern("FCBGetChar") is + fcb_i_nextchar(fcb); + c := fcb.buffer[fcb.bufferptr]; +end sub; + +sub FCBPutChar(fcb: [FCB], c: uint8) is + fcb_i_nextchar(fcb); + fcb.buffer[fcb.bufferptr] := c; + fcb.dirty := 1; +end sub; + +# --------------------------------------------------------- + +var fd1: FCB; +var fd2: FCB; +var fd3: FCB; +var fd4: FCB; + +sub closefiles() @extern("closefiles") is + var sts: uint8; + sts := FCBClose(&fd1); + sts := FCBClose(&fd2); + sts := FCBClose(&fd3); + sts := FCBClose(&fd4); +end sub; + +# Open advent?.txt files +sub opentxt() @extern("opentxt") is + var sts: uint8; + + sts := FCBOpenIn(&fd1, "advent1.txt"); + if sts != 0 then + print("Sorry, I can't open advent1.txt...\n"); + exit(); + end if; + sts := FCBOpenIn(&fd2, "advent2.txt"); + if sts != 0 then + print("Sorry, I can't open advent2.txt...\n"); + exit(); + end if; + sts := FCBOpenIn(&fd3, "advent3.txt"); + if sts != 0 then + print("Sorry, I can't open advent3.txt...\n"); + exit(); + end if; + sts := FCBOpenIn(&fd4, "advent4.txt"); + if sts != 0 then + print("Sorry, I can't open advent4.txt...\n"); + exit(); + end if; +end sub; + +const MAXLOC := 140; + +var idx1: uint32[MAXLOC] := { + 3,160,304,367,448, + 507,564,689,855,980, + 1086,1333,1385,1567,1694, + 2033,2083,2224,2332,2415, + 2472,2496,2525,2647,2770, + 2894,2963,3029,3125,3164, + 3274,3282,3314,3490,3547, + 4023,4151,4229,4335,4477, + 4574,4733,4793,4853,4913, + 4973,4986,4999,5012,5072, + 5132,5192,5252,5312,5325, + 5385,5398,5581,5594,5691, + 5863,5977,6045,6058,6270, + 6398,6557,6892,7187,7242, + 7302,7447,7512,7532,7688, + 7744,7803,7896,7953,8065, + 8125,8139,8153,8213,8273, + 8287,8301,8361,8516,8589, + 8643,8818,9043,9096,9154, + 9364,9499,9698,9944,10149, + 10283,10357,10504,10769,10834, + 10888,11197,11262,11328,11802, + 12278,12486,12553,12884,12899, + 13652,14160,14346,14427,14494, + 14561,14628,14722,14818,15026, + 15215,16503,16733,16843,16980, + 17180,17247,17312,17379,17446, + 17511,17576,17641,17708,17773 + }; + +var idx2: uint32[MAXLOC] := { + 3,35,62,89,110, + 131,152,184,209,237, + 265,292,344,372,404, + 433,483,519,554,586, + 644,668,697,736,760, + 784,853,919,1015,1054, + 1164,1172,1204,1224,1281, + 1310,1339,1417,1523,1554, + 1651,1692,1752,1812,1872, + 1932,1946,1960,1974,2034, + 2094,2154,2214,2274,2288, + 2348,2362,2390,2404,2501, + 2538,2575,2643,2657,2689, + 2817,2850,2889,2914,2969, + 3029,3077,3142,3162,3214, + 3270,3329,3422,3479,3591, + 3651,3665,3679,3739,3799, + 3813,3827,3887,3918,3991, + 4045,4091,4117,4170,4228, + 4265,4290,4319,4347,4370, + 4398,4424,4452,4479,4544, + 4598,4623,4688,4715,4745, + 4775,4809,4876,4902,4917, + 4954,4991,5024,5057,5124, + 5191,5258,5291,5316,5345, + 5386,5421,5457,5491,5528, + 5556,5623,5688,5755,5822, + 5887,5952,6017,6084,6149 + }; + +const MAXOBJ := 100; + +var idx3: uint32[MAXOBJ] := { + 3,63,153,208,274, + 355,436,524,636,770, + 833,889,981,1110,1200, + 1377,1469,1473,1477,1522, + 1640,1668,1693,1709,2151, + 2315,2335,2424,2518,2541, + 2557,2780,3020,3196,3250, + 3451,3643,3674,3821,3924, + 3952,3956,3960,3964,3968, + 3972,3976,3980,3984,3988, + 4062,4112,4166,4223,4269, + 4329,4444,4509,4733,4812, + 4891,4957,5072,5120,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0 + }; + +const MAXMSG := 201; + +var idx4: uint32[MAXMSG] := { + 3,485,537,655,716, + 760,785,810,842,884, + 959,1073,1119,1148,1194, + 1301,1376,1427,1465,1580, + 1631,1796,1832,1891,1924, + 1950,2060,2113,2152,2180, + 2276,2298,2318,2371,2398, + 2427,2458,2487,2520,2545, + 2571,2666,2687,2698,2735, + 2790,2855,2886,2947,2979, + 3033,4327,4342,4359,4366, + 4397,4485,4609,4659,4781, + 4809,4819,4860,5032,5394, + 5717,5810,5842,5874,6040, + 6067,6104,6138,6268,6306, + 6401,6444,6492,6517,6531, + 6546,6717,6921,7054,7171, + 7312,7372,7385,7398,7411, + 7424,7493,7566,7613,7665, + 7708,7780,7820,7854,7900, + 7990,8033,8097,8170,8214, + 8248,8306,8345,8382,8408, + 8434,8488,8565,8630,8733, + 8804,8874,8991,9059,9129, + 9197,9267,9328,9391,9592, + 9688,9825,9892,10117,10254, + 10373,10503,10712,10986,11202, + 11294,11474,11518,11577,11649, + 11685,11741,13063,13100,13156, + 13229,13270,13293,13333,13418, + 13474,13542,13605,13672,13793, + 13807,13937,14078,14222,14291, + 14332,14382,14619,14759,14830, + 14889,14950,15008,15134,15178, + 15210,15242,15272,15333,15368, + 15395,15442,15509,15564,15737, + 15780,15800,15870,16064,16101, + 16236,16564,16636,16719,16820, + 16873,16945,17067,17195,17238, + 17274,17335,17433,17502,17612, + 17637 + }; + +const EOF := 0x1A; + +# Function to scan a file up to a specified +# point and either print or return a string. +sub rdupto(fdi: [FCB], uptoc: uint8, print: uint8, str: [uint8]) is + var ch: uint8; + ch := FCBGetChar(fdi); + while ch != uptoc loop + if ch == EOF or ch == 0 then + return; +# elseif ch == '\n' then +# ch := FCBGetChar(fdi); +# continue; + elseif print == 1 then + print_char(ch); + else + [str] := ch; str := str + 1; + end if; + ch := FCBGetChar(fdi); + end loop; + if print == 0 then + [str] := 0; + end if; +end sub; + +# Function to read a file skipping +# a given character a specified number +# of times, with or without repositioning +# the file. +sub rdskip(fdi: [FCB], skipc: uint8, n: uint16, rewind: uint8) is + var ch: uint8; + if rewind == 1 then + FCBSeek(fdi, 0); + end if; + while n > 0 loop + ch := FCBGetChar(fdi); + while ch != skipc loop + if ch == EOF or ch == 0 then + bug(32); + end if; + ch := FCBGetChar(fdi); + end loop; + n := n - 1; + end loop; +end sub; + +# Print a location description from "advent4.txt" +sub rspeak(msg: uint8) @extern("rspeak") is + if msg == 54 then + print("ok.\n"); + else + if get_dbugflg() == 1 then + print("Seek loc msg #"); + print(itoa(msg as int16)); + print(" @ "); + print(ltoa(idx4[msg - 1] as int32)); + end if; + FCBSeek(&fd4, idx4[msg - 1]); + rdupto(&fd4, '#', 1, 0); + end if; +end sub; + +# Print an item message for a given state from "advent3.txt" +sub pspeak(item: uint8, state: int8) @extern("pspeak") is + FCBSeek(&fd3, idx3[item - 1]); + rdskip(&fd3, '/', (state+2) as uint16, 0); + rdupto(&fd3, '/', 1, 0); +end sub; + +# Print a long location description from "advent1.txt" +sub desclg(loc: uint8) @extern("desclg") is + FCBSeek(&fd1, idx1[loc - 1]); + rdupto(&fd1, '#', 1, 0); +end sub; + +# Print a short location description from "advent2.txt" +sub descsh(loc: uint8) @extern("descsh") is + FCBSeek(&fd2, idx2[loc - 1]); + rdupto(&fd2, '#', 1, 0); +end sub; + +record wac is + aword: [uint8]; + acode: uint16; +end record; + +# Adventure vocabulary & encryption +const MAXWC := 301; +var wc: wac[] := +{ + {"spelunker today",1016}, + {"?", 3051}, + {"above", 29}, + {"abra", 3050}, + {"abracadabra", 3050}, + {"across", 42}, + {"ascend", 29}, + {"attack", 2012}, + {"awkward", 26}, + {"axe", 1028}, + {"back", 8}, + {"barren", 40}, + {"bars", 1052}, + {"batteries", 1039}, + {"battery", 1039}, + {"beans", 1024}, + {"bear", 1035}, + {"bed", 16}, + {"bedquilt", 70}, + {"bird", 1008}, + {"blast", 2023}, + {"blowup", 2023}, + {"bottle", 1020}, + {"box", 1055}, + {"break", 2028}, + {"brief", 2026}, + {"broken", 54}, + {"building", 12}, + {"cage", 1004}, + {"calm", 2010}, + {"canyon", 25}, + {"capture", 2001}, + {"carpet", 1040}, + {"carry", 2001}, + {"catch", 2001}, + {"cave", 67}, + {"cavern", 73}, + {"chain", 1064}, + {"chant", 2003}, + {"chasm", 1032}, + {"chest", 1055}, + {"clam", 1014}, + {"climb", 56}, + {"close", 2006}, + {"cobblestone", 18}, + {"coins", 1054}, + {"continue", 2011}, + {"crack", 33}, + {"crap", 3079}, + {"crawl", 17}, + {"cross", 69}, + {"d", 30}, + {"damn", 3079}, + {"damnit", 3079}, + {"dark", 22}, + {"debris", 51}, + {"depression", 63}, + {"descend", 30}, + {"describe", 57}, + {"detonate", 2023}, + {"devour", 2014}, + {"diamonds", 1051}, + {"dig", 3066}, + {"discard", 2002}, + {"disturb", 2029}, + {"dome", 35}, + {"door", 1009}, + {"down", 30}, + {"downstream", 4}, + {"downward", 30}, + {"dragon", 1031}, + {"drawing", 1029}, + {"drink", 2015}, + {"drop", 2002}, + {"dump", 2002}, + {"dwarf", 1017}, + {"dwarves", 1017}, + {"e", 43}, + {"east", 43}, + {"eat", 2014}, + {"egg", 1056}, + {"eggs", 1056}, + {"emerald", 1059}, + {"enter", 3}, + {"entrance", 64}, + {"examine", 57}, + {"excavate", 3066}, + {"exit", 11}, + {"explore", 2011}, + {"extinguish", 2008}, + {"fee", 2025}, + {"fee", 3001}, + {"feed", 2021}, + {"fie", 2025}, + {"fie", 3002}, + {"fight", 2012}, + {"figure", 1027}, + {"fill", 2022}, + {"find", 2019}, + {"fissure", 1012}, + {"floor", 58}, + {"foe", 2025}, + {"foe", 3003}, + {"follow", 2011}, + {"foo", 2025}, + {"foo", 3004}, + {"food", 1019}, + {"forest", 6}, + {"fork", 77}, + {"forward", 7}, + {"free", 2002}, + {"fuck", 3079}, + {"fum", 2025}, + {"fum", 3005}, + {"get", 2001}, + {"geyser", 1037}, + {"giant", 27}, + {"go", 2011}, + {"gold", 1050}, + {"goto", 2011}, + {"grate", 1003}, + {"gully", 13}, + {"h2o", 1021}, + {"hall", 38}, + {"headlamp", 1002}, + {"help", 3051}, + {"hill", 2}, + {"hit", 2012}, + {"hocus", 3050}, + {"hole", 52}, + {"hours", 2031}, + {"house", 12}, + {"ignite", 2023}, + {"in", 19}, + {"info", 3142}, + {"information", 3142}, + {"inside", 19}, + {"inventory", 2020}, + {"inward", 19}, + {"issue", 1016}, + {"jar", 1020}, + {"jewel", 1053}, + {"jewelry", 1053}, + {"jewels", 1053}, + {"jump", 39}, + {"keep", 2001}, + {"key", 1001}, + {"keys", 1001}, + {"kill", 2012}, + {"knife", 1018}, + {"knives", 1018}, + {"lamp", 1002}, + {"lantern", 1002}, + {"leave", 11}, + {"left", 36}, + {"light", 2007}, + {"lock", 2006}, + {"log", 2032}, + {"look", 57}, + {"lost", 3068}, + {"low", 24}, + {"machine", 1038}, + {"magazine", 1016}, + {"main", 76}, + {"message", 1036}, + {"ming", 1058}, + {"mirror", 1023}, + {"mist", 3069}, + {"moss", 1040}, + {"mumble", 2003}, + {"n", 45}, + {"ne", 47}, + {"nest", 1056}, + {"north", 45}, + {"nothing", 2005}, + {"nowhere", 21}, + {"nugget", 1050}, + {"null", 21}, + {"nw", 50}, + {"off", 2008}, + {"office", 76}, + {"oil", 1022}, + {"on", 2007}, + {"onward", 7}, + {"open", 2004}, + {"opensesame", 3050}, + {"oriental", 72}, + {"out", 11}, + {"outdoors", 32}, + {"outside", 11}, + {"over", 41}, + {"oyster", 1015}, + {"passage", 23}, + {"pause", 2030}, + {"pearl", 1061}, + {"persian", 1062}, + {"peruse", 2027}, + {"pillow", 1010}, + {"pirate", 1030}, + {"pit", 31}, + {"placate", 2010}, + {"plant", 1024}, + {"plant", 1025}, + {"platinum", 1060}, + {"plover", 71}, + {"plugh", 65}, + {"pocus", 3050}, + {"pottery", 1058}, + {"pour", 2013}, + {"proceed", 2011}, + {"pyramid", 1060}, + {"quit", 2018}, + {"rations", 1019}, + {"read", 2027}, + {"release", 2002}, + {"reservoir", 75}, + {"retreat", 8}, + {"return", 8}, + {"right", 37}, + {"road", 2}, + {"rock", 15}, + {"rod", 1005}, + {"rod", 1006}, + {"room", 59}, + {"rub", 2016}, + {"rug", 1062}, + {"run", 2011}, + {"s", 46}, + {"save", 2030}, + {"say", 2003}, + {"score", 2024}, + {"se", 48}, + {"secret", 66}, + {"sesame", 3050}, + {"shadow", 1027}, + {"shake", 2009}, + {"shard", 1058}, + {"shatter", 2028}, + {"shazam", 3050}, + {"shell", 74}, + {"shit", 3079}, + {"silver", 1052}, + {"sing", 2003}, + {"slab", 61}, + {"slit", 60}, + {"smash", 2028}, + {"snake", 1011}, + {"south", 46}, + {"spelunker", 1016}, + {"spice", 1063}, + {"spices", 1063}, + {"stairs", 10}, + {"stalactite", 1026}, + {"steal", 2001}, + {"steps", 1007}, + {"steps", 34}, + {"stop", 3139}, + {"stream", 14}, + {"strike", 2012}, + {"surface", 20}, + {"suspend", 2030}, + {"sw", 49}, + {"swim", 3147}, + {"swing", 2009}, + {"tablet", 1013}, + {"take", 2001}, + {"tame", 2010}, + {"throw", 2017}, + {"toss", 2017}, + {"tote", 2001}, + {"touch", 57}, + {"travel", 2011}, + {"treasure", 1055}, + {"tree", 3064}, + {"trees", 3064}, + {"trident", 1057}, + {"troll", 1033}, + {"troll", 1034}, + {"tunnel", 23}, + {"turn", 2011}, + {"u", 29}, + {"unlock", 2004}, + {"up", 29}, + {"upstream", 4}, + {"upward", 29}, + {"utter", 2003}, + {"valley", 9}, + {"vase", 1058}, + {"velvet", 1010}, + {"vending", 1038}, + {"view", 28}, + {"volcano", 1037}, + {"w", 44}, + {"wake", 2029}, + {"walk", 2011}, + {"wall", 53}, + {"water", 1021}, + {"wave", 2009}, + {"west", 44}, + {"xyzzy", 62}, + {"y2", 55} +}; + +# binary search +sub binary(w: [uint8], wctable: [wac], maxwc: uint16): (ret: int16) is + var lo: uint16; + var mid: uint16; + var hi: uint16; + var check: int8; + var pwc: [wac]; + + lo := 0; + hi := maxwc - 1; + while lo <= hi loop + mid := (lo + hi) / 2; + pwc := wctable + 4 * mid; + check := strcmp(w, [pwc].aword); + + if check == -1 then + hi := mid - 1; + elseif check == 1 then + lo := mid + 1; + else + ret := mid as int16; + return; + end if; + end loop; + ret := -1; +end sub; + +# look-up vocabulary word in lex-ordered table. words may have +# two entries with different codes. if minimum acceptable value +# = 0, then return minimum of different codes. last word CANNOT +# have two entries(due to binary sort). +# word is the word to look up. +# val is the minimum acceptable value, +# if != 0 return %1000 +sub vocab(word: [uint8], val: uint16): (ret: int16) @extern("vocab") is + var v1: int16; + var v2: int16; + + v1 := binary(word, &wc[0], MAXWC); + + if v1 >= 0 then + v2 := binary(word, &wc[0], MAXWC-1); + if v2 < 0 then + v2 := v1; + end if; + if val == 0 then + if wc[v1 as uint16].acode < wc[v2 as uint16].acode then + ret := wc[v1 as uint16].acode as int16; + else + ret := wc[v2 as uint16].acode as int16; + end if; + else + if val <= wc[v1 as uint16].acode then + ret := (wc[v1 as uint16].acode % 1000) as int16; + elseif val <= wc[v2 as uint16].acode then + ret := (wc[v2 as uint16].acode % 1000) as int16; + else + ret := -1; + end if; + end if; + else + ret := -1; + end if; +end sub; + +sub tolower(ch:uint8): (ret: uint8) @extern("tolower") is + @asm "cp 'A'"; + @asm "ret c"; + @asm "cp 'Z'+1"; + @asm "ret nc"; + @asm "or 20H"; + @asm "ld (", ret, "),a"; +end sub; + +# output adventure word list (motion/0xxx & verb/2xxx) only +# 6 words/line pausing at 20th line until keyboard active +sub outwords() @extern("outwords") is + var i: uint16; + var j: uint16; + var line: uint16; + var ch: uint8; + + j := 0; + line := 0; + + i := 0; + while i < 301 loop + if (wc[i].acode < 1000) or ((wc[i].acode < 3000) and (wc[i].acode > 1999)) then + print(wc[i].aword); + print_char(' '); + j := j + 1; + if (j == 6) or (i == 300) then + j := 0; + print_nl(); + line := line + 1; + if line == 20 then + line := 0; + print("\nHit any key to continue..."); + ch := get_char(); + end if; + end if; + end if; + i := i + 1; + end loop; +end sub; + +# Routine true x% of the time. +sub pct(x: uint16): (ret: uint8) @extern("pct") is + var v: uint16; + + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + + if v % 100 < x then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to request a yes or no answer to a question. +sub yes(msg1: uint8, msg2: uint8, msg3: uint8): (ret: uint8) @extern("yes") is + var answer: uint8[80]; + var n: uint8; + var ch: uint8; + + if msg1 > 0 then + rspeak(msg1); + end if; + print_char('>'); + get_line(&answer[0]); + if answer[0] == 'n' or answer[0] == 'N' then + if msg3 == 1 then + rspeak(msg3); + end if; + ret := 0; + end if; + if msg2 == 1 then + rspeak(msg2); + end if; + ret := 1; +end sub; + +# Routine to analyze a word. +sub analyze(word: [uint8]): (valid: uint8, type: int16, value: int16) @extern("analyze") is + var wordval: int16; + var msg: uint8; + var v: uint16; + + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + + # make sure I understand + wordval := vocab(word, 0); + + if wordval == -1 then + case (v % 3) is + when 0: + msg := 60; + when 1: + msg := 61; + when else: + msg := 13; + end case; + rspeak(msg); + valid := 0; + type := -1; + value := -1; + else + valid := 1; + type := wordval/1000; + value := wordval%1000; + end if; +end sub; + +# Routine to destroy an object +sub dstroy(obj: uint16) @extern("dstroy") is + move(obj, 0); +end sub; + +# Juggle an object, currently a no-op +sub juggle(loc: uint16) @extern("juggle") is +end sub; + +# routine to move an object and return a +# value used to set the negated prop values +# for the repository. +sub put(obj: uint16, where: int16, pval: int16): (ret: int16) @extern("put") is + move(obj, where); + ret := -pval-1; +end sub; + +const WATER := 21; +const OIL := 22; + +# Convert 0 to WATER +# 1 to nothing +# 2 to OIL +sub liq2(pbottle: uint16): (ret: uint16) @extern("liq2") is + ret := (1 - pbottle) * WATER + (pbottle >> 1) * (WATER + OIL); +end sub; + +record trav is + tdest: int16; + tverb: int16; + tcond: int16; +end record; +const MAXTRAV := 16+1; + +# Routine to copy a travel array +sub copytrv(trav1: [trav], trav2: [trav]) @extern("copytrv") is + var i: uint8; + + i := 0; + while i < MAXTRAV loop + [trav2].tdest := [trav1].tdest; + [trav2].tverb := [trav1].tverb; + [trav2].tcond := [trav1].tcond; + trav1 := @next trav1; + trav2 := @next trav2; + i := i + 1; + end loop; +end sub; + \ No newline at end of file diff --git a/Source/Images/d_cowgol/u0/ADVENT.SUB b/Source/Images/d_cowgol/u0/ADVENT.SUB new file mode 100644 index 00000000..be375bde --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT.SUB @@ -0,0 +1,2 @@ +COWGOL ADVENT.COW ADVMAIN.COW XRND.AS + \ No newline at end of file diff --git a/Source/Images/d_cowgol/u0/ADVENT1.TXT b/Source/Images/d_cowgol/u0/ADVENT1.TXT new file mode 100644 index 00000000..098916c1 --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT1.TXT @@ -0,0 +1,497 @@ +#1 +You are standing at the end of a road before a small brick +building. Around you is a forest. A small stream flows out +of the building and down a gully. +#2 +You have walked up a hill, still in the forest. The road +slopes back down the other side of the hill. There is a +building in the distance. +#3 +You are inside a building, a well house for a large spring. +#4 +You are in a valley in the forest beside a stream tumbling +along a rocky bed. +#5 +You are in open forest, with a deep valley to one side. +#6 +You are in open forest near both a valley and a road. +#7 +At your feet all the water of the stream splashes into a +2-inch slit in the rock. Downstream the streambed is bare rock. +#8 +You are in a 20-foot depression floored with bare dirt. Set +into the dirt is a strong steel grate mounted in concrete. +A dry streambed leads into the depression. +#9 +You are in a small chamber beneath a 3x3 steel grate to the +surface. A low crawl over cobbles leads inward to the West. +#10 +You are crawling over cobbles in a low passage. There is a +dim light at the east end of the passage. +#11 +You are in a debris room filled with stuff washed in from the +surface. A low wide passage with cobbles becomes plugged +with mud and debris here, but an awkward canyon leads +upward and west. A note on the wall says: + Magic Word "XYZZY" +#12 +You are in an awkward sloping east/west canyon. +#13 +You are in a splendid chamber thirty feet high. The walls +are frozen rivers of orange stone. An awkward canyon and a +good passage exit from east and west sides of the chamber. +#14 +At your feet is a small pit breathing traces of white mist. +An east passage ends here except for a small crack leading +on. +#15 +You are at one end of a vast hall stretching forward out of +sight to the west. There are openings to either side. +Nearby, a wide stone staircase leads downward. The hall +is filled with wisps of white mist swaying to and fro +almost as if alive. A cold wind blows up the staircase. +There is a passage at the top of a dome behind you. +#16 +The crack is far too small for you to follow. +#17 +You are on the east bank of a fissure slicing clear across +the hall. The mist is quite thick here, and the fissure +is too wide to jump. +#18 +This is a low room with a crude note on the wall. The +note says: + You won't get it up the steps. +#19 +You are in the hall of the mountain king, with passages +off in all directions. +#20 +You are at the bottom of the pit with a broken neck. +#21 +You didn't make it. +#22 +The dome is unclimbable. +#23 +You are at the west end of the twopit room. There is a +large hole in the wall above the pit at this end of the +room. +#24 +You are that the bottom of the eastern pit in the twopit +room. There is a small pool of oil in one corner of the +pit. +#25 +You are at the bottom of the western pit in the towpit room. +There is a large hole in the wall about 25 feet above you. +#26 +You clamber up the plant and scurry through the hole at the +top. +#27 +You are on the west side of the fissure in the hall of mists. +#28 +You are in a low N/S passage at a hole in the floor. The +hole goes down to an E/W passage. +#29 +You are in the south side chamber. +#30 +You are in the west side chamber of the hall of the +mountain king. A passage continues west and up here. +#31 +>$< +#32 +You can't get by the snake. +#33 +You are in a large room, with a passage to the south, +a passage to the west, and a wall of broken rock to the +east. There is a large "Y2" on a rock in the room's +center. +#34 +You are in a jumble of rock, with cracks everywhere. +#35 +You're at a low window overlooking a huge pit, which +extends up out of sight. A floor is indistinctly visible +over 50 feet below. Traces of white mist cover the floor +of the pit, becoming thicker to the right. Marks in the +dust around the window would seem to indicate that +someone has been here recently. Directly across the pit +from you and 25 feet away there is a similar window +looking into a lighted room. A shadowy figure can +be seen there peering back at you. +#36 +You are in a dirty broken passage. To the east is a +crawl. To the west is a large passage. Above you is +another passage. +#37 +You are on the brink of a small clean climbable pit. A +crawl leads west. +#38 +You are in the bottom of a small pit with a little stream, +which enters and exits through tiny slits. +#39 +You are in a large room full of dusty rocks. There is a +big hole in the floor. There are cracks everywhere, and +a passage leading east. +#40 +You have crawled through a very low wide passage parallel +to and north of the hall of mists. +#41 +You are at the west end of hall of mists. A low wide crawl +continues west and another goes north. To the south is a +little passage 6 feet off the floor. +#42 +You are in a maze of twisty little passages, all alike. +#43 +You are in a maze of twisty little passages, all alike. +#44 +You are in a maze of twisty little passages, all alike. +#45 +You are in a maze of twisty little passages, all alike. +#46 +Dead end +#47 +Dead end +#48 +Dead end +#49 +You are in a maze of twisty little passages, all alike. +#50 +You are in a maze of twisty little passages, all alike. +#51 +You are in a maze of twisty little passages, all alike. +#52 +You are in a maze of twisty little passages, all alike. +#53 +You are in a maze of twisty little passages, all alike. +#54 +Dead end +#55 +You are in a maze of twisty little passages, all alike. +#56 +Dead end +#57 +You are on the brink of a thirty foot pit with a massive +orange column down one wall. You could climb down here but +you could not get back up. The maze continues at this level. +#58 +Dead end +#59 +You have crawled through a very low wide passage paralled +to and north of the hall of mists. +#60 +You are at the east end of a very long hall apparently +without side chambers. To the east a low wide crawl +slants up. To the north a round two foot hole slants +down. +#61 +You are at the west end of a very long featureless hall. +The hall joins up with a narrow north/south passage. +#62 +You are at a crossover of a high N/S passage and a low +E/W one. +#63 +Dead end +#64 +You are at a complex junction. A low hands and knees passage +from the north joins a higher crawl from the east to make +a walking passage going west. There is also a large room +above. The air is damp here. +#65 +You are in bedquilt, a long east/west passage with holes +everywhere. To explore at random select north, south, up +or down. +#66 +You are in a room whose walls resemble swiss cheese. +Obvious passages go west, east, ne, and nw. Part of the +room is occupied by a large bedrock block. +#67 +You are at the east end of the twopit room. The floor +here is littered with thin rock slabs, which make it easy +to descend the pits. There is a path here bypassing +the pits to connect passages from east and west. +There are holes all over, but the only bit one is on +the wall directly over the west pit where you can't +get at it. +#68 +You are in a large low circular chamber whose floor is +an immense slab fallen from the ceiling (slab room). +East and west there once were large passages, but they +are now filled with boulders. Low small passages go +north and south, and the south one quickly bends west +around the boulders. +#69 +You are in a secret N/S canyon above a large room. +#70 +You are in a secret N/S canyon above a sizable passage. +#71 +You are in a secret canyon at a junction of three canyons, +bearing north, south and se. The north one is as tall as +the other two combined. +#72 +You are in a large low room. Crawls lead north, se, and sw. +#73 +Dead end crawl. +#74 +You are in a secret canyon which here runs E/W. It crosses +over a very tight canyon 15 feet below. If you go down you +may not be able to get back up. +#75 +You are at a wide place in a very tight N/S canyon. +#76 +The canyon here becomes too tight to go further south. +#77 +You are in a tall E/W canyon. A low tight crawl goes 3 +feet north and seems to open up. +#78 +The canyon runs into a mass of boulders -- dead end. +#79 +The stream flows out through a pair of 1 foot diameter +sewer pipes. It would be advisable to use the exit. +#80 +You are in a maze of twisty little passages, all alike. +#81 +Dead end. +#82 +Dead end. +#83 +You are in a maze of twisty little passages, all alike. +#84 +You are in a maze of twisty little passages, all alike. +#85 +Dead end. +#86 +Dead end. +#87 +You are in a maze of twisty little passages, all alike. +#88 +You are in a long, narrow corridor stretching out of sight +to the west. At the eastern end is a hole through which +you can see a profusion of leaves, +#89 +There is nothing here to climb. Use "up" or "out" to leave +the pit. +#90 +You have climbed up the plant and out of the pit. +#91 +You are at the top of a steep incline above a large room. +You could climb down here, but you would not be able to +climb up. There is a passage leading back to the north. +#92 +You are in the giant room. The ceiling is too high up +for your lamp to show it. Cavernous passages lead east, +north, and south. On the west wall is scrawled the +inscription: + "Fee Fie Foe Foo" {sic} +#93 +The passage here is blocked by a recent cave-in. +#94 +You are at one end of an immense north/south passage. +#95 +You are in a magnificent cavern with a rushing stream, +which cascades over a sparkling waterfall into a +roaring whirlpool which disappears through a hole in +the floor. Passages exit to the south and west. +#96 +You are in the soft room. The walls are covered with +heavy curtains, the floor with a thick pile carpet. +Moss covers the ceiling. +#97 +This is the oriental room. Ancient oriental cave drawings +cover the walls. A gently sloping passage leads upward +to the north, another passage leads se, and a hands and +knees crawl leads west. +#98 +You are following a wide path around the outer edge of a +large cavern. Far below, through a heavy white mist, +strange splashing noises can be heard. The mist rises up +through a fissure in the ceiling. The path exits to the +south and west. +#99 +You are in an alcove. A small nw path seems to widen +after a short distance. An extremely tight tunnel leads +east. It looks like a very tight squeeze. An eerie +light can be seen at the other end. +#100 +You're in a small chamber lit by an eerie green light. An +extremely narrow tunnel exits to the west. A dark corridor +leads ne. +#101 +You're in the dark-room. A corridor leading south is the +only exit. +#102 +You are in an arched hall. A coral passage once continued +up and east from here, but is now blocked by debris. The +air smells of sea water. +#103 +You're in a large room carved out of sedimentary rock. +The floor and walls are littered with bits of shells +imbedded in the stone. A shallow passage proceeds +downward, and a somewhat steeper one leads up. A low +hands and knees passage enters from the south. +#104 +You are in a long sloping corridor with ragged sharp walls. +#105 +You are in a cul-de-sac about eight feet across. +#106 +You are in an anteroom leading to a large passage to the +east. Small passages go west and up. The remnants of +recent digging are evident. A sign in midair here says: + "Cave under construction beyond this point." + "Proceed at your own risk." + "Witt construction company" +#107 +You are in a maze of twisty little passages, all different. +#108 +You are at Witt's end. Passages lead off in ALL directions. +#109 +You are in a north/south canyon about 25 feet across. The +floor is covered by white mist seeping in from the north. +The walls extend upward for well over 100 feet. Suspended +from some unseen point far above you, an enormous two- +sided mirror is hanging paralled to and midway between +the canyon walls. (The mirror is obviously provided +for the use of the dwarves, who as you know, are +extremely vain.) A small window can be seen in either +wall, some fifty feet up. +#110 +You're at a low window overlooking a huge pit, which +extends up out of sight. A floor is indistinctly visible +over 50 feet below. Traces of white mist cover the floor +of the pit, becoming thicker to the left. Marks in the +dust around the window would seem to indicate that +someone has been here recently. Directly across the pit +from you and 25 feet away there is a similar window +looking into a lighted room. A shadowy figure can be seen +there peering back at you. +#111 +A large stalactite extends from the roof and almost reaches +the floor below. You could climb down it, and jump from +it to the floor, but having done so you would be unable to +reach it to climb back up. +#112 +You are in a little maze of twisting passages, all different. +#113 +You are at the edge of a large underground reservoir. An +opaque cloud of white mist fills the room and rises +rapidly upward. The lake is fed by a stream which tumbles +out of a hole in the wall about 10 feet overhead and +splashes noisily into the water somewhere within the mist. +The only passage goes back toward the south. +#114 +Dead end. +#115 +You are at the northeast end of an immense room, even +larger than the giant room. It appears to be a repository +for the "adventure" program. Massive torches far overhead +bathe the room with smoky yellow light. Scattered about +you can be seen a pile of bottles (all of them empty), a +nursery of young beanstalks murmuring quietly, a bed of +oysters, a bundle of black rods with rusty stars on their +ends, and a collection of brass lanterns. Off to one side +a great many Dwarves are sleeping on the floor, snoring +loudly. A sign nearby reads: + "Do NOT disturb the Dwarves!" +An immense mirror is hanging against one wall, and +stretches to the other end of the room, where various +other sundry objects can be glimpsed dimly in the distance. +#116 +You are at the southwest end of the repository. To one +side is a pit full of fierce green snakes. On the other +side is a row of small wicker cages, each of which contains +a little sulking bird. In one corner is a bundle of +black rods with rusty marks on their ends. A large +number of velvet pillows are scattered about on the floor. +A vast mirror stretches off to the northeast. At your +feet is a large steel grate, next to which is a sign +which reads: + "Treasure vault. Keys in main office." +#117 +You are on one side of a large deep chasm. A heavy white +mist rising up from below obscures all view of the far +side. A sw path leads away from the chasm into a winding +corridor. +#118 +You are in a long winding corridor sloping out of sight +in both directions. +#119 +You are in a secret canyon which exits to the north and east. +#120 +You are in a secret canyon which exits to the north and east. +#121 +You are in a secret canyon which exits to the north and east. +#122 +You are on the far side of the chasm. A ne path leads away +from the chasm on this side. +#123 +You're in a long east/west corridor. A faint rumbling noise +can be heard in the distance. +#124 +The path forks here. The left fork leads northeast. A dull +rumbling seems to get louder in that direction. The right +fork leads southeast down a gentle slope. The main +corridor enters from the west. +#125 +The walls are quite warm here. From the north can be heard +a steady roar, so loud that the entire cave seems to be +trembling. Another passage leads south, and a low crawl +goes east. +#126 +You are on the edge of a breath-taking view. Far below +you is an active volcano, from which great gouts of molten +lava come surging out, cascading back down into the depths. +The glowing rock fills the farthest reaches of the cavern +with a blood-red glare, giving everything an eerie, +macabre appearance. The air is filled with flickering +sparks of ash and a heavy smell of brimstone. The walls +are hot to the touch, and the thundering of the volcano +drowns out all other sounds. Embedded in the jagged roof +far overhead are myriad formations composed of pure +white alabaster, which scatter their murky light into +sinister apparitions upon the walls. To one side is a +deep gorge, filled with a bizarre chaos of tortured +rock which seems to have been crafted by the Devil +Himself. An immense river of fire crashes out from +the depths of the volcano, burns its way through the +gorge, and plummets into a bottomless pit far off to your +left. To the right, an immense geyser of blistering +steam erupts continuously from a barren island in the +center of a sulfurous lake, which bubbles ominously. +The far right wall is aflame with an incandescence of its +own, which lends an additional infernal splendor to the +already hellish scene. A dark, foreboding passage exits +to the south. +#127 +You are in a small chamber filled with large boulders. +The walls are very warm, causing the air in the room +to be almost stifling from the heat. The only exit +is a crawl heading west, through which is coming +a low rumbling. +#128 +You are walking along a gently sloping north/south passage +lined with oddly shaped limestone formations. +#129 +You are standing at the entrance to a large, barren +room. A sign posted above the entrance reads: + "Caution! Bear in room!" +#130 +You are inside a barren room. The center of the room +is completely empty except for some dust. Marks in +the dust lead away toward the far end of the room. +The only exit is the way you came in. +#131 +You are in a maze of twisting little passages, all different. +#132 +You are in a little maze of twisty passages, all different. +#133 +You are in a twisting maze of little passages, all different. +#134 +You are in a twisting little maze of passages, all different. +#135 +You are in a twisty little maze of passages, all different. +#136 +You are in a twisty maze of little passages, all different. +#137 +You are in a little twisty maze of passages, all different. +#138 +You are in a maze of little twisting passages, all different. +#139 +You are in a maze of little twisty passages, all different. +#140 +Dead end. diff --git a/Source/Images/d_cowgol/u0/ADVENT2.TXT b/Source/Images/d_cowgol/u0/ADVENT2.TXT new file mode 100644 index 00000000..75590807 --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT2.TXT @@ -0,0 +1,293 @@ +#1 +You're at end of road again. +#2 +You're at hill in road. +#3 +You're inside building. +#4 +You're in valley. +#5 +You're in forest. +#6 +You're in forest. +#7 +You're at slit in streambed. +#8 +You're outside grate. +#9 +You're below the grate. +#10 +You're in cobble crawl. +#11 +You're in debris room. +#12 +You are in an awkward sloping east/west canyon. +#13 +You're in bird chamber. +#14 +You're at top of small pit. +#15 +You're in hall of mists. +#16 +The crack is far too small for you to follow. +#17 +You're on east bank of fissure. +#18 +You're in nugget of gold room. +#19 +You're in hall of mt. king. +#20 +You are the the bottom of the pit with a broken neck. +#21 +You didn't make it. +#22 +The dome is unclimbable. +#23 +You're at west end of twopit room. +#24 +You're in east pit. +#25 +You're in west pit. +#26 +You clamber up the plant and scurry through the hole at the +top. +#27 +You are on the west side of the fissure in the hall of mists. +#28 +You are in a low N/S passage at a hole in the floor. The +hole goes down to an E/W passage. +#29 +You are in the south side chamber. +#30 +You are in the west side chamber of the hall of the +mountain king. A passage continues west and up here. +#31 +>$< +#32 +You can't get by the snake. +#33 +You're at "Y2". +#34 +You are in a jumble of rock, with cracks everywhere. +#35 +You're at window on pit. +#36 +You're in dirty passage. +#37 +You are on the brink of a small clean climbable pit. A +crawl leads west. +#38 +You are in the bottom of a small pit with a little stream, +which enters and exits through tiny slits. +#39 +You're in dusty rock room. +#40 +You have crawled through a very low wide passage parallel +to and north of the hall of mists. +#41 +You're at west end of hall of mists. +#42 +You are in a maze of twisty little passages, all alike. +#43 +You are in a maze of twisty little passages, all alike. +#44 +You are in a maze of twisty little passages, all alike. +#45 +You are in a maze of twisty little passages, all alike. +#46 +Dead end. +#47 +Dead end. +#48 +Dead end. +#49 +You are in a maze of twisty little passages, all alike. +#50 +You are in a maze of twisty little passages, all alike. +#51 +You are in a maze of twisty little passages, all alike. +#52 +You are in a maze of twisty little passages, all alike. +#53 +You are in a maze of twisty little passages, all alike. +#54 +Dead end. +#55 +You are in a maze of twisty little passages, all alike. +#56 +Dead end. +#57 +You're at brink of pit. +#58 +Dead end. +#59 +You have crawled through a very low wide passage paralled +to and north of the hall of mists. +#60 +You're at east end of long hall. +#61 +You're at west end of long hall. +#62 +You are at a crossover of a high N/S passage and a low +E/W one. +#63 +Dead end. +#64 +You're at complex junction. +#65 +You are in bedquilt, a long east/west passage with holes +everywhere. To explore at random select north, south, up +or down. +#66 +You're in swiss cheese room. +#67 +You're at east end of twopit room. +#68 +You're in slab room. +#69 +You are in a secret N/S canyon above a large room. +#70 +You are in a secret N/S canyon above a sizable passage. +#71 +You're at junction of three secret canyons. +#72 +You are in a large low room. Crawls lead north, se, and sw. +#73 +Dead end crawl. +#74 +You're at secret E/W canyon above tight canyon. +#75 +You are at a wide place in a very tight N/S canyon. +#76 +The canyon here becomes too tight to go further south. +#77 +You are in a tall E/W canyon. A low tight crawl goes 3 +feet north and seems to open up. +#78 +The canyon runs into a mass of boulders -- dead end. +#79 +The stream flows out through a pair of 1 foot diameter +sewer pipes. It would be advisable to use the exit. +#80 +You are in a maze of twisty little passages, all alike. +#81 +Dead end. +#82 +Dead end. +#83 +You are in a maze of twisty little passages, all alike. +#84 +You are in a maze of twisty little passages, all alike. +#85 +Dead end. +#86 +Dead end. +#87 +You are in a maze of twisty little passages, all alike. +#88 +You're in narrow corridor. +#89 +There is nothing here to climb. Use "up" or "out" to leave +the pit. +#90 +You have climbed up the plant and out of the pit. +#91 +You're at steep incline above large room. +#92 +You're in giant room. +#93 +The passage here is blocked by a recent cave-in. +#94 +You are at one end of an immense north/south passage. +#95 +You're in cavern with waterfall. +#96 +You're in soft room. +#97 +You're in oriental room. +#98 +You're in misty cavern. +#99 +You're in alcove. +#100 +You're in plover room. +#101 +You're in dark-room. +#102 +You're in arched hall. +#103 +You're in shell room. +#104 +You are in a long sloping corridor with ragged sharp walls. +#105 +You are in a cul-de-sac about eight feet across. +#106 +You're in anteroom. +#107 +You are in a maze of twisty little passages, all different. +#108 +You're at Witt's end. +#109 +You're in mirror canyon. +#110 +You're at window on pit. +#111 +You're at top of stalactite. +#112 +You are in a little maze of twisting passages, all different. +#113 +You're at reservoir. +#114 +Dead end. +#115 +You're at ne end of repository. +#116 +You're at sw end of repository. +#117 +You're on sw side of chasm. +#118 +You're in sloping corridor. +#119 +You are in a secret canyon which exits to the north and east. +#120 +You are in a secret canyon which exits to the north and east. +#121 +You are in a secret canyon which exits to the north and east. +#122 +You're on ne side of chasm. +#123 +You're in corridor. +#124 +You're at fork in path. +#125 +You're at junction with warm walls. +#126 +You're at breath-taking view. +#127 +You're in chamber of boulders. +#128 +You're in limestone passage. +#129 +You're in front of barren room. +#130 +You're in barren room. +#131 +You are in a maze of twisting little passages, all different. +#132 +You are in a little maze of twisty passages, all different. +#133 +You are in a twisting maze of little passages, all different. +#134 +You are in a twisting little maze of passages, all different. +#135 +You are in a twisty little maze of passages, all different. +#136 +You are in a twisty maze of little passages, all different. +#137 +You are in a little twisty maze of passages, all different. +#138 +You are in a maze of little twisting passages, all different. +#139 +You are in a maze of little twisty passages, all different. +#140 +Dead end. diff --git a/Source/Images/d_cowgol/u0/ADVENT3.TXT b/Source/Images/d_cowgol/u0/ADVENT3.TXT new file mode 100644 index 00000000..4d62b224 --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT3.TXT @@ -0,0 +1,269 @@ +#1 +/Set of keys. +/There are some keys on the ground here. +/ +#2 +/Brass lantern +/There is a shiny brass lamp nearby. +/There is a lamp shining nearby. +/ +#3 +/*Grate +/The grate is locked. +/The grate is open. +/ +#4 +/Wicker cage +/There is a small wicker cage discarded nearby. +/ +#5 +/Black rod +/A three foot black rod with a rusty star on an end lies nearby. +/ +#6 +/Black rod +/A three foot black rod with a rusty mark on an end lies nearby. +/ +#7 +/*Steps +/Rough stone steps lead down the pit. +/Rough stone steps lead up the dome. +/ +#8 +/Little bird in cage +/A cheerful little bird is sitting here singing. +/There is a little bird in the cage. +/ +#9 +/*Rusty door +/The way north is barred by a massive, rusty, iron door. +/The way north leads through a massive, rusty, iron door. +/ +#10 +/Velvet pillow +/A small velvet pillow lies on the floor. +/ +#11 +/*Snake +/A huge green fierce snake bars the way! +// +#12 +/*Fissure +//A crystal bridge now spans the fissure. +/The crystal bridge has vanished! +/ +#13 +/*Stone tablet +/A massive stone tablet imbedded in the wall reads: +"Congratulations on bringing light into the dark-room!" +/ +#14 +/Giant clam >Grunt!< +/There is an enormous clam here with its shell tightly closed. +/ +#15 +/Giant oyster >Groan!< +/There is an enormous oyster here with its shell tightly closed. +/Interesting. There seems to be something written on the +underside of the oyster. +/ +#16 +/"Spelunker Today" +/There are a few recent issues of "Spelunker Today" magazine +here. +/ +#17 +#18 +#19 +/Tasty food +/There is tasty food here. +/ +#20 +/Small bottle +/There is a bottle of water here. +/There is an empty bottle here. +/There is a bottle of oil here. +/ +#21 +/Water in the bottle. +/ +#22 +/Oil in the bottle +/ +#23 +/*Mirror +// +#24 +/*Plant +/There is a tiny little plant in the pit, murmuring +"Water, Water, ..." +/The plant spurts into furious growth for a few seconds. +/There is a 12-foot-tall beanstalk stretching up out of +the pit, bellowing "Water!! Water!!" +/The plant grows explosively, almost filling the bottom +of the pit. +/There is a gigantic beanstalk stretching all the way +up to the hole. +/You've over-watered the plant! It's shriveling up! +It's, It's... +/ +#25 +/*Phony plant +/ +/The top of a 12-foot-tall beanstalk is poking up out of +the west pit. +/There is a huge beanstalk growing out of the west pit up to +the hole. +/ +#26 +/*Stalactite +// +#27 +/*Shadowy figure +/The shadowy figure seems to be trying to attract your attention. +/ +#28 +/Dwarf's axe +/There is a little axe here. +/There is a little axe lying beside the bear. +/ +#29 +/*Cave drawings +// +#30 +/*Pirate +// +#31 +/*Dragon +/A huge green fierce dragon bars the way! +/Congratulations! You have just vanquished a dragon with +your bare hands! (Unbelievable, Isn't it?) +/The body of a huge green dead dragon is lying off to one +side. +/ +#32 +/*Chasm +/A rickety wooden bridge extends across the chasm, vanishing +into the mist. A sign posted on the bridge reads: + "Stop! Pay Troll!" +/The wreckage of a bridge (and a dead bear) can be seen +at the bottom of the chasm. +/ +#33 +/*Troll +/A burly troll stands by the bridge and insists you throw +him a treasure before you may cross. +/The troll steps out from beneath the bridge and blocks +your way. +// +#34 +/*Phony troll +/The troll is nowhere to be seen. +/ +#35 +//There is a ferocious cave bear eyeing you from the far +end of the room! +/There is a gentle cave bear sitting placidly in one corner. +/There is a contented-looking bear wandering about nearby. +// +#36 +/*Message in second maze +/There is a message scrawled in the dust in a flowery script, +reading: + "This is not the maze where the" + "pirate leaves his treasure chest" +/ +#37 +/*Volcano and,or Geyser +// +#38 +/*Vending machine +/There is a massive vending machine here. The instructions +on it read: + "Drop coins here to receive fresh batteries." +/ +#39 +/Batteries +/There are fresh batteries here. +/Some worn-out batteries have been discarded nearby. +/ +#40 +/*Carpet and,or moss +// +#41 +#42 +#43 +#44 +#45 +#46 +#47 +#48 +#49 +#50 +/Large gold nugget +/There is a large sparkling nugget of gold here! +/ +#51 +/Several diamonds +/There are diamonds here! +/ +#52 +/Bars of silver +/There are bars of silver here! +/ +#53 +/Precious jewelry +/There is precious jewelry here! +/ +#54 +/Rare coins +/There are many coins here! +/ +#55 +/Treasure chest +/The pirate's treasure chest is here! +/ +#56 +/Golden eggs +/There is a large nest here, full of golden eggs! +/The nest of golden eggs has vanished! +/Done! +/ +#57 +/Jeweled trident +/There is a jewel-encrusted trident here! +/ +#58 +/Ming vase +/There is a delicate, precious, ming vase here! +/The vase is now resting, delicately, on a velvet pillow. +/The floor is littered with worthless shards of pottery. +/The ming vase drops with a delicate crash. +/ +#59 +/Egg-sized emerald +/There is an emerald here the size of a plover's egg! +/ +#60 +/Platinum pyramid +/There is a platinum pyramid here, 8 inches on a side! +/ +#61 +/Glistening pearl +/Off to one side lies a glistening pearl! +/ +#62 +/Persian rug +/There is a persian rug spread out on the floor! +/The dragon is sprawled out on a persian rug!! +/ +#63 +/Rare spices +/There are rare spices here! +/ +#64 +/Golden chain +/There is a golden chain lying in a heap on the floor! +/The bear is locked to the wall with a golden chain! +/There is a golden chain locked to the wall! +/ diff --git a/Source/Images/d_cowgol/u0/ADVENT4.TXT b/Source/Images/d_cowgol/u0/ADVENT4.TXT new file mode 100644 index 00000000..0471e5b8 --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVENT4.TXT @@ -0,0 +1,584 @@ +#1 + + +Somewhere nearby is Colossal Cave, where others have +found fortunes in treasure and gold, though it is rumored +that some who enter are never seen again. Magic is said +to work in the cave. I will be your eyes and hands. Direct +me with commands of 1 or 2 words. I should warn you that I +look at only the first five letters of each word, so you'll +have to enter "Northeast" as "ne" to distinguish it from +"North". (Should you get stuck, type "help" for some +general hints). + +#2 +A little dwarf with a big knife blocks your way. +#3 +A little dwarf just walked around a corner, saw you, +threw a little axe at you which missed, cursed, and ran away. +#4 +There is a threatening little dwarf in the room with you! +#5 +One sharp, nasty knife is thrown at you! +#6 +None of them hit you! +#7 +One of them gets you! +#8 +A hollow voice says "Plugh". +#9 +There is no way to go that direction. +#10 +I am unsure how you are facing. Use compass points or +nearby objects. +#11 +I don't know in from out here. Use compass points or name +something in the general direction you want to go. +#12 +I don't know how to apply that word here. +#13 +I don't understand that! +#14 +I'm game. Would you care to explain how? +#15 +Sorry, but I am not allowed to give more detail. I will +repeat the long description of your location. +#16 +It is now pitch dark. If you proceed you will likely fall +into a pit. +#17 +If you prefer, simply type W rather than West. +#18 +Are you trying to catch the bird? +#19 +The bird is frightened right now and you cannot catch +it no matter what you try. Perhaps you might try later. +#20 +Are you trying to somehow deal with the snake? +#21 +You can't kill the snake, or drive it away, or avoid it, +or anything like that. There is a way to get by, but you +don't have the necessary resources right now. +#22 +Do you really want to quit now? +#23 +You fell into a pit and broke every bone in your body! +#24 +You are already carrying it! +#25 +You can't be serious! +#26 +The bird was unafraid when you entered, but as you approach +it becomes disturbed and you cannot catch it. +#27 +You can catch the bird, but you cannot carry it. +#28 +There is nothing here with a lock! +#29 +You aren't carrying it! +#30 +The little bird attacks the green snake, and in an +astounding flurry drives the snake away. +#31 +You have no keys! +#32 +It has no lock. +#33 +I don't know how to lock or unlock such a thing. +#34 +It was already locked. +#35 +The grate is now locked. +#36 +The grate is now unlocked. +#37 +It was already unlocked. +#38 +You have no source of light. +#39 +Your lamp is now on. +#40 +Your lamp is now off. +#41 +There is no way to get past the bear to unlock the chain,_ +which is probably just as well. +#42 +Nothing happens. +#43 +Where? +#44 +There is nothing here to attack. +#45 +The little bird is now dead. Its body disappears. +#46 +Attacking the snake both doesn't work and is very dangerous. +#47 +You killed a little dwarf. +#48 +You attack a little dwarf, but he dodges out of the way. +#49 +With what? Your bare hands? +#50 +Good try, but that is an old worn-out magic word. +#51 +I know of places, actions, and things. Most of my vocabulary +describes places and is used to move you there. To move, try +words like forest, building, downstream, enter, east, west, +north, south, up or down. I know about a few special +objects, like a black rod hidden in the cave. These objects +can be manipulated using some of the action words I know. +Usually you will need to give both the object and action +words (In either order), but sometimes I can infer the +object from the verb alone. Some objects also imply verbs; +in particular, "inventory" implies "take inventory", which +causes me to give you a list of what you're carrying. The +objects have side effects; for instance, the rod scares the +bird. Usually people having trouble moving just need +to try a few more words. Usually people trying unsuccessfully +to manipulate an object are attempting something beyond their +(or my!) capabilities and should try a completely different +tack. To speed the game you can sometimes move long distances +with a single word. For example, "building" usually gets you +to the building from anywhere above ground except when lost +in the forest. Also, note that cave passages turn a lot, and +that leaving a room to the north does not guarantee entering +the next from the south. +Good luck! +#52 +It misses! +#53 +It gets you! +#54 +OK +#55 +You can't unlock the keys. +#56 +You have crawled around in some little holes and wound up +back in the main passage. +#57 +I don't know where the cave is, but hereabouts no stream +can run on the surface for very long. I would try the stream. +#58 +I need more detailed instructions to do that. +#59 +I can only tell you what you see as you move about and +manipulate things. I cannot tell you where remote things are. +#60 +I don't know that word. +#61 +What? +#62 +Are you trying to get into the cave? +#63 +The grate is very solid and has a hardened steel lock. You +cannot enter without a key, and there are no keys nearby. +I would recommend looking elsewhere for the keys. +#64 +The trees of the forest are large hardwood oak and maple, +with an occasional grove of pine or spruce. There is quite +a bit of undergrowth, largely birch and ash saplings plus +nondescript bushes of various sorts. This time of year +visibility is quite restricted by all the leaves, but travel +is quite easy if you detour around the spruce and berry +bushes. +#65 + + + Welcome to ADVENTURE! + ===================== + -Original development by Willie Crowther. + -Major features added by Don Woods. + -Conversion to BDS C by J. R. Jaeger + -Unix standardization by Jerry D. Pohl. + -OS/2 Conversion by Martin Heller + -Conversion to TurboC 2.0 by Daimler + + Would you like instructions? + +#66 +Digging without a shovel is quite impractical. Even with a +shovel progress is unlikely. +#67 +Blasting requires dynamite. +#68 +I'm as confused as you are. +#69 +Mist is a white vapor, usually water. Seen from time to time +in caverns. It can be found anywhere but is frequently a +sign of a deep pit leading down to water. +#70 +Your feet are now wet. +#71 +I think I just lost my appetite. +#72 +Thank you. It was delicious! +#73 +You have taken a drink from the stream. The water tastes +strongly of minerals, but is not unpleasant. It is extremely +cold. +#74 +The bottle of water is now empty. +#75 +Rubbing the electric lamp is not particularly rewarding. +Anyway, nothing exciting happens. +#76 +Peculiar. Nothing unexpected happens. +#77 +Your bottle is empty and the ground is wet. +#78 +You can't pour that. +#79 +Watch it! +#80 +Which way? +#81 +Oh dear, you seem to have gotten yourself killed. I might +be able to help you out, but I've never really done this +before. Do you want me to try to reincarnate you? +#82 +All right. But don't blame me if something goes wr...... + --- POOF !! --- +You are engulfed in a cloud of orange smoke. Coughing and +gasping, you emerge from the smoke and find... +#83 +You clumsy oaf, you've done it again! I don't know how long +I can keep this up. Do you want me to try reincarnating +you again? +#84 +Okay, now where did i put my orange smoke? ... > POOF! < +Everything disappears in a dense cloud of orange smoke. +#85 +Now you've really done it! I'm out of orange smoke! You +don't expect me to do a decent reincarnation without any +orange smoke, do you? +#86 +Okay, If you're so smart, do it yourself! I'm leaving! +#87 +Reserved +#88 +Reserved +#89 +Reserved +#90 +Reserved +#91 +Sorry, but I no longer seem to remember how it was you +got here. +#92 +You can't carry anything more. You'll have to drop something +first. +#93 +You can't go through a locked steel grate! +#94 +I believe what you want is right here with you. +#95 +You don't fit through a two-inch slit! +#96 +I respectfully suggest you go across the bridge instead +of jumping. +#97 +There is no way across the fissure. +#98 +You're not carrying anything. +#99 +You are currently holding the following: +#100 +It's not hungry (It's merely pinin' for the Fjords). Besides +You have no bird seed. +#101 +The snake has now devoured your bird. +#102 +There's nothing here it wants to eat (Except perhaps you). +#103 +You fool, Dwarves eat only coal! Now you've made +him REALLY mad !! +#104 +You have nothing in which to carry it. +#105 +Your bottle is already full. +#106 +There is nothing here with which to fill the bottle. +#107 +Your bottle is now full of water. +#108 +Your bottle is now full of oil. +#109 +You can't fill that. +#110 +Don't be ridiculous! +#111 +The door is extremely rusty and refuses to open. +#112 +The plant indignantly shakes the oil off its leaves and asks: +"Water?". +#113 +The hinges are quite thoroughly rusted now and won't budge. +#114 +The oil has freed up the hinges so that the door will now move, +although it requires some effort. +#115 +The plant has exceptionally deep roots and cannot be pulled free. +#116 +The Dwarves' knives vanish as they strike the walls of the cave. +#117 +Something you're carrying won't fit through the tunnel with +you. You'd best take inventory and drop something. +#118 +You can't fit this five-foot clam through that little passage! +#119 +You can't fit this five foot oyster through that little passage! +#120 +I advise you to put down the clam before opening it. >STRAIN!< +#121 +I advise you to put down the oyster before opening it. +>WRENCH!< +#122 +You don't have anything strong enough to open the clam. +#123 +You don't have anything strong enough to open the oyster. +#124 +A glistening pearl falls out of the clam and rolls away. +Goodness, this must really be an oyster. (I never was +very good at identifying bivalves.) Whatever it is, +it has now snapped shut again. +#125 +The oyster creaks open, revealing nothing but oyster inside. +It promptly snaps shut again. +#126 +You have crawled around in some little holes and found your +way blocked by a recent cave-in. You are now back in the +main passage. +#127 +There are faint rustling noises from the darkness behind +you. +#128 +Out from the shadows behind you pounces a bearded pirate! +"Har, har" he chortles, "I'll just take all this booty and +hide it away with me chest deep in the maze!". He snatches +your treasure and vanishes into the gloom. +#129 +A sepulchral voice reverberating through the cave says: +"Cave closing soon. All adventurers exit immediately +through main office." +#130 +A mysterious recorded voice groans into life and announces: +"This exit is closed. Please leave via main office." +#131 +It looks as though you're dead. Well, seeing as how it's so +close to closing time anyway, I think we'll just call it a day. +#132 +The sepulchral voice entones, "The cave is now closed." As +the echoes fade, there is a blinding flash of light (and a +small puff of orange smoke). . . . +As your eyes refocus you look around and find... +#133 +There is a loud explosion, and a twenty-foot hole appears in +the far wall, burying the Dwarves in the rubble. You march +through the hole and find yourself in the main office, where +a cheering band of friendly elves carry the conquering +adventurer off into the sunset. +#134 +There is a loud explosion, and a twenty-foot hole appears in +the far wall, burying the snakes in the rubble. A river of +molten lava pours in through the hole, destroying +everything in its path, including you!! +#135 +There is a loud explosion, and you are suddenly splashed across +the walls of the room. +#136 +The resulting ruckus has awakened the Dwarves. There are now +several threatening little Dwarves in the room with you! +Most of them throw knives at you! All of them get you! +#137 +Oh, leave the poor unhappy bird alone. +#138 +I daresay whatever you want is around here somewhere. +#139 +I don't know the word "stop". Use "quit" if you want to +give up. +#140 +You can't get there from here. +#141 +You are being followed by a very large, tame bear. +#142 +If you want to end your adventure early, say "quit". To +suspend you adventure such that you can continue later +say "suspend" (or "pause" or "save"). To see how well +you're doing, say "score". To get full credit for a +treasure, you must have left it safely in the building, +though you get partial credit just for locating it. +You lose points for getting killed, or for quitting, +though the former costs you more. There are also points +based on how much (If any) of the cave you've managed to +explore; in particular, there is a large bonus just for +getting in (to distinguish the beginners from the rest of +the pack), and there are other ways to determine whether +you've been through some of the more harrowing sections. +If you think you've found all the treasures, just keep +exploring for a while. If nothing interesting happens, you +haven't found them all yet. If something interesting DOES +happen, it means you're getting a bonus and have an +opportunity to garner many more points in the master's +section. I may occasionally offer hints in you seem to +be having trouble. If I do, I'll warn you in +advance how much it will affect your score to accept the +hints. Finally, to save paper, you may specify "brief", +which tells me never to repeat the full description of a place +unless you explicitly ask me to. +#143 +Do you indeed wish to quit now? +#144 +There is nothing here with which to fill the vase. +#145 +The sudden change in temperature has delicately shattered +the vase. +#146 +It is beyond your power to do that. +#147 +I don't know how. +#148 +It is too far up for you to reach. +#149 +You killed a little Dwarf. The body vanished in a cloud +of greasy black smoke. +#150 +The shell is very strong and impervious to attack. +#151 +What's the matter, can't you read? Now you'd best start +over. +#152 +The axe bounces harmlessly off the dragon's thick scales. +#153 +The dragon looks rather nasty. You'd best not try to get by. +#154 +The little bird attacks the green dragon, and in an +astounding flurry gets burnt to a cinder. The ashes blow away. +#155 +On what? +#156 +Okay, from now on I'll only describe a place in full the +first time you come to it. To get the full description +say "look". +#157 +Trolls are close relatives with the rocks and have skin as +tough as that of a rhinoceros. The troll fends off your +blows effortlessly. +#158 +The troll deftly catches the axe, examines it carefully, +and tosses it back, declaring, "Good workmanship, +but it's not valuable enough.". +#159 +The troll catches your treasure and scurries away out of sight. +#160 +The troll refuses to let you cross. +#161 +There is no longer any way across the chasm. +#162 +Just as you reach the other side, the bridge buckles beneath +the weight of the bear, which was still following you around. +You scrabble desperately for support, but as the bridge +collapses you stumble back and fall into the chasm. +#163 +The bear lumbers toward the troll, who lets out a +startled shriek and scurries away. The bear soon gives +up pursuit and wanders back. +#164 +The axe misses and lands near the bear where you can't get +at it. +#165 +With what? Your bare hands? Agains HIS bear hands?? +#166 +The bear is confused; he only wants to be your friend. +#167 +For crying out loud, the poor thing is already dead! +#168 +The bear eagerly wolfs down your food, after which he seems +to calm down considerably, and even becomes rather friendly. +#169 +The bear is still chained to the wall. +#170 +The chain is still locked. +#171 +The chain is now unlocked. +#172 +The chain is now locked. +#173 +There is nothing here to which the chain can be locked. +#174 +There is nothing here to eat. +#175 +Do you want the hint? +#176 +Do you need help getting out of the maze? +#177 +You can make the passages look less alike by dropping things. +#178 +Are you trying to explore beyond the plover room? +#179 +There is a way to explore that region without having to +worry about falling into a pit. None of the objects +available is immediately useful in descovering the secret. +#180 +Do you need help getting out of here? +#181 +Don't go west. +#182 +Gluttony is not one of the Troll's vices. Avarice, however, is. +#183 +Your lamp is getting dim.. You'd best start wrapping this up, +unless you can find some fresh batteries. I seem to recall +there's a vending machine in the maze. Bring some coins +with you. +#184 +Your lamp has run out of power. +#185 +There's not much point in wandering around out here, and you +can't explore the cave without a lamp. So let's just call +it a day. +#186 +There are faint rustling noises from the darkness behind you. +As you turn toward them, the beam of your lamp falls across a +bearded pirate. He is carrying a large chest. "Shiver me +timbers!" he cries, "I've been spotted! I'd best hide +meself off to the maze and hide me chest!". With that, +he vanished into the gloom. +#187 +Your lamp is getting dim. You'd best go back for +those batteries. +#188 +Your lamp is getting dim.. I'm taking the liberty of replacing +the batteries. +#189 +Your lamp is getting dim, and you're out of spare batteries. +You'd best start wrapping this up. +#190 +I'm afraid the magazine is written in Dwarvish. +#191 +"This is not the maze where the pirate leaves his treasure +chest." +#192 +Hmm, this looks like a clue, which means it'll cost you 10 +points to read it. Should I go ahead and read it anyway? +#193 +It says, "There is something strange about this place, +such that one of the words I've always known now has +a new effect." +#194 +It says the same thing it did before. +#195 +I'm afraid I don't understand. +#196 +"Congratulations on bringing light into the dark-room!" +#197 +You strike the mirror a resounding blow, whereupon it +shatters into a myriad tiny fragments. +#198 +You have taken the vase and hurled it delicately to the +ground. +#199 +You prod the nearest Dwarf, who wakes up grumpily, takes +one look at you, curses, and grabs for his axe. +#200 +Is this acceptable? +#201 +There's no point in suspending a demonstration game. diff --git a/Source/Images/d_cowgol/u0/ADVMAIN.COW b/Source/Images/d_cowgol/u0/ADVMAIN.COW new file mode 100644 index 00000000..f2077e4b --- /dev/null +++ b/Source/Images/d_cowgol/u0/ADVMAIN.COW @@ -0,0 +1,3105 @@ +## +## This is Daimler's 350-point "Adventure" (circa June 1990, according +## to Russel Dalenberg). Its version information lists +## +## -Conversion to BDS C by J. R. Jaeger +## -Unix standardization by Jerry D. Pohl. +## -OS/2 Conversion by Martin Heller +## -Conversion to TurboC 2.0 by Daimler +## +## It contains Jerry Pohl's original ADVENT.DOC (dated 12 JUNE 1984), +## plus comments from Martin Heller (dated 30-Aug-1988). Strangely for +## an expansion, Daimler's version actually introduces a number of typos +## into the data files, and disables a handful of inessential verbs +## (READ, EAT, FILL) with the comment that there is "no room" for them +## (presumably in the PC's limited memory). +## ------------------------------------------------------------------- +## Adapted for HiTech C Z80 under CP/M by Ladislau Szilagyi, Oct. 2023 +## Uncommented Daimler's disabled verbs - game is complete again ! +## Added a new pseudo-random number generator (Xorshift) +## Adapted to Cowgol language by Ladislau Szilagyi, Feb. 2024 + +@decl sub exit() @extern("exit"); +@decl sub get_char(): (c: uint8) @extern("get_char"); +@decl sub get_line(p: [uint8]) @extern("get_line"); +@decl sub print_char(c: uint8) @extern("print_char"); +@decl sub print(ptr: [uint8]) @extern("print"); +@decl sub print_nl() @extern("print_nl"); +@decl sub itoa(i: int16): (pbuf: [uint8]) @extern("itoa"); +@decl sub ltoa(i: int32): (pbuf: [uint8]) @extern("ltoa"); +@decl sub isdigit(ch: uint8): (ret: uint8) @extern("isdigit"); +@decl sub atoi(p: [uint8]): (ret: int16) @extern("atoi"); +@decl sub atol(p: [uint8]): (ret: int32) @extern("atol"); +@decl sub strcpy(dest: [uint8], src: [uint8]) @extern("strcpy"); +@decl sub strcmp(s1: [uint8], s2: [uint8]): (ret: int8) @extern("strcmp"); +@decl sub strlen(s: [uint8]): (ret: uint16) @extern("strlen"); +@decl sub strcat(dest: [uint8], src: [uint8]) @extern("strcat"); +@decl sub rindex(str: [uint8], ch: uint8): (ret: [uint8]) @extern("rindex"); +@decl sub MemSet(buf: [uint8], byte: uint8, len: uint16) @extern("MemSet"); +@decl sub ArgvInit() @extern("ArgvInit"); +@decl sub ArgvNext(): (arg: [uint8]) @extern("ArgvNext"); +@decl sub bug(n: uint8) @extern("bug"); +@decl sub closefiles() @extern("closefiles"); +@decl sub opentxt() @extern("opentxt"); +@decl sub rspeak(msg: uint8) @extern("rspeak"); +@decl sub pspeak(item: uint8, state: int8) @extern("pspeak"); +@decl sub desclg(loc: uint8) @extern("desclg"); +@decl sub descsh(loc: uint8) @extern("descsh"); +@decl sub vocab(word: [uint8], val: uint16): (ret: int16) @extern("vocab"); +@decl sub outwords() @extern("outwords"); +@decl sub tolower(ch: uint8): (ret: uint8) @extern("tolower"); +@decl sub pct(x: uint16): (ret: uint8) @extern("pct"); +@decl sub dstroy(obj: uint16) @extern("dstroy"); +@decl sub juggle(loc: uint16) @extern("juggle"); +@decl sub put(obj: uint16, where: int16, pval: int16): (ret: int16) @extern("put"); +@decl sub liq2(pbottle: uint16): (ret: uint16) @extern("liq2"); +@decl sub copytrv(trav1: [trav], trav2: [trav]) @extern("copytrv"); +@decl sub analyze(word: [uint8]): (valid: uint8, type: int16, value: int16) @extern("analyze"); +@decl sub yes(msg1: uint8, msg2: uint8, msg3: uint8): (ret: uint8) @extern("yes"); +@decl sub ivkill() @extern("ivkill"); + +# --------------------------------------------------------------------------- + +const MAXOBJ := 100; # max # of objects in cave +const MAXWC := 301; # max # of adventure words +const MAXLOC := 140; # max # of cave locations +const WORDSIZE := 20; # max # of chars in commands +const MAXMSG := 201; # max # of long location descr + +const MAXTRAV := (16+1); # max # of travel directions from loc + # +1 for terminator travel[x].tdest=-1 +const DWARFMAX := 7; # max # of nasty dwarves +const MAXDIE := 3; # max # of deaths before close +const MAXTRS := 79; # max # of + +# Object definitions + +const KEYS := 1; +const LAMP := 2; +const GRATE := 3; +const CAGE := 4; +const ROD := 5; +const ROD2 := 6; +const STEPS := 7; +const BIRD := 8; +const DOOR := 9; +const PILLOW := 10; +const SNAKE := 11; +const FISSURE := 12; +const TABLET := 13; +const CLAM := 14; +const OYSTER := 15; +const MAGAZINE := 16; +const DWARF := 17; +const KNIFE := 18; +const FOOD := 19; +const BOTTLE := 20; +const WATER := 21; +const OIL := 22; +const MIRROR := 23; +const PLANT := 24; +const PLANT2 := 25; +const AXE := 28; +const DRAGON := 31; +const CHASM := 32; +const TROLL := 33; +const TROLL2 := 34; +const BEAR := 35; +const MESSAGE := 36; +const VEND := 38; +const BATTERIES := 39; +const NUGGET := 50; +const COINS := 54; +const CHEST := 55; +const EGGS := 56; +const TRIDENT := 57; +const VASE := 58; +const EMERALD := 59; +const PYRAMID := 60; +const PEARL := 61; +const RUG := 62; +const SPICES := 63; +const CHAIN := 64; + +# Verb definitions + +const NULLX := 21; +const BACK := 8; +const LOOK := 57; +const CAVE := 67; +const ENTRANCE := 64; +const DEPRESSION := 63; + +# Action verb definitions + +const TAKE := 1; +const DROP := 2; +const SAY := 3; +const OPEN := 4; +const NOTHING := 5; +const LOCK := 6; +const ON := 7; +const OFF := 8; +const WAVE := 9; +const CALM := 10; +const WALK := 11; +const KILL := 12; +const POUR := 13; +const EAT := 14; +const DRINK := 15; +const RUB := 16; +const THROW := 17; +const QUIT := 18; +const FIND := 19; +const INVENTORY := 20; +const FEED := 21; +const FILL := 22; +const BLAST := 23; +const SCORE := 24; +const FOO := 25; +const BRIEF := 26; +const READ := 27; +const BREAK := 28; +const WAKE := 29; +const SUSPEND := 30; +const HOURS := 31; +const LOG := 32; + +# BIT mapping of "cond" array which indicates location status + +const LIGHT := 1; +const WATOIL := 2; +const LIQUID := 4; +const NOPIRAT := 8; +const HINTC := 16; +const HINTB := 32; +const HINTS := 64; +const HINTM := 128; +const HINT := 240; + +# Structure definitions + +record trav is + tdest: int16; + tverb: int16; + tcond: int16; +end record; + +# --------------------------------------------------------------- + +# WARNING: GLOBAL variable allocations for adventure + +# Database variables + +var travel: trav[MAXTRAV]; +var actmsg: int16[32]; # action messages + +# English variables + +var verb: int16; +var object: int16; +var motion: int16; +var word1: uint8[WORDSIZE]; +var word2: uint8[WORDSIZE]; + +# Play variables + +var turns: int16; +var loc: int16; +var oldloc: int16; +var oldloc2: int16; +var newloc: int16; # location variables +var cond: int16[MAXLOC]; # location status +var place: int16[MAXOBJ]; # object location +var fixed: int16[MAXOBJ]; # second object loc +var visited: int16[MAXLOC]; # >0 if has been here +var prop: int16[MAXOBJ]; # status of object +var tally: int16; +var tally2: int16; # item counts +var limit: int16; # time limit +var lmwarn: int16; # lamp warning flag +var wzdark: int16; +var closing: int16; +var closed: int16; # game state flags +var holding: int16; # count of held items +var detail: int16; # LOOK count +var knfloc: int16; # knife location +var clock1: int16; +var clock2: int16; +var panic: int16; # timing variables +var dloc: int16[DWARFMAX]; # dwarf locations +var dflag: int16; # dwarf flag +var dseen: int16[DWARFMAX]; # dwarf seen flag +var odloc: int16[DWARFMAX]; # dwarf old locations +var daltloc: int16; # alternate appearance +var dkill: int16; # dwarves killed +var chloc: int16; +var chloc2: int16; # chest locations +var bonus: int16; # to pass to end +var numdie: int16; # number of deaths +var object1: int16; # to help intrans. +var gaveup: int16; # 1 if he quit early +var foobar: int16; # fie fie foe foo... +var saveflg: int16; # if game being saved +var dbugflg: uint8; # if game is in debug +var lastglob: int16; # to get space req. + +sub get_dbugflg(): (ret: uint8) @extern("get_dbugflg") is + ret := dbugflg; +end sub; + +sub set_saveflg() @extern("set_saveflg") is + saveflg := 1; +end sub; + +# -------------------------------------------------------------- + +# WARNING: the travel array for the cave is stored as MAXLOC +# strings. the strings are an array of 1..MAXTRAV +# LONG INTEGERS. this requires 32 bit LONG INTEGERS. +# these values are used in database.c "gettrav". +# tdset*1000000 + tverb*1000 + tcond = value stored + +var cave: [uint8][] := + { + "2002,2044,2029,3003,3012,3019,3043,4005,4013,4014,4046,4030,5006,5045,5043,8063,", + "1002000,1012000,1007000,1043000,1045000,1030000,5006000,5045000,5046000,", + "1003000,1011000,1032000,1044000,11062000,33065000,79005000,79014000,", + "1004000,1012000,1045000,5006000,5043000,5044000,5029000,7005000,7046000,7030000,8063000,", + "4009000,4043000,4030000,5006050,5007050,5045050,6006000,5044000,5046000,", + "1002000,1045000,4009000,4043000,4044000,4030000,5006000,5046000,", + "1012000,4004000,4045000,5006000,5043000,5044000,8005000,8015000,8016000,8046000,595060000,595014000,595030000,", + "5006000,5043000,5046000,5044000,1012000,7004000,7013000,7045000,9003303,9019303,9030303,593003000,", + "8011303,8029303,593011000,10017000,10018000,10019000,10044000,14031000,11051000,", + "9011000,9020000,9021000,9043000,11019000,11022000,11044000,11051000,14031000,", + "8063303,9064000,10017000,10018000,10023000,10024000,10043000,12025000,12019000,12029000,12044000,3062000,14031000,", + "8063303,9064000,11030000,11043000,11051000,13019000,13029000,13044000,14031000,", + "8063303,9064000,11051000,12025000,12043000,14023000,14031000,14044000,", + "8063303,9064000,11051000,13023000,13043000,20030150,20031150,20034150,15030000,16033000,16044000,", + "1803,1804,1700,1703,1704,1901,1903,1904,2202,2203,2203,2203,2202,2204,1402,3405,", + "14001000,", + "15038000,15043000,596039312,21007412,597041412,597042412,597044412,597069412,27041000,", + "15038000,15011000,15045000,", + "15010000,15029000,15043000,28045311,28036311,29046311,29037311,30044311,30007311,32045000,74049035,32049211,74066000,", + "001000,", + "001000,", + "15001000,", + "67043000,67042000,68044000,68061000,25030000,25031000,648052000,", + "67029000,67011000,", + "23029000,23011000,31056724,26056000,", + "88001000,", + "596039312,21007412,597041412,597042412,597043412,597069412,17041000,40045000,41044000,", + "19038000,19011000,19046000,33045000,33055000,36030000,36052000,", + "19038000,19011000,19045000,", + "19038000,19011000,19043000,62044000,62029000,", + "89001524,90001000,", + "19001000,", + "3065000,28046000,34043000,34053000,34054000,35044000,302071159,100071000,", + "33030000,33055000,15029000,", + "33043000,33055000,20039000,", + "37043000,37017000,28029000,28052000,39044000,65070000,", + "36044000,36017000,38030000,38031000,38056000,", + "37056000,37029000,37011000,595060000,595014000,595030000,595004000,595005000,", + "36043000,36023000,64030000,64052000,64058000,65070000,", + "41001000,", + "42046000,42029000,42023000,42056000,27043000,59045000,60044000,60017000,", + "41029000,42045000,43043000,45046000,80044000,", + "42044000,44046000,45043000,", + "43043000,48030000,50046000,82045000,", + "42044000,43045000,46043000,47046000,87029000,87030000,", + "45044000,45011000,", + "45043000,45011000,", + "44029000,44011000,", + "50043000,51044000,", + "44043000,49044000,51030000,52046000,", + "49044000,50029000,52043000,53046000,", + "50044000,51043000,52046000,53029000,55045000,86030000,", + "51044000,52045000,54046000,", + "53044000,53011000,", + "52044000,55045000,56030000,57043000,", + "55029000,55011000,", + "13030000,13056000,55044000,58046000,83045000,84043000,", + "57043000,57011000,", + "27001000,", + "41043000,41029000,41017000,61044000,62045000,62030000,62052000,", + "60043000,62045000,107046100,", + "60044000,63045000,30043000,61046000,", + "62046000,62011000,", + "39029000,39056000,39059000,65044000,65070000,103045000,103074000,106043000,", + "64043000,66044000,556046080,68061000,556029080,70029050,39029000,556045060,72045075,71045000,556030080,106030000,", + "65047000,67044000,556046080,77025000,96043000,556050050,97072000,", + "66043000,23044000,23042000,24030000,24031000,", + "23046000,69029000,69056000,65045000,", + "68030000,68061000,120046331,119046000,109045000,113075000,", + "71045000,65030000,65023000,111046000,", + "65048000,70046000,110045000,", + "65070000,118049000,73045000,97048000,97072000,", + "72046000,72017000,72011000,", + "19043000,120044331,121044000,75030000,", + "76046000,77045000,", + "75045000,", + "75043000,78044000,66045000,66017000,", + "77046000,", + "3001000,", + "42045000,80044000,80046000,81043000,", + "80044000,80011000,", + "44046000,44011000,", + "57046000,84043000,85044000,", + "57045000,83044000,114050000,", + "83043000,83011000,", + "52029000,52011000,", + "45029000,45030000,", + "25030000,25056000,25043000,20039000,92044000,92027000,", + "25001000,", + "23001000,", + "95045000,95073000,95023000,72030000,72056000,", + "88046000,93043000,94045000,", + "92046000,92027000,92011000,", + "92046000,92027000,92023000,95045309,95003309,95073309,611045000,", + "94046000,94011000,92027000,91044000,", + "66044000,66011000,", + "66048000,72044000,72017000,98029000,98045000,98073000,", + "97046000,97072000,99044000,", + "98050000,98073000,301043000,301023000,100043000,", + "301044000,301023000,301011000,99044000,302071159,33071000,101047000,101022000,", + "100046000,100071000,100011000,", + "103030000,103074000,103011000,", + "102029000,102038000,104030000,618046114,619046115,64046000,", + "103029000,103074000,105030000,", + "104029000,104011000,103074000,", + "64029000,65044000,108043000,", + "131046000,132049000,133047000,134048000,135029000,136050000,137043000,138044000,139045000,61030000,", + "556043095,556045095,556046095,556047095,556048095,556049095,556050095,556029095,556030095,106043000,626044000,", + "69046000,113045000,113075000,", + "71044000,20039000,", + "70045000,50030040,50039040,50056040,53030050,45030000,", + "131049000,132045000,133043000,134050000,135048000,136047000,137044000,138030000,139029000,140046000,", + "109046000,109011000,109109000,", + "84048000,", + "116049000,", + "115047000,593030000,", + "118049000,660041233,660042233,660069233,660047233,661041332,303041000,21039332,596039000,", + "72030000,117029000,", + "69045000,69011000,653043000,65307000,", + "69045000,74043000,", + "74043000,74011000,653045000,653007000,", + "123047000,660041233,660042233,660069233,660049233,303041000,596039000,124077000,126028000,129040000,", + "122044000,124043000,124077000,126028000,129040000,", + "123044000,125047000,125036000,128048000,128037000,128030000,126028000,129040000,", + "124046000,124077000,126045000,126028000,127043000,127017000,", + "125046000,125023000,125011000,124077000,610030000,610039000,", + "125044000,125011000,125017000,124077000,126028000,", + "124045000,124029000,124077000,129046000,129030000,129040000,126028000,", + "128044000,128029000,124077000,130043000,130019000,130040000,130003000,126028000,", + "129044000,124077000,126028000,", + "107044000,132048000,133050000,134049000,135047000,136029000,137030000,138045000,139046000,112043000,", + "107050000,131029000,133045000,134046000,135044000,136049000,137047000,138043000,139030000,112048000,", + "107029000,131030000,132044000,134047000,135049000,136043000,137045000,138050000,139048000,112046000,", + "107047000,131045000,132050000,133048000,135043000,136030000,137046000,138029000,139044000,112049000,", + "107045000,131048000,132030000,133046000,134043000,136044000,137049000,138047000,139050000,112029000,", + "107043000,131044000,132029000,133049000,134030000,135046000,137050000,138048000,139047000,112045000,", + "107048000,131047000,132046000,133030000,134029000,135050000,136045000,138049000,139043000,112044000,", + "107030000,131043000,132047000,133029000,134044000,135045000,136046000,137048000,139049000,112050000,", + "107049000,131050000,132043000,133044000,134045000,135030000,136048000,137029000,138046000,112047000,", + "112045000,112011000," + }; + +var caveend: [uint8][] := + { + "000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + "6000,6000,7000,8000,4000,0000,0000,5000,9150,1150,4150,5150,3150,3150,9000,5000,", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + ",", + "," + }; + +# Utility Routines -------------------------------------- + +# retrieve input line (max 80 chars), convert to lower case +# & rescan for first two words (max. WORDSIZE-1 chars). +sub getwords() @extern("getwords") is + var words: uint8[80]; + var wptr: [uint8]; + var n: uint8; + + print_char('>'); + word1[0] := 0; + word2[0] := 0; + + get_line(&words[0]); + + wptr := &words[0]; + + while [wptr] != 0 loop + [wptr] := tolower([wptr]); + wptr := wptr + 1; + end loop; + + n := 0; + wptr := &words[0]; + + if [wptr] == 0 then return; end if; + + while [wptr] != ' ' and [wptr] != 0 loop + word1[n] := [wptr]; + wptr := wptr + 1; + n := n + 1; + if n == 19 then break; end if; + end loop; + word1[n] := 0; + + if [wptr] == 0 then return; end if; + + wptr := wptr + 1; #skip blank + n := 0; + while [wptr] != ' ' and [wptr] != 0 loop + word2[n] := [wptr]; + wptr := wptr + 1; + n := n + 1; + if n == 19 then break; end if; + end loop; + word2[n] := 0; + + if dbugflg == 1 then + print("WORD1 = "); + print(&word1[0]); + print(" WORD2 = "); + print(&word2[0]); + print_nl(); + end if; +end sub; + +# Routine to fill travel array for a given location +sub gettrav(loc: uint8) is + var i: uint8; + var t: int32; + var p1: [uint8]; + var q1: [uint8]; + var p2: [uint8]; + var q2: [uint8]; + var buf1: uint8[256]; + var buf2: uint8[256]; + var aptr: [uint8]; + var atrav: uint8[256]; + var hasend: uint8 := 1; + + strcpy(&buf1[0], cave[loc - 1]); + p1 := &buf1[0]; + + strcpy(&buf2[0], caveend[loc - 1]); + p2 := &buf2[0]; + + if [p2] == ',' then + hasend := 0; + end if; + + aptr := &atrav[0]; + + q1 := rindex(p1, ','); + while q1 != 0 loop + [q1] := 0; + strcpy(aptr, p1); + p1 := q1 + 1; + + if hasend == 1 then + q2 := rindex(p2, ','); + [q2] := 0; + strcat(aptr, p2); + p2 := q2 + 1; + end if; + + q1 := rindex(p1, ','); + #print(aptr); print_nl(); + aptr := aptr + strlen(aptr) + 1; + end loop; + [aptr] := 0; + + aptr := &atrav[0]; + + i := 0; + while i < MAXTRAV loop + t := atol(aptr); # convert to long int + travel[i].tcond := (t % 1000) as int16; + t := t / 1000; + travel[i].tverb := (t % 1000) as int16; + t := t / 1000; + travel[i].tdest := (t % 1000) as int16; + + aptr := aptr + strlen(aptr) + 1; + + if [aptr] == 0 then + i := i + 1; + travel[i].tdest := -1; # end of array + if dbugflg != 0 then + i := 0; + while travel[i].tdest != -1 loop + print("cave["); + print(itoa(loc as int16)); + print("] = "); + print(itoa(travel[i].tdest)); + print_char(' '); + print(itoa(travel[i].tverb)); + print_char(' '); + print(itoa(travel[i].tcond)); + print_nl(); + i := i + 1; + end loop; + end if; + return; + end if; + i := i + 1; + end loop; + bug(33); +end sub; + +# Analyze a two word sentence +sub english(): (ret: uint8) is + var msg: [uint8]; + var type1: int16; + var type2: int16; + var val1: int16; + var val2: int16; + var valid: uint8; + + verb := 0; + object := 0; + motion := 0; + type2 := -1; + val2 := -1; + type1 := -1; + val1 := -1; + msg := "bad grammar..."; + + getwords(); + + if word1[0] == 0 then + ret := 0; # ignore whitespace + return; + end if; + + (valid, type1, val1) := analyze(&word1[0]); + if valid == 0 then # check word1 + ret := 0; # didn't know it + return; + end if; + + if type1 == 2 and val1 == SAY then + verb := SAY; # repeat word & act upon if.. + object := 1; + ret := 1; + return; + end if; + + if word2[0] != 0 then + (valid, type2, val2) := analyze(&word2[0]); + if valid == 0 then + ret := 0; # didn't know it + return; + end if; + end if; + + # check his grammar + if (type1 == 3) and (type2 == 3) and (val1 == 51) and (val2 == 51) then + outwords(); + ret := 0; + return; + elseif type1 == 3 then + rspeak(val1 as uint8); + ret := 0; + return; + elseif type2 == 3 then + rspeak(val2 as uint8); + ret := 0; + return; + elseif type1 == 0 then + if type2 == 0 then + print(msg); + print_nl(); + ret := 0; + return; + else + motion := val1; + end if; + elseif type2 == 0 then + motion := val2; + elseif type1 == 1 then + object := val1; + if type2 == 2 then + verb := val2; + end if; + if type2 == 1 then + print(msg); + print_nl(); + ret := 0; + return; + end if; + elseif type1 == 2 then + verb := val1; + if type2 == 1 then + object := val2; + end if; + if type2 == 2 then + print(msg); + print_nl(); + ret := 0; + return; + end if; + else + bug(36); + end if; + ret := 1; +end sub; + +# ensure uniqueness as objects are searched +# out for an intransitive verb +sub addobj(obj: uint16) is + if object1 != 0 then + return; + end if; + if object != 0 then + object1 := -1; + return; + end if; + object := obj as int16; +end sub; + +# Routine to tell if an item is being carried. +sub toting(item: uint16): (ret: uint8) is + if place[item as uint8] == -1 then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to tell if an item is present. +sub here(item: uint16): (ret: uint8) is + if place[item as uint8] == loc or toting(item) == 1 then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to test for darkness +sub dark(): (ret: uint8) is + if ((cond[loc as uint8] & LIGHT) == 0) and (prop[LAMP] == 0 or here(LAMP) == 0) then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to tell if a location causes a forced move. +sub forced(atloc: uint16): (ret: uint8) is + if cond[atloc as uint8] == 2 then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to tell if player is on either side of a two sided object. +sub at(item: uint16): (ret: uint8) is + if place[item as uint8] == loc or fixed[item as uint8] == loc then + ret := 1; + else + ret := 0; + end if; +end sub; + +# Routine to carry an object +sub carry(obj: uint16, where: int16) is + if obj < MAXOBJ then + if place[obj as uint8] == -1 then + return; + end if; + place[obj as uint8] := -1; + holding := holding + 1; + end if; +end sub; + +# Routine to drop an object +sub drop(obj: uint16, where: int16) is + if obj < MAXOBJ then + if place[obj as uint8] == -1 then + holding := holding - 1; + end if; + place[obj as uint8] := where; + else + fixed[obj as uint8 - MAXOBJ] := where; + end if; +end sub; + +# Routine to move an object +sub move(obj: uint16, where: int16) @extern("move") is + var from: int16; + + if obj < MAXOBJ then + from := place[obj as uint8]; + else + from := fixed[obj as uint8]; + end if; + + if from > 0 and from <= 300 then + carry(obj, from); + end if; + + drop(obj, where); +end sub; + +# Routine to check for presence of dwarves.. +sub dcheck(): (ret: uint8) is + var i: uint8; + + i := 1; + while i < (DWARFMAX-1) loop + if dloc[i] == loc then + ret := i; return; + end if; + i := i + 1; + end loop; + ret := 0; +end sub; + +# Determine liquid in the bottle +sub liq(): (ret: uint16) is + var i: int16; + var j: int16; + + i := prop[BOTTLE]; + j := -i - 1; + + if i > j then + ret := liq2(i as uint16); + else + ret := liq2(j as uint16); + end if; +end sub; + +# Determine liquid at a location +sub liqloc(loc: uint16): (ret: uint16) is + if cond[loc as uint8] & LIQUID != 0 then + ret := liq2((cond[loc as uint8] & WATOIL) as uint16); + else + ret := liq2(1); + end if; +end sub; + +# Routine to indicate no reasonable +# object for verb found. Used mostly by +# intransitive verbs. +sub needobj() @extern("needobj") is + var wtype: int16; + var wval: int16; + var valid: uint8; + + (valid, wtype, wval) := analyze(&word1[0]); + + if valid == 1 then + if wtype == 2 then + print(&word1[0]); + else + print(&word2[0]); + end if; + print(" what?\n"); + end if; +end sub; + +# Routine to speak default verb message +sub actspk(verb: uint16) @extern("actspk") is + var i: int16; + + if verb < 1 or verb > 31 then + bug(39); + end if; + i := actmsg[verb as uint8]; + if i > 0 then + rspeak(i as uint8); + end if; +end sub; + +# scoring +sub score() @extern("score") is + var t: uint8; + var i: uint8; + var k: uint8; + var s: uint8; + + s := 0; + t := 0; + i := 50; + while i <= MAXTRS loop + if i == CHEST then + k := 14; + elseif i > CHEST then + k := 16; + else + k := 12; + end if; + if prop[i] >= 0 then + t := t + 2; + end if; + if place[i] == 3 and prop[i] == 0 then + t := t + k-2; + end if; + i := i + 1; + end loop; + s := t; + print("Treasures: "); + print(itoa(s as int16)); + print_nl(); + t := (MAXDIE - numdie as uint8)*10; + if t != 0 then + print("Survival: "); + print(itoa(t as int16)); + print_nl(); + end if; + s := s + t; + if gaveup == 0 then + s := s + 4; + end if; + if dflag != 0 then + t := 25; + else + t := 0; + end if; + if t != 0 then + print("Getting well in: "); + print(itoa(t as int16)); + print_nl(); + end if; + s := s + t; + if closing == 1 then + t := 25; + else + t := 0; + end if; + if t != 0 then + print("Masters section: "); + print(itoa(t as int16)); + print_nl(); + end if; + s := s + t; + if closed != 0 then + if (bonus == 0) then + t := 10; + elseif bonus == 135 then + t := 25; + elseif bonus == 134 then + t := 30; + elseif bonus == 133 then + t := 45; + end if; + print("Bonus: "); + print(itoa(t as int16)); + print_nl(); + s := s + t; + end if; + if place[MAGAZINE] == 108 then + s := s + 1; + end if; + s := s + 2; + print("Score: "); + print(itoa(s as int16)); + print_nl(); +end sub; + +# normal end of game +sub normend() is + score(); + exit(); +end sub; + +# Routine to handle the passing on of one +# of the player's incarnations... +sub death() is + var yea: uint8; + var i: uint8; + var j: uint8; + var k: uint8; + + if closing == 0 then + yea := yes(81+(numdie as uint8)*2, 82+(numdie as uint8)*2, 54); + numdie := numdie + 1; + if numdie >= MAXDIE or yea == 0 then + normend(); + end if; + place[WATER] := 0; + place[OIL] := 0; + if toting(LAMP) == 1 then + prop[LAMP] := 0; + end if; + j := 1; + while j < 101 loop + i := 101 - j; + if toting(i as uint16) == 1 then + if i == LAMP then + drop(i as uint16, 1); + else + drop(i as uint16, oldloc2); + end if; + end if; + j := j + 1; + end loop; + newloc := 3; + oldloc := loc; + return; + end if; + + # closing -- no resurrection... + rspeak(131); + numdie := numdie + 1; + normend(); +end sub; + +# Routine to handle player's demise via +# waking up the dwarves... +sub dwarfend() is + death(); + normend(); +end sub; + +# DROP etc. +sub vdrop() @extern("vdrop") is + var i: int16; + + # check for dynamite + + if toting(ROD2) == 1 and object == ROD and toting(ROD) == 0 then + object := ROD2; + end if; + if toting(object as uint16) == 0 then + actspk(verb as uint16); + return; + end if; + + # snake and bird + + if object == BIRD and here(SNAKE) == 1 then + rspeak(30); + if closed == 1 then + dwarfend(); + end if; + dstroy(SNAKE); + prop[SNAKE] := -1; + # coins and vending machine + elseif object == COINS and here(VEND) == 1 then + dstroy(COINS); + drop(BATTERIES,loc); + pspeak(BATTERIES,0); + return; + # bird and dragon (ouch!!) + elseif object == BIRD and at(DRAGON) == 1 and prop[DRAGON] == 0 then + rspeak(154); + dstroy(BIRD); + prop[BIRD] := 0; + if (place[SNAKE] != 0) then + tally2 := tally2 + 1; + end if; + return; + end if; + + # Bear and troll + + if object == BEAR and at(TROLL) == 1 then + rspeak(163); + move(TROLL,0); + move((TROLL+MAXOBJ),0); + move(TROLL2,117); + move((TROLL2+MAXOBJ),122); + juggle(CHASM); + prop[TROLL] := 2; + # vase + elseif object == VASE then + if loc == 96 then + rspeak(54); + else + if at(PILLOW) == 1 then + prop[VASE] := 0; + else + prop[VASE] := 2; + end if; + pspeak(VASE,prop[VASE] as int8 + 1); + if prop[VASE] != 0 then + fixed[VASE] := -1; + end if; + end if; + end if; + + # handle liquid and bottle + + i := liq() as int16; + if i == object then + object := BOTTLE; + end if; + if object == BOTTLE and i != 0 then + place[i as uint8] := 0; + end if; + + # handle bird and cage + + if object == CAGE and prop[BIRD] != 0 then + drop(BIRD,loc); + end if; + if object == BIRD then + prop[BIRD] := 0; + end if; + drop(object as uint16,loc); +end sub; + +# FILL +sub vfill() @extern("vfill") is + var msg: uint8; + var i: uint16; + + case object is + when BOTTLE: + if liq() != 0 then + msg := 105; + elseif liqloc(loc as uint16) == 0 then + msg := 106; + else + prop[BOTTLE] := cond[loc as uint8] & WATOIL; + i := liq(); + if (toting(BOTTLE) == 1) then + place[i as uint8] := -1; + end if; + if i == OIL then + msg := 108; + else + msg := 107; + end if; + end if; + when VASE: + if liqloc(loc as uint16) == 0 then + msg := 144; + else + if toting(VASE) == 0 then + msg := 29; + else + rspeak(145); + vdrop(); + return; + end if; + end if; + when else: + msg := 29; + end case; + rspeak(msg); +end sub; + +# CARRY TAKE etc. +sub vtake() @extern("vtake") is + var msg: uint8; + var i: uint16; + + if toting(object as uint16) == 1 then + actspk(verb as uint16); + return; + end if; + + # special case objects and fixed objects + + msg := 25; + if object == PLANT and prop[PLANT] <= 0 then + msg := 115; + end if; + if object == BEAR and prop[BEAR] == 1 then + msg := 169; + end if; + if object == CHAIN and prop[BEAR] != 0 then + msg := 170; + end if; + if fixed[object as uint8] != 0 then + rspeak(msg); + return; + end if; + + # special case for liquids + + if object == WATER or object == OIL then + if here(BOTTLE) == 0 or liq() != object as uint16 then + object := BOTTLE; + if toting(BOTTLE) == 1 and prop[BOTTLE] == 1 then + vfill(); + return; + end if; + if prop[BOTTLE] != 1 then + msg := 105; + end if; + if toting(BOTTLE) == 0 then + msg := 104; + end if; + rspeak(msg); + return; + end if; + object := BOTTLE; + end if; + if holding >= 7 then + rspeak(92); + return; + end if; + + # special case for bird. + + if object == BIRD and prop[BIRD] == 0 then + if toting(ROD) == 1 then + rspeak(26); + return; + end if; + if toting(CAGE) == 0 then + rspeak(27); + return; + end if; + prop[BIRD] := 1; + end if; + if (object == BIRD or object == CAGE) and prop[BIRD] != 0 then + carry((BIRD+CAGE)-object as uint16, loc); + end if; + carry(object as uint16,loc); + + # handle liquid in bottle + + i := liq(); + if object == BOTTLE and i != 0 then + place[i as uint8] := -1; + end if; + rspeak(54); +end sub; + +# LOCK, UNLOCK, OPEN, CLOSE etc. +sub vopen() @extern("vopen") is + var msg: uint8; + var oyclam: uint8; + + case object is + when CLAM: + when OYSTER: + if object == OYSTER then + oyclam := 1; + else + oyclam := 0; + end if; + if verb == LOCK then + msg := 61; + elseif toting(TRIDENT) == 0 then + msg := 122+oyclam; + elseif toting(object as uint16) == 1 then + msg := 120+oyclam; + else + msg := 124+oyclam; + dstroy(CLAM); + drop(OYSTER,loc); + drop(PEARL,105); + end if; + when DOOR: + if prop[DOOR] == 1 then + msg := 54; + else + msg := 111; + end if; + when CAGE: + msg := 32; + when KEYS: + msg := 55; + when CHAIN: + if here(KEYS) == 0 then + msg := 31; + elseif verb == LOCK then + if prop[CHAIN] != 0 then + msg := 34; + elseif loc != 130 then + msg := 173; + else + prop[CHAIN] := 2; + if toting(CHAIN) == 1 then + drop(CHAIN,loc); + end if; + fixed[CHAIN] := -1; + msg := 172; + end if; + else + if prop[BEAR] == 0 then + msg := 41; + elseif prop[CHAIN] == 0 then + msg := 37; + else + prop[CHAIN] := 0; + fixed[CHAIN] := 0; + if prop[BEAR] != 3 then + prop[BEAR] := 2; + end if; + fixed[BEAR] := 2-prop[BEAR]; + msg := 171; + end if; + end if; + when GRATE: + if here(KEYS) == 0 then + msg := 31; + elseif closing == 1 then + if panic == 0 then + clock2 := 15; + panic := panic + 1; + end if; + msg := 130; + else + msg := 34+prop[GRATE] as uint8; + if verb == LOCK then + prop[GRATE] := 0; + else + prop[GRATE] := 1; + end if; + msg := msg + 2*prop[GRATE] as uint8; + end if; + when else: + msg := 33; + end case; + rspeak(msg); +end sub; + +# SAY etc. +sub vsay() @extern("vsay") is + var wtype: int16; + var wval: int16; + var valid: uint8; + + (valid, wtype, wval) := analyze(&word1[0]); + if valid == 1 then + print("Okay.\n"); + if wval == SAY then + print(&word2[0]); + else + print(&word1[0]); + end if; + end if; +end sub; + +# Routine to describe current location +sub describe() is + if toting(BEAR) == 1 then + rspeak(141); + end if; + if dark() == 1 then + rspeak(16); + elseif visited[loc as uint8] == 1 then + descsh(loc as uint8); + else + desclg(loc as uint8); + end if; + if loc == 33 and pct(25) == 1 and closing == 0 then + rspeak(8); + end if; +end sub; + +# ON etc. +sub von() @extern("von") is + if here(LAMP) == 0 then + actspk(verb as uint16); + elseif limit < 0 then + rspeak(184); + else + prop[LAMP] := 1; + rspeak(39); + if wzdark == 1 then + wzdark := 0; + describe(); + end if; + end if; +end sub; + +# OFF etc. +sub voff() @extern("voff") is + if here(LAMP) == 0 then + actspk(verb as uint16); + else + prop[LAMP] := 0; + rspeak(40); + end if; +end sub; + +# WAVE etc. +sub vwave() @extern("vwave") is + if toting(object as uint16) == 0 and (object != ROD or toting(ROD2) == 0) then + rspeak(29); + elseif object != ROD or at(FISSURE) == 0 or toting(object as uint16) == 0 or closing == 1 then + actspk(verb as uint16); + else + prop[FISSURE] := 1-prop[FISSURE]; + pspeak(FISSURE,2-prop[FISSURE] as int8); + end if; +end sub; + +# ATTACK, KILL etc. +sub vkill() @extern("vkill") is + var msg: uint8; + var i: uint16; + + case object is + when BIRD: + if closed == 1 then + msg := 137; + else + dstroy(BIRD); + prop[BIRD] := 0; + if place[SNAKE] == 19 then + tally2 := tally2 + 1; + end if; + msg := 45; + end if; + when 0: + msg := 44; + when CLAM: + when OYSTER: + msg := 150; + when SNAKE: + msg := 46; + when DWARF: + if closed == 1 then + dwarfend(); + end if; + msg := 49; + when TROLL: + msg := 157; + when BEAR: + msg := 165+(prop[BEAR] as uint8+1)/2; + when DRAGON: + if prop[DRAGON] != 0 then + msg := 167; + elseif yes(49,0,0) != 0 then + pspeak(DRAGON,1); + prop[DRAGON] := 2; + prop[RUG] := 0; + move((DRAGON+MAXOBJ),-1); + move((RUG+MAXOBJ),0); + move(DRAGON,120); + move(RUG,120); + i := 1; + while i < MAXOBJ loop + if place[i as uint8] == 119 or place[i as uint8] == 121 then + move(i,120); + end if; + i := 1 + 1; + end loop; + newloc := 120; + return; + end if; + when else: + actspk(verb as uint16); + return; + end case; + rspeak(msg); +end sub; + +# POUR +sub vpour() @extern("vpour") is + if object == BOTTLE or object == 0 then + object := liq() as int16; + end if; + if object == 0 then + needobj(); + return; + end if; + if toting(object as uint16) == 0 then + actspk(verb as uint16); + return; + end if; + if object != OIL and object != WATER then + rspeak(78); + return; + end if; + prop[BOTTLE] := 1; + place[object as uint8] := 0; + if at(PLANT) == 1 then + if object != WATER then + rspeak(112); + else + pspeak(PLANT,prop[PLANT] as int8 +1); + prop[PLANT] := (prop[PLANT]+2)%6; + prop[PLANT2] := prop[PLANT]/2; + describe(); + end if; + elseif at(DOOR) == 1 then + if object == OIL then + prop[DOOR] := 1; + else + prop[DOOR] := 0; + end if; + rspeak(113+prop[DOOR] as uint8); + else + rspeak(77); + end if; +end sub; + +# EAT +sub veat() @extern("veat") is + var msg: uint8; + + case object is + when FOOD: + dstroy(FOOD); + msg := 72; + when BIRD: + when SNAKE: + when CLAM: + when OYSTER: + when DWARF: + when DRAGON: + when TROLL: + when BEAR: + msg := 71; + when else: + actspk(verb as uint16); + return; + end case; + rspeak(msg); +end sub; + +# DRINK +sub vdrink() @extern("vdrink") is + if object != WATER then + rspeak(110); + elseif liq() != WATER or here(BOTTLE) == 0 then + actspk(verb as uint16); + else + prop[BOTTLE] := 1; + place[WATER] := 0; + rspeak(74); + end if; +end sub; + +# FEED +sub vfeed() @extern("vfeed") is + var msg: uint8; + + case object is + when BIRD: + msg := 100; + when DWARF: + if here(FOOD) == 0 then + actspk(verb as uint16); + return; + end if; + dflag := dflag + 1; + msg := 103; + when BEAR: + if here(FOOD) == 0 then + if prop[BEAR] == 0 then + msg := 102; + elseif prop[BEAR] == 3 then + msg := 110; + else + actspk(verb as uint16); + return; + end if; + else + dstroy(FOOD); + prop[BEAR] := 1; + fixed[AXE] := 0; + prop[AXE] := 0; + msg := 168; + end if; + when DRAGON: + if prop[DRAGON] != 0 then + msg := 110; + else + msg := 102; + end if; + when TROLL: + msg := 182; + when SNAKE: + if closed == 1 or here(BIRD) == 0 then + msg := 102; + else + msg := 101; + dstroy(BIRD); + prop[BIRD] := 0; + tally2 := tally2 + 1; + end if; + when else: + msg := 14; + end case; + rspeak(msg); +end sub; + +# THROW etc. +sub vthrow() @extern("vthrow") is + var msg: uint8; + var i: uint8; + + if toting(ROD2) == 1 and object == ROD and toting(ROD) == 0 then + object := ROD2; + end if; + if toting(object as uint16) == 0 then + actspk(verb as uint16); + return; + end if; + + # treasure to troll + if at(TROLL) == 1 and object >= 50 and object < MAXOBJ then + rspeak(159); + drop(object as uint16,0); + move(TROLL,0); + move((TROLL+MAXOBJ),0); + drop(TROLL2,117); + drop((TROLL2+MAXOBJ),122); + juggle(CHASM); + return; + end if; + + # feed the bears... + if object == FOOD and here(BEAR) == 1 then + object := BEAR; + vfeed(); + return; + end if; + + # if not axe, same as drop... + if object != AXE then + vdrop(); + return; + end if; + + # AXE is THROWN + + # at a dwarf... + i := dcheck(); + if i > 0 then + msg := 48; + if pct(33) == 1 then + dseen[i] := 0; + dloc[i] := 0; + msg := 47; + dkill := dkill + 1; + if dkill == 1 then + msg := 149; + end if; + end if; + # at a dragon... + elseif at(DRAGON) == 1 and prop[DRAGON] == 0 then + msg := 152; + # at the troll... + elseif at(TROLL) == 1 then + msg := 158; + # at the bear... + elseif here(BEAR) == 1 and prop[BEAR] == 0 then + rspeak(164); + drop(AXE,loc); + fixed[AXE] := -1; + prop[AXE] := 1; + juggle(BEAR); + return; + # otherwise it is an attack + else + #verb := KILL; + object := 0; + #itverb(); + ivkill(); #instead of itverb --> ivkill + return; + end if; + + # handle the left over axe... + rspeak(msg); + drop(AXE,loc); + describe(); +end sub; + +# INVENTORY, FIND etc. +sub vfind() @extern("vfind") is + var msg: uint8; + if toting(object as uint16) == 1 then + msg := 24; + elseif closed == 1 then + msg := 138; + elseif dcheck() > 1 and dflag >= 2 and object == DWARF then + msg := 94; + elseif at(object as uint16) == 1 or (liq() as int16 == object and here(BOTTLE) == 1) or object == liqloc(loc as uint16) as int16 then + msg := 94; + else + actspk(verb as uint16); + return; + end if; + rspeak(msg); +end sub; + +# READ etc. +sub vread() @extern("vread") is + var msg: uint8; + var wtype: int16; + var wval: int16; + var valid: uint8; + + msg := 0; + if dark() == 1 then + (valid, wtype, wval) := analyze(&word1[0]); + if valid == 1 then + print("I see no "); + if (wtype == 1) then + print(&word1[0]); + else + print(&word2[0]); + end if; + print(" here.\n"); + end if; + return; + end if; + case object is + when MAGAZINE: + msg := 190; + when TABLET: + msg := 196; + when MESSAGE: + msg := 191; + when OYSTER: + if toting(OYSTER) != 0 and closed != 0 then + valid := yes(192,193,54); + return; + end if; + when else: + end case; + if msg > 0 then + rspeak(msg); + else + actspk(verb as uint16); + end if; +end sub; + +# BLAST etc. +sub vblast() @extern("vblast") is + if prop[ROD2] < 0 or closed == 0 then + actspk(verb as uint16); + else + bonus := 133; + if loc == 115 then + bonus := 134; + end if; + if here(ROD2) == 1 then + bonus := 135; + end if; + rspeak(bonus as uint8); + normend(); + end if; +end sub; + +# BREAK etc. +sub vbreak() @extern("vbreak") is + var msg: uint8; + + if object == MIRROR then + msg := 148; + if closed == 1 then + rspeak(197); + dwarfend(); + end if; + elseif object == VASE and prop[VASE] == 0 then + msg := 198; + if toting(VASE) == 1 then + drop(VASE,loc); + end if; + prop[VASE] := 2; + fixed[VASE] := -1; + else + actspk(verb as uint16); + return; + end if; + rspeak(msg); +end sub; + +# WAKE etc. +sub vwake() @extern("vwake") is + if object != DWARF or closed == 0 then + actspk(verb as uint16); + else + rspeak(199); + dwarfend(); + end if; +end sub; + +# CARRY, TAKE etc. +sub ivtake() @extern("ivtake") is + var anobj: uint16; + var item: uint16; + + anobj := 0; + item := 1; + while item < MAXOBJ loop + if place[item as uint8] == loc then + if anobj != 0 then + needobj(); + return; + end if; + anobj := item; + end if; + item := item + 1; + end loop; + if anobj==0 or (dcheck() > 0 and dflag >= 2) then + needobj(); + return; + end if; + object := anobj as int16; + vtake(); +end sub; + +# OPEN, LOCK, UNLOCK +sub ivopen() @extern("ivopen") is + if here(CLAM) == 1 then + object := CLAM; + end if; + if here(OYSTER) == 1 then + object := OYSTER; + end if; + if at(DOOR) == 1 then + object := DOOR; + end if; + if at(GRATE) == 1 then + object := GRATE; + end if; + if here(CHAIN) == 1 then + if object != 0 then + needobj(); + return; + end if; + object:=CHAIN; + end if; + if object==0 then + rspeak(28); + return; + end if; + vopen(); +end sub; + +# ATTACK, KILL etc +@impl sub ivkill is + object1 := 0; + if dcheck() > 1 and dflag >=2 then + object:=DWARF; + end if; + if here(SNAKE) == 1 then + addobj(SNAKE); + end if; + if at(DRAGON) == 1 and prop[DRAGON]==0 then + addobj(DRAGON); + end if; + if at(TROLL) == 1 then + addobj(TROLL); + end if; + if here(BEAR) == 1 and prop[BEAR]==0 then + addobj(BEAR); + end if; + if object1 != 0 then + needobj(); + return; + end if; + if object != 0 then + vkill(); + return; + end if; + if here(BIRD) == 1 and verb!= THROW then + object:=BIRD; + end if; + if here(CLAM) == 1 or here(OYSTER) == 1 then + addobj(CLAM); + end if; + if object1 != 0 then + needobj(); + return; + end if; + vkill(); +end sub; + +# EAT +sub iveat() @extern("iveat") is + if here(FOOD) == 0 then + needobj(); + else + object:=FOOD; + veat(); + end if; +end sub; + +# DRINK +sub ivdrink() @extern("ivdrink") is + if liqloc(loc as uint16) != WATER and (liq() != WATER or here(BOTTLE) == 0) then + needobj(); + else + object:=WATER; + vdrink(); + end if; +end sub; + +# QUIT +sub ivquit() @extern("ivquit") is + gaveup := yes(22,54,54) as int16; + if gaveup == 1 then + normend(); + end if; +end sub; + +# FILL +sub ivfill() @extern("ivfill") is + if here(BOTTLE) == 0 then + needobj(); + else + object:=BOTTLE; + vfill(); + end if; +end sub; + +# Handle fee fie foe foo... +sub ivfoo() @extern("ivfoo") is + var k: uint8; + var msg: uint8; + + k := vocab(&word1[0],3000) as uint8; + msg := 42; + if foobar != 1-k as int16 then + if foobar != 0 then + msg := 151; + end if; + rspeak(msg); + return; + end if; + foobar := k as int16; + if k != 4 then + return; + end if; + foobar := 0; + if place[EGGS] == 92 or (toting(EGGS) == 1 and loc == 92) then + rspeak(msg); + return; + end if; + if place[EGGS] == 0 and place[TROLL] == 0 and prop[TROLL] == 0 then + prop[TROLL] := 1; + end if; + if here(EGGS) == 1 then + k := 1; + elseif loc == 92 then + k := 0; + else + k := 2; + end if; + move(EGGS,92); + pspeak(EGGS,k as int8); + return; +end sub; + +# read etc... +sub ivread() @extern("ivread") is + if here(MAGAZINE) == 1 then + object := MAGAZINE; + end if; + if here(TABLET) == 1 then + object := object*100 + TABLET; + end if; + if here(MESSAGE) == 1 then + object := object*100 + MESSAGE; + end if; + if object > 100 or object == 0 or dark() == 1 then + needobj(); + return; + end if; + vread(); +end sub; + +# INVENTORY +sub inventory() @extern("inventory") is + var msg: uint8; + var i: uint16; + + msg := 98; + i := 1; + while i <= MAXOBJ loop + if i == BEAR or toting(i) == 0 then + i := i + 1; + continue; + end if; + if msg > 0 then + rspeak(99); + end if; + msg := 0; + pspeak(i as uint8 ,-1); + i := i + 1; + end loop; + if toting(BEAR) == 1 then + msg := 141; + end if; + if msg > 0 then + rspeak(msg); + end if; +end sub; + +# ---------------------------------------------------------- + +# Initialize integer arrays +sub scanint(pi: [int16], str: [uint8]) is + var p: [uint8]; + + p := str; + while [p] != 0 loop + if [p] == ',' then + [p] := 0; + end if; + p := p + 1; + end loop; + + p := str; + while [p] != 0 loop + [pi] := atoi(p); + pi := @next pi; + p := p + strlen(p) + 1; + end loop; +end sub; + +# Initialization of adventure play variables +sub initplay() is + turns := 0; + + # initialize location status array + MemSet(&cond[0] as [uint8], 0, 2 * MAXLOC); + scanint(&cond[1], "5,1,5,5,1,1,5,17,1,1,"); + scanint(&cond[13], "32,0,0,2,0,0,64,2,"); + scanint(&cond[21], "2,2,0,6,0,2,"); + scanint(&cond[31], "2,2,0,0,0,0,0,4,0,2,"); + scanint(&cond[42], "128,128,128,128,136,136,136,128,128,"); + scanint(&cond[51], "128,128,136,128,136,0,8,0,2,"); + scanint(&cond[79], "2,128,128,136,0,0,8,136,128,0,2,2,"); + scanint(&cond[95], "4,0,0,0,0,1,"); + scanint(&cond[113], "4,0,1,1,"); + scanint(&cond[122], "8,8,8,8,8,8,8,8,8,"); + + # initialize object locations + MemSet(&place[0] as [uint8], 0, 2 * MAXOBJ); + scanint(&place[1], "3,3,8,10,11,0,14,13,94,96,"); + scanint(&place[11], "19,17,101,103,0,106,0,0,3,3,"); + scanint(&place[23], "109,25,23,111,35,0,97,"); + scanint(&place[31], "119,117,117,0,130,0,126,140,0,96,"); + scanint(&place[50], "18,27,28,29,30,"); + scanint(&place[56], "92,95,97,100,101,0,119,127,130,"); + + # initialize second (fixed) locations + MemSet(&fixed[0] as [uint8], 0, 2 * MAXOBJ); + scanint(&fixed[3], "9,0,0,0,15,0,-1,"); + scanint(&fixed[11], "-1,27,-1,0,0,0,-1,"); + scanint(&fixed[23], "-1,-1,67,-1,110,0,-1,-1,"); + scanint(&fixed[31], "121,122,122,0,-1,-1,-1,-1,0,-1,"); + scanint(&fixed[62], "121,-1,"); + + # initialize default verb messages + scanint(&actmsg[0], "0,24,29,0,33,0,33,38,38,42,14,"); + scanint(&actmsg[11], "43,110,29,110,73,75,29,13,59,59,"); + scanint(&actmsg[21], "174,109,67,13,147,155,195,146,110,13,13,"); + + # initialize various flags and other variables + MemSet(&visited[0] as [uint8], 0, 2 * MAXLOC); + MemSet(&prop[0] as [uint8], 0, 2 * MAXOBJ); + MemSet(&prop[50] as [uint8], 0xFF, 2 * (MAXOBJ-50)); + wzdark := 0; + closed := 0; + closing := 0; + holding := 0; + detail := 0; + limit := 100; + tally := 15; + tally2 := 0; + newloc := 3; + loc := 1; + oldloc := 1; + oldloc2 := 1; + knfloc := 0; + chloc := 114; + chloc2 := 140; +# dloc[DWARFMAX-1] := chloc; + scanint(&dloc[0], "0,19,27,33,44,64,114,"); + scanint(&odloc[0], "0,0,0,0,0,0,0,"); + dkill := 0; + scanint(&dseen[0], "0,0,0,0,0,0,0,"); + clock1 := 30; + clock2 := 50; + panic := 0; + bonus := 0; + numdie := 0; + daltloc := 18; + lmwarn := 0; + foobar := 0; + dflag := 0; + gaveup := 0; + saveflg := 0; +end sub; + +# Routine to describe visible items +sub descitem() is + var i: uint8; + var state: uint8; + + i := 1; + while i < MAXOBJ loop + if at(i as uint16) == 1 then + if i == STEPS and toting(NUGGET) == 1 then + i := i + 1; + continue; + end if; + if prop[i] < 0 then + if closed == 1 then + i := i + 1; + continue; + else + prop[i] := 0; + if i == RUG or i == CHAIN then + prop[i] := prop[i] + 1; + end if; + tally := tally - 1; + end if; + end if; + if i == STEPS and loc == fixed[STEPS] then + state := 1; + else + state := prop[i] as uint8; + end if; + pspeak(i, state as int8); + end if; + i := i + 1; + end loop; + if tally == tally2 and tally != 0 and limit > 35 then + limit := 35; + end if; +end sub; + +# Routine to process a transitive verb +sub trverb() @extern("trverb") is + case verb is + when CALM: + when WALK: + when QUIT: + when SCORE: + when FOO: + when BRIEF: + when SUSPEND: + when HOURS: + when LOG: + actspk(verb as uint16); + when TAKE: + vtake(); + when DROP: + vdrop(); + when OPEN: + when LOCK: + vopen(); + when SAY: + vsay(); + when NOTHING: + rspeak(54); + when ON: + von(); + when OFF: + voff(); + when WAVE: + vwave(); + when KILL: + vkill(); + when POUR: + vpour(); + when EAT: + veat(); + when DRINK: + vdrink(); + when RUB: + if object != LAMP then + rspeak(76); + else + actspk(RUB); + end if; + when THROW: + vthrow(); + when FEED: + vfeed(); + when FIND: + when INVENTORY: + vfind(); + when FILL: + vfill(); + when READ: + vread(); + when BLAST: + vblast(); + when BREAK: + vbreak(); + when WAKE: + vwake(); + when else: + print("This verb is not implemented yet.\n"); + end case; +end sub; + +# Routine to process an object being referred to. +sub trobj() is + var wtype: int16; + var wval: int16; + var valid: uint8; + + if verb != 0 then + trverb(); + else + (valid, wtype, wval) := analyze(&word1[0]); + if valid == 1 then + print("What do you want to do with the"); + if wtype == 1 then + print(&word1[0]); + else + print(&word2[0]); + end if; + print_nl(); + end if; + end if; +end sub; + +# The player tried a poor move option. +sub badmove() is + var msg: uint8; + + msg := 12; + if motion >= 43 and motion <= 50 then msg := 9; end if; + if motion == 29 or motion == 30 then msg := 9; end if; + if motion == 7 or motion == 36 or motion == 37 then msg := 10; end if; + if motion == 11 or motion == 19 then msg := 11; end if; + if verb == FIND or verb == INVENTORY then msg := 59; end if; + if motion == 62 or motion == 65 then msg := 42; end if; + if motion == 17 then msg := 80; end if; + rspeak(msg); +end sub; + +# Routine to handle very special movement. +sub spcmove(rdest: uint16) is + case rdest-300 is + when 1: # plover movement via alcove + if holding == 0 or (holding == 1 and toting(EMERALD) == 1) then + newloc := (99+100)-loc; + else + rspeak(117); + end if; + when 2: # trying to remove plover, bad route + drop(EMERALD, loc); + when 3: # troll bridge + if prop[TROLL] == 1 then + pspeak(TROLL, 1); + prop[TROLL] := 0; + move(TROLL2, 0); + move((TROLL2+MAXOBJ), 0); + move(TROLL, 117); + move((TROLL+MAXOBJ), 122); + juggle(CHASM); + newloc := loc; + else + if loc == 117 then + newloc := 122; + else + newloc := 117; + end if; + if prop[TROLL] == 0 then + prop[TROLL] := prop[TROLL] + 1; + end if; + if toting(BEAR) == 0 then + return; + end if; + rspeak(162); + prop[CHASM] := 1; + prop[TROLL] := 2; + drop(BEAR, newloc); + fixed[BEAR] := -1; + prop[BEAR] := 3; + if prop[SPICES] < 0 then + tally2 := tally2 + 1; + end if; + oldloc2 := newloc; + death(); + end if; + when else: + bug(38); + end case; +end sub; + +# Routine to figure out a new location +# given current location and a motion. +sub dotrav() is + var mvflag: uint8; + var hitflag: uint8; + var kk: uint8; + var rdest: int16; + var rverb: int16; + var rcond: int16; + var robject: int16; + var pctt: uint16; + var v: uint16; + + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + + newloc := loc; + mvflag := 0; + hitflag := 0; + pctt := v % 100; + + kk := 0; + while travel[kk].tdest >= 0 and mvflag == 0 loop + rdest := travel[kk].tdest; + rverb := travel[kk].tverb; + rcond := travel[kk].tcond; + robject := rcond % 100; + + if dbugflg == 1 then + print("rdest = "); + print(itoa(rdest)); + print(", rverb = "); + print(itoa(rverb)); + print(", rcond = "); + print(itoa(rcond)); + print(", robject = "); + print(itoa(robject)); + print(" in dotrav\n"); + end if; + + if rverb != 1 and rverb != motion and hitflag == 0 then + kk := kk + 1; + continue; + end if; + + hitflag := hitflag + 1; + + case rcond / 100 is + when 0: + if rcond == 0 or pctt < rcond as uint16 then + mvflag := mvflag + 1; + end if; + if rcond == 1 and dbugflg == 1 then + print("%% move "); + print(itoa(pctt as int16)); + print_char(' '); + print(itoa(mvflag as int16)); + print_nl(); + end if; + when 1: + if robject == 0 or toting(robject as uint16) == 1 then + mvflag := mvflag + 1; + end if; + when 2: + if toting(robject as uint16) == 1 or at(robject as uint16) == 1 then + mvflag := mvflag + 1; + end if; + when 3: + when 4: + when 5: + when 7: + if prop[robject as uint8] != (rcond/100)-3 then + mvflag := mvflag + 1; + end if; + when else: + bug(37); + end case; + kk := kk + 1; + end loop; + + if mvflag == 0 then + badmove(); + elseif rdest > 500 then + rspeak((rdest-500) as uint8); + elseif rdest>300 then + spcmove(rdest as uint16); + else + newloc := rdest; + if dbugflg == 1 then + print("newloc in dotrav = "); + print(itoa(newloc)); + print_nl(); + end if; + end if; +end sub; + +# Routine to handle request to return +# from whence we came! +sub goback() is + var kk: uint8; + var k2: uint8; + var want: int16; + var temp: int16; + var strav: trav[MAXTRAV]; + + if forced(oldloc as uint16) == 1 then + want := oldloc2; + else + want := oldloc; + end if; + oldloc2 := oldloc; + oldloc := loc; + k2 := 0; + if want == loc then + rspeak(91); + return; + end if; + copytrv(&travel[0], &strav[0]); + kk := 0; + while travel[kk].tdest != 0xFFFF loop + if travel[kk].tcond == 0 and travel[kk].tdest == want then + motion := travel[kk].tverb; + dotrav(); + return; + end if; + if travel[kk].tcond == 0 then + k2 := kk; + temp := travel[kk].tdest; + gettrav(temp as uint8); + if forced(temp as uint16) == 1 and travel[0].tdest == want then + k2 := temp as uint8; + end if; + copytrv(&strav[0], &travel[0]); + end if; + kk := kk + 1; + end loop; + if k2 > 0 then + motion := travel[k2].tverb; + dotrav(); + else + rspeak(140); + end if; +end sub; + +# Routine to handle motion requests +sub domove() is + gettrav(loc as uint8); + case motion is + when NULLX: + when BACK: + goback(); + when LOOK: + detail := detail + 1; + if detail < 3 then + rspeak(15); + end if; + wzdark := 0; + visited[loc as uint8] := 0; + newloc := loc; + loc := 0; + when CAVE: + if loc < 8 then + rspeak(57); + else + rspeak(58); + end if; + when else: + oldloc2 := oldloc; + oldloc := loc; + dotrav(); + end case; +end sub; + +# pirate stuff +sub dopirate() is + var j: uint8; + var k: uint8; + + if newloc == chloc or prop[CHEST] >= 0 then + return; + end if; + k := 0; + j := 50; + while j <= MAXTRS loop + if j != PYRAMID or (newloc != place[PYRAMID] and newloc != place[EMERALD]) then + if toting(j as uint16) == 1 then + rspeak(128); + if place[MESSAGE] == 0 then + move(CHEST, chloc); + end if; + move(MESSAGE, chloc2); + j := 50; + while j <= MAXTRS loop + if j == PYRAMID and (newloc == place[PYRAMID] or newloc == place[EMERALD]) then + j := j + 1; + continue; + end if; + if at(j as uint16) == 1 and fixed[j] == 0 then + carry(j as uint16, newloc); + end if; + if toting(j as uint16) == 1 then + drop(j as uint16, chloc); + end if; + j := j + 1; + end loop; + dloc[6] := chloc; + odloc[6] := chloc; + dseen[6] := 0; + end if; + if here(j as uint16) == 1 then + k := k + 1; + end if; + end if; + j := j + 1; + end loop; + if tally == tally2+1 and k == 0 and place[CHEST] == 0 and here(LAMP) == 1 and prop[LAMP] == 1 then + rspeak(186); + move(CHEST, chloc); + move(MESSAGE, chloc2); + dloc[6] := chloc; + odloc[6] := chloc; + dseen[6] := 0; + return; + end if; + if odloc[6] != dloc[6] and pct(20) == 1 then + rspeak(127); + return; + end if; +end sub; + +# dwarf stuff. +sub dwarves() is + var i: uint8; + var j: uint8; + var k: uint8; + var try: uint8; + var attack: uint8; + var stick: uint8; + var dtotal: uint8; + var v: uint16; + + # see if dwarves allowed here + + if newloc == 0 or forced(newloc as uint16) == 1 or (cond[newloc as uint8] & NOPIRAT) != 0 then + return; + end if; + + # see if dwarves are active. + + if dflag == 0 then + if newloc > 15 then + dflag := dflag + 1; + end if; + return; + end if; + + # if first close encounter (of 3rd kind) kill 0, 1 or 2 + + if dflag == 1 then + if newloc < 15 or pct(95) != 0 then + return; + end if; + dflag := dflag + 1; + i := 1; + while i < 3 loop + if pct(50) == 1 then + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + dloc[(v % 5 + 1) as uint8] := 0; + end if; + i := 1 + 1; + end loop; + i := 1; + while i < (DWARFMAX-1) loop + if dloc[i] == newloc then + dloc[i] := daltloc; + end if; + odloc[i] := dloc[i]; + i := i + 1; + end loop; + rspeak(3); + drop(AXE, newloc); + return; + end if; + dtotal := 0; + attack := 0; + stick := 0; + i := 1; + while i < DWARFMAX loop + if dloc[i] == 0 then + i := i + 1; + continue; + end if; + + # move a dwarf at random. + try := 1; + while try < 20 loop + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + j := (v % 106 + 15) as uint8; # allowed area + if j != odloc[i] as uint8 and j != dloc[i] as uint8 and not(i == (DWARFMAX-1) and (cond[j] & NOPIRAT) == 1) then + break; + end if; + try := try + 1; + end loop; + if j == 0 then + j := odloc[i] as uint8; + end if; + odloc[i] := dloc[i]; + dloc[i] := j as int16; + if dseen[i] > 0 and newloc >= 15 or + dloc[i] == newloc or odloc[i] == newloc then + dseen[i] := 1; + else + dseen[i] := 0; + end if; + if dseen[i] == 0 then + i := i + 1; + continue; + end if; + dloc[i] := newloc; + if i == 6 then + dopirate(); + else + dtotal := dtotal + 1; + if odloc[i] == dloc[i] then + attack := attack + 1; + if knfloc >= 0 then + knfloc := newloc; + end if; + @asm "call _xrnd"; + @asm "ld (", v, "),hl"; + if v % 1000 < 95*(dflag as uint16 - 2) then + stick := stick + 1; + end if; + end if; + end if; + i := i + 1; + end loop; + if dtotal == 0 then + return; + end if; + if dtotal > 1 then + print("There are "); + print(itoa(dtotal as int16)); + print(" threatening little dwarves in the room with you!\n"); + else + rspeak(4); + end if; + if attack == 0 then + return; + end if; + if dflag == 2 then + dflag := dflag + 1; + end if; + if attack > 1 then + print(itoa(attack as int16)); + print(" of them throw knives at you!!\n"); + k := 6; + else + rspeak(5); + k := 52; + end if; + if stick <= 1 then + rspeak(stick+k); + if stick == 0 then + return; + end if; + else + print(itoa(stick as int16)); + print(" of them get you !!!\n"); + end if; + oldloc2 := newloc; + death(); +end sub; + +# special time limit stuff... +sub stimer(): (ret: uint8) is + var i: uint8; + + if foobar > 0 then + foobar := -foobar; + else + foobar := 0; + end if; + + if tally == 0 and loc >= 15 and loc != 33 then + clock1 := clock1 - 1; + end if; + if clock1 == 0 then + # start closing the cave + prop[GRATE] := 0; + prop[FISSURE] := 0; + i := 1; + while i < DWARFMAX loop + dseen[i] := 0; + i := i + 1; + end loop; + move(TROLL, 0); + move((TROLL+MAXOBJ), 0); + move(TROLL2, 117); + move((TROLL2+MAXOBJ), 122); + juggle(CHASM); + if prop[BEAR] != 3 then + dstroy(BEAR); + end if; + prop[CHAIN] := 0; + fixed[CHAIN] := 0; + prop[AXE] := 0; + fixed[AXE] := 0; + rspeak(129); + clock1 := -1; + closing := 1; + ret := 0; + return; + end if; + if clock1 < 0 then + clock2 := clock2 - 1; + end if; + if clock2 == 0 then + # set up storage room... and close the cave... + prop[BOTTLE] := put(BOTTLE, 115, 1); + prop[PLANT] := put(PLANT, 115, 0); + prop[OYSTER] := put(OYSTER, 115, 0); + prop[LAMP] := put(LAMP, 115, 0); + prop[ROD] := put(ROD, 115, 0); + prop[DWARF] := put(DWARF, 115, 0); + loc := 115; + oldloc := 115; + newloc := 115; + var tmp: int16 := put(GRATE, 116, 0); + prop[SNAKE] := put(SNAKE, 116, 1); + prop[BIRD] := put(BIRD, 116, 1); + prop[CAGE] := put(CAGE, 116, 0); + prop[ROD2] := put(ROD2, 116, 0); + prop[PILLOW] := put(PILLOW, 116, 0); + prop[MIRROR] := put(MIRROR, 115, 0); + fixed[MIRROR] := 116; + i := 1; + while i <= MAXOBJ loop + if toting(i as uint16) == 1 then + dstroy(i as uint16); + end if; + i := i + 1; + end loop; + rspeak(132); + closed := 1; + ret := 1; + return; + end if; + if prop[LAMP] == 1 then + limit := limit - 1; + end if; + if limit <= 30 and here(BATTERIES) == 1 and prop[BATTERIES] == 0 and here(LAMP) == 1 then + rspeak(188); + prop[BATTERIES] := 1; + if (toting(BATTERIES) == 1) then + drop(BATTERIES, loc); + end if; + limit := limit + 2500; + lmwarn := 0; + ret := 0; + return; + end if; + if limit == 0 then + limit := limit - 1; + prop[LAMP] := 0; + if here(LAMP) == 1 then + rspeak(184); + end if; + ret := 0; + return; + end if; + if limit < 0 and loc <= 8 then + rspeak(185); + gaveup := 1; + normend(); + end if; + if limit <= 30 then + if lmwarn > 0 or here(LAMP) == 0 then + ret := 0; + return; + end if; + lmwarn := 1; + i := 187; + if place[BATTERIES] == 0 then + i := 183; + end if; + if prop[BATTERIES] == 1 then + i := 189; + end if; + rspeak(i); + ret := 0; + return; + end if; + ret := 0; +end sub; + +# Routine to process an object. +sub doobj() is + var wtype: int16; + var wval: int16; + var i: uint8; + var valid: uint8; + + # is object here? if so, transitive + + if fixed[object as uint8] == loc or here(object as uint16) == 1 then + trobj(); + # did he give grate as destination? + elseif object == GRATE then + if loc == 1 or loc == 4 or loc == 7 then + motion := DEPRESSION; + domove(); + elseif loc > 9 and loc < 15 then + motion := ENTRANCE; + domove(); + end if; + # is it a dwarf he is after? + elseif dcheck() > 0 and dflag >= 2 then + object := DWARF; + trobj(); + # is he trying to get/use a liquid? + elseif liq() == object as uint16 and here(BOTTLE) == 1 or liqloc(loc as uint16) == object as uint16 then + trobj(); + elseif object == PLANT and at(PLANT2) == 1 and prop[PLANT2] == 0 then + object := PLANT2; + trobj(); + # is he trying to grab a knife? + elseif object == KNIFE and knfloc == loc then + rspeak(116); + knfloc := -1; + # is he trying to get at dynamite? + elseif object == ROD and here(ROD2) == 1 then + object := ROD2; + trobj(); + else + (valid, wtype, wval) := analyze(&word1[0]); + if valid == 1 then + print("I see no "); + if wtype == 1 then + print(&word1[0]); + else + print(&word2[0]); + end if; + print(" here.\n"); + end if; + end if; +end sub; + +# Routines to process intransitive verbs +sub itverb() @extern("itverb") is + case verb is + when DROP: + when SAY: + when WAVE: + when CALM: + when RUB: + when THROW: + when FIND: + when FEED: + when BREAK: + when WAKE: + needobj(); + when TAKE: + ivtake(); + when OPEN: + when LOCK: + ivopen(); + when NOTHING: + rspeak(54); + when ON: + when OFF: + when POUR: + trverb(); + when WALK: + actspk(verb as uint16); + when KILL: + ivkill(); + when EAT: + iveat(); + when DRINK: + ivdrink(); + when QUIT: + ivquit(); + when FILL: + ivfill(); + when BLAST: + vblast(); + when SCORE: + score(); + when FOO: + ivfoo(); + when SUSPEND: + saveflg := 1; + when INVENTORY: + inventory(); + when READ: + ivread(); + when else: + print("This intransitive not implemented yet\n"); + end case; +end sub; + +# Routine to take 1 turn +sub turn() is + var i: uint8; + + # if closing, then he can't leave except via + # the main office. + + if newloc < 9 and newloc != 0 and closing == 1 then + rspeak(130); + newloc := loc; + if panic == 0 then + clock2 := 15; + end if; + panic := 1; + end if; + + # see if a dwarf has seen him and has come + # from where he wants to go. + + if newloc != loc and forced(loc as uint16) == 0 and cond[loc as uint8] & NOPIRAT == 0 then + i := 1; + while i < (DWARFMAX-1) loop + if odloc[i] == newloc and dseen[i] == 1 then + newloc := loc; + rspeak(2); + break; + end if; + i := i + 1; + end loop; + end if; + + dwarves(); # & special dwarf(pirate who steals) + + if loc != newloc then + turns := turns + 1; + loc := newloc; + + # check for death + if loc == 0 then + death(); + return; + end if; + + # check for forced move + if forced(loc as uint16) == 1 then + describe(); + domove(); + return; + end if; + + # check for wandering in dark + if wzdark == 1 and dark() == 1 and pct(35) == 1 then + rspeak(23); + oldloc2 := loc; + death(); + return; + end if; + + # describe his situation + describe(); + + if dark() == 0 then + visited[loc as uint8] := visited[loc as uint8] + 1; + descitem(); + end if; + end if; + + if closed == 1 then + if prop[OYSTER] < 0 and toting(OYSTER) == 1 then + pspeak(OYSTER, 1); + end if; + i := 1; + while i <= MAXOBJ loop + if toting(i as uint16) == 1 and prop[i] < 0 then + prop[i] := -1 - prop[i]; + end if; + i := i + 1; + end loop; + end if; + + wzdark := dark() as int16; + + if knfloc > 0 and knfloc != loc then + knfloc := 0; + end if; + + if stimer() == 1 then # as the grains of sand slip by + return; + end if; + + while english() == 0 loop # retrieve player instructions + end loop; + + if dbugflg == 1 then + print("loc = "); + print(itoa(loc)); + print(", verb = "); + print(itoa(verb)); + print(", object = "); + print(itoa(object)); + print(", motion = "); + print(itoa(motion)); + print_nl(); + end if; + + if motion == 1 then # execute player instructions + domove(); + elseif object == 1 then + doobj(); + else + itverb(); + end if; +end sub; + +# main + var arg: [uint8]; + + @asm "call _xrndseed"; + + dbugflg := 0; + + ArgvInit(); + + arg := ArgvNext(); + + if [arg] == 'd' or [arg] == 'D' then + dbugflg := 1; + end if; + + opentxt(); + initplay(); + + if yes(65, 1, 0) == 1 then + limit := 1000; + else + limit := 330; + end if; + + saveflg := 0; + + while saveflg == 0 loop + turn(); + end loop; + + closefiles(); + exit(); + \ No newline at end of file diff --git a/Source/Images/d_cowgol/u0/COWFIX.COM b/Source/Images/d_cowgol/u0/COWFIX.COM index a294951eae1c475dd1df3e830f535bd1a4056f55..3d886f082be69ae9050d58571606ccefc7d98552 100644 GIT binary patch literal 13952 zcmdT~dvqIDnIFlvEXz(}#cn!s(sahkV=UROu{qA?a_xFu_4r$(fY->bS&dlz+dw1!BZ507&_Kf;mV?sS8 z?e#jOl7OWCt(4F|qC}$!U)7m}F1r(YuQDo0`aomC2&5zTRQsHu5>I(VsH<(z6G~#DG3mw{VxOUIIiOy3Iz=VRRNJ+$9oU zsn>3DPYin!`kKaQbm*z2v5w|o{lXGhZ{S!#g~RA8_6HjBsB#xsdx5Aw*f?x}kv7~o zmo@@daa2>1ml?sUMy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QO{|II56y$t%J_PiU>ru6ntWJG&QG?uFddhRZ^q}2$?D0fIQ@_= z#wTm>^D*VjI3T8CNB&N8&OASc{=vCppCW~Fxs9(hresHBm6bX=c}I)Giycl^{nvQT z=qH;duOlQ?AB-E{4}dn==_|tj63zvWKCijU^_P_ozSFD0gCc0PH0`W*R#z?1Ng zXc0Yiyza^4-d2x8DlTg+p6P8ZhPI4j*7RZ`L3fT}scfbfF80?!xRQi9J@)C1wNb68 zMxND|MYZA@pL`LoTf|iDYf4#-FREO`j^kMKW^jIyzKmvO0h^ebCVtmOPy2ucbc0q; zIo6gF#05+d%?{~b9t{M8xJ6HgnGC~h-8nYP5>{gTT;3S@snojJ)Hw^4jsO#G)pn`d zJZww3bxxwsy*)k3mpZ~nmF}KB9oUy~^Q^-i|Nr>)+Q)^xfCjv45X(u&+(o(-Y}B zctklE-raSud!N!X(9dsxrdQh35f1nCD?Nwzg#mDQpkE;vI$oq;4vX?9d!@sD`}XuJ z{risedx+S+!%ZM?=e-*?ecB_H?d_EIcJf1Lkv{1_H$fEM*#mS4rAyl1-O~x)?%sFg zAkgtko6_6Yue5mVjrMl*cYvn8HjlJ-Uss=E4|n$U*#kG;)asG4Bmhba4|I1oN+Tl@ zzGYmJunvc~aXIaQKYZD=eOud(%{$uexo=zB-8=7Xla%?-N3AZF{v?newdMcMxg0y) z^vONtZroLcpW@ud9^b$}jzvBKU?cxH7x~b<(sJWXH{Y^0bZhIn4I4LY{=^ok_W$nl E-`&!>mH+?% diff --git a/Source/Images/d_cowgol/u0/XRND.AS b/Source/Images/d_cowgol/u0/XRND.AS new file mode 100644 index 00000000..73a8054f --- /dev/null +++ b/Source/Images/d_cowgol/u0/XRND.AS @@ -0,0 +1,53 @@ +; Xorshift is a class of pseudorandom number generators discovered +; by George Marsaglia and detailed in his 2003 paper, Xorshift RNGs. +; +; 16-bit xorshift pseudorandom number generator by John Metcalf +; returns hl = pseudorandom number +; corrupts a + +; generates 16-bit pseudorandom numbers with a period of 65535 +; using the xorshift method: + +; hl ^= hl << 7 +; hl ^= hl >> 9 +; hl ^= hl << 8 + +; some alternative shift triplets which also perform well are: +; 6, 7, 13; 7, 9, 13; 9, 7, 13. + + psect text + + GLOBAL _xrnd, _xrndseed + +_xrnd: + ld hl,1 ; seed must not be 0 + ld a,h + rra + ld a,l + rra + xor h + ld h,a + ld a,l + rra + ld a,h + rra + xor l + ld l,a + xor h + ld h,a + ld (_xrnd+1),hl + res 7,h ;make-it positive... + ret + +_xrndseed: + ld a,r + ld l,a + ld a,r + ld h,a + or l ; HL must be not NULL + jr nz,1f + inc hl +1: + ld (_xrnd+1),hl + ret + \ No newline at end of file