Prev: 60600 Up: Map Next: 61974
61946: Code sheet - get the code that the player needs to enter
Used by the routine at 62102.
Called from 62194 after code generated and message printed on screen.
Picks out the relevant code from the code table at 60600 that the player needs to type in. The 2-byte code is returned in the DE registers.
61946 LD A,(62048) Second part of code from code sheet (number) - value = 0-41
61949 LD L,A
61950 LD H,0 Store value in HL register pair
Each set (0-41) in the code table at 60600 is 32 bytes long, so need to multiply this by 32 bytes to get to the right set
61952 ADD HL,HL x2
61953 ADD HL,HL x4
61954 ADD HL,HL x8
61955 ADD HL,HL x16
61956 ADD HL,HL x32
Next use the first part of the code to find the value within the set:
61957 LD A,(62049) First part of code from code sheet (letter) - value = 0-16 (A-P)
61960 ADD A,A x2 (as each 4-digit code is 2 bytes long)
61961 LD C,A
61962 LD B,0 Store value in BC register pair
61964 ADD HL,BC Add to HL value
61965 LD BC,60600
61968 ADD HL,BC ...and then add the start of the code sheet address location to get to the right place.
The HL register pair is now pointing to relevant code (2 bytes) in table at 60600.
Now put the 2 code bytes into the D & E registers
61969 INC HL
61970 LD D,(HL) Second (high) byte stored in D register
61971 DEC HL
61972 LD E,(HL) First (low) byte stored in E register
61973 RET
Prev: 60600 Up: Map Next: 61974