Sherlock: annotated disassembly

Routines

Prev: CEDE Up: Map Next: CF43
CEFE: Skip past a plan instruction
CEFE also skips a success address (bit 7 set in A); CF03 skips only the opcode and operands: 1 byte for opcodes 10, 11 and 15, 2 for 1, 8, 9 and 13, 3 for 3, 6 and 14, 4 for 2 and 5, and 5 for 4, 7 and 12. The INC HL chain at CF3D-CF41 is entered at the point that gives the right count.
Input
A The opcode byte
HL The instruction
Output
HL Past the instruction (CF03 skips the opcode and operands only)
CEFE BIT 7,A Bit 7 of the opcode byte: a success address (2 bytes) follows...
CF00 CALL NZ,$CF40 ...skip it (enter the INC HL chain two from the end)
This entry point is used by the routine at CE8F.
CF03 AND $0F The opcode alone
CF05 CP $0F Compare A with $0F - Opcode 15: 1 byte
CF07 JR Z,$CF41 If A equals $0F, jump on to CF41
CF09 CP $08 Compare A with $08 - Opcodes 8, 9, 1 and 13: 2 bytes
CF0B JR Z,$CF40 If A equals $08, jump on to CF40
CF0D CP $09 Compare A with $09
CF0F JR Z,$CF40 If A equals $09, jump on to CF40
CF11 CP $01 Compare A with $01
CF13 JR Z,$CF40 If A equals $01, jump on to CF40
CF15 CP $02 Compare A with $02
CF17 JR Z,$CF3E Opcode 2: 4 bytes
CF19 CP $03 Compare A with $03 - Opcodes 3 and 14: 3 bytes
CF1B JR Z,$CF3F If A equals $03, skip ahead to CF3F
CF1D CP $0D Compare A with $0D
CF1F JR Z,$CF40 If A equals $0D, skip ahead to CF40
CF21 CP $0E Compare A with $0E
CF23 JR Z,$CF3F If A equals $0E, skip ahead to CF3F
CF25 CP $07 Compare A with $07 - Opcodes 7 and 12: 5 bytes
CF27 JR Z,$CF3D If A equals $07, skip ahead to CF3D
CF29 CP $0C Compare A with $0C
CF2B JR Z,$CF3D If A equals $0C, skip ahead to CF3D
CF2D CP $0B Compare A with $0B - Opcodes 11 and 10: 1 byte
CF2F JR Z,$CF41 If A equals $0B, skip ahead to CF41
CF31 CP $0A Compare A with $0A
CF33 JR Z,$CF41 If A equals $0A, skip ahead to CF41
CF35 CP $05 Compare A with $05 - Opcode 5: 4 bytes
CF37 JR Z,$CF3E If A equals $05, skip ahead to CF3E
CF39 CP $04 Compare A with $04 - Opcode 4: 5 bytes; anything else (6): 3
CF3B JR NZ,$CF3F If A differs from $04, skip ahead to CF3F
CF3D INC HL HL is advanced by 5, 4, 3, 2 or 1 depending on where the chain is entered
CF3E INC HL Four
CF3F INC HL Three
This entry point is used by the routine at CE8F.
CF40 INC HL Two
CF41 INC HL One
CF42 RET Return with HL at the next instruction
Prev: CEDE Up: Map Next: CF43