Knight Lore
by ultimate
play the game

KNIGHT LORE DATA FORMAT
this document contains the data format for knight lore, it is not complete but gives a good start and understanding. for futher information download knight lore source this may help fill in some of the blanks. should you find any errors with this document or indeed have any information to add, please send me an email.

Thanks to Neil Walker of retrospec for the work on his Filmation Viewer, and making me finalising all the missing information that I had.

 

  general memory layout
start stop description
5ba0 6107 scratch mem
6108 6247 font
6248 6250 room size table
6251 6bd0 locations
6bd1 6c0a block types table 1
6c0b 6ce1 block type data
6ce2 6d11 background types table
6d12 6f2e background types data
6ff2 7111 objects
7112 7289 sprite offset table
728a af6b sprite data
af6c d8f3 code
b096 b20d sprite routine jump table
b20e b217 audio tune
b218 b238 audio tune
b239 b252 audio tune
b253 b2b5 audio tune
b332 b3e9 frequency table
b58b b592 jump table
bad2 bb4b completed message
bb4c bc0f game over stats
bce7 bceb day text
bcec bd0b day font
bda2 be30 menu text
c27d cd8a objects required table
c7a9 c7b0 jump table
ca32 ca39 jump table
ca92 ca99 jump table
cf69 cf9e jump table
d1e2 d1e5 start locations
d27e d295 panel data
d2cf d2ef border data
d8f3 f0f2 linear screen buffer

 

  variables
address description
5bba lives
5bb5 user input
5bbb no objects placed in cauldron
d8f3 work screen
5bc7 8x8 graphic base
5ba4 user input method
c44d day or night
5c08 general game variables
+08 current screen

 


the game locations are played on a 16*16 grid
 location movement is implicit by adding to the location no depending on direction ie: +16 north, -16 south, -1 west, +1 east, 
only used locations are stored and must be found from the location list

 

 

all coordinates use the xyz notation as illustrated. blocks are placed on a grid that is 16x16x12 pixels.

 

address 0x6248 room sizes
a table consisting of 3 entries for the dimensions of the rooms
type offset description
BYTE 00 x
BYTE 01 y
BYTE 02 z

address 0x6251 locations
the locations data is a sequential list of screens. they are not in any particular order and must be search for by reading the first byte ( screen no ) and adding on the next byte ( size ) if it is not the screen required,
type offset description
BYTE 00 screen - id of this screen
BYTE 01 size - bytes in this entry
BYTE 02

room size and attribute

size attribute
7 6 5 4 3 2 1 0
BYTE 03 ... each entry is a background type until hitting an 0xff
BYTE 00 the following byte is decoded as
block count
7 6 5 4 3 2 1 0
BYTE 01 ... count+1 number of bytes giving the positions of the block
z y x
7 6 5 4 3 2 1 0

These coordinates are mapped to the screen as
x = (x*16) + (x1*8) + 72
y = (y*16) + (y1*8) + 72
z = (z*12) + (z1*4) + screenz

for x1,y1, and z1 see block types data

address 0x6bd1 block types
offset table for the block type information
type offset description
WORD 00 offset

 

type sprite no's   description
00   07   block
01   b0   fire *(unused)
02   b2   ball moving up - down - offset half block y
03   06   rock
04   16   gargoyle
05   17   spike block
06   55   pushable and slide chest
07   54   pushable table
08   96/90   guard moving east - west
09   52   ghost
0a   b5   fire moving north - south
0b   07   block high
0c   b2   ball moving up - down - offset half block x & y
0d   1e/90   guard patrolling square circuit
0e   36   block moving east - west
0f   37   block moving north - south
10   3e   movable block
11   17  spike block - high
12   3f   spike ball - fall
13   3f   spike ball - high fall
14   56   fire moving east - west
15   5b   dropping block
16   8f   collapsing block
17   b6   ball bouncing around
18   b2   ball up down
19   a4   spell that repels player
1a   8   portculis moving up - down
1b   8   portculis moving up - down
1c   b2   ball moving up - down - offset half block x

 

address 0x6c0b block type data
this table is similar to the same table in alien 8 only one byte more per entry
type offset description
BYTE 00 sprite
01 width (x)
02 depth (y)
03 height (z)
04
v h 5 4 3 m 1 0
7 6 5 4 3 2 1 0
v =  flip vertical
h = flip horizontal
4 = draw - this is internal but seems to always be set
m = movable/moving
0-3 - seem to be block type dependent
05
z1 y1 x1
7 6 5 4 3 2 1 0

 these values are added in the block positioning calculation.

keep reading an entry until the sprite is zero. all these sprites make one entity 

 

address 0x6ce2 background types
offset table for the background type information
type offset description
WORD 00 offset

 

type   description
00   arch north
01   arch east
02   arch south
03   arch west
04   tree arch north
05   tree arch east
06   tree arch south
07   tree arch west
08   portcullis north
09   portcullis east
0A   portcullis south
0B   portcullis west
0C   wall room size 1
0D   wall room size 2
0E   wall room size 3
0F   tree room size 1
10   tree filler west
11   tree filler north
12   wizard
13   cauldron
14   high arch east
15   high arch south
16   high arch east base
17   high arch south base

 

address 0x6d12 background type data
type offset description
BYTE 00 sprite
01 x
02 y
03 z
04 width (x)
05 depth (y)
06 height (z)
07
v h 5 4 3 2 1 0
7 6 5 4 3 2 1 0
v =  flip vertical
h = flip horizontal
4 = draw - this is internal but seems to always be set
keep reading an entry until the sprite is zero. all these sprites make one entity 

 

address 0x6ff2 objects
type offset description
BYTE 00 object graphic no - randomly changed at runtime
BYTE 01 x - start x position ( range = 0x46 - 0xba )
BYTE 02 y - start y position  ( 0x40 - 0x70 steps of 0x0c )
BYTE 03 z - start z position ( range = 0x46 - 0xba )
BYTE 04 screen - start screen
BYTE 05 cur_x - current x position
BYTE 06 cur_y - current y position
BYTE 07 cur_z - current z position
BYTE 08 cur_scr - current screen

 

address 0x7112 sprite offset table
offset table for the sprite data
type offset description
WORD 00 offset

 

address 0x728a sprite data
data for sprites
type offset description
BYTE 00 width
BYTE 01 height
BYTE 03... image data
( size = (width* height)*2 )
[ 0 ... height ]
   [ 0 ... width ]
BYTE 00 image
BYTE 01 mask

ObjectsRequired:
C27D DB 000h,001h,002h,003h,004h,005h,006h,003h,005h,000h,006h,001h,002h,004h
 

StartLocations:
D1E2 DB 02Fh,044h,0B3h,08Fh