Prev: DAC0 Up: Map Next: DCA7
DB27: Enter and decode password
Used by the routine at DAC0.
DB27 CALL $DD1F Handle passsword code input
Decode entered password into text definition at DD0E
DB2A LD A,($DD01) Set first figure of score
DB2D LD ($DD0E),A
DB30 LD A,($DCF6) Set second figure of score
DB33 LD ($DD0F),A
DB36 LD A,($DCFA) Set third figure of score
DB39 LD ($DD10),A
DB3C LD A,($DCFE) Set fourth figure of score
DB3F LD ($DD11),A
DB42 LD A,($DCFC) Set fifth figure of score
DB45 LD ($DD12),A
DB48 LD A,($DCF8) Set number of lives
DB4B LD ($DD13),A
DB4E LD A,($DCF5) Set weapon available for double fire
DB51 LD ($DD14),A
DB54 LD A,($DCF9) Set weapon available for laser
DB57 LD ($DD15),A
DB5A LD A,($DCFB) Set weapon available for multiple
DB5D LD ($DD16),A
DB60 LD A,($DCF7) Set weapon available for spray
DB63 LD ($DD17),A
DB66 LD A,($DD00) Set first figure for shield power
DB69 LD ($DD18),A
DB6C LD A,($DCFD) Set second figure for shield power
DB6F LD ($DD19),A
DB72 LD A,($DCFF) Set number of smartbombs
DB75 LD ($DD1A),A
DB78 LD A,($DD03) Set first figure of checksum
DB7B LD ($DD1B),A
DB7E LD A,($DD04) Set second figure of checksum
DB81 LD ($DD1C),A
DB84 LD A,($DD02) Set third figure of checksum
DB87 LD ($DD1D),A
DB8A LD B,$0D For every charcode in the password substract the current number to 9. So 9 => 0 8 => 1 7 => 2 ...
DB8C LD E,$00
DB8E LD ($A22C),HL
DB91 LD HL,$DD0E
DB94 LD C,(HL)
DB95 LD A,$39
DB97 SUB C
DB98 ADD A,$30
DB9A LD (HL),A
DB9B SUB $30 Set into E the protection code (checksum) Checksum will be the sum of all the digits of the code
DB9D ADD A,E
DB9E LD E,A
DB9F INC HL Increment address for the next charcode
DBA0 DJNZ $DB94 Jump until all charcodes processed
DBA2 LD HL,$DCF5 Computes checksum code into E for the entered password
DBA5 LD B,$0D
DBA7 LD DE,$0000
DBAA LD A,(HL)
DBAB SUB $30
DBAD ADD A,E
DBAE LD E,A
DBAF INC HL
DBB0 DJNZ $DBAA
DBB2 LD ($A261),DE Save checksum code into A261
DBB6 LD A,E Jump to show invalid code windows if checksum == 0
DBB7 OR A
DBB8 JP Z,$DC59
DBBB LD A,$30 Set into charcode buffer at A23F the checksum code
DBBD LD ($A23F),A
DBC0 LD ($A240),A
DBC3 LD A,($DD1D)
DBC6 LD ($A243),A
DBC9 LD A,($DD1B)
DBCC LD ($A241),A
DBCF LD A,($DD1C)
DBD2 LD ($A242),A
DBD5 CALL $DC69 Computes into HL the corresponent checksum number
DBD8 LD DE,($A261) Test if checksum number computed is equal to checksum number of the code and jump to show invalid code if both number are diferent
DBDC AND A
DBDD SBC HL,DE
DBDF JP NZ,$DC59
DBE2 LD A,($DD0E) Set into charcode buffer at A23F th score
DBE5 LD ($A23F),A
DBE8 LD A,($DD0F)
DBEB LD ($A240),A
DBEE LD A,($DD10)
DBF1 LD ($A241),A
DBF4 LD A,($DD11)
DBF7 LD ($A242),A
DBFA LD A,($DD12)
DBFD LD ($A243),A
DC00 CALL $DC69 Computes the score number and set into A263
DC03 LD ($A263),HL
DC06 LD A,($DD13) Computes the lives of Rex from password code and set into A267
DC09 SUB $30
DC0B LD ($A267),A
DC0E LD A,($DD14) For every weapon set if weapon is available or not based on password
DC11 SUB $30
DC13 LD ($A1E9),A
DC16 LD A,($DD15)
DC19 SUB $30
DC1B LD ($A1EA),A
DC1E LD A,($DD16)
DC21 SUB $30
DC23 LD ($A1EB),A
DC26 LD A,($DD17)
DC29 SUB $30
DC2B LD ($A1EC),A
DC2E LD A,$30 Set into charcode buffer the shield power
DC30 LD ($A23F),A
DC33 LD ($A240),A
DC36 LD ($A241),A
DC39 LD A,($DD18)
DC3C LD ($A242),A
DC3F LD A,($DD19)
DC42 LD ($A243),A
DC45 CALL $DC69 Computes shield power number and set into A265
DC48 LD ($A265),HL
DC4B LD A,($DD1A) Computes smartbombs number and set into A266
DC4E SUB $30
DC50 LD ($A266),A
DC53 CP $04 if smartbomb is greater than 3 then jump to show invalid code
DC55 JP NC,$DC59
DC58 RET
Show invalid code windows
DC59 LD IX,$DCA7 Set IY to the address for text definition of invalid code
DC5D LD B,$02 Set B the number of lines
DC5F CALL $A2E6 Draws a windows
DC62 CALL $DD9B Wait for a keypress and set into A the charcode for the key
DC65 POP BC Restore BC
DC66 JP $DAE3 Jump back to handle password input
Convert the digit charcode buffer to the equivalent number and save it into HL
DC69 LD HL,$A23F Point HL to the digit charcode buffer for checksum code
DC6C LD B,$05 Convert charcode buffer to number buffer number = charcode - $30
DC6E LD A,(HL)
DC6F SUB $30
DC71 LD (HL),A
DC72 INC HL
DC73 DJNZ $DC6E
DC75 LD HL,$0000 Reset number value to 0
DC78 LD IX,$A23E Point IX to the address previous to the ten thousands figure
DC7C LD DE,$2710 Set DE to 10.000
DC7F CALL $DC9B Jump to compute the equivalent number in the figure of ten thousands
DC82 LD DE,$03E8 Set DE to 1.000
DC85 CALL $DC9B Jump to compute the equivalent number in the figure of thousands
DC88 LD DE,$0064 Set DE to 100
DC8B CALL $DC9B Jump to compute the equivalent number in the figure of hundreds
DC8E LD DE,$000A Set DE to 10
DC91 CALL $DC9B Jump to compute the equivalent number in the figure of tens
DC94 LD DE,$0001 Set DE to 1
DC97 CALL $DC9B Jump to compute the equivalent number in the figure of units
DC9A RET
Compute the equivalent number based in the figure of the digit
DC9B INC IX Point to the next figure
DC9D LD A,(IX+$00) Return if digit is 0
DCA0 OR A
DCA1 RET Z
DCA2 LD B,A Compute the equivalent figure x => x0.000 for ten thousands, x => x.000 for thousands ...
DCA3 ADD HL,DE
DCA4 DJNZ $DCA3
DCA6 RET
Prev: DAC0 Up: Map Next: DCA7