1
1
# The Lighthouse of Doom
2
2
3
- This repository contain a simple text-based adventure game.
3
+ This repository contain a simple text-based adventure game, implemented
4
+ twice:
4
5
5
- Currently this is implemented in portable C, however the intention is
6
- to re-implement the game to run on a CP/M system.
6
+ * [ C Implementation ] ( #c-implementation )
7
+ * [ Z80 Implementation ] ( #z80-implementation )
7
8
9
+ My intention was to write a simple text-based adventure game to run under
10
+ CP/M. Starting large projects in Z80 assembly language from scratch
11
+ is a bit of a daunting prospect, so I decided to code a simple game in C
12
+ to get the design right and to avoid getting stuck in too many low-level
13
+ details.
8
14
9
15
10
16
## Plot
@@ -15,21 +21,16 @@ to re-implement the game to run on a CP/M system.
15
21
* The boat will surely crash if you don't turn on the main light.
16
22
17
23
The game is over, when you either fix the light, or find another solution.
18
- If you do not achieve victory in 100 turns the boat runs aground, and
24
+ If you do not achieve victory within a turn-limit the boat runs aground, and
19
25
death will consume you all. (It is a _ very_ big boat!)
20
26
21
27
22
28
23
29
## C Implementation
24
30
25
- My goal behind this game is to write something simple, which can then be ported
26
- to run upon a CP/M system. That mostly means that we should store as much
27
- logic as possible in a series of lookup-tables, or array of items - rather
28
- than writing complex logic within our handlers.
29
-
30
31
The implementation is mostly concerned with creating the correct series of
31
32
data-structures, which are essentially arrays of objects. Because if we
32
- can make the game table-based that simplifies the coding that needs to be
33
+ can make the game table-based we simplify the coding that needs to be
33
34
done - we don't need to write per-object handlers anywhere, we can just
34
35
add pointers to tables/structures.
35
36
@@ -48,7 +49,7 @@ too much state to care about:
48
49
* Whether you won/lost.
49
50
50
51
51
- ### Running The Game
52
+ ### Running It
52
53
53
54
Build the game by running ` make ` , and then launch it.
54
55
@@ -58,11 +59,27 @@ If you get stuck you can see command by entering `help`.
58
59
59
60
## Z80 Implementation
60
61
61
- There is not yet a complete implementation of the game written in z80
62
- assembly language, however there is a basic stub.
62
+ The Z80 implementation is based upon the C-implementation, with a few
63
+ small changes.
64
+
65
+ The implementation uses a simple set of structures:
66
+
67
+ * A command-table to map input-commands to handlers.
68
+ * An item-table to store details about each object in the game.
69
+ * A person table to store telephone messages.
70
+
71
+ Along the way I did realize that having fixed inventory slots made the
72
+ coding more of a challenge, so I made the location of each object a
73
+ property of the object itself.
74
+
75
+
76
+ ### Running It
77
+
78
+ Ensure you have the ` pasmo ` assembler installed, then build the code
79
+ by running ` make game ` , or ` make releas ` .
63
80
64
- The C-code will not be literally ported over, however the same text will
65
- be used and the idea of using tables and structures will be maintained .
81
+ In either case the output will be a binary named ` lihouse.com ` which you
82
+ should be able to run upon your system - or under a CP/M emulator .
66
83
67
84
68
85
0 commit comments