Basys 3 RISC-V computer
The Basys 3 Z-80 computer with the Z-80 replaced by an RV32IM processor written from scratch (rtl/rv32_cpu.v): multi-cycle, 90 MHz, CSRs and traps, interrupts, two hardware triggers and a resumable NMI for the monitor. Passes riscv-tests rv32ui/um/mi. rv32_system.v keeps all the Z-80 machine's peripherals, with I/O port N at FFFFFF00h + N, 80 KB of RAM with BASIC preloaded, and a 32 KB monitor ROM. BASIC, the five games and the monitor (with an RV32 disassembler, assembler, breakpoints and single step) are ported to RISC-V GCC. Python emulator and tests in tools/; full-system simulation in sim/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
5930b958b4
103 files changed
+55677
No files matched your search
@@ -0,0 +1,454 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Turn the art and the castle map below into data.h for keep.c.
|
||||
|
||||
Shapes and tiles are 16 rows of 16 hex digits, one colour per pixel (the
|
||||
terminal's 16 colours; 0 is see-through). The castle is 4 x 3 rooms; each room
|
||||
is 18 x 12 tiles inside a wall border that gen.py adds, with gaps where two
|
||||
rooms connect. Map characters:
|
||||
|
||||
# wall D locked door (a key opens it) X stairs out
|
||||
. floor P where the player starts
|
||||
K key G gold chest A ammunition C the crown
|
||||
h guard patrolling left-right v guard patrolling up-down
|
||||
c guard that chases you once it has seen you
|
||||
|
||||
The script checks that every room's objects fit the sprite budget and that
|
||||
everything can be reached from the start, counting a key for every door.
|
||||
"""
|
||||
import sys
|
||||
from collections import deque
|
||||
|
||||
# ------------------------------------------------------------------ shapes
|
||||
PLAYER_DOWN_TOP = [
|
||||
"0000033333300000",
|
||||
"0000333333330000",
|
||||
"0000399999930000",
|
||||
"0000390990930000",
|
||||
"0000099999900000",
|
||||
"0000000990000000",
|
||||
]
|
||||
PLAYER_UP_TOP = [
|
||||
"0000033333300000",
|
||||
"0000333333330000",
|
||||
"0000333333330000",
|
||||
"0000333333330000",
|
||||
"0000033333300000",
|
||||
"0000000990000000",
|
||||
]
|
||||
BODY_FRONT = [
|
||||
"000CCCCCCCCCC000",
|
||||
"00CCCCCCCCCCCC00",
|
||||
"009CCCCCCCCCC900",
|
||||
"009CCCCCCCCCC900",
|
||||
"0000CCCCCCCC0000",
|
||||
"0000444444440000",
|
||||
]
|
||||
LEGS_FRONT_A = [
|
||||
"0000444004440000",
|
||||
"0000444004440000",
|
||||
"0000777007770000",
|
||||
"0000000000000000",
|
||||
]
|
||||
LEGS_FRONT_B = [
|
||||
"0000044004400000",
|
||||
"0000044004400000",
|
||||
"0000077007700000",
|
||||
"0000000000000000",
|
||||
]
|
||||
PLAYER_SIDE_TOP = [
|
||||
"0000033333300000",
|
||||
"0000333333330000",
|
||||
"0000333399990000",
|
||||
"0000333990990000",
|
||||
"0000033999990000",
|
||||
"0000000999000000",
|
||||
"00000CCCCCC00000",
|
||||
"0000CCCCCCCC0000",
|
||||
"0000CCCCC9990000",
|
||||
"0000CCCCCC000000",
|
||||
"00000CCCCC000000",
|
||||
"0000044444400000",
|
||||
]
|
||||
LEGS_SIDE_A = [
|
||||
"0000044004400000",
|
||||
"0000444000440000",
|
||||
"0000777000770000",
|
||||
"0000000000000000",
|
||||
]
|
||||
LEGS_SIDE_B = [
|
||||
"0000004444000000",
|
||||
"0000004444000000",
|
||||
"0000007777000000",
|
||||
"0000000000000000",
|
||||
]
|
||||
PLAYER = [
|
||||
PLAYER_DOWN_TOP + BODY_FRONT + LEGS_FRONT_A,
|
||||
PLAYER_DOWN_TOP + BODY_FRONT + LEGS_FRONT_B,
|
||||
PLAYER_UP_TOP + BODY_FRONT + LEGS_FRONT_A,
|
||||
PLAYER_UP_TOP + BODY_FRONT + LEGS_FRONT_B,
|
||||
PLAYER_SIDE_TOP + LEGS_SIDE_A,
|
||||
PLAYER_SIDE_TOP + LEGS_SIDE_B,
|
||||
]
|
||||
# guards: grey helmet, green tunic, dark grey trousers, brown boots
|
||||
GUARD = [[r.translate(str.maketrans("3C47", "7283")) for r in s] for s in PLAYER]
|
||||
|
||||
|
||||
def dot(c):
|
||||
rows = ["0" * 16] * 16
|
||||
for y in range(6, 10):
|
||||
rows[y] = "000000" + c * 4 + "000000"
|
||||
return rows
|
||||
|
||||
|
||||
KEY = ["0" * 16] * 3 + [
|
||||
"000BBB0000000000",
|
||||
"00B000B000000000",
|
||||
"00B000BBBBBBBBB0",
|
||||
"00B000B0000B0B00",
|
||||
"000BBB00000B0B00",
|
||||
] + ["0" * 16] * 8
|
||||
CHEST = ["0" * 16] * 3 + [
|
||||
"0003333333333000",
|
||||
"0033333333333300",
|
||||
"003BBBBBBBBBB300",
|
||||
"0033333BB3333300",
|
||||
"0033333BB3333300",
|
||||
"0033333333333300",
|
||||
"0033333333333300",
|
||||
"003BBBBBBBBBB300",
|
||||
"0033333333333300",
|
||||
] + ["0" * 16] * 4
|
||||
AMMO = ["0" * 16] * 3 + [
|
||||
"0022222222222200",
|
||||
"0028888888888200",
|
||||
"0028BB8BB8BB8200",
|
||||
"0028BB8BB8BB8200",
|
||||
"0028BB8BB8BB8200",
|
||||
"0028888888888200",
|
||||
"0022222222222200",
|
||||
] + ["0" * 16] * 6
|
||||
CROWN = ["0" * 16] * 3 + [
|
||||
"000B000BB000B000",
|
||||
"000BB0BBBB0BB000",
|
||||
"000BBBBBBBBBB000",
|
||||
"000BB9BBBB9BB000",
|
||||
"000BBBBCCBBBB000",
|
||||
"000BBBBBBBBBB000",
|
||||
"0000000000000000",
|
||||
"000BBBBBBBBBB000",
|
||||
] + ["0" * 16] * 5
|
||||
PUFF = [
|
||||
"0000000000000000",
|
||||
"000F00000000F000",
|
||||
"0000F00BB00F0000",
|
||||
"00000F0BB0F00000",
|
||||
"000000BFFB000000",
|
||||
"0BBB0BFFFFB0BBB0",
|
||||
"000000BFFB000000",
|
||||
"00000F0BB0F00000",
|
||||
"0000F00BB00F0000",
|
||||
"000F00000000F000",
|
||||
] + ["0" * 16] * 6
|
||||
|
||||
SHAPES = PLAYER + GUARD + [dot("B"), dot("9"), KEY, CHEST, AMMO, CROWN, PUFF]
|
||||
SHAPE_NAMES = ["S_PDOWN", "S_PDOWN2", "S_PUP", "S_PUP2", "S_PSIDE", "S_PSIDE2",
|
||||
"S_GDOWN", "S_GDOWN2", "S_GUP", "S_GUP2", "S_GSIDE", "S_GSIDE2",
|
||||
"S_SHOT", "S_GSHOT", "S_KEY", "S_CHEST", "S_AMMO", "S_CROWN", "S_PUFF"]
|
||||
|
||||
# ------------------------------------------------------------------- tiles
|
||||
WALL = (["8888888888888888", "7777777877777778", "7777777877777778", "7777777877777778",
|
||||
"8888888888888888", "7778777777787777", "7778777777787777", "7778777777787777"] * 2)
|
||||
DOOR = (["8888888888888888"] + ["8333833383338338"] * 6 +
|
||||
["8333833BB3338338"] * 2 + ["8333833383338338"] * 6 + ["8888888888888888"])
|
||||
STAIRS = ["EEEEEEEEEEEEEEEE", "6666666666666666", "8888888888888888", "0000000000000000"] * 4
|
||||
TILES = [["0" * 16] * 16, WALL, DOOR, STAIRS] # floor, wall, door, stairs
|
||||
|
||||
# -------------------------------------------------------------------- map
|
||||
ROOMS = [[None] * 4 for _ in range(3)]
|
||||
NAMES = [[None] * 4 for _ in range(3)]
|
||||
|
||||
def room(r, c, name, rows):
|
||||
ROOMS[r][c] = rows
|
||||
NAMES[r][c] = name
|
||||
|
||||
room(0, 0, "GATEHOUSE", [
|
||||
"..................",
|
||||
"..P...............",
|
||||
"..................",
|
||||
"....####....####..",
|
||||
"....#..........#..",
|
||||
"....#...A......#..",
|
||||
"....#..........#..",
|
||||
"....####....####..",
|
||||
"..................",
|
||||
"..................",
|
||||
"..................",
|
||||
"..................",
|
||||
])
|
||||
room(0, 1, "GUARD ROOM", [
|
||||
"..................",
|
||||
".h................",
|
||||
"..................",
|
||||
"..###.......###...",
|
||||
"..#...........#...",
|
||||
"..#.....K.....#...",
|
||||
"..#...........#...",
|
||||
"..###.......###...",
|
||||
"..................",
|
||||
"...........h......",
|
||||
"..................",
|
||||
"..................",
|
||||
])
|
||||
room(0, 2, "CHAPEL", [
|
||||
"..................",
|
||||
".v..........v.....",
|
||||
"..................",
|
||||
"......######......",
|
||||
"......#G.G#.......",
|
||||
"......#...D.......",
|
||||
"......#####.......",
|
||||
"..................",
|
||||
"..................",
|
||||
"....h.............",
|
||||
"..................",
|
||||
"..................",
|
||||
])
|
||||
room(0, 3, "ARMOURY", [
|
||||
"..................",
|
||||
"..A............A..",
|
||||
"..................",
|
||||
".####.......####..",
|
||||
"..................",
|
||||
"........h.........",
|
||||
"..................",
|
||||
".####.......####..",
|
||||
"..................",
|
||||
"..................",
|
||||
".......c..........",
|
||||
"..................",
|
||||
])
|
||||
room(1, 0, "CORRIDOR", [
|
||||
"..................",
|
||||
".v.......####.....",
|
||||
".........#........",
|
||||
".........#....h...",
|
||||
"#######..#........",
|
||||
"..................",
|
||||
"..................",
|
||||
"#######..########.",
|
||||
".........#........",
|
||||
"..A......#........",
|
||||
".........#....v...",
|
||||
"..................",
|
||||
])
|
||||
room(1, 1, "GREAT HALL", [
|
||||
"..................",
|
||||
"..G............G..",
|
||||
"..................",
|
||||
"....##......##....",
|
||||
"....##..h...##....",
|
||||
"..................",
|
||||
"..................",
|
||||
"....##......##....",
|
||||
"....##...h..##....",
|
||||
"..................",
|
||||
".c...........v....",
|
||||
"..................",
|
||||
])
|
||||
room(1, 2, "CELLARS", [
|
||||
"...#.......#......",
|
||||
"...#.#####.#.####.",
|
||||
"...#.#.....#....#.",
|
||||
".....#.#######..#.",
|
||||
"######.#.....#..#.",
|
||||
".......#..A..#....",
|
||||
".#######.....###..",
|
||||
".#.......###......",
|
||||
".#.#######.#.####.",
|
||||
".#.........#.#....",
|
||||
".#####.#####.#.h..",
|
||||
".......#.......#..",
|
||||
])
|
||||
room(1, 3, "LIBRARY", [
|
||||
"..................",
|
||||
".##.##.##.##.##.#.",
|
||||
"..................",
|
||||
".##.##.##.##.##.#.",
|
||||
"..........h.......",
|
||||
"..................",
|
||||
".##.##.##.##.##.#.",
|
||||
"..................",
|
||||
".##.##.##.##.##.#.",
|
||||
"........K.........",
|
||||
"...v..............",
|
||||
"..................",
|
||||
])
|
||||
room(2, 0, "STAIRWELL", [
|
||||
"..................",
|
||||
"..................",
|
||||
"..######..######..",
|
||||
"..#............#..",
|
||||
"..#.....XX.....#..",
|
||||
"..#.....XX.....#..",
|
||||
"..#............#..",
|
||||
"..######..######..",
|
||||
"..................",
|
||||
"....h.............",
|
||||
"..................",
|
||||
"..................",
|
||||
])
|
||||
room(2, 1, "DUNGEON", [
|
||||
".#..#..#..#..#..#.",
|
||||
".#..#..#..#..#..#.",
|
||||
".#..#..#..#..#..#.",
|
||||
".##.####..####.##.",
|
||||
"..................",
|
||||
"........v.........",
|
||||
"..................",
|
||||
".##.####..####.##.",
|
||||
".#..#..#..#..#..#.",
|
||||
".#K.#..#..#.G#..#.",
|
||||
".#..#..#..#..#..#.",
|
||||
"..................",
|
||||
])
|
||||
room(2, 2, "TREASURY", [
|
||||
"..................",
|
||||
"..h...............",
|
||||
"..................",
|
||||
".....##########...",
|
||||
".....#G..G...G#...",
|
||||
".....#........#...",
|
||||
".....######D###...",
|
||||
"..................",
|
||||
"..................",
|
||||
".........v........",
|
||||
"..................",
|
||||
"..................",
|
||||
])
|
||||
room(2, 3, "THRONE ROOM", [
|
||||
"#######D##########",
|
||||
"..................",
|
||||
".c..............c.",
|
||||
"..................",
|
||||
"...####....####...",
|
||||
"...#..........#...",
|
||||
"...#....C.....#...",
|
||||
"...#..........#...",
|
||||
"...####....####...",
|
||||
"..................",
|
||||
".v..............v.",
|
||||
"..................",
|
||||
])
|
||||
|
||||
# links: (room, room) side by side or one above the other
|
||||
H_LINKS = {(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1)} # (r, c) to (r, c+1)
|
||||
V_LINKS = {(0, 0), (1, 0), (0, 3), (1, 3), (1, 1)} # (r, c) to (r+1, c)
|
||||
|
||||
W, H = 20, 14
|
||||
GAP_ROWS = (6, 7) # side gaps, in room rows
|
||||
GAP_COLS = (8, 9) # top/bottom gaps, in room columns
|
||||
OBJ = "PKGAChvc"
|
||||
|
||||
|
||||
def full_room(r, c):
|
||||
inner = ROOMS[r][c]
|
||||
assert len(inner) == 12 and all(len(x) == 18 for x in inner), NAMES[r][c]
|
||||
g = [["#"] * W for _ in range(H)]
|
||||
for y in range(12):
|
||||
for x in range(18):
|
||||
g[y + 1][x + 1] = inner[y][x]
|
||||
if (r, c) in H_LINKS:
|
||||
for y in GAP_ROWS: g[y][W - 1] = "."
|
||||
if (r, c - 1) in H_LINKS:
|
||||
for y in GAP_ROWS: g[y][0] = "."
|
||||
if (r, c) in V_LINKS:
|
||||
for x in GAP_COLS: g[H - 1][x] = "."
|
||||
if (r - 1, c) in V_LINKS:
|
||||
for x in GAP_COLS: g[0][x] = "."
|
||||
return g
|
||||
|
||||
|
||||
FULL = [[full_room(r, c) for c in range(4)] for r in range(3)]
|
||||
|
||||
# one big grid to check reachability across rooms
|
||||
BIG = [[FULL[gy // H][gx // W][gy % H][gx % W] for gx in range(4 * W)] for gy in range(3 * H)]
|
||||
|
||||
def check():
|
||||
start = [(x, y) for y in range(3 * H) for x in range(4 * W) if BIG[y][x] == "P"]
|
||||
assert len(start) == 1
|
||||
doors = sum(row.count("D") for row in BIG)
|
||||
keys = sum(row.count("K") for row in BIG)
|
||||
assert keys >= doors, f"{keys} keys for {doors} doors"
|
||||
# with every door open, every non-wall tile must be reachable
|
||||
seen = {start[0]}
|
||||
q = deque(seen)
|
||||
while q:
|
||||
x, y = q.popleft()
|
||||
for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < 4 * W and 0 <= ny < 3 * H and (nx, ny) not in seen and BIG[ny][nx] != "#":
|
||||
seen.add((nx, ny)); q.append((nx, ny))
|
||||
lost = [(x, y, BIG[y][x]) for y in range(3 * H) for x in range(4 * W)
|
||||
if BIG[y][x] != "#" and (x, y) not in seen]
|
||||
objs_lost = [t for t in lost if t[2] != "."]
|
||||
assert not objs_lost, f"unreachable objects: {objs_lost}"
|
||||
# rooms' sprite budgets: 6 guards, 8 items
|
||||
for r in range(3):
|
||||
for c in range(4):
|
||||
s = "".join("".join(row) for row in FULL[r][c])
|
||||
assert sum(s.count(ch) for ch in "hvc") <= 6, NAMES[r][c]
|
||||
assert sum(s.count(ch) for ch in "KGAC") <= 8, NAMES[r][c]
|
||||
assert s.count("D") <= 8, NAMES[r][c]
|
||||
return len(lost)
|
||||
|
||||
|
||||
def nib(c):
|
||||
return int(c, 16)
|
||||
|
||||
|
||||
def main(out):
|
||||
unreach = check()
|
||||
L = ["/* made by gen.py - edit that instead */", ""]
|
||||
L.append("#define N_SHAPES %d" % len(SHAPES))
|
||||
for i, n in enumerate(SHAPE_NAMES):
|
||||
L.append("#define %s %d" % (n, i))
|
||||
for i, s in enumerate(SHAPES):
|
||||
assert len(s) == 16 and all(len(row) == 16 for row in s), SHAPE_NAMES[i]
|
||||
L.append("static const u8 shape_data[N_SHAPES * 128] = {")
|
||||
for s in SHAPES:
|
||||
b = [nib(row[x]) << 4 | nib(row[x + 1]) for row in s for x in range(0, 16, 2)]
|
||||
L.append(" " + ",".join(str(v) for v in b) + ",")
|
||||
L.append("};")
|
||||
L.append("static const u8 tile_data[4 * 256] = {")
|
||||
for t in TILES:
|
||||
assert len(t) == 16 and all(len(row) == 16 for row in t)
|
||||
L.append(" " + ",".join(str(nib(ch)) for row in t for ch in row) + ",")
|
||||
L.append("};")
|
||||
# rooms: tiles packed two per byte (low nibble first), then object lists
|
||||
code = {".": 0, "#": 1, "D": 2, "X": 3}
|
||||
L.append("static const u8 room_tiles[12][140] = {")
|
||||
objs = []
|
||||
for r in range(3):
|
||||
for c in range(4):
|
||||
g = FULL[r][c]
|
||||
t = [code.get(g[y][x], 0) for y in range(H) for x in range(W)]
|
||||
L.append(" {" + ",".join(str(t[i] | t[i + 1] << 4) for i in range(0, W * H, 2)) + "},")
|
||||
ol = [(g[y][x], x, y) for y in range(H) for x in range(W) if g[y][x] in OBJ]
|
||||
objs.append(ol)
|
||||
L.append("};")
|
||||
L.append("/* objects: type, tile x, tile y; ends with 0 */")
|
||||
L.append("static const u8 room_objs[12][3 * 16 + 1] = {")
|
||||
for ol in objs:
|
||||
assert len(ol) <= 16
|
||||
L.append(" {" + ",".join("'%s',%d,%d" % o for o in ol) + (",0}," if ol else "0},"))
|
||||
L.append("};")
|
||||
L.append("static const char *const room_names[12] = {")
|
||||
L.append(" " + ", ".join('"%s"' % NAMES[r][c] for r in range(3) for c in range(4)))
|
||||
L.append("};")
|
||||
open(out, "w").write("\n".join(L) + "\n")
|
||||
print("data.h: %d shapes, 12 rooms (%d floor tiles only reachable through nothing)" %
|
||||
(len(SHAPES), unreach))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1] if len(sys.argv) > 1 else "data.h")
|
||||
@@ -0,0 +1,4 @@
|
||||
10 REM THE IRON KEEP: LOAD THE GAME (MEMORY FILE KEEPGAME) AND PLAY IT
|
||||
20 REM THE GAME RUNS AT A200H, PAST THIS PROGRAM, AND COMES BACK HERE
|
||||
30 BLOAD "KEEPGAME": CALL 41472
|
||||
40 CLS
|
||||
@@ -0,0 +1,647 @@
|
||||
/* The Iron Keep: a top-down escape game for the Basys 3 RISC-V computer.
|
||||
|
||||
You are a prisoner in a castle of twelve rooms. Steal the crown from the
|
||||
throne room and get out down the stairs. Guards patrol, and shoot when they
|
||||
can see you along a row or a column; some come after you. Keys open locked
|
||||
doors, chests hold gold, crates hold ammunition.
|
||||
|
||||
It runs at A200h, loaded by the KEEP program in BASIC, and returns to BASIC
|
||||
when you quit. It uses the hardware sprites (ports 70h-78h), the graphics
|
||||
layer (30h-34h), the held-key port (88h) and the terminal for text.
|
||||
Build with build.sh; gen.py makes data.h from the art and the map. */
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef signed char i8;
|
||||
typedef unsigned short u16;
|
||||
typedef short i16;
|
||||
|
||||
#include "basys3.h"
|
||||
|
||||
#define con_stat IO8(0x00) /* bit 0: key waiting, bit 1: can send */
|
||||
#define con_data IO8(0x01)
|
||||
#define gx_lo IO8(0x30)
|
||||
#define gx_hi IO8(0x31)
|
||||
#define gy_p IO8(0x32)
|
||||
#define gpix IO8(0x33) /* plot, then X + 1 */
|
||||
#define gfill IO8(0x34) /* fill the graphics (and turn sprites off) */
|
||||
#define sp_sel IO8(0x70)
|
||||
#define sp_xlo IO8(0x71)
|
||||
#define sp_xhi IO8(0x72)
|
||||
#define sp_y IO8(0x73)
|
||||
#define sp_shape IO8(0x74)
|
||||
#define sp_ctl IO8(0x75)
|
||||
#define sp_load IO8(0x76)
|
||||
#define sp_data IO8(0x77)
|
||||
#define frame_ctr IO8(0x78)
|
||||
#define joy IO8(0x88)
|
||||
|
||||
#include "data.h" /* out/data.h, made by gen.py */
|
||||
|
||||
#define J_UP 1
|
||||
#define J_DOWN 2
|
||||
#define J_LEFT 4
|
||||
#define J_RIGHT 8
|
||||
#define J_FIRE 16
|
||||
#define J_ENTER 32
|
||||
#define J_ESC 128
|
||||
|
||||
/* directions */
|
||||
#define D_DOWN 0
|
||||
#define D_UP 1
|
||||
#define D_LEFT 2
|
||||
#define D_RIGHT 3
|
||||
static const i8 dir_dx[4] = { 0, 0, -1, 1 };
|
||||
static const i8 dir_dy[4] = { 1, -1, 0, 0 };
|
||||
|
||||
/* tiles */
|
||||
#define T_FLOOR 0
|
||||
#define T_WALL 1
|
||||
#define T_DOOR 2
|
||||
#define T_STAIRS 3
|
||||
#define T_OUT 0xFF
|
||||
|
||||
/* sprite numbers: lower numbers are in front */
|
||||
#define SP_PLAYER 0
|
||||
#define SP_PSHOT 1 /* 2 */
|
||||
#define SP_GUARD 3 /* 6 */
|
||||
#define SP_GSHOT 9 /* 4 */
|
||||
#define SP_ITEM 13 /* 8 */
|
||||
#define SP_PUFF 21
|
||||
|
||||
#define NG 6
|
||||
#define NI 8
|
||||
#define NPS 2
|
||||
#define NGS 4
|
||||
|
||||
/* the hit box inside a 16 x 16 figure */
|
||||
#define HB_X0 3
|
||||
#define HB_X1 12
|
||||
#define HB_Y0 2
|
||||
#define HB_Y1 14
|
||||
|
||||
/* -------------------------------------------------------------- state */
|
||||
static u8 map[14][20];
|
||||
/* not static: test-keep.py finds these in the link map */
|
||||
u8 room; /* 0-11: row * 4 + column */
|
||||
static u16 gone[12]; /* objects taken or guards beaten, by index */
|
||||
static u8 opened[12]; /* doors opened, by order in the room */
|
||||
|
||||
i16 px, py; /* player */
|
||||
static i16 ex, ey; /* where it entered the room */
|
||||
static u8 pdir, panim, fire_cool, fire_held;
|
||||
u8 inv, lives, keys, ammo, crown;
|
||||
static u16 gold, kills;
|
||||
|
||||
static i16 gx[NG], gy[NG];
|
||||
static u8 gdir[NG], gon[NG], gkind[NG], gcool[NG], gsee[NG], gobj[NG];
|
||||
static i16 ix[NI], iy[NI];
|
||||
static u8 itype[NI], ion[NI], iobj[NI];
|
||||
static i16 psx[NPS], psy[NPS], gsx[NGS], gsy[NGS];
|
||||
static u8 psd[NPS], pson[NPS], gsd[NGS], gson[NGS];
|
||||
static u8 puff;
|
||||
static i16 puff_x, puff_y;
|
||||
|
||||
static u8 last_frame, quit, status_dirty, msg_time;
|
||||
u8 over, won;
|
||||
static const char *msg;
|
||||
static u16 rnd_state;
|
||||
|
||||
/* -------------------------------------------------------------- text */
|
||||
static void putch(char c) { while (!(con_stat & 2)); con_data = c; }
|
||||
static void puts_(const char *s) { while (*s) putch(*s++); }
|
||||
static void putn(u16 n)
|
||||
{
|
||||
char b[6];
|
||||
u8 i = 0;
|
||||
do { b[i++] = '0' + n % 10; n /= 10; } while (n);
|
||||
while (i) putch(b[--i]);
|
||||
}
|
||||
static void at(u8 r, u8 c) { putch(27); putch('['); putn(r); putch(';'); putn(c); putch('H'); }
|
||||
static void ink(const char *s) { putch(27); putch('['); puts_(s); putch('m'); }
|
||||
static void centre(u8 r, const char *s)
|
||||
{
|
||||
u8 n = 0;
|
||||
while (s[n]) n++;
|
||||
at(r, 41 - n / 2);
|
||||
puts_(s);
|
||||
}
|
||||
|
||||
static u16 rnd(void)
|
||||
{
|
||||
rnd_state ^= rnd_state << 7;
|
||||
rnd_state ^= rnd_state >> 9;
|
||||
rnd_state ^= rnd_state << 8;
|
||||
return rnd_state;
|
||||
}
|
||||
|
||||
static void wait_frame(void)
|
||||
{
|
||||
while (frame_ctr == last_frame);
|
||||
last_frame = frame_ctr;
|
||||
}
|
||||
|
||||
/* Keys also arrive as characters; throw them away (P pauses). */
|
||||
static u8 drain_keys(void)
|
||||
{
|
||||
u8 c, p = 0;
|
||||
while (con_stat & 1) {
|
||||
c = con_data;
|
||||
if (c == 'p' || c == 'P') p = 1;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------- graphics */
|
||||
static void clear_gfx(void)
|
||||
{
|
||||
gfill = 0; /* also turns every sprite off */
|
||||
while (gfill & 1);
|
||||
}
|
||||
|
||||
static void draw_tile(u8 tx, u8 ty, u8 t)
|
||||
{
|
||||
const u8 *p = tile_data + ((u16)t << 8);
|
||||
u16 x = tx << 4;
|
||||
u8 y = 16 + (ty << 4), r, i;
|
||||
for (r = 0; r < 16; r++) {
|
||||
gx_lo = x; gx_hi = x >> 8; gy_p = y + r;
|
||||
for (i = 0; i < 16; i++) gpix = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
static void spr_at(u8 n, i16 x, i16 y)
|
||||
{
|
||||
sp_sel = n; sp_xlo = x; sp_xhi = (x >> 8) & 1; sp_y = y;
|
||||
}
|
||||
static void spr_show(u8 n, u8 shape, u8 ctl)
|
||||
{
|
||||
sp_sel = n; sp_shape = shape; sp_ctl = ctl;
|
||||
}
|
||||
static void spr_off(u8 n) { sp_sel = n; sp_ctl = 0; }
|
||||
|
||||
static void load_shapes(void)
|
||||
{
|
||||
const u8 *p = shape_data;
|
||||
u8 s, i;
|
||||
for (s = 0; s < N_SHAPES; s++) {
|
||||
sp_load = s;
|
||||
for (i = 0; i < 128; i++) sp_data = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- map */
|
||||
static u8 tile_at(i16 x, i16 y)
|
||||
{
|
||||
if (x < 0 || x > 319 || y < 16 || y > 239) return T_OUT;
|
||||
return map[(u8)((y - 16) >> 4)][(u8)(x >> 4)];
|
||||
}
|
||||
|
||||
static u8 hit_tx, hit_ty;
|
||||
|
||||
/* What stops a figure at (x, y): 0 nothing, T_WALL or T_DOOR (hit_tx/ty say
|
||||
which tile). Off the room is open for the player, a wall for guards. */
|
||||
static u8 blocked(i16 x, i16 y, u8 guard)
|
||||
{
|
||||
static const u8 cx[4] = { HB_X0, HB_X1, HB_X0, HB_X1 };
|
||||
static const u8 cy[4] = { HB_Y0, HB_Y0, HB_Y1, HB_Y1 };
|
||||
u8 i, t;
|
||||
for (i = 0; i < 4; i++) {
|
||||
t = tile_at(x + cx[i], y + cy[i]);
|
||||
if (t == T_WALL || t == T_DOOR) {
|
||||
hit_tx = (u8)((x + cx[i]) >> 4);
|
||||
hit_ty = (u8)((y + cy[i] - 16) >> 4);
|
||||
return t;
|
||||
}
|
||||
if (t == T_OUT && guard) return T_WALL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 door_index(u8 tx, u8 ty)
|
||||
{
|
||||
const u8 *p = room_tiles[room];
|
||||
u8 n = 0, i, t;
|
||||
u16 k, want = ty * 20 + tx;
|
||||
for (k = 0; k < want; k++) {
|
||||
i = p[k >> 1];
|
||||
t = (k & 1) ? i >> 4 : i & 15;
|
||||
if (t == T_DOOR) n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static void say(const char *s)
|
||||
{
|
||||
msg = s;
|
||||
msg_time = 180;
|
||||
status_dirty = 1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- status */
|
||||
static void status(void)
|
||||
{
|
||||
status_dirty = 0;
|
||||
at(1, 1); ink("0;93"); puts_("THE IRON KEEP"); ink("0;37"); puts_(" ");
|
||||
puts_(room_names[room]);
|
||||
puts_("\033[K");
|
||||
if (msg && msg_time) { at(1, 40); ink("0;96"); puts_(msg); }
|
||||
at(2, 1); ink("0;37");
|
||||
puts_("LIVES "); ink("0;97"); putn(lives); ink("0;37");
|
||||
puts_(" KEYS "); ink("0;97"); putn(keys); ink("0;37");
|
||||
puts_(" AMMO "); ink("0;97"); putn(ammo); ink("0;37");
|
||||
puts_(" GOLD "); ink("0;97"); putn(gold); ink("0;37");
|
||||
if (crown) { puts_(" "); ink("0;93"); puts_("CROWN"); }
|
||||
puts_("\033[K");
|
||||
ink("0");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- rooms */
|
||||
static void enter_room(void)
|
||||
{
|
||||
const u8 *p = room_tiles[room], *o = room_objs[room];
|
||||
u8 x, y, i, t, d = 0, ng = 0, ni = 0, k = 0;
|
||||
|
||||
clear_gfx();
|
||||
for (y = 0; y < 14; y++)
|
||||
for (x = 0; x < 20; x += 2) {
|
||||
i = *p++;
|
||||
map[y][x] = i & 15;
|
||||
map[y][x + 1] = i >> 4;
|
||||
}
|
||||
for (y = 0; y < 14; y++)
|
||||
for (x = 0; x < 20; x++) {
|
||||
t = map[y][x];
|
||||
if (t == T_DOOR && (opened[room] & (1 << d++))) t = map[y][x] = T_FLOOR;
|
||||
if (t != T_FLOOR) draw_tile(x, y, t);
|
||||
}
|
||||
|
||||
for (i = 0; i < NG; i++) gon[i] = 0;
|
||||
for (i = 0; i < NI; i++) ion[i] = 0;
|
||||
for (; *o; o += 3, k++) {
|
||||
if (gone[room] & (1 << k)) continue;
|
||||
t = o[0];
|
||||
if (t == 'h' || t == 'v' || t == 'c') {
|
||||
gx[ng] = o[1] << 4; gy[ng] = 16 + (o[2] << 4);
|
||||
gkind[ng] = t; gon[ng] = 1; gsee[ng] = 0; gobj[ng] = k;
|
||||
gdir[ng] = t == 'v' ? D_DOWN : D_RIGHT;
|
||||
gcool[ng] = 30 + (rnd() & 31);
|
||||
ng++;
|
||||
} else if (t != 'P') {
|
||||
ix[ni] = o[1] << 4; iy[ni] = 16 + (o[2] << 4);
|
||||
itype[ni] = t; ion[ni] = 1; iobj[ni] = k;
|
||||
spr_at(SP_ITEM + ni, ix[ni], iy[ni]);
|
||||
spr_show(SP_ITEM + ni, t == 'K' ? S_KEY : t == 'G' ? S_CHEST : t == 'A' ? S_AMMO : S_CROWN, 1);
|
||||
ni++;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NPS; i++) pson[i] = 0;
|
||||
for (i = 0; i < NGS; i++) gson[i] = 0;
|
||||
puff = 0;
|
||||
ex = px; ey = py;
|
||||
status_dirty = 1;
|
||||
}
|
||||
|
||||
/* Leave by an edge into the next room. */
|
||||
static void edges(void)
|
||||
{
|
||||
if (px + HB_X0 < 0) { room--; px = 304; }
|
||||
else if (px + HB_X1 > 319) { room++; px = 0; }
|
||||
else if (py + HB_Y0 < 16) { room -= 4; py = 224; }
|
||||
else if (py + HB_Y1 > 239) { room += 4; py = 16; }
|
||||
else return;
|
||||
enter_room();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- player */
|
||||
static void open_door(void)
|
||||
{
|
||||
if (!keys) { say("LOCKED. YOU NEED A KEY."); return; }
|
||||
keys--;
|
||||
opened[room] |= 1 << door_index(hit_tx, hit_ty);
|
||||
map[hit_ty][hit_tx] = T_FLOOR;
|
||||
draw_tile(hit_tx, hit_ty, T_FLOOR);
|
||||
say("THE KEY TURNS. THE DOOR OPENS.");
|
||||
}
|
||||
|
||||
static void move_player(u8 j)
|
||||
{
|
||||
i16 n;
|
||||
u8 t, moved = 0;
|
||||
if (j & (J_LEFT | J_RIGHT)) {
|
||||
pdir = (j & J_LEFT) ? D_LEFT : D_RIGHT;
|
||||
n = px + ((j & J_LEFT) ? -2 : 2);
|
||||
t = blocked(n, py, 0);
|
||||
if (!t) { px = n; moved = 1; }
|
||||
else if (t == T_DOOR) open_door();
|
||||
}
|
||||
if (j & (J_UP | J_DOWN)) {
|
||||
if (!(j & (J_LEFT | J_RIGHT))) pdir = (j & J_UP) ? D_UP : D_DOWN;
|
||||
n = py + ((j & J_UP) ? -2 : 2);
|
||||
t = blocked(px, n, 0);
|
||||
if (!t) { py = n; moved = 1; }
|
||||
else if (t == T_DOOR) open_door();
|
||||
}
|
||||
if (moved) panim++;
|
||||
}
|
||||
|
||||
static void fire(u8 j)
|
||||
{
|
||||
u8 i;
|
||||
if (!(j & J_FIRE)) { fire_held = 0; return; }
|
||||
if (fire_held || fire_cool) return;
|
||||
fire_held = 1;
|
||||
if (!ammo) { say("OUT OF AMMUNITION!"); return; }
|
||||
for (i = 0; i < NPS; i++)
|
||||
if (!pson[i]) {
|
||||
pson[i] = 1; psd[i] = pdir;
|
||||
psx[i] = px + 8 + dir_dx[pdir] * 6;
|
||||
psy[i] = py + 8 + dir_dy[pdir] * 6;
|
||||
ammo--; fire_cool = 8; status_dirty = 1;
|
||||
spr_show(SP_PSHOT + i, S_SHOT, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void player_hit(void)
|
||||
{
|
||||
u8 i;
|
||||
if (inv || over) return;
|
||||
puff = 30; puff_x = px; puff_y = py;
|
||||
if (!--lives) { over = 1; won = 0; return; }
|
||||
say("YOU ARE HIT!");
|
||||
px = ex; py = ey; inv = 120;
|
||||
for (i = 0; i < NGS; i++) { gson[i] = 0; spr_off(SP_GSHOT + i); }
|
||||
}
|
||||
|
||||
static u8 overlap(i16 ax, i16 ay, i16 bx, i16 by)
|
||||
{
|
||||
return ax + HB_X0 <= bx + HB_X1 && bx + HB_X0 <= ax + HB_X1 &&
|
||||
ay + HB_Y0 <= by + HB_Y1 && by + HB_Y0 <= ay + HB_Y1;
|
||||
}
|
||||
|
||||
static void pick_up(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < NI; i++) {
|
||||
if (!ion[i] || !overlap(px, py, ix[i], iy[i])) continue;
|
||||
ion[i] = 0;
|
||||
gone[room] |= 1 << iobj[i];
|
||||
spr_off(SP_ITEM + i);
|
||||
switch (itype[i]) {
|
||||
case 'K': keys++; say("A KEY!"); break;
|
||||
case 'G': gold += 100; say("GOLD! 100 CROWNS."); break;
|
||||
case 'A': ammo += 5; say("FIVE MORE SHOTS."); break;
|
||||
case 'C': crown = 1; say("THE CROWN! NOW FIND THE STAIRS."); break;
|
||||
}
|
||||
}
|
||||
if (tile_at(px + 8, py + 8) == T_STAIRS) {
|
||||
if (crown) { over = 1; won = 1; }
|
||||
else if (msg_time < 120) say("NOT WITHOUT THE CROWN.");
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------- guards */
|
||||
/* Can guard i see the player along a row or a column? Returns the direction
|
||||
to look in, plus 1, or 0. */
|
||||
static u8 sees(u8 i)
|
||||
{
|
||||
i16 gcx = gx[i] + 8, gcy = gy[i] + 8, pcx = px + 8, pcy = py + 8, d;
|
||||
u8 a, b, t, k;
|
||||
d = gcy - pcy;
|
||||
if (d > -8 && d < 8) {
|
||||
k = (u8)((gcy - 16) >> 4);
|
||||
a = (u8)(gcx >> 4); b = (u8)(pcx >> 4);
|
||||
if (a > b) { t = a; a = b; b = t; }
|
||||
for (; a <= b; a++) if (map[k][a] == T_WALL || map[k][a] == T_DOOR) return 0;
|
||||
return (pcx < gcx ? D_LEFT : D_RIGHT) + 1;
|
||||
}
|
||||
d = gcx - pcx;
|
||||
if (d > -8 && d < 8) {
|
||||
k = (u8)(gcx >> 4);
|
||||
a = (u8)((gcy - 16) >> 4); b = (u8)((pcy - 16) >> 4);
|
||||
if (a > b) { t = a; a = b; b = t; }
|
||||
for (; a <= b; a++) if (map[a][k] == T_WALL || map[a][k] == T_DOOR) return 0;
|
||||
return (pcy < gcy ? D_UP : D_DOWN) + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void guard_shoots(u8 i)
|
||||
{
|
||||
u8 k;
|
||||
for (k = 0; k < NGS; k++)
|
||||
if (!gson[k]) {
|
||||
gson[k] = 1; gsd[k] = gdir[i];
|
||||
gsx[k] = gx[i] + 8 + dir_dx[gdir[i]] * 6;
|
||||
gsy[k] = gy[i] + 8 + dir_dy[gdir[i]] * 6;
|
||||
spr_show(SP_GSHOT + k, S_GSHOT, 1);
|
||||
gcool[i] = 45 + (rnd() & 63);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void guards(void)
|
||||
{
|
||||
u8 i, s, d;
|
||||
i16 nx, ny;
|
||||
for (i = 0; i < NG; i++) {
|
||||
if (!gon[i]) continue;
|
||||
if (gcool[i]) gcool[i]--;
|
||||
s = inv ? 0 : sees(i);
|
||||
if (s) {
|
||||
gdir[i] = s - 1;
|
||||
if (!gsee[i]) { gsee[i] = 1; if (gcool[i] < 25) gcool[i] = 25; }
|
||||
if (!gcool[i]) guard_shoots(i);
|
||||
if (gkind[i] != 'c') goto shown; /* the others stand and shoot */
|
||||
} else
|
||||
gsee[i] = 0;
|
||||
d = gdir[i];
|
||||
nx = gx[i] + dir_dx[d];
|
||||
ny = gy[i] + dir_dy[d];
|
||||
if (blocked(nx, ny, 1)) {
|
||||
/* turn round, or for a chaser, try the other way across */
|
||||
if (gkind[i] == 'c' && !s) gdir[i] = (rnd() & 3);
|
||||
else if (!s) gdir[i] = d ^ 1;
|
||||
} else {
|
||||
gx[i] = nx; gy[i] = ny;
|
||||
}
|
||||
if (overlap(gx[i], gy[i], px, py)) player_hit();
|
||||
shown:
|
||||
d = gdir[i];
|
||||
spr_at(SP_GUARD + i, gx[i], gy[i]);
|
||||
spr_show(SP_GUARD + i,
|
||||
(d == D_DOWN ? S_GDOWN : d == D_UP ? S_GUP : S_GSIDE) + (((gx[i] + gy[i]) >> 3) & 1),
|
||||
d == D_LEFT ? 3 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- bullets */
|
||||
static void shots(void)
|
||||
{
|
||||
u8 i, k;
|
||||
for (i = 0; i < NPS; i++) {
|
||||
if (!pson[i]) continue;
|
||||
psx[i] += dir_dx[psd[i]] * 5;
|
||||
psy[i] += dir_dy[psd[i]] * 5;
|
||||
k = tile_at(psx[i], psy[i]);
|
||||
if (k == T_WALL || k == T_DOOR || k == T_OUT) { pson[i] = 0; spr_off(SP_PSHOT + i); continue; }
|
||||
for (k = 0; k < NG; k++)
|
||||
if (gon[k] && psx[i] >= gx[k] + HB_X0 && psx[i] <= gx[k] + HB_X1 &&
|
||||
psy[i] >= gy[k] + HB_Y0 && psy[i] <= gy[k] + HB_Y1) {
|
||||
gon[k] = 0;
|
||||
gone[room] |= 1 << gobj[k];
|
||||
spr_off(SP_GUARD + k);
|
||||
pson[i] = 0; spr_off(SP_PSHOT + i);
|
||||
puff = 20; puff_x = gx[k]; puff_y = gy[k];
|
||||
kills++;
|
||||
break;
|
||||
}
|
||||
if (pson[i]) spr_at(SP_PSHOT + i, psx[i] - 8, psy[i] - 8);
|
||||
}
|
||||
for (i = 0; i < NGS; i++) {
|
||||
if (!gson[i]) continue;
|
||||
gsx[i] += dir_dx[gsd[i]] * 3;
|
||||
gsy[i] += dir_dy[gsd[i]] * 3;
|
||||
k = tile_at(gsx[i], gsy[i]);
|
||||
if (k == T_WALL || k == T_DOOR || k == T_OUT) { gson[i] = 0; spr_off(SP_GSHOT + i); continue; }
|
||||
if (gsx[i] >= px + HB_X0 && gsx[i] <= px + HB_X1 && gsy[i] >= py + HB_Y0 && gsy[i] <= py + HB_Y1) {
|
||||
gson[i] = 0; spr_off(SP_GSHOT + i);
|
||||
player_hit();
|
||||
continue;
|
||||
}
|
||||
spr_at(SP_GSHOT + i, gsx[i] - 8, gsy[i] - 8);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_player(void)
|
||||
{
|
||||
u8 s = pdir == D_DOWN ? S_PDOWN : pdir == D_UP ? S_PUP : S_PSIDE;
|
||||
spr_at(SP_PLAYER, px, py);
|
||||
spr_show(SP_PLAYER, s + ((panim >> 3) & 1),
|
||||
(inv & 4) ? 0 : pdir == D_LEFT ? 3 : 1);
|
||||
if (puff) {
|
||||
spr_at(SP_PUFF, puff_x, puff_y);
|
||||
spr_show(SP_PUFF, S_PUFF, --puff ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------- screens */
|
||||
static u8 wait_fire(void)
|
||||
{
|
||||
u8 j;
|
||||
while (joy & (J_FIRE | J_ENTER | J_ESC)) { wait_frame(); drain_keys(); }
|
||||
for (;;) {
|
||||
wait_frame(); drain_keys(); rnd();
|
||||
j = joy;
|
||||
if (j & J_ESC) return 0;
|
||||
if (j & (J_FIRE | J_ENTER)) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 title(void)
|
||||
{
|
||||
u8 i;
|
||||
clear_gfx();
|
||||
puts_("\033[0m\033[2J");
|
||||
for (i = 0; i < 20; i++) { draw_tile(i, 0, T_WALL); draw_tile(i, 13, T_WALL); }
|
||||
for (i = 1; i < 13; i++) { draw_tile(0, i, T_WALL); draw_tile(19, i, T_WALL); }
|
||||
draw_tile(9, 13, T_DOOR); draw_tile(10, 13, T_DOOR);
|
||||
spr_at(0, 120, 168); spr_show(0, S_PDOWN, 1);
|
||||
spr_at(1, 152, 168); spr_show(1, S_CROWN, 1);
|
||||
spr_at(2, 184, 168); spr_show(2, S_GSIDE, 3);
|
||||
spr_at(3, 72, 168); spr_show(3, S_GSIDE, 1);
|
||||
ink("1;93"); centre(7, "T H E I R O N K E E P");
|
||||
ink("0;37");
|
||||
centre(10, "You are a prisoner in the Iron Keep. Steal the king's crown");
|
||||
centre(11, "from the throne room, and escape down the stairs.");
|
||||
centre(14, "ARROWS or W A S D move SPACE or CTRL shoot");
|
||||
centre(15, "Keys open locked doors. Chests hold gold, crates hold shots.");
|
||||
centre(16, "Guards see along rows and columns - and they shoot.");
|
||||
centre(17, "P pauses. ESC gives up.");
|
||||
ink("1;96"); centre(25, "PRESS SPACE TO BEGIN");
|
||||
ink("0");
|
||||
return wait_fire();
|
||||
}
|
||||
|
||||
static u8 end_screen(void)
|
||||
{
|
||||
u16 score = gold + kills * 50;
|
||||
u8 j;
|
||||
if (won) score += 1000 + 500 + lives * 200;
|
||||
else if (crown) score += 1000;
|
||||
clear_gfx(); /* a clean box: no walls or figures behind it */
|
||||
ink("0;44;97");
|
||||
centre(12, " ");
|
||||
centre(13, won ? " YOU ESCAPED WITH THE CROWN! " :
|
||||
" THE GUARDS HAVE TAKEN YOU. ");
|
||||
centre(14, " ");
|
||||
at(15, 21); puts_(" SCORE "); putn(score);
|
||||
for (j = 10 + (score > 9) + (score > 99) + (score > 999) + (score > 9999); j < 40; j++) putch(' ');
|
||||
centre(16, " ");
|
||||
centre(17, " SPACE TO PLAY AGAIN, ESC TO STOP ");
|
||||
centre(18, " ");
|
||||
ink("0");
|
||||
return wait_fire();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- game */
|
||||
static void play(void)
|
||||
{
|
||||
u8 j, i;
|
||||
const u8 *o = room_objs[0];
|
||||
for (i = 0; i < 12; i++) { gone[i] = 0; opened[i] = 0; }
|
||||
lives = 3; keys = 0; ammo = 10; gold = 0; kills = 0; crown = 0;
|
||||
over = 0; won = 0; inv = 0; fire_cool = 0; fire_held = 1; panim = 0;
|
||||
msg = 0; msg_time = 0; pdir = D_DOWN;
|
||||
room = 0;
|
||||
for (; *o; o += 3)
|
||||
if (o[0] == 'P') { px = o[1] << 4; py = 16 + (o[2] << 4); }
|
||||
puts_("\033[2J");
|
||||
enter_room();
|
||||
say("FIND THE CROWN. MIND THE GUARDS.");
|
||||
while (!over) {
|
||||
wait_frame();
|
||||
if (drain_keys()) { /* P: pause until P again */
|
||||
at(1, 40); ink("0;96"); puts_("PAUSED - P TO GO ON\033[K"); ink("0");
|
||||
for (;;) {
|
||||
wait_frame();
|
||||
if (joy & J_ESC) { quit = 1; return; }
|
||||
if (drain_keys()) break;
|
||||
}
|
||||
status_dirty = 1;
|
||||
}
|
||||
j = joy;
|
||||
if (j & J_ESC) { over = 1; won = 0; break; }
|
||||
move_player(j);
|
||||
edges();
|
||||
fire(j);
|
||||
shots();
|
||||
guards();
|
||||
pick_up();
|
||||
draw_player();
|
||||
if (inv) inv--;
|
||||
if (fire_cool) fire_cool--;
|
||||
if (msg_time && !--msg_time) status_dirty = 1;
|
||||
if (status_dirty) status();
|
||||
}
|
||||
status();
|
||||
for (i = 0; i < 60; i++) { wait_frame(); drain_keys(); draw_player(); }
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
rnd_state = 0xACE1 ^ frame_ctr;
|
||||
last_frame = frame_ctr;
|
||||
puts_("\033[?3l\033[?25l"); /* 80 columns (this clears), no cursor */
|
||||
load_shapes();
|
||||
quit = 0;
|
||||
while (!quit) {
|
||||
if (!title()) break;
|
||||
play();
|
||||
if (quit) break;
|
||||
if (!end_screen()) break;
|
||||
}
|
||||
clear_gfx();
|
||||
puts_("\033[0m\033[2J\033[H\033[?25h");
|
||||
while (con_stat & 1) (void)con_data;
|
||||
}
|
||||
@@ -0,0 +1,989 @@
|
||||
:10A2000097420000938282DA17430000130343FB56
|
||||
:10A2100063F8620023A00200938242006FF05FFFA8
|
||||
:10A2200017130000670083E5834700F093F72700CA
|
||||
:10A23000E38C07FEA300A0F067800000130101FF7C
|
||||
:10A240002324810023261100130405000345040084
|
||||
:10A25000631A05008320C10003248100130101015A
|
||||
:10A26000678000001304140097000000E78000FCE2
|
||||
:10A270006FF0DFFD130101FE232C8100232E11005E
|
||||
:10A28000130400009306A000130690003377D50254
|
||||
:10A290009307040093870701B38727001304140072
|
||||
:10A2A0001374F40F13070703238CE7FE93070500CD
|
||||
:10A2B0003355D502E36CF6FC631A04008320C10118
|
||||
:10A2C0000324810113010102678000001304F4FFDD
|
||||
:10A2D0001374F40F93070401B387270003C587FFA6
|
||||
:10A2E00097000000E78080F46FF01FFD130101FF6D
|
||||
:10A2F00023229100930405001305B00123261100C9
|
||||
:10A30000232481001384050097000000E78000F2F9
|
||||
:10A310001305B00597000000E78040F113850400A5
|
||||
:10A3200097000000E78040F51305B0039700000098
|
||||
:10A33000E780C0EF1305040097000000E780C0F33A
|
||||
:10A34000032481008320C10083244100130580047D
|
||||
:10A350001301010117030000670043ED130101FF22
|
||||
:10A3600023248100130405001305B00123261100E6
|
||||
:10A3700097000000E78080EB1305B0059700000010
|
||||
:10A38000E780C0EA1305040097000000E78040EB77
|
||||
:10A39000032481008320C1001305D00613010101AD
|
||||
:10A3A00017030000670083E8130101FF23248100E5
|
||||
:10A3B0002326110013840500930700003307F400DF
|
||||
:10A3C00003470700631A070293D71700930590020B
|
||||
:10A3D000B385F54093F5F50F97000000E78040F155
|
||||
:10A3E00013050400032481008320C100130101012F
|
||||
:10A3F000170300006700C3E49387170093F7F70F74
|
||||
:10A400006FF0DFFBB7E7000003D5A7FA131775005D
|
||||
:10A410003345E50013150501135505011357950044
|
||||
:10A420003345E500131785003345E5001315050195
|
||||
:10A43000135505012395A7FA67800000B7E70000D0
|
||||
:10A4400003C757FB834680F7E38EE6FE034780F79A
|
||||
:10A45000A38AE7FA67800000130500009306000551
|
||||
:10A46000834700F093F717006394070067800000AC
|
||||
:10A47000034710F01377F70D6304D7009307050027
|
||||
:10A48000138507006FF0DFFD230A00F2834740F3D6
|
||||
:10A4900093F71700E39C07FE67800000B7D7000022
|
||||
:10A4A0009387872213168600939545001315450060
|
||||
:10A4B0003306F600938505011377F50F93F5F50F35
|
||||
:10A4C00013558500930706102308E0F2A308A0F2B5
|
||||
:10A4D0002309B0F29306060103480600130616008E
|
||||
:10A4E000A30900F3E31AD6FE9385150093F5F50F43
|
||||
:10A4F000E39CC7FC678000002308A0F693F7F50FE4
|
||||
:10A5000093D58540A308F0F693F515002309B0F61E
|
||||
:10A510001376F60FA309C0F66780000093160501B5
|
||||
:10A5200093D606019307F0131307050063E2D704DF
|
||||
:10A53000938505FF9396050193D606019307F00DC9
|
||||
:10A540001305F00F63E8D7029306400193D5454009
|
||||
:10A55000B385D502B7E700009387470A13574740F2
|
||||
:10A56000B387B700B387E70003C507006780000023
|
||||
:10A570001305F00F67800000130101FD232861011E
|
||||
:10A580002326710137DB0000B7DB00002322910294
|
||||
:10A59000232E3101232C4101232A5101232481013F
|
||||
:10A5A000232291012320A1012326110223248102C9
|
||||
:10A5B00023202103130A0500938A05009304060053
|
||||
:10A5C00093090000130B0B91938BCB90930C10000D
|
||||
:10A5D000130DF00F130C4000B387690103C9070086
|
||||
:10A5E000B387790103C40700330949011315090131
|
||||
:10A5F000330454019315040193D5054113550541C6
|
||||
:10A6000097000000E780C0F19307F5FF93F7F70F7D
|
||||
:10A6100063E0FC06B7E7000013594940130404FF48
|
||||
:10A62000A38427FB13544440B7E70000238487FA30
|
||||
:10A63000930405008320C10203248102032901023F
|
||||
:10A640008329C101032A8101832A4101032B0101CE
|
||||
:10A65000832BC100032C8100832C4100032D0100BA
|
||||
:10A660001385040083244102130101036780000065
|
||||
:10A670006314A501E39004FC93891900E39E89F516
|
||||
:10A68000930400006FF01FFBB7E70000130740FBC7
|
||||
:10A6900023A6A7FAB7E700002389E7FAB7E7000087
|
||||
:10A6A00013071000A389E7FA67800000130101FE79
|
||||
:10A6B000B7E700009305100013051000232E1100CA
|
||||
:10A6C000A38907FA232C8100232A91002328210142
|
||||
:10A6D0002326310123244101B7C90000970000005F
|
||||
:10A6E000E78000C11385C94A97000000E78040C792
|
||||
:10A6F00037C500001305454B97000000E78040B4C4
|
||||
:10A7000037C400001305444C97000000E78040C5A3
|
||||
:10A7100037CA00001305CA4C97000000E78040B21A
|
||||
:10A7200037E700000347070AB7D700009387C791B0
|
||||
:10A7300013172700B387E70003A5070037C90000F8
|
||||
:10A7400097000000E780C0AF1305094D9700000097
|
||||
:10A75000E78000AFB7E7000083A4C7FA638E040266
|
||||
:10A76000B7E7000083C727FB6388070293058002D1
|
||||
:10A770001305100097000000E78080B737C5000080
|
||||
:10A780001305454D97000000E78080BD1385040048
|
||||
:10A7900097000000E780C0AA930510001305200071
|
||||
:10A7A00097000000E780C0B41305444C97000000F8
|
||||
:10A7B000E78000BB37C500001305C54DB7C40000D6
|
||||
:10A7C00097000000E780C0A71385444E9700000063
|
||||
:10A7D000E78000B9B7E7000003C5B706970000009F
|
||||
:10A7E000E78080A91305444C97000000E78040B73C
|
||||
:10A7F00037C500001305C54E97000000E78040A450
|
||||
:10A800001385444E97000000E78080B5B7E700004D
|
||||
:10A8100003C5A70697000000E78000A61305444C77
|
||||
:10A8200097000000E780C0B337C500001305854FCF
|
||||
:10A8300097000000E780C0A01385444E97000000F9
|
||||
:10A84000E78000B2B7E7000003C597069700000055
|
||||
:10A85000E78080A21305444C97000000E78040B0D9
|
||||
:10A8600037C500001305455097000000E780409D64
|
||||
:10A870001385444E97000000E78080AEB7E70000E4
|
||||
:10A8800003D5670697000000E780009F1305444C3E
|
||||
:10A8900097000000E780C0ACB7E7000083C78706D9
|
||||
:10A8A000638607021305CA4C97000000E7804099B1
|
||||
:10A8B0001385C94A97000000E78080AA37C50000C9
|
||||
:10A8C0001305055197000000E78080971305094D97
|
||||
:10A8D00097000000E780C096032481018320C10116
|
||||
:10A8E00083244101032901018329C100032A810036
|
||||
:10A8F00037C500001305855113010102170300003D
|
||||
:10A90000670003A6130101FB232E3103B7E9000002
|
||||
:10A910002324810403C4090A9307C00837D7000021
|
||||
:10A92000B307F402130787B9232861032326110410
|
||||
:10A930002322910423202105232C4103232A5103A0
|
||||
:10A940002326710323248103B387E7001307100331
|
||||
:10A950003304E40237D700001307C7942326F1001D
|
||||
:10A96000232291032320A103232EB1013304E40009
|
||||
:10A9700097000000E78080B18327C10037E700001F
|
||||
:10A98000130B470A1385C7081307470A93060700E6
|
||||
:10A990009385A70003C607009387170093862600B8
|
||||
:10A9A0001378F60013564600238F06FFA38FC6FECA
|
||||
:10A9B000E392B7FE13074701E39AA7FCB7EB000049
|
||||
:10A9C000930A000013090000130C2000938BCB079F
|
||||
:10A9D000930C4001130DE000130A0B0093040000D8
|
||||
:10A9E00003460A006314861383C7090A13871A00F3
|
||||
:10A9F0001377F70FB387FB0083C70700B3D757411F
|
||||
:10AA000093F717006380071223000A00930A0700D8
|
||||
:10AA10009384140093F4F40F130A1A00E39294FD44
|
||||
:10AA2000130919001379F90F130B4B01E316A9FB56
|
||||
:10AA3000B7E400009387C40337E9000023920700BE
|
||||
:10AA400037EA00009307C9FEB7EA000037EB0000C1
|
||||
:10AA5000B7EB000023AE040223A0070023A20700E7
|
||||
:10AA6000930D0000130D0000930C00009384C403A9
|
||||
:10AA70001309C9FE130A8A08938ACA00130BCBFF75
|
||||
:10AA8000938B4BFF034C040063120C0AB7E70000E2
|
||||
:10AA9000239207FCB7E7000023AE07FAB7E70000F0
|
||||
:10AAA000238D07FAB7E7000003D78707B7E7000051
|
||||
:10AAB0008320C104239AE706B7E7000003D767079E
|
||||
:10AAC00003248104B7E700002399E706B7E70000F5
|
||||
:10AAD00013071000A389E7FA832441040329010422
|
||||
:10AAE0008329C103032A8103832A4103032B010322
|
||||
:10AAF000832BC102032C8102832C4102032D01020E
|
||||
:10AB0000832DC1011301010567800000E30206F0F7
|
||||
:10AB1000930509001385040097000000E780409822
|
||||
:10AB20006FF01FEF930A07006FF09FFE83C7090ABB
|
||||
:10AB300093971700B307FA0083D70700B3D7B7413D
|
||||
:10AB400093F717006396070E930700056302FC0E48
|
||||
:10AB50001307DCF91377F70F9307300183451400CF
|
||||
:10AB60000346240063EEE70CB7070800938717023B
|
||||
:10AB7000B3D7E70093F717006384070CB7E700002B
|
||||
:10AB800013971C0093878705B387E70093954500CB
|
||||
:10AB90002390B700B7E700009387C7041316460059
|
||||
:10ABA000B387E700130606012390C700B7E700004C
|
||||
:10ABB00093874703B387970123808701130710000A
|
||||
:10ABC000B38794012380E700B7E70000938747022B
|
||||
:10ABD000B387970123800700B7E700009387C70179
|
||||
:10ABE000B38797012380B7019307600713073000ED
|
||||
:10ABF0006314FC0013070000B7E7000093874704C5
|
||||
:10AC0000B38797012380E70097F0FFFFE780C07FBD
|
||||
:10AC1000B7E700009387C7021375F501B387970163
|
||||
:10AC20001305E501938C1C002380A70093FCFC0F07
|
||||
:10AC3000938D1D001304340093FDFD0F6FF09FE40E
|
||||
:10AC4000131646001306060193171D009395450041
|
||||
:10AC5000131606013387FA0013560641B307FB00AB
|
||||
:10AC6000939505012390C70093D50541B387AB01A8
|
||||
:10AC7000238087012310B700B307A9011307100031
|
||||
:10AC80002380E700B7E70000938747FE1305DD0048
|
||||
:10AC9000B387A7011375F50F2380B7012326A10001
|
||||
:10ACA000130CFCFB97000000E7804085137CFC0F31
|
||||
:10ACB0001307A0000325C10093071001636A8701F1
|
||||
:10ACC000B7D7000093870790B387870183C7070032
|
||||
:10ACD0002308A0F6230AF0F6130D1D0093071000B9
|
||||
:10ACE000A30AF0F6137DFD0F6FF09FF437E7000025
|
||||
:10ACF0008347A706639A070037C500001305C551AF
|
||||
:10AD000017030000670083989387F7FF130101FF83
|
||||
:10AD10002305F706B7E7000003C597FAB7E7000079
|
||||
:10AD200083C587FA13074001B7E7000003C3070A8A
|
||||
:10AD30003387E5021308C008B7D8000023261100A6
|
||||
:10AD40009307000093060000938888B9130F200032
|
||||
:10AD5000330803033307E5001317070113570701EF
|
||||
:10AD60006310F706B7E700009387C707B38767004C
|
||||
:10AD7000130710003317D70083C60700130600001F
|
||||
:10AD80003367D7002380E700130740013387E502CC
|
||||
:10AD9000B7E700009387470AB387E700B387A700A8
|
||||
:10ADA0002380070097F0FFFFE780806F37C5000022
|
||||
:10ADB0008320C10013054553130101016FF05FF4B7
|
||||
:10ADC00013D617003306C80033061601834E06005B
|
||||
:10ADD00013F6170013FEFE006304060013DE4E0098
|
||||
:10ADE0006316EE019386160093F6F60F938717000D
|
||||
:10ADF0009397070193D707016FF09FF6130101FFA7
|
||||
:10AE0000B7E700002322910083C4070723248100B1
|
||||
:10AE10002326110013040000638A04009307100026
|
||||
:10AE2000130440006394F40013042000B7E700000B
|
||||
:10AE300003966707B7E700008395870713050000AF
|
||||
:10AE400097F0FFFFE780806BB7E7000083C7F70646
|
||||
:10AE500093D7370093F717003304F400B7E70000E7
|
||||
:10AE600003C7C7069307000013774700631A07005C
|
||||
:10AE700013072000930710006394E4009307300049
|
||||
:10AE8000230800F6230A80F6A30AF0F6B7E40000D0
|
||||
:10AE900003C4A4FB63020404B7E70000039667FB46
|
||||
:10AEA000B7E70000839587FB130550011304F4FFF7
|
||||
:10AEB00097F0FFFFE78080641374F40F238D84FA0A
|
||||
:10AEC000930750012308F0F69307200133348000E4
|
||||
:10AED000230AF0F6A30A80F68320C1000324810030
|
||||
:10AEE000832441001301010167800000130101FF69
|
||||
:10AEF0002326110023248100034480F81374040BDB
|
||||
:10AF00006318040497F0FFFFE780805397F0FFFF7A
|
||||
:10AF1000E780C05497F0FFFFE780004F834780F839
|
||||
:10AF200013F7F70F9397870193D7874163C80700FB
|
||||
:10AF300093770703E38807FC130410008320C10004
|
||||
:10AF40001305040003248100130101016780000040
|
||||
:10AF500097F0FFFFE780C04E97F0FFFFE7800050BB
|
||||
:10AF60006FF09FF9130101FF2324810037E70000F0
|
||||
:10AF700037E400008347C406834617FB23261100ED
|
||||
:10AF80002322910023202101B3E7D700639C07040B
|
||||
:10AF9000B7E700009306E00137E90000238DD7FAF8
|
||||
:10AFA00083568907B7E70000B7E40000239CD7FA6F
|
||||
:10AFB00083D66407B7E70000239BD7FAB7E6000003
|
||||
:10AFC00083C7B6069387F7FF93F7F70FA385F606B7
|
||||
:10AFD0006396070293071000A308F7FAB7E700008B
|
||||
:10AFE000238807FA8320C1000324810083244100C1
|
||||
:10AFF00003290100130101016780000037C500002B
|
||||
:10B000001305455597F0FFFFE7804068B7E700005C
|
||||
:10B0100083D7470713079000231CF906B7E7000002
|
||||
:10B0200083D72707239BF406930780072306F4069C
|
||||
:10B03000B7E70000238E07FA2308E0F6A30A00F61C
|
||||
:10B040009387C7FBA38007001307A0002308E0F63F
|
||||
:10B05000A30A00F6238107001307B0002308E0F6D7
|
||||
:10B06000A30A00F6A38107009307C0002308F0F6A7
|
||||
:10B07000A30A00F66FF01FF7130101F9232611064A
|
||||
:10B08000232481062322910623202107232E310524
|
||||
:10B09000232C4105232A5105232861052326710508
|
||||
:10B0A00023248105232291052320A105232EB1030A
|
||||
:10B0B0002326010023280100834780F737B7FFFFCD
|
||||
:10B0C000130717CEB3C7E70037E700002315F7FAD9
|
||||
:10B0D000034780F737C50000B7E700001305C55BDD
|
||||
:10B0E000A38AE7FA97F0FFFFE7808015B7D7000043
|
||||
:10B0F000938787621307000093063001230BE0F665
|
||||
:10B100001386070883C5070093871700A30BB0F6C3
|
||||
:10B11000E39AC7FE130717001377F70FE310D7FE64
|
||||
:10B12000B7E70000238A07FAB7D700009387879113
|
||||
:10B1300037D400002324F10013044491B7E7000042
|
||||
:10B1400083C447FB6394043C97F0FFFFE78000341F
|
||||
:10B1500037C500001305855C97F0FFFFE780400EC0
|
||||
:10B160001309400113850400130610009305000025
|
||||
:10B1700097F0FFFFE780C03213850400938414002A
|
||||
:10B18000130610009305D00093F4F40F97F0FFFF1F
|
||||
:10B19000E7800031E39824FD930410001309D000E8
|
||||
:10B1A00093850400130610001305000097F0FFFFBD
|
||||
:10B1B000E780002F93850400938414001306100089
|
||||
:10B1C0001305300193F4F40F97F0FFFFE780402D53
|
||||
:10B1D000E39824FD130620009305D000130590008A
|
||||
:10B1E00097F0FFFFE780C02B130620009305D000E7
|
||||
:10B1F0001305A00097F0FFFFE780802A93078007E0
|
||||
:10B20000230800F6A308F0F6230900F6930780FA56
|
||||
:10B21000A309F0F6230800F6230A00F693041000B1
|
||||
:10B22000A30A90F6230890F6130780F9A308E0F626
|
||||
:10B23000230900F6A309F0F6230890F6130710017E
|
||||
:10B24000230AE0F6A30A90F6130720002308E0F68D
|
||||
:10B25000930680FBA308D0F6230900F6A309F0F6B5
|
||||
:10B260002308E0F6130AA000230A40F71309300070
|
||||
:10B27000A30A20F713078004230820F7A308E0F6A9
|
||||
:10B28000230900F6A309F0F6230820F7230A40F764
|
||||
:10B2900037C500001305455DA30A90F697F0FFFF40
|
||||
:10B2A000E780000CB7C500009385C55D13057000ED
|
||||
:10B2B00097F0FFFFE780800F37C500001305454C6E
|
||||
:10B2C00097F0FFFFE780C009B7C500009385855F51
|
||||
:10B2D0001305A00097F0FFFFE780400DB7C5000001
|
||||
:10B2E000938545631305B00097F0FFFFE780000CDE
|
||||
:10B2F000B7C50000938585661305E00097F0FFFF52
|
||||
:10B30000E780C00AB7C500009385C5691305F00042
|
||||
:10B3100097F0FFFFE7808009B7C500009385C56DF2
|
||||
:10B320001305000197F0FFFFE7804008B7C5000054
|
||||
:10B33000938505711305100197F0FFFFE780000763
|
||||
:10B3400037C500001305C57297F0FFFFE780400185
|
||||
:10B35000B7C50000938545731305900197F0FFFF73
|
||||
:10B36000E780C004B7C700001385875197F0FFFF3F
|
||||
:10B37000E78000FF97000000E78080B763080518AA
|
||||
:10B38000B7E70000130680011385870893050000C6
|
||||
:10B3900097100000E7800010B7E700009387C70709
|
||||
:10B3A00023A0070023A2070023A40700B7E700009B
|
||||
:10B3B000A3852707B7E7000023850706B7E7000046
|
||||
:10B3C00023930706B7E7000023920706B7E70000BC
|
||||
:10B3D00023840706B7E70000A38807FAB7E7000051
|
||||
:10B3E000238807FAB7E7000023860706B7E70000BF
|
||||
:10B3F00023870706B7E70000A3869706B7E7000094
|
||||
:10B40000A3870706B7E7000023A607FAB7E70000FF
|
||||
:10B41000238907FAB7E7000023880706B7E700008B
|
||||
:10B42000B7E900002380070AB7D70000A3844907C3
|
||||
:10B43000130700009387C7941306000583C607000F
|
||||
:10B4400063980612630E07000327C100B7E70000E8
|
||||
:10B45000239BE70603270101B7E70000239CE706CB
|
||||
:10B4600037C500001305C55C97F0FFFFE78040DD9E
|
||||
:10B4700097F0FFFFE780404937C500001305C5740A
|
||||
:10B4800097F0FFFFE7808020B7E7000083C717FB36
|
||||
:10B49000639A071497F0FFFFE78080FA97F0FFFFA9
|
||||
:10B4A000E780C0FB630C05109305800213051000B4
|
||||
:10B4B00097F0FFFFE780C0E337C500001305454D57
|
||||
:10B4C00097F0FFFFE780C0E937C500001305057757
|
||||
:10B4D00097F0FFFFE780C0D6B7C7000013858751FC
|
||||
:10B4E00097F0FFFFE780C0E797F0FFFFE78040F5A8
|
||||
:10B4F000834780F89397870193D7874163D4070ADE
|
||||
:10B500009307100037E70000230AF7FA97F0FFFFD0
|
||||
:10B51000E780C0F737D500001305058797F0FFFFD8
|
||||
:10B52000E78000D2834700F093F71700E39E07748B
|
||||
:10B530008320C106032481068324410603290106D2
|
||||
:10B540008329C105032A8105832A4105032B0105AF
|
||||
:10B55000832BC104032C8104832C4104032D01049B
|
||||
:10B56000832DC1031305000013010107678000004C
|
||||
:10B570006396C60203C71700131747002328E1008C
|
||||
:10B5800003C7270013174700130707011317070105
|
||||
:10B59000135707412326E100130710009387370054
|
||||
:10B5A0006FF0DFE997F0FFFFE78040EBE30E05F275
|
||||
:10B5B000B7E7000013071000A389E7FA834780F874
|
||||
:10B5C00013FAF70F9397870193D7874163D6071C28
|
||||
:10B5D0009307100037E70000A308F7FAB7E7000069
|
||||
:10B5E000238807FA97F0FFFFE780800C9304C003DD
|
||||
:10B5F00097F0FFFFE780C0E49384F4FF97F0FFFF2C
|
||||
:10B60000E780C0E593F4F40F97F0FFFFE780407FF9
|
||||
:10B61000E39004FEB7E7000083C747FBE39807EE1B
|
||||
:10B62000B7E7000083D4470693072003B7E900007B
|
||||
:10B63000B384F402B7E7000083D76706B384F4004D
|
||||
:10B6400083C709FB9394040193D40401E38C07603E
|
||||
:10B65000B7E7000083C7B7061307800CB387E7027C
|
||||
:10B66000B387F4009387C75D9394070193D40401D3
|
||||
:10B6700097F0FFFFE78080E137D500001305458094
|
||||
:10B6800097F0FFFFE780C0CD37D900009305C98050
|
||||
:10B690001305C00097F0FFFFE78040D183C709FB87
|
||||
:10B6A000E38E075CB7C50000938545561305D000AF
|
||||
:10B6B00097F0FFFFE78080CF9305C9801305E00076
|
||||
:10B6C00097F0FFFFE78080CE930550011305F0004F
|
||||
:10B6D00097F0FFFFE780C0C137D5000013058583D1
|
||||
:10B6E00097F0FFFFE780C0B51385040097F0FFFFD8
|
||||
:10B6F000E78080B813B7440693B6843E93B616002D
|
||||
:10B70000133717003307D700B726000093079000C0
|
||||
:10B710009386F670B3B79700B3B496009387A700EB
|
||||
:10B72000B384E400B38497009309800293841400E7
|
||||
:10B730001305000293F4F40F97F0FFFFE78000AFCA
|
||||
:10B74000E39634FF9305C9801305000197F0FFFFCE
|
||||
:10B75000E780C0C5B7D50000938545841305100167
|
||||
:10B7600097F0FFFFE78080C49305C980130520018F
|
||||
:10B7700097F0FFFFE78080C3B7C7000013858751AC
|
||||
:10B7800097F0FFFFE780C0BD97F0FFFFE7804076AE
|
||||
:10B79000E316059A6FF09FD7937ACA00B7E40000CA
|
||||
:10B7A000638C0A0C13774A0093371700938727009E
|
||||
:10B7B000B7E600002388F60693072000630607001B
|
||||
:10B7C000B70701009387E7FF03D78407130600003C
|
||||
:10B7D000B387E70013990701B7E700008395670770
|
||||
:10B7E000135909411305090097F0FFFFE78000D9BD
|
||||
:10B7F000631C0506239C24071309100093773A0065
|
||||
:10B800006388070893771A0063960A0037E70000F9
|
||||
:10B810002308F7069305200063860700B70501009B
|
||||
:10B820009385E5FF37EB000083576B07039584078B
|
||||
:10B8300013060000B385F500939A050193DA0A41D7
|
||||
:10B8400093850A0097F0FFFFE78040D3631A050253
|
||||
:10B85000231B5B0737E700008347F7069387170032
|
||||
:10B86000A307F7066F000003930720006316F50097
|
||||
:10B8700097F0FFFFE780C047130900006FF01FF843
|
||||
:10B88000930720006316F50097F0FFFFE78040461E
|
||||
:10B89000E31209FC839784071307D0FF63D4E732D0
|
||||
:10B8A00037E700008347070A9387F7FF2300F70A6B
|
||||
:10B8B00093070013239CF40697F0FFFFE780C00472
|
||||
:10B8C00037E90000B7ED000037EC0000B7EB0000EF
|
||||
:10B8D000137A0A01834749FC37E70000130949FC42
|
||||
:10B8E000938D8DFC130C0CFE938BCBFD63120A34ED
|
||||
:10B8F000A3060706130B1000930A5000130A10004A
|
||||
:10B90000834709006380070883C70D000327810070
|
||||
:10B910003387E700B3878700830C0700038D070098
|
||||
:10B9200003570C00B38C5C0383D70B00330D5D030E
|
||||
:10B93000B38CEC00939C0C0193DC0C4123109C0114
|
||||
:10B9400013850C00330DFD00131D0D01135D0D411A
|
||||
:10B950002390AB0193050D0097F0FFFFE78040BCFB
|
||||
:10B960009307F5FF93F7F70F6376FA009307F00F4D
|
||||
:10B97000631EF53A230009009377FB0F2308F0F6C6
|
||||
:10B98000A30A00F613091900130C2C00938B2B004B
|
||||
:10B99000938D1D0063084B3937E50000B7E50000C3
|
||||
:10B9A0009307C5FB37E60000232AF100938745FD86
|
||||
:10B9B000B7E60000232CF100930706FC232EF100CC
|
||||
:10B9C0009387C6FC130CC5FB138A45FD930A06FC3E
|
||||
:10B9D0001389C6FC930B90002320F102130B300057
|
||||
:10B9E000930CF00F83460C00638E060883278100BA
|
||||
:10B9F00083C60A003386F600B38686000305060078
|
||||
:10BA0000038D060003560A003305650383560900BB
|
||||
:10BA1000330D6D033305C500931D05011318050192
|
||||
:10BA200093DD0D41135808012310BA0113850D0051
|
||||
:10BA300023240103330DDD0013160D01131D0D0129
|
||||
:10BA4000135D0D41135606012310A90193050D0046
|
||||
:10BA50002322C10297F0FFFFE78080AC9306F5FF39
|
||||
:10BA600093F6F60F9307100063F8D7000326410200
|
||||
:10BA7000032881026310954123000C00230870F70E
|
||||
:10BA8000A30A00F693871B0093FBF70F9307D000E0
|
||||
:10BA9000130C1C00130A2A00938A1A0013092900A8
|
||||
:10BAA000E392FBF4B7EC0000B7EA000037EA0000CD
|
||||
:10BAB00037E9000037EC0000B7EB0000B7E4000006
|
||||
:10BAC000938CCC03938A4A04130A8A051309C90488
|
||||
:10BAD000130C4C03938B4B029384C402130B300062
|
||||
:10BAE000B7ED000083C70C00638A074C83C70400CE
|
||||
:10BAF000638607009387F7FF2380F400B7E7000011
|
||||
:10BB000083C7C70683160A0003170900639A077CD8
|
||||
:10BB100083D86D071317070113037000135707012C
|
||||
:10BB2000330E1341939606019307870093D60601BF
|
||||
:10BB30003307C70113858600131707011316050184
|
||||
:10BB400093950701131505019397070137E8000046
|
||||
:10BB500013570701130EE000035888071356060118
|
||||
:10BB60001355054193D5050193D707416366EE62EE
|
||||
:10BB700013088800131808011358084193564540CC
|
||||
:10BB800013574840938707FF93F6F60F1377F70F85
|
||||
:10BB900093D747406368D7009308070013870600D0
|
||||
:10BBA000938608001303400193F7F70FB3876702EA
|
||||
:10BBB000B7E800009388480A13031000B387F80021
|
||||
:10BBC0006F00C03313073013635EF70037E70000E0
|
||||
:10BBD0008347070A239C0406938717002300F70A6C
|
||||
:10BBE0006FF09FCDB7E70000039767079306D0007B
|
||||
:10BBF00063C0E602B7E6000003C7060A1307C7FFE3
|
||||
:10BC00002380E60A1307000E239BE7066FF0DFCAC6
|
||||
:10BC10009306100EE3D6E6CAB7E6000003C7060A8D
|
||||
:10BC2000130747002380E60A130700016FF0DFFDCA
|
||||
:10BC3000B7E500008346D70603C6E506B3E6C600AF
|
||||
:10BC4000E39A06CA03C5990693061000A306D70611
|
||||
:10BC5000630E05006386070283471900E39C07C84B
|
||||
:10BC600093071000930610006F00C00137C5000055
|
||||
:10BC70001305857897F0FFFFE78040A16FF09FC71D
|
||||
:10BC80009306000033872601130610002300C70027
|
||||
:10BC900037E70000034707073388B60193086000C1
|
||||
:10BCA0002300E800139816008326810003D384073D
|
||||
:10BCB000330E8801B306D70083860600330787005A
|
||||
:10BCC00003070700B3861603130383009387170047
|
||||
:10BCD00093F7F70F33071703B38666002310DE00D0
|
||||
:10BCE000B306780137E80000035868071308880096
|
||||
:10BCF000330707012390E6001307F5FFA384E90645
|
||||
:10BD0000130780002387E50637E70000A309C7FA79
|
||||
:10BD10002308F0F69307C000230AF0F6A30AC0F642
|
||||
:10BD20006FF05FBD130B20006FF09FBD37E7000081
|
||||
:10BD300037E60000B7E80000130887051305C604BE
|
||||
:10BD400093070000130787051306C6049388C803EA
|
||||
:10BD5000130E6000338317018345030063820510CF
|
||||
:10BD600083150800938E250063DC9E0F9385C50024
|
||||
:10BD700063C8950F83150500938E150063D2AE0F2F
|
||||
:10BD80009385E50063CEA50DB7E6000083C5060ADE
|
||||
:10BD9000B7E6000013858608939515003305B500B6
|
||||
:10BDA000B7E500009385C501B385F50003C805001C
|
||||
:10BDB0009305100023000300B39505010358050007
|
||||
:10BDC000B3E505012310B5009385370093F5F50F12
|
||||
:10BDD0002308B0F6A30A00F6230009009375FB0FB1
|
||||
:10BDE0002308B0F693971700A30A00F63307F7006D
|
||||
:10BDF000B7E5000013054001238DA5FA8355070020
|
||||
:10BE0000B307F60037E70000231CB7FA03D7070093
|
||||
:10BE1000B7E70000239BE7FA37E7000083574706A0
|
||||
:10BE2000938717002312F70683470900E38C07B4B2
|
||||
:10BE300003D60B0083550C0013050B00130686FF79
|
||||
:10BE4000938585FF13160601939505011356064148
|
||||
:10BE500093D5054197E0FFFFE780406A6FF09FB2FE
|
||||
:10BE6000938717001308280013052500E394C7EFF4
|
||||
:10BE70006FF01FFC839684079385260063DEB5036D
|
||||
:10BE80009386C60063CAB603B7E6000083966607CA
|
||||
:10BE90009385160063D2A5039386E60063CEA601C0
|
||||
:10BEA00023000C00230870F7A30A00F697F0FFFFA9
|
||||
:10BEB000E780800B6FF01FBD930588FF130686FF98
|
||||
:10BEC00013160601939505011356064193D50541B6
|
||||
:10BED00013850B0097E0FFFFE78040626FF09FBA89
|
||||
:10BEE000B388E70083C808009388F8FF93F8F80F39
|
||||
:10BEF0006378133F130717001377F70FE3F2E6FE9B
|
||||
:10BF0000130D40006354A800130D30001308FDFF0B
|
||||
:10BF100083C60B001378F80F23800A0103C70400BF
|
||||
:10BF200063980630930610002380DB00930680019F
|
||||
:10BF300063E6E600130790012380E40083460C00CB
|
||||
:10BF4000130730066382E63A03C70A0083150A0026
|
||||
:10BF50000316090013050B002326E1022324C10266
|
||||
:10BF60002322B10297E0FFFFE78040590327C10277
|
||||
:10BF7000832541020326810293076000630A0700BC
|
||||
:10BF8000930610009307A0006314D7009307800066
|
||||
:10BF9000B385C50093D5354093F5150013062000F1
|
||||
:10BFA000B387B700930610006314C70093063000F0
|
||||
:10BFB000230860F7230AF0F6A30AD0F6130B1B0040
|
||||
:10BFC000137BFB0F93079000938C1C00938A1A003D
|
||||
:10BFD000130A2A0013092900130C1C00938B1B0061
|
||||
:10BFE00093841400E310FBB037E90000B7EA0000C7
|
||||
:10BFF00037EA0000B7E7000037EB0000B7EB0000BE
|
||||
:10C000001309C9FE938ACA00130ACAFF93040000E9
|
||||
:10C0100037EC0000B7EC000037ED0000938D870887
|
||||
:10C02000130B4BFE938B4BFF83470900638A070872
|
||||
:10C0300003970A0083178C079306970063C2F608DC
|
||||
:10C040009387970063CEE70603170A0083976C0770
|
||||
:10C050009306C70063C6F6069387C70063C2E70668
|
||||
:10C0600083470D0A3387640103470700939717003E
|
||||
:10C07000B387FD0003D60700930610003397E60050
|
||||
:10C080003367C7002390E7009387D400230009009B
|
||||
:10C0900093F7F70F2308F0F6A30A00F6B3877401AD
|
||||
:10C0A00083C70700130770046386E734636EF730B5
|
||||
:10C0B00013071004638EE734130730046386E736F2
|
||||
:10C0C000938414009307800013091900938A2A00AF
|
||||
:10C0D000130A2A00E39AF4F4B7E7000083D5670750
|
||||
:10C0E000B7E7000003D58707938585009395050181
|
||||
:10C0F000130585001315050193D505411355054119
|
||||
:10C1000097E0FFFFE780C04193073000B7E40000ED
|
||||
:10C110006314F502B7E7000083C7870603C724FB53
|
||||
:10C12000638E07309307100037E70000A308F7FA83
|
||||
:10C1300037E700002308F7FA97F0FFFFE78040CCCD
|
||||
:10C1400037E700008347C706638607009387F7FF3A
|
||||
:10C150002306F70637E700008347E70663860700F4
|
||||
:10C160009387F7FF2307F70683C724FB37E7000011
|
||||
:10C170006384072E9387F7FF93F7F70F2389F4FA69
|
||||
:10C18000639C072C93071000A309F7FA97E0FFFFC1
|
||||
:10C19000E78000526FF04FAF3303034133876600EF
|
||||
:10C1A0001317070113570701636CEE129388880079
|
||||
:10C1B0009398080193D80841138307FF138708FF5A
|
||||
:10C1C0001353434013574740135545401373F30F20
|
||||
:10C1D0001377F70F1375F50F636867009306070071
|
||||
:10C1E000130703001383060037E800001308480A0A
|
||||
:10C1F000130E4001930E10006F008002B306C703B8
|
||||
:10C20000B306D800B386A60083C606009386F6FF61
|
||||
:10C2100093F6F60F63F6DE0C130717001377F70F8C
|
||||
:10C22000E37EE3FC33ADF800130D1D006FF01FCE6D
|
||||
:10C23000E31607D013050000930640008327410151
|
||||
:10C240003387A70083480700639608088327C10146
|
||||
:10C2500093081000230017013387A700832781016B
|
||||
:10C260009316150023000701338ED7008327810022
|
||||
:10C27000130360003307F800030707003308880042
|
||||
:10C280008327010233076702B386D7003307E6002E
|
||||
:10C290002310EE0003070800330767023387E50029
|
||||
:10C2A0002390E600130795001377F70F2308E0F6B5
|
||||
:10C2B0001307D000230AE0F6A30A10F797E0FFFF68
|
||||
:10C2C000E78080141375F5031305D5022380A400BD
|
||||
:10C2D0006FF0DFC613051500E312D5F66FF01FC629
|
||||
:10C2E00023800B00130D000083C60A008327810002
|
||||
:10C2F000835509002326D1023387F6000306070081
|
||||
:10C3000003570A003307C70033868600030606007A
|
||||
:10C310001317070113570741B385C500939505010E
|
||||
:10C3200093D5054113050700130610002324B1021D
|
||||
:10C330002322E10297E0FFFFE78040240327410228
|
||||
:10C3400083258102630C050603460C0013073006A3
|
||||
:10C350008326C102631CE604631A0D0097E0FFFF09
|
||||
:10C36000E780800A137535002380AA0037E60000B5
|
||||
:10C370000316860703170A00831709009305960022
|
||||
:10C3800083966D07E3C2E5BC13079700E34EC7BA77
|
||||
:10C390001387C600E34AF7BA9387C700E3C6D7BA44
|
||||
:10C3A00097F0FFFFE78040BC6FF01FBAE3100DFC71
|
||||
:10C3B00093C716002380FA006FF05FFB2310EA009A
|
||||
:10C3C0002310B9006FF09FFA1307B004E39AE7CE89
|
||||
:10C3D00037E700008347A70637C500001305C57976
|
||||
:10C3E000938717002305F70697E0FFFFE780002AF1
|
||||
:10C3F0006FF01FCD37E700008357670637C5000091
|
||||
:10C400001305457A938747062313F7066FF0DFFD80
|
||||
:10C4100083C7990637C500001305857B93875700AE
|
||||
:10C42000A384F9066FF05FFCB7E7000037C5000092
|
||||
:10C430002384D7061305C57C6FF01FFB9307700795
|
||||
:10C44000E3ECE7CE37C500001305C57E97E0FFFF9C
|
||||
:10C45000E780C0236FF05FCE834737FB6386078298
|
||||
:10C460006FF0DFD2B7E7000083C78706638207A0BB
|
||||
:10C470009384843E939404016FF04F9FB7C50000EE
|
||||
:10C48000938505596FF08FA2834710F06FF08F8965
|
||||
:10C490003306C500930705006394C700678000005A
|
||||
:10C4A00093871700A38FB7FE6FF01FFF303B393320
|
||||
:10C4B000000000005448452049524F4E204B45454E
|
||||
:10C4C00050000000303B33370000000020202000E7
|
||||
:10C4D0001B5B4B00303B3936000000004C49564591
|
||||
:10C4E00053200000303B3937000000002020204B53
|
||||
:10C4F0004559532000000000202020414D4D4F2081
|
||||
:10C5000000000000202020474F4C44200000000085
|
||||
:10C5100043524F574E000000300000004C4F434B39
|
||||
:10C5200045442E20594F55204E4545442041204B2F
|
||||
:10C5300045592E00544845204B4559205455524EDC
|
||||
:10C54000532E2054484520444F4F52204F50454EC3
|
||||
:10C55000532E0000594F552041524520484954213F
|
||||
:10C5600000000000202020594F55204553434150E2
|
||||
:10C5700045442057495448205448452043524F577A
|
||||
:10C580004E212020202020202020202000000000FC
|
||||
:10C5900020202054484520475541524453204841CB
|
||||
:10C5A00056452054414B454E20594F552E202020B2
|
||||
:10C5B0002020202020202020000000001B5B3F3393
|
||||
:10C5C0006C1B5B3F32356C001B5B306D1B5B324A72
|
||||
:10C5D00000000000313B39330000000054204820A7
|
||||
:10C5E00045202020492052204F204E2020204B2043
|
||||
:10C5F0004520452050000000596F7520617265206C
|
||||
:10C600006120707269736F6E657220696E20746844
|
||||
:10C61000652049726F6E204B6565702E20537465DE
|
||||
:10C62000616C20746865206B696E67277320637284
|
||||
:10C630006F776E0066726F6D207468652074687223
|
||||
:10C640006F6E6520726F6F6D2C20616E6420657354
|
||||
:10C650006361706520646F776E2074686520737401
|
||||
:10C66000616972732E0000004152524F5753206F80
|
||||
:10C6700072205720412053204420206D6F76652082
|
||||
:10C68000202020202020205350414345206F72203D
|
||||
:10C690004354524C202073686F6F74004B6579735C
|
||||
:10C6A000206F70656E206C6F636B656420646F6FC4
|
||||
:10C6B00072732E2043686573747320686F6C6420F6
|
||||
:10C6C000676F6C642C2063726174657320686F6C93
|
||||
:10C6D000642073686F74732E0000000047756172E8
|
||||
:10C6E00064732073656520616C6F6E6720726F776D
|
||||
:10C6F0007320616E6420636F6C756D6E73202D20E6
|
||||
:10C70000616E6420746865792073686F6F742E00A1
|
||||
:10C7100050207061757365732E2020455343206748
|
||||
:10C72000697665732075702E00000000313B393644
|
||||
:10C7300000000000505245535320535041434520C0
|
||||
:10C74000544F20424547494E0000000046494E44A0
|
||||
:10C75000205448452043524F574E2E204D494E44B9
|
||||
:10C7600020544845204755415244532E00000000B4
|
||||
:10C77000504155534544202D205020544F20474FC1
|
||||
:10C78000204F4E1B5B4B00004F5554204F4620411D
|
||||
:10C790004D4D554E4954494F4E21000041204B45C7
|
||||
:10C7A00059210000474F4C44212031303020435262
|
||||
:10C7B0004F574E532E00000046495645204D4F52CC
|
||||
:10C7C000452053484F54532E000000005448452044
|
||||
:10C7D00043524F574E21204E4F572046494E44203A
|
||||
:10C7E000544845205354414952532E004E4F542033
|
||||
:10C7F000574954484F5554205448452043524F57A9
|
||||
:10C800004E2E0000303B34343B39370020202020AE
|
||||
:10C810002020202020202020202020202020202018
|
||||
:10C820002020202020202020202020202020202008
|
||||
:10C83000202020200000000020202053434F52459C
|
||||
:10C8400020000000202020535041434520544F2019
|
||||
:10C85000504C415920414741494E2C2045534320DB
|
||||
:10C86000544F2053544F502020202020000000001F
|
||||
:10C870001B5B306D1B5B324A1B5B481B5B3F3235D9
|
||||
:10C880006800000047415445484F5553450000009B
|
||||
:10C89000475541524420524F4F4D000043484150AC
|
||||
:10C8A000454C000041524D4F55525900434F525292
|
||||
:10C8B00049444F520000000047524541542048412E
|
||||
:10C8C0004C4C000043454C4C415253004C494252A1
|
||||
:10C8D00041525900535441495257454C4C000000B5
|
||||
:10C8E00044554E47454F4E005452454153555259B9
|
||||
:10C8F000000000005448524F4E4520524F4F4D000B
|
||||
:10C900001011111111110F1111110E0002020E0E52
|
||||
:10C91000030C030C01FF00000000FF0184C80000AD
|
||||
:10C9200090C800009CC80000A4C80000ACC800006B
|
||||
:10C93000B8C80000C4C80000CCC80000D4C80000BB
|
||||
:10C94000E0C80000E8C80000F4C80000500302413D
|
||||
:10C9500009060000000000000000000000000000C8
|
||||
:10C9600000000000000000000000000000000000C7
|
||||
:10C97000000000000000000000000000006802024B
|
||||
:10C980004B0906680C0A00000000000000000000CF
|
||||
:10C990000000000000000000000000000000000097
|
||||
:10C9A000000000000000000000000000000076020F
|
||||
:10C9B00002760D02470805470A0568050A000000CF
|
||||
:10C9C0000000000000000000000000000000000067
|
||||
:10C9D0000000000000000000000000000000004116
|
||||
:10C9E000030241100268090663080B000000000002
|
||||
:10C9F0000000000000000000000000000000000037
|
||||
:10CA00000000000000000000000000000000000026
|
||||
:10CA1000760202680F0441030A760F0B0000000043
|
||||
:10CA20000000000000000000000000000000000006
|
||||
:10CA300000000000000000000000000000000000F6
|
||||
:10CA400000470302471002680905680A0963020BE0
|
||||
:10CA5000760E0B0000000000000000000000000047
|
||||
:10CA600000000000000000000000000000000000C6
|
||||
:10CA70000000410B0668100B0000000000000000E1
|
||||
:10CA800000000000000000000000000000000000A6
|
||||
:10CA90000000000000000000000000000000000096
|
||||
:10CAA000000000680B054B090A76040B000000002B
|
||||
:10CAB0000000000000000000000000000000000076
|
||||
:10CAC0000000000000000000000000000000000066
|
||||
:10CAD0000000000068050A000000000000000000DF
|
||||
:10CAE0000000000000000000000000000000000046
|
||||
:10CAF0000000000000000000000000000000000036
|
||||
:10CB000000000000007609064B030A470D0A0000EA
|
||||
:10CB10000000000000000000000000000000000015
|
||||
:10CB20000000000000000000000000000000000005
|
||||
:10CB3000000000000000680302470705470A054798
|
||||
:10CB40000E05760A0A000000000000000000000048
|
||||
:10CB500000000000000000000000000000000000D5
|
||||
:10CB60000000000000000063020363110343090793
|
||||
:10CB700076020B76110B00000000000000000000A0
|
||||
:10CB800000000000000000000000000000000000A5
|
||||
:10CB9000000000000000000011111111111111110D
|
||||
:10CBA0001111010000000000000000100100000051
|
||||
:10CBB0000000000000100100000000000000001054
|
||||
:10CBC00001001011010010110110010010000000FF
|
||||
:10CBD0000000011001001000000000000100010031
|
||||
:10CBE00010000000000001000100101101001011F0
|
||||
:10CBF0000110010000000000000000100100000012
|
||||
:10CC00000000000000100100000000000000001003
|
||||
:10CC100001000000000000000010111111110011AE
|
||||
:10CC20001111111111111111111111111111010015
|
||||
:10CC300000000000000000100100000000000000E3
|
||||
:10CC400000100100000000000000001001101100A1
|
||||
:10CC50000000101100100110000000000010001072
|
||||
:10CC60000010000000000010000000100000000094
|
||||
:10CC70000010000001101100000010110010010050
|
||||
:10CC80000000000000000010010000000000000093
|
||||
:10CC90000010010000000000000000100100000072
|
||||
:10CCA00000000000001011111111111111111111CA
|
||||
:10CCB00011111111111111111111010000000000C9
|
||||
:10CCC0000000001001000000000000000010010042
|
||||
:10CCD0000000000000000010010000101111010010
|
||||
:10CCE00000100100001000100000001000000010F3
|
||||
:10CCF00000200000000000000010111100000000E2
|
||||
:10CD00000100000000000000001001000000000011
|
||||
:10CD100000000010010000000000000000100100F1
|
||||
:10CD200000000000000000100100000000000000F2
|
||||
:10CD300000101111111111111111111111111111F5
|
||||
:10CD4000111111111111010000000000000000106C
|
||||
:10CD500001000000000000000010010000000000C1
|
||||
:10CD6000000000100111110000001011011001005D
|
||||
:10CD700000000000000000100000000000000000A3
|
||||
:10CD80000010000000000000000000100111110060
|
||||
:10CD90000000101101100100000000000000001050
|
||||
:10CDA0000100000000000000001001000000000071
|
||||
:10CDB0000000001001000000000000000010111130
|
||||
:10CDC0001111001111111111111111110011111175
|
||||
:10CDD000111101000000000000000010010000001F
|
||||
:10CDE00000111100001001000000000100000010FF
|
||||
:10CDF00001000000000100000010111111110001DC
|
||||
:10CE00000000001001000000000000000000010010
|
||||
:10CE1000000000000000000011111111001111119B
|
||||
:10CE200011100100000000010000001001000000CE
|
||||
:10CE300000010000001001000000000100000010CF
|
||||
:10CE4000010000000000000000101111111100117C
|
||||
:10CE500011111111111111111111111111110100E3
|
||||
:10CE600000000000000000100100000000000000B1
|
||||
:10CE7000001001000000000000000010010010017F
|
||||
:10CE8000000010010010010010010000100100104E
|
||||
:10CE90000000000000000000000000000000000092
|
||||
:10CEA000000000000100100100001001001001004E
|
||||
:10CEB000100100001001001001000000000000003F
|
||||
:10CEC0000010010000000000000000100100000040
|
||||
:10CED00000000000001011111111001111111111A9
|
||||
:10CEE0001111111111111111111101000100000096
|
||||
:10CEF00001000010010001111101011111100100C8
|
||||
:10CF000001010000010010100100000111111101C8
|
||||
:10CF1000101011111101010000011010000000009B
|
||||
:10CF200001000001000000111111010000110100B9
|
||||
:10CF30000101000000110100001001011111110197
|
||||
:10CF40000111111001010000000001010010011188
|
||||
:10CF50001101111101010010010000000100000089
|
||||
:10CF600001101111111111111111111111111111C2
|
||||
:10CF7000001111111111010000000000000000104B
|
||||
:10CF8000011110011110011110100100000000002A
|
||||
:10CF9000000000100111100111100111101001000A
|
||||
:10CFA0000000000000000010000000000000000071
|
||||
:10CFB00000100011100111100111101001000000EB
|
||||
:10CFC00000000000001001111001111001111010DB
|
||||
:10CFD000010000000000000000100100000000003F
|
||||
:10CFE00000000010010000000000000000101111FE
|
||||
:10CFF0001111001111111111111111110011111143
|
||||
:10D0000011110100000000000000001001000000EC
|
||||
:10D010000000000000100110111101101111011089
|
||||
:10D02000011000000000000001100110000030039A
|
||||
:10D030000000011001100000300300000100011089
|
||||
:10D040000000000000000100011011110110111179
|
||||
:10D0500001100100000000000000001001000000AD
|
||||
:10D06000000000000010010000000000000000109F
|
||||
:10D070000100000000000000001011111111111139
|
||||
:10D0800011111111111111110011111111110101C1
|
||||
:10D09000100001100001101001011000011000012A
|
||||
:10D0A00010100101100001100001101001111011E9
|
||||
:10D0B000011011011110010000000000000000101B
|
||||
:10D0C0000000000000000000000000000000000060
|
||||
:10D0D00000000000011110110110110111100101D7
|
||||
:10D0E00010000110000110100101100001100001DA
|
||||
:10D0F00010100101100001100001101001000000CB
|
||||
:10D100000000000000101111111111111111111165
|
||||
:10D110001111111111111111111101000000000064
|
||||
:10D1200000000010010000000000000000100100DD
|
||||
:10D130000000000000000010010000111111111189
|
||||
:10D1400000100100000100000010001000000001AC
|
||||
:10D150000000001000100000001111111211001049
|
||||
:10D1600001000000000000000010010000000000AD
|
||||
:10D17000000000100100000000000000001001008D
|
||||
:10D18000000000000000001001000000000000008E
|
||||
:10D190000010111111111111111111111111111191
|
||||
:10D1A000001111111111111111111211111111117F
|
||||
:10D1B000010000000000000000100100000000005D
|
||||
:10D1C000000000100100000000000000001001003D
|
||||
:10D1D00011110000111100100100010000000010E9
|
||||
:10D1E000001001000100000000100010010001000B
|
||||
:10D1F00000000010001001001111000011110010BA
|
||||
:10D20000010000000000000000100100000000000C
|
||||
:10D2100000000010010000000000000000101111CB
|
||||
:10D220001111111111111111000000000000000076
|
||||
:10D2300000000000000000000000000000000000EE
|
||||
:10D2400000000000000000000000000000000000DE
|
||||
:10D2500000000000000000000000000000000000CE
|
||||
:10D2600000000000000000000000000000000000BE
|
||||
:10D2700000000000000000000000000000000000AE
|
||||
:10D28000000000000000000000000000000000009E
|
||||
:10D29000000000000000000000000000000000008E
|
||||
:10D2A000000000000000000000000000000000007E
|
||||
:10D2B000000000000000000000000000000000006E
|
||||
:10D2C000000000000000000000000000000000005E
|
||||
:10D2D000000000000000000000000000000000004E
|
||||
:10D2E000000000000000000000000000000000003E
|
||||
:10D2F000000000000000000000000000000000002E
|
||||
:10D30000000000000000000000000000000000001D
|
||||
:10D31000000000000000000000000000000000000D
|
||||
:10D3200000000000000000000808080808080808BD
|
||||
:10D330000808080808080808070707070707070874
|
||||
:10D34000070707070707070807070707070707086B
|
||||
:10D35000070707070707070807070707070707085B
|
||||
:10D360000707070707070708080808080808080844
|
||||
:10D370000808080808080808070707080707070734
|
||||
:10D38000070707080707070707070708070707072B
|
||||
:10D39000070707080707070707070708070707071B
|
||||
:10D3A0000707070807070707080808080808080804
|
||||
:10D3B00008080808080808080707070707070708F4
|
||||
:10D3C00007070707070707080707070707070708EB
|
||||
:10D3D00007070707070707080707070707070708DB
|
||||
:10D3E00007070707070707080808080808080808C4
|
||||
:10D3F00008080808080808080707070807070707B4
|
||||
:10D4000007070708070707070707070807070707AA
|
||||
:10D41000070707080707070707070708070707079A
|
||||
:10D420000707070807070707080808080808080883
|
||||
:10D43000080808080808080808030303080303038A
|
||||
:10D440000803030308030308080303030803030393
|
||||
:10D450000803030308030308080303030803030383
|
||||
:10D460000803030308030308080303030803030373
|
||||
:10D470000803030308030308080303030803030363
|
||||
:10D480000803030308030308080303030803030353
|
||||
:10D490000803030308030308080303030803030B3B
|
||||
:10D4A0000B03030308030308080303030803030B28
|
||||
:10D4B0000B03030308030308080303030803030320
|
||||
:10D4C0000803030308030308080303030803030313
|
||||
:10D4D0000803030308030308080303030803030303
|
||||
:10D4E00008030303080303080803030308030303F3
|
||||
:10D4F00008030303080303080803030308030303E3
|
||||
:10D5000008030303080303080803030308030303D2
|
||||
:10D5100008030303080303080808080808080808A4
|
||||
:10D5200008080808080808080E0E0E0E0E0E0E0E4B
|
||||
:10D530000E0E0E0E0E0E0E0E06060606060606064B
|
||||
:10D54000060606060606060608080808080808086B
|
||||
:10D55000080808080808080800000000000000008B
|
||||
:10D5600000000000000000000E0E0E0E0E0E0E0E4B
|
||||
:10D570000E0E0E0E0E0E0E0E06060606060606060B
|
||||
:10D58000060606060606060608080808080808082B
|
||||
:10D59000080808080808080800000000000000004B
|
||||
:10D5A00000000000000000000E0E0E0E0E0E0E0E0B
|
||||
:10D5B0000E0E0E0E0E0E0E0E0606060606060606CB
|
||||
:10D5C00006060606060606060808080808080808EB
|
||||
:10D5D000080808080808080800000000000000000B
|
||||
:10D5E00000000000000000000E0E0E0E0E0E0E0ECB
|
||||
:10D5F0000E0E0E0E0E0E0E0E06060606060606068B
|
||||
:10D6000006060606060606060808080808080808AA
|
||||
:10D6100008080808080808080000000000000000CA
|
||||
:10D620000000000000000000000003333330000061
|
||||
:10D630000000333333330000000039999993000020
|
||||
:10D6400000003909909300000000099999900000AA
|
||||
:10D650000000000990000000000CCCCCCCCCC00035
|
||||
:10D6600000CCCCCCCCCCCC00009CCCCCCCCCC9005D
|
||||
:10D67000009CCCCCCCCCC9000000CCCCCCCC0000E5
|
||||
:10D6800000004444444400000000444004440000BE
|
||||
:10D690000000444004440000000077700777000059
|
||||
:10D6A00000000000000000000000033333300000E1
|
||||
:10D6B00000003333333300000000399999930000A0
|
||||
:10D6C000000039099093000000000999999000002A
|
||||
:10D6D0000000000990000000000CCCCCCCCCC000B5
|
||||
:10D6E00000CCCCCCCCCCCC00009CCCCCCCCCC900DD
|
||||
:10D6F000009CCCCCCCCCC9000000CCCCCCCC000065
|
||||
:10D700000000444444440000000004400440000081
|
||||
:10D710000000044004400000000007700770000093
|
||||
:10D720000000000000000000000003333330000060
|
||||
:10D730000000333333330000000033333333000051
|
||||
:10D740000000333333330000000003333330000074
|
||||
:10D750000000000990000000000CCCCCCCCCC00034
|
||||
:10D7600000CCCCCCCCCCCC00009CCCCCCCCCC9005C
|
||||
:10D77000009CCCCCCCCCC9000000CCCCCCCC0000E4
|
||||
:10D7800000004444444400000000444004440000BD
|
||||
:10D790000000444004440000000077700777000058
|
||||
:10D7A00000000000000000000000033333300000E0
|
||||
:10D7B00000003333333300000000333333330000D1
|
||||
:10D7C00000003333333300000000033333300000F4
|
||||
:10D7D0000000000990000000000CCCCCCCCCC000B4
|
||||
:10D7E00000CCCCCCCCCCCC00009CCCCCCCCCC900DC
|
||||
:10D7F000009CCCCCCCCCC9000000CCCCCCCC000064
|
||||
:10D800000000444444440000000004400440000080
|
||||
:10D810000000044004400000000007700770000092
|
||||
:10D82000000000000000000000000333333000005F
|
||||
:10D830000000333333330000000033339999000084
|
||||
:10D8400000003339909900000000033999990000D5
|
||||
:10D85000000000099900000000000CCCCCC00000C2
|
||||
:10D860000000CCCCCCCC00000000CCCCC99900008E
|
||||
:10D870000000CCCCCC00000000000CCCCC000000A0
|
||||
:10D880000000044444400000000004400440000044
|
||||
:10D890000000444000440000000077700077000062
|
||||
:10D8A00000000000000000000000033333300000DF
|
||||
:10D8B0000000333333330000000033339999000004
|
||||
:10D8C0000000333990990000000003399999000055
|
||||
:10D8D000000000099900000000000CCCCCC0000042
|
||||
:10D8E0000000CCCCCCCC00000000CCCCC99900000E
|
||||
:10D8F0000000CCCCCC00000000000CCCCC00000020
|
||||
:10D9000000000444444000000000004444000000C3
|
||||
:10D910000000004444000000000000777700000091
|
||||
:10D920000000000000000000000007777770000092
|
||||
:10D9300000007777777700000000799999970000C9
|
||||
:10D940000000790990970000000009999990000063
|
||||
:10D950000000000990000000000222222222200084
|
||||
:10D9600000222222222222000092222222222900A8
|
||||
:10D9700000922222222229000000222222220000DC
|
||||
:10D9800000008888888800000000888008880000DF
|
||||
:10D990000000888008880000000033300333000056
|
||||
:10D9A0000000000000000000000007777770000012
|
||||
:10D9B0000000777777770000000079999997000049
|
||||
:10D9C00000007909909700000000099999900000E3
|
||||
:10D9D0000000000990000000000222222222200004
|
||||
:10D9E0000022222222222200009222222222290028
|
||||
:10D9F000009222222222290000002222222200005C
|
||||
:10DA000000008888888800000000088008800000E6
|
||||
:10DA10000000088008800000000003300330000090
|
||||
:10DA20000000000000000000000007777770000091
|
||||
:10DA3000000077777777000000007777777700002E
|
||||
:10DA40000000777777770000000007777770000095
|
||||
:10DA50000000000990000000000222222222200083
|
||||
:10DA600000222222222222000092222222222900A7
|
||||
:10DA700000922222222229000000222222220000DB
|
||||
:10DA800000008888888800000000888008880000DE
|
||||
:10DA90000000888008880000000033300333000055
|
||||
:10DAA0000000000000000000000007777770000011
|
||||
:10DAB00000007777777700000000777777770000AE
|
||||
:10DAC0000000777777770000000007777770000015
|
||||
:10DAD0000000000990000000000222222222200003
|
||||
:10DAE0000022222222222200009222222222290027
|
||||
:10DAF000009222222222290000002222222200005B
|
||||
:10DB000000008888888800000000088008800000E5
|
||||
:10DB1000000008800880000000000330033000008F
|
||||
:10DB20000000000000000000000007777770000090
|
||||
:10DB300000007777777700000000777799990000E9
|
||||
:10DB4000000077799099000000000779999900000A
|
||||
:10DB500000000009990000000000022222200000BD
|
||||
:10DB60000000222222220000000022222999000027
|
||||
:10DB700000002222220000000000022222000000F9
|
||||
:10DB800000000888888000000000088008800000ED
|
||||
:10DB9000000088800088000000003330003300005F
|
||||
:10DBA0000000000000000000000007777770000010
|
||||
:10DBB0000000777777770000000077779999000069
|
||||
:10DBC000000077799099000000000779999900008A
|
||||
:10DBD000000000099900000000000222222000003D
|
||||
:10DBE00000002222222200000000222229990000A7
|
||||
:10DBF0000000222222000000000002222200000079
|
||||
:10DC0000000008888880000000000088880000006C
|
||||
:10DC1000000000888800000000000033330000008E
|
||||
:10DC200000000000000000000000000000000000F4
|
||||
:10DC300000000000000000000000000000000000E4
|
||||
:10DC400000000000000000000000000000000000D4
|
||||
:10DC50000000000000000000000000BBBB0000004E
|
||||
:10DC6000000000BBBB000000000000BBBB000000C8
|
||||
:10DC7000000000BBBB00000000000000000000002E
|
||||
:10DC80000000000000000000000000000000000094
|
||||
:10DC90000000000000000000000000000000000084
|
||||
:10DCA0000000000000000000000000000000000074
|
||||
:10DCB0000000000000000000000000000000000064
|
||||
:10DCC0000000000000000000000000000000000054
|
||||
:10DCD0000000000000000000000000999900000012
|
||||
:10DCE00000000099990000000000009999000000D0
|
||||
:10DCF00000000099990000000000000000000000F2
|
||||
:10DD00000000000000000000000000000000000013
|
||||
:10DD10000000000000000000000000000000000003
|
||||
:10DD200000000000000000000000000000000000F3
|
||||
:10DD300000000000000000000000000000000000E3
|
||||
:10DD4000000BBB000000000000B000B000000000AD
|
||||
:10DD500000B000BBBBBBBBB000B000B0000B0B0001
|
||||
:10DD6000000BBB00000B0B000000000000000000D7
|
||||
:10DD700000000000000000000000000000000000A3
|
||||
:10DD80000000000000000000000000000000000093
|
||||
:10DD90000000000000000000000000000000000083
|
||||
:10DDA0000000000000000000000000000000000073
|
||||
:10DDB0000000000000000000000000000000000063
|
||||
:10DDC0000003333333333000003333333333330022
|
||||
:10DDD000003BBBBBBBBBB3000033333BB3333300AF
|
||||
:10DDE0000033333BB3333300003333333333330047
|
||||
:10DDF0000033333333333300003BBBBBBBBBB30017
|
||||
:10DE000000333333333333000000000000000000E0
|
||||
:10DE10000000000000000000000000000000000002
|
||||
:10DE200000000000000000000000000000000000F2
|
||||
:10DE300000000000000000000000000000000000E2
|
||||
:10DE4000002222222222220000288888888882003C
|
||||
:10DE50000028BB8BB8BB82000028BB8BB8BB8200FC
|
||||
:10DE60000028BB8BB8BB8200002888888888820085
|
||||
:10DE700000222222222222000000000000000000D6
|
||||
:10DE80000000000000000000000000000000000092
|
||||
:10DE90000000000000000000000000000000000082
|
||||
:10DEA0000000000000000000000000000000000072
|
||||
:10DEB0000000000000000000000000000000000062
|
||||
:10DEC000000B000BB000B000000BB0BBBB0BB000F0
|
||||
:10DED000000BBBBBBBBBB000000BB9BBBB9BB00016
|
||||
:10DEE000000BBBBCCBBBB000000BBBBBBBBBB000D3
|
||||
:10DEF0000000000000000000000BBBBBBBBBB0007B
|
||||
:10DF00000000000000000000000000000000000011
|
||||
:10DF10000000000000000000000000000000000001
|
||||
:10DF200000000000000000000000000000000000F1
|
||||
:10DF3000000F00000000F0000000F00BB00F000028
|
||||
:10DF400000000F0BB0F00000000000BFFB0000005D
|
||||
:10DF50000BBB0BFFFFB0BBB0000000BFFB0000001D
|
||||
:10DF600000000F0BB0F000000000F00BB00F00003D
|
||||
:10DF7000000F00000000F0000000000000000000A2
|
||||
:10DF80000000000000000000000000000000000091
|
||||
:10DF90000000000000000000000000000000000081
|
||||
:08DFA000000000000000000079
|
||||
:040000030000A20057
|
||||
:00000001FF
|
||||
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run The Iron Keep in tools/rv32emu.py on a model of the board's game ports
|
||||
(graphics, sprites, frame counter, held keys, terminal) and take screenshots.
|
||||
|
||||
python3 test-keep.py [--shots DIR] [--fuzz FRAMES]
|
||||
|
||||
The scripted run starts a game, walks east into the next room, fires, and
|
||||
checks what the status line says; --fuzz then plays random keys for a while
|
||||
and checks the program never leaves its code or wrecks the stack. Screenshots
|
||||
need pyte and Pillow (text is drawn with the board's font).
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, os.path.join(HERE, "..", "..", "tools"))
|
||||
from boardemu import Board, load_ihx, load_font, load_syms # noqa: E402
|
||||
|
||||
UP, DOWN, LEFT, RIGHT, FIRE, ENTER, ESC = 1, 2, 4, 8, 16, 32, 128
|
||||
|
||||
|
||||
def play_through(b, a, check, font):
|
||||
"""Walk the castle by breadth-first search over gen.py's map: both keys
|
||||
nearest the throne room, the crown behind its locked door, then the
|
||||
stairs. The bot can't be seen or hurt (it keeps inv set), so this tests
|
||||
the castle and the game's rules, not the bot's skill."""
|
||||
sys.path.insert(0, HERE)
|
||||
import gen
|
||||
from collections import deque
|
||||
sym = {"_" + n: a for n, a in load_syms(os.path.join(HERE, "out", "keep.sym")).items()}
|
||||
big = gen.BIG
|
||||
W, H = len(big[0]), len(big)
|
||||
where = {ch: [(x, y) for y in range(H) for x in range(W) if big[y][x] == ch] for ch in "KCX"}
|
||||
def room_of(p): return (p[1] // 14) * 4 + p[0] // 20
|
||||
keys = sorted(where["K"], key=lambda p: room_of(p) not in (1, 7))[:2]
|
||||
targets = keys + where["C"] + where["X"][:1]
|
||||
names = ["key", "key", "crown", "stairs"]
|
||||
|
||||
def i16(addr):
|
||||
v = b.m[addr] | b.m[addr + 1] << 8
|
||||
return v - 65536 if v & 0x8000 else v
|
||||
|
||||
def path(s, g):
|
||||
prev = {s: None}
|
||||
q = deque([s])
|
||||
while q:
|
||||
p = q.popleft()
|
||||
if p == g:
|
||||
break
|
||||
for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
|
||||
n = (p[0] + dx, p[1] + dy)
|
||||
if 0 <= n[0] < W and 0 <= n[1] < H and n not in prev and big[n[1]][n[0]] != "#":
|
||||
prev[n] = p; q.append(n)
|
||||
out = [g]
|
||||
while prev[out[-1]] is not None:
|
||||
out.append(prev[out[-1]])
|
||||
return out[::-1]
|
||||
|
||||
t = 0
|
||||
joy = 0
|
||||
for frame in range(30000):
|
||||
b.m[sym["_inv"]] = 2
|
||||
if b.m[sym["_over"]]:
|
||||
break
|
||||
px, py, room = i16(sym["_px"]), i16(sym["_py"]), b.m[sym["_room"]]
|
||||
if px % 16 == 0 and (py - 16) % 16 == 0:
|
||||
here = ((room % 4) * 20 + px // 16, (room // 4) * 14 + (py - 16) // 16)
|
||||
while t < len(targets) and here == targets[t]:
|
||||
print("bot reached the %s at frame %d" % (names[t], frame))
|
||||
t += 1
|
||||
if t == len(targets):
|
||||
joy = 0
|
||||
else:
|
||||
p = path(here, targets[t])
|
||||
n = p[1]
|
||||
joy = RIGHT if n[0] > here[0] else LEFT if n[0] < here[0] else DOWN if n[1] > here[1] else UP
|
||||
elif joy == 0: # between tiles: line up with one
|
||||
joy = LEFT if px % 16 else UP
|
||||
if frame % 2000 == 0:
|
||||
print("frame %d: room %d at %d,%d, heading for the %s" % (frame, room, px, py, names[min(t, 3)]))
|
||||
b.run_frames(1, joy)
|
||||
check("bot collected %d keys and the crown" % b.m[sym["_keys"]], b.m[sym["_crown"]] == 1)
|
||||
check("taking the crown down the stairs wins", b.m[sym["_over"]] == 1 and b.m[sym["_won"]] == 1)
|
||||
b.run_frames(80)
|
||||
check("end screen", "YOU ESCAPED WITH THE CROWN" in "\n".join(b.screen_text().display))
|
||||
if a.shots: b.shot(os.path.join(a.shots, "5-escaped.png"), font)
|
||||
b.run_frames(10, ESC)
|
||||
b.run_frames(5)
|
||||
check("Esc returns to BASIC", b.pc == 0)
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--shots", help="write PNG screenshots here")
|
||||
ap.add_argument("--fuzz", type=int, default=0, help="random frames to play")
|
||||
ap.add_argument("--play", action="store_true",
|
||||
help="then let a bot play the game through: keys, door, crown, stairs")
|
||||
a = ap.parse_args()
|
||||
mem, hi = load_ihx(os.path.join(HERE, "keep.ihx"))
|
||||
b = Board(mem, code_end=hi)
|
||||
font = None
|
||||
if a.shots:
|
||||
os.makedirs(a.shots, exist_ok=True)
|
||||
font = load_font()
|
||||
errors = 0
|
||||
|
||||
def check(what, ok):
|
||||
nonlocal errors
|
||||
print(("PASS " if ok else "FAIL ") + what)
|
||||
errors += not ok
|
||||
|
||||
def status():
|
||||
return "\n".join(b.screen_text().display[:2])
|
||||
|
||||
b.run_frames(20)
|
||||
check("title screen", "T H E I R O N K E E P" in "\n".join(b.screen_text().display))
|
||||
if a.shots: b.shot(os.path.join(a.shots, "1-title.png"), font)
|
||||
b.run_frames(5, FIRE)
|
||||
b.run_frames(10)
|
||||
check("game starts in the gatehouse", "GATEHOUSE" in status() and "LIVES 3" in status())
|
||||
check("player sprite shown", b.spr[0][3] & 1 == 1)
|
||||
if a.shots: b.shot(os.path.join(a.shots, "2-gatehouse.png"), font)
|
||||
# east along the top, down to the east doorway's rows, then through it
|
||||
x0, y0 = b.spr[0][0], b.spr[0][1]
|
||||
b.run_frames(30, DOWN)
|
||||
check("moving down moves the player", b.spr[0][1] == (y0 + 60) & 255)
|
||||
b.run_frames(30, UP)
|
||||
b.run_frames(8, FIRE)
|
||||
check("a shot uses ammunition", "AMMO 9" in status())
|
||||
b.run_frames(130, RIGHT)
|
||||
check("walls stop the player", b.spr[0][0] == 290)
|
||||
b.run_frames(32, DOWN)
|
||||
b.run_frames(30, RIGHT)
|
||||
check("east doorway leads to the guard room", "GUARD ROOM" in status())
|
||||
if a.shots: b.shot(os.path.join(a.shots, "3-guardroom.png"), font)
|
||||
b.run_frames(60)
|
||||
print(status())
|
||||
if a.play:
|
||||
play_through(b, a, check, font)
|
||||
if a.fuzz:
|
||||
rnd = random.Random(1)
|
||||
j = 0
|
||||
for f in range(a.fuzz):
|
||||
if f % 10 == 0:
|
||||
j = rnd.choice([UP, DOWN, LEFT, RIGHT, UP | FIRE, DOWN | FIRE, LEFT | FIRE,
|
||||
RIGHT | FIRE, FIRE, 0, UP | LEFT, DOWN | RIGHT])
|
||||
b.run_frames(1, j)
|
||||
if b.pc == 0:
|
||||
break
|
||||
if f % 500 == 499:
|
||||
print("frame", f + 1, "-", b.screen_text().display[0].strip())
|
||||
check("random play for %d frames without a crash" % a.fuzz, True)
|
||||
if a.shots: b.shot(os.path.join(a.shots, "4-fuzz.png"), font)
|
||||
sys.exit(1 if errors else 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user