===============================================================================

                              CASTLE  CPCSTEIN

               A first-person shooter for the Amstrad CPC 6128

                          2026 by Devil-System

===============================================================================


CONTENTS
--------
  1.  The Story
  2.  Requirements
  3.  Loading the Game
  4.  Controls
  5.  How to Play
  6.  The Floors
  7.  Enemies
  8.  Items and Objects
  9.  Health and Game Over
 10.  Hints and Tips
 11.  Technical Details
 12.  Files on the Disk


-------------------------------------------------------------------------------
1.  THE STORY
-------------------------------------------------------------------------------

You have been captured and locked away deep inside Castle CPCStein, the
fortress of the Fuehrer. Armed with nothing but a pistol you took from a
careless guard, you must fight your way up through the castle, floor by
floor.

Seven floors stand between you and the Fuehrer's bunker: the castle
courtyard, the dungeon, the officers' quarters, the armoury, the cell
block, the library and the command centre. On each floor you have to
find the elevator that takes you further up. At the very top, in his bunker,
the Fuehrer himself is waiting.

End the war. Free Castle CPCStein.


-------------------------------------------------------------------------------
2.  REQUIREMENTS
-------------------------------------------------------------------------------

  - Amstrad CPC 6128 (or a CPC 464/664 with 64 KB memory expansion), or an
    emulator set up as a CPC 6128 (e.g. WinAPE, CPCEC, Caprice, Arnold,
    RetroVirtualMachine)
  - Disk drive (3" drive, Gotek/HxC or disk image in the emulator)
  - Keyboard; a joystick is optional

  The game needs the extra 64 KB RAM of the 6128: parts of the 3D engine are
  loaded into the additional memory banks. It will not run on an unexpanded
  CPC 464 or 664.


-------------------------------------------------------------------------------
3.  LOADING THE GAME
-------------------------------------------------------------------------------

  Insert the disk (or attach CPCSTEIN.DSK in your emulator) and type:

      RUN"CPCSTEIN"

  and press RETURN (or ENTER).

  The loader first shows the title picture, then loads the game code and the
  three engine files into memory. After a few seconds the title screen
  appears.

  Please note: do NOT start the game with RUN"CPCSTEIN.BIN". Always use the
  BASIC loader, otherwise the engine files cannot be loaded.


-------------------------------------------------------------------------------
4.  CONTROLS
-------------------------------------------------------------------------------

  Keyboard and joystick can be used at the same time. There is nothing to
  select or configure.

    Action                      Keyboard                Joystick
    --------------------------  ----------------------  -------------------
    Walk forward                Cursor Up    or  W      Up
    Walk backward               Cursor Down  or  S      Down
    Turn left                   Cursor Left  or  A      Left
    Turn right                  Cursor Right or  D      Right
    Strafe (step sideways)      Q (left) / E (right)    -
    Shoot                       CTRL                    Fire
    Open a door                 SPACE, F, RETURN, ENTER 2nd fire
    Use the elevator            SPACE, F, RETURN, ENTER 2nd fire
    Open a secret wall          SPACE, F, RETURN, ENTER 2nd fire
    Automap (pauses the game)   M                       -
    Start game (title)          SPACE / RETURN          Fire
    (Like the PC original: SPACE opens doors. With a one-button joystick
    the button fires and SPACE is used to open doors.)
    Continue (between floors)   any key                 Fire
    Options (title)             O, then 1 / 2           -
    Enter a password (title)    P, letters, RETURN      -
    Back to the title menu      ESC

  PASSWORD ENTRY
    On the title screen, press P. "Password:" appears with six dots.
    Type the password, correct mistakes with DEL and confirm with RETURN
    (ESC cancels). The result is shown in the same line:
      "Start: FLOOR n"   the game will start on that floor
      "Wrong password"   the game will start on floor 1
    You can enter a new password at any time by pressing P again.

  OPTIONS
    On the title screen, press O to open the options menu:
      1   View size:  FULL -> 2/3 -> 1/2 -> FULL ...
      2   Detail:     HIGH / LOW
    Any other key (or fire) returns to the title menu.

    View size:
      View   Window size (pixels)     Speed (approx.)
      -----  -----------------------  ------------------------
      FULL   160 x 200 (full screen)  5 - 6 frames per second
      2/3    108 x 136                 7 - 8 frames per second
      1/2     80 x 104                 9 - 11 frames per second

    The field of view is the same in all sizes. The smaller the window, the
    smoother the game runs. The default is 2/3.
    In the smaller sizes the rest of the screen is filled with a blue
    stone wall pattern, with a black frame around the 3D window.

    Detail LOW halves the horizontal resolution of the walls (one ray for
    every two columns). Walls look coarser, sprites and weapon stay sharp,
    and the game runs about 20 % faster. The default is HIGH.
    Both settings are kept until you change them.

  Shooting and using are separate: CTRL / Fire always fires the pistol,
  USE (SPACE, F, RETURN, ENTER or 2nd fire) opens doors and secret walls and
  operates the elevator when you stand right in front of them. Elsewhere
  USE does nothing, so no ammunition is wasted.


-------------------------------------------------------------------------------
5.  HOW TO PLAY
-------------------------------------------------------------------------------

  Floors 1 to 7:
    Find the ELEVATOR and use it. The elevator wall is easy to spot: a grey
    metal wall with vertical white stripes and a control panel with a yellow
    switch. Walk up close (about one tile), face it and press USE
    (SPACE, F, RETURN, ENTER or 2nd fire).
    You are taken to the next floor.

  Floor 8 (the Fuehrer's bunker):
    There is no elevator here. Your goal is to KILL THE FUEHRER. When he
    falls, you have won the game.

  You do NOT have to kill every guard. Speed and survival matter more than
  a body count, but guards will chase you once you get close, so it is often
  safer to deal with them than to run.

  Before each floor a short screen shows the floor number and your goal:
    "FLOOR n  -  Find the elevator!"   (floors 1-7)
    "FLOOR 8  -  Kill the Fuehrer!"    (floor 8)
  It also shows your score, your ammunition and - from floor 2 on - the
  PASSWORD of this floor. Write it down: entering it on the title screen
  (press P) lets you start directly on that floor next time (with a score
  of zero).

  AUTOMAP
    Press M at any time to see a map of the floor inside a cyan frame.
    It shows the area around every place you have walked (one tile in
    each direction); secret walls look like normal walls. The floor is
    shown as a dark blue area, walls in their own colour (grey, red banner,
    blue, wood, elevator yellow, doors cyan, red brick, cell doors light
    blue). Your position is a yellow arrow pointing in the direction you
    are facing. Below the map: floor number, ammunition and score. The
    game is paused while the map is shown. Press M, ESC or Fire to go
    back.


-------------------------------------------------------------------------------
6.  THE FLOORS
-------------------------------------------------------------------------------

  Every floor is a 16 x 16 tile maze.

    Floor  Name                   Walls                     Guards
    -----  ---------------------  ------------------------  -----------
      1    Castle Courtyard       Grey stone, red banners      6
      2    The Dungeon            Blue stone, cell doors       9
      3    Officers' Quarters     Wood panelling               8
      4    The Armoury            Red brick                    7
      5    The Cell Block         Blue stone, cell doors       8
      6    The Library            Wood panelling               7
      7    Command Centre         Grey stone, red brick        8
      8    The Fuehrer's Bunker   Grey stone, red banners      7 + FUEHRER

  Every floor also holds medikits, ammunition and treasure. Some of it is
  hidden behind secret walls.

  Goal on floors 1-7: reach the elevator.
  Goal on floor 8:    kill the Fuehrer.

  Your health is fully restored at the start of every floor.


-------------------------------------------------------------------------------
7.  ENEMIES
-------------------------------------------------------------------------------

  GUARD
    Green uniform, grey helmet.
    - Takes 3 hits to go down.
    - Notices you when you come within about 8 tiles and starts chasing you.
    - Shoots at you whenever he has a clear line of sight - even from far
      away. The closer he is, the more likely he hits. Walls and closed
      doors block his shots.
    - Attacks in close combat (less than one tile away).
    - Every hit takes one unit of your health.
    - When hit, he flashes red and stops for a moment.
    - His body disappears about 2.5 seconds after he falls and leaves
      an ammunition clip behind.

  THE FUEHRER
    Black uniform, black hair and moustache, red armband.
    - Takes 12 hits to go down.
    - Chases and attacks you just like a guard.
    - Flashes red when hit.
    - About 2.5 seconds after his death the victory screen appears.

  Guards cannot walk through closed doors. Once you open a door, it stays
  open, and guards can follow you through it.


-------------------------------------------------------------------------------
8.  ITEMS AND OBJECTS
-------------------------------------------------------------------------------

  MEDIKIT
    A white box with a red cross, lying on the floor.
    - Walk over it to pick it up.
    - Restores 4 units of health (half of the maximum), up to the maximum
      of 8.
    - It is only picked up if you are injured. At full health it stays
      where it is, so you can come back for it later.

  AMMUNITION CLIP
    A small olive box with yellow stripes.
    - Walk over it to pick it up: +8 rounds (maximum 40).
    - It is only picked up if you are not fully loaded.
    - Every guard you kill leaves one behind.

  TREASURE (GOLDEN CHALICE)
    - Walk over it to pick it up: +500 points.

  DOORS
    Bright cyan metal doors with a darker cyan frame, a golden handle and
    rivets.
    - Face the door from close range (about 1.5 tiles) and press USE
      (SPACE, F, RETURN, ENTER or 2nd fire).
    - The door slides open sideways in a little under a second and stays
      open.

  ELEVATOR
    Grey metal wall with white stripes and a control panel (yellow switch).
    - Face it from close range (about one tile) and press USE.
    - Takes you to the next floor.

  SECRET WALLS
    Some walls look exactly like normal grey stone but can be moved: face
    the wall from close range and press USE. It slides aside like
    a door and reveals a hidden room. Where they are is up to you to find
    out.

  WALL TYPES
    - Grey stone
    - Grey stone with red banners
    - Blue stone
    - Wood panelling
    - Red brick
    - Cell door (bars in a grey frame; solid)


-------------------------------------------------------------------------------
9.  HEALTH AND GAME OVER
-------------------------------------------------------------------------------

  Your health is shown as a red bar in the top left corner of the screen.
  The maximum is 8 units. Below it, the yellow bar shows your ammunition
  (maximum 40 rounds, one small block = 2 rounds). You start the game with
  16 rounds; ammunition is kept from floor to floor. With an empty pistol
  you only hear a click.

  SCORE
    Guard            100 points
    Treasure         500 points
    Floor completed  1000 points
    The Fuehrer      5000 points
  Your score is shown between floors, on the automap and at the end of the
  game. The best score (HI-SCORE) is shown on the title screen.

  HALL OF FAME
    The eight best players are kept in the HALL OF FAME. If your score is
    good enough at the end of a game (Game Over or victory), "Name:"
    appears: type up to 8 letters (DEL corrects, RETURN confirms). The list
    is then saved to the disk as HISCORE.DAT and loaded again the next
    time you start the game. Leave the disk in the drive and do not
    write-protect it if you want your scores to be saved; if saving is not
    possible, the list is simply kept until the computer is reset.

    To reset the Hall of Fame to its original entries, type
        RUN"RESHIGH"
    (disk must not be write-protected). Then start the game again with
    RUN"CPCSTEIN".

  - Each guard hit (shot or close combat) takes 1 unit. The screen border flashes red when you
    are hit.
  - Medikits restore 4 units.
  - Health is refilled to 8 at the start of every floor.

  Press ESC at any time during the game to abandon it and return to the
  title menu (for example to change the view size). To leave the game
  completely, reset the computer.

  When your health reaches zero, "GAME OVER" appears together with your
  score (and "NEW HI-SCORE!" if you beat the record; see HALL OF FAME for
  entering your name). Press any key or Fire to return to the title screen
  and try again from floor 1 - or enter a password to continue on a later
  floor.

  TITLE SEQUENCE AND DEMO MODE
  If no key is pressed, the title screen changes every 5 seconds:
    title menu - Hall of Fame - title menu - Hall of Fame - title menu -
    demo.
  Any key brings back the title menu and starts the sequence again. The
  demo is an autopilot that plays through floor 1 (opens the door, shoots
  the guards on its way and takes the elevator). The title music plays in a
  loop while the title screen is shown. Press any key, Fire or move the
  joystick to return to the title screen at once. The demo also
  ends by itself at the elevator. The selected view size is used.

  After beating the Fuehrer you get the victory screen:
    "VICTORY!  The Fuehrer is dead.  Castle CPCStein is free!"
  Press any key or Fire to return to the title screen.


-------------------------------------------------------------------------------
10. HINTS AND TIPS
-------------------------------------------------------------------------------

  - Keep your distance. Guards shoot back, but they hit much less often
    from far away. Use corners and doors as cover.
  - Your shot hits whatever is in the middle of the screen. Line up the
    enemy with the centre before firing.
  - A guard who is hit stops for a moment. Keep firing and he will not
    reach you.
  - Save medikits for later: they are not picked up while you are at full
    health.
  - Watch your ammunition. Collect the clips the guards leave behind.
  - Use Q / E to step sideways out of a guard's reach while keeping him in
    your sights.
  - Lost? Press M for the automap.
  - A dead end in a straight corridor or an odd single wall block can hide a
    secret wall. Try USE (SPACE / F / RETURN / 2nd fire).
  - Open doors carefully. Guards may be waiting in the room behind.
  - On floor 8, clear out the guards before you open the door to the
    throne room. The Fuehrer needs 12 hits, so you want a full health bar
    for that fight.


-------------------------------------------------------------------------------
11. TECHNICAL DETAILS
-------------------------------------------------------------------------------

  Engine
    - Raycasting engine written entirely in Z80 assembly language.
    - Full-screen 3D view: 160 x 200 pixels in MODE 0 (16 colours).
      80 rays are cast per frame, each ray drawn as 2 pixels wide.
    - Texture-mapped walls: 16 x 16 texel textures, 9 wall types, each with
      a light and a dark variant for the two wall orientations (simple
      lighting).
    - Compiled scalers: for each possible wall height there is a
      specialised, unrolled drawing routine. These routines take about
      61 KB (including the clipped scalers for the smaller view sizes) and
      are stored in the extra 64 KB RAM banks of the CPC 6128.
      They are paged in at &4000-&7FFF while the walls are drawn.
    - Sprites (guards, the Fuehrer, bodies, medikits, ammunition, treasure)
      are scaled with the distance and clipped against the walls per
      column (depth buffer).
    - Only changed parts of the ceiling and floor are redrawn, which saves
      a lot of time.
    - Sliding doors are handled inside the raycaster: rays pass through the
      part of the door that is already open.
    - Movement and animation are timed with the 50 Hz interrupt, so the
      game runs at the same speed whatever the frame rate.
    - Frame rate on a standard 4 MHz CPC, depending on the scene:
        full view (80 rays)   about 5 - 6 frames per second
        2/3 view  (54 rays)   about 8 frames per second
        1/2 view  (40 rays)   about 11 frames per second
    - Selectable view size: the smaller windows are vertically centred so
      that the normal scalers can be reused unchanged (a wall in a small
      window looks exactly like a more distant wall in the full window).
      Only walls that are taller than the small window use extra, clipped
      scalers (43 for 2/3, 43 for 1/2). Separate ray angle and fish-eye
      correction tables keep the field of view identical.

  Sound
    - Own sound player for the AY-3-8912 sound chip, driven by the
      firmware's 50 Hz interrupt (frame flyback event).
    - Sound effects: pistol shot, empty pistol, enemy hit, enemy death,
      player hurt, door, medikit, ammunition and treasure pickup, short
      melodies between floors, on victory and on defeat.
    - Title music: a small three-channel tracker plays a looping theme in
      A minor at 125 BPM - lead melody on channel B (centre), pumping
      octave bass on channel C and drums (kick, snare, hi-hat made from
      tone and noise) on channel A. Other melodies play on channel B,
      sound effects use all three channels.

  Graphics
    - Custom 16-colour palette (firmware colours):
      0,1,13,26,3,6,12,15,24,2,11,9,16,14,10,20
    - Custom bold character set (96 characters) in the style of the
      original Wolfenstein games, with small capitals for lower case
      letters.
    - The title logo is drawn at runtime from the character set: twice
      as wide, three times as high, with a colour gradient and a drop
      shadow.
    - Title picture (TITLE.SCR) shown by the loader while the game loads.

  Game data
    - 8 floors of 16 x 16 tiles, stored in memory bank 7 behind the last
      block of scalers and copied to a buffer when a floor starts
    - Up to 16 objects per floor (guards, medikits, ammunition, treasure,
      the Fuehrer)
    - Player health: 8 units; guard: 3 hits; Fuehrer: 12 hits
    - Medikit: +4 health; ammunition clip: +8 rounds (max. 40)
    - Score kept as BCD (in hundreds); Hall of Fame (8 names) saved to
      and loaded from HISCORE.DAT (80 bytes)
    - Automap: whenever you enter a new tile, the 3x3 tiles around you
      are marked as explored (256-byte table); no cost for the raycaster

  Memory map (main RAM)
    &0170 - &02FF   BASIC loader (MEMORY &2FF)
    &0300 - &7FFF   Game code, tables, textures, sprites
    &8000 - &8FFF   Sound player, view size module, automap, title and
                    password logic, character set data, title logo routine
    &9000 - &97FF   AMSDOS file buffer (while loading the banks and
                    HISCORE.DAT at start-up)
    &9000 - &96FF   Character matrix table used by the firmware
                    (set up after loading)
    &9800 - &9BFF   Quarter-square multiplication tables (built at start-up)
    &9C00 - &9CFF   Automap: explored tiles
    &9D00 - &9EFF   Buffer for the current floor
    &9800 - &9FFF   AMSDOS file buffer when saving HISCORE.DAT
                    (tables are rebuilt afterwards)
    &C000 - &FFFF   Screen memory
    Banks 4-7       Compiled scalers (SC0.BIN - SC3.BIN); bank 7 also
                    holds the 8 floors

  Development
    - Assembled with RASM.
    - Textures, sprites, levels, font and scaler code are generated by
      Python scripts, then assembled and written to the disk image.


-------------------------------------------------------------------------------
12. FILES ON THE DISK
-------------------------------------------------------------------------------

    CPCSTEIN.BAS   BASIC loader (start with RUN"CPCSTEIN")
    TITLE.SCR      Title picture (loaded to &C000, palette routine at &C7D0)
    CPCSTEIN.BIN   Main program (loaded to &0300, about 35 KB)
    SC0.BIN        Compiled wall scalers, part 1 (memory bank 4)
    SC1.BIN        Compiled wall scalers, part 2 (memory bank 5)
    SC2.BIN        Compiled wall scalers, part 3 (memory bank 6)
    SC3.BIN        Compiled wall scalers, part 4, and the 8 floors
                   (memory bank 7)
    HISCORE.DAT    Hall of Fame (8 names and scores, 80 bytes)
    RESHIGH.BAS    Resets the Hall of Fame (start with RUN"RESHIGH")
    RESHIGH.BIN    Reset program (loaded to &4000 by RESHIGH.BAS)


===============================================================================
                  Castle CPCStein  -  2026 by Devil-System
===============================================================================
