Sherlock: annotated disassembly

ROM and system variables

The game uses a few places outside its own code: ROM routines, screen memory and the system-variable area. Descriptions link here when they mention one of them.

AddressNameKindWhat the game uses it for
$04C2SA-BYTESROMThe ROM routine that writes a block of bytes to tape. The save routine uses it for the saved game.
$0556LD-BYTESROMThe ROM routine that reads a block of bytes from tape (the game load and the header read).
$0F12COPY-LINE codeROMThe part of the ROM printer routine that prints one pixel line; the screen-copy routine joins it here.
$22AAPIXEL-ADDRESSROMThe ROM routine that turns pixel coordinates (B = y, C = x) into the screen byte address in HL and the bit position in A.
$4000Display fileScreenThe start of the screen bitmap: 6,144 bytes, eight pixel lines per character row.
$5800Attribute fileScreenThe start of the colour attributes: 768 bytes, one per character cell ($5800 to $5AFF).
$5B00Typed lineWorkspaceWhere the line the player types is kept before it is split into words.
$5B81Token listWorkspaceThe list of words made from the typed line. A repeated command reuses the one from the previous command.
$5C08LAST_KSystem variableThe last key pressed. The keyboard routine takes a new key from here.
$5C0BLine bufferSystem variable areaUsed by the game as the buffer where typed characters are collected, and as the tape header workspace.
$5C3AERR_NRSystem variableThe error-number byte; the start of the standard system-variable area that IY is pointed at.
$5C3BFLAGSSystem variableA set of ROM flag bits.
$5C3CTV_FLAGSystem variableThe ROM's output flags. The game stores a value here to switch printing to the screen on or off for a message.
$5C42Spelling bufferSystem variable areaUsed by the game as the buffer where a dictionary word is spelled out from its kept letters, new letters and suffix.