Prev: F950 Up: Map Next: FB78
FA00: High Score Entry
Used by the routine at New_Game.
New_HighScore FA00 CALL HighScore
FA03 JP HighScore_Input
HighScore FA06 LD DE,$5B80 Copies $40 bytes of data from HL to Print_TwoToneText_Alias.
FA09 LD BC,$0040
FA0C LDIR
FA0E LD A,$30 Writes "0" ($30 in ASCII) to HighScore_Text_Buffer.
FA10 LD ($FB94),A
FA13 CALL HighScore_Clear_Screen Call HighScore_Clear_Screen.
FA16 LD HL,$4040 Writes $4040 to FBF0.
FA19 LD ($FBF0),HL
FA1C PUSH IX
FA1E CALL $FC09 Call FC09.
FA21 LD ($FB57),A
FA24 POP IX
FA26 CP $1F
FA28 LD A,$01
FA2A JP Z,New_HighScore_1
FA2D LD HL,$4000
FA30 LD ($FBF0),HL
FA33 LD A,($FB57)
FA36 CALL HighScore_Position
FA39 LD DE,$61EF
FA3C PUSH DE
FA3D EX DE,HL
FA3E AND A
FA3F SBC HL,DE
FA41 PUSH HL
FA42 POP BC
FA43 POP HL
FA44 LD DE,$61FF
FA47 INC BC
FA48 LDDR
FA4A LD A,($FB57)
FA4D DEC A
FA4E CALL $FBFF
FA51 LD DE,$62F9
FA54 PUSH DE
FA55 EX DE,HL
FA56 AND A
FA57 SBC HL,DE
FA59 PUSH HL
FA5A POP BC
FA5B POP HL
FA5C LD DE,$62FF
FA5F INC BC
FA60 LDDR
FA62 LD A,($FB57)
FA65 CALL $FBFF
FA68 DEC HL
FA69 EX DE,HL
FA6A PUSH IX
FA6C POP HL
FA6D LD B,$06
New_HighScore_0 FA6F LD A,(HL)
FA70 ADD A,$30
FA72 LD (DE),A
FA73 DEC DE
FA74 INC HL
FA75 DJNZ New_HighScore_0
FA77 LD HL,$5BC0 Overwrites the text at Dueller_01 with spaces to "blank" it out ($12 characters).
FA7A LD DE,$5BC1
FA7D LD BC,$0011
FA80 LD (HL),$20
FA82 LDIR
FA84 LD (HL),$FF Set a string termination character ($FF) at the end of the string.
FA86 CALL HighScore_Clear_Screen
FA89 LD HL,$FB78 Points to HighScore_Title and sends it to Print_TwoToneText_Alias.
Value Ink Paper Bright
07 07 00 00
03 03 00 00
FA8C LD DE,$4802
FA8F LD BC,$0703
FA92 CALL Print_TwoToneText_Alias
FA95 CALL HighScore_Something
FA98 CALL HighScore_Clear_Screen
FA9B LD A,($FB57)
FA9E CALL HighScore_Position
FAA1 EX DE,HL
FAA2 LD HL,$5BC0
FAA5 LD BC,$0010
FAA8 LDIR
FAAA SUB $05
FAAC JR NC,New_HighScore_3
FAAE JR New_HighScore_2
New_HighScore_1 FAB0 LD HL,$FBB5 Points to HighScore_Sub_Head and sends it to Print_TwoToneText_Alias.
Value Ink Paper Bright
07 07 00 00
06 06 00 00
FAB3 LD DE,$4000
FAB6 LD BC,$0706
FAB9 CALL Print_TwoToneText_Alias
New_HighScore_2 FABC XOR A
New_HighScore_3 FABD INC A
FABE LD B,$0A
New_HighScore_4 FAC0 PUSH BC
FAC1 PUSH AF
FAC2 CALL New_HighScore_5
FAC5 LD DE,$FB94
FAC8 CALL $FBD5
FACB POP AF
FACC POP BC
FACD INC A
FACE CP $1F
FAD0 RET Z
FAD1 DJNZ New_HighScore_4
FAD3 RET
HighScore_Clear_Screen FAD4 LD HL,$4000 Clears the screen buffer by writing $00 to all 6912 memory locations.
FAD7 LD DE,$4001
FADA LD BC,$1AFF
FADD LD (HL),$00
FADF LDIR
FAE1 RET
New_HighScore_5 FAE2 LD C,A
FAE3 LD HL,$FB94
FAE6 SUB $0A
FAE8 JR C,New_HighScore_6
FAEA LD (HL),$31
FAEC SUB $0A
FAEE JR C,New_HighScore_6
FAF0 LD (HL),$32
FAF2 SUB $0A
FAF4 JR C,New_HighScore_6
FAF6 LD (HL),$33
FAF8 SUB $0A
New_HighScore_6 FAFA ADD A,$0A
FAFC INC HL
FAFD ADD A,$30
FAFF LD (HL),A
FB00 LD A,C
FB01 CALL HighScore_Position
FB04 LD DE,$FB9A
FB07 LD BC,$0010
FB0A LDIR
FB0C INC DE
FB0D INC DE
FB0E INC DE
FB0F INC DE
FB10 CALL $FBFF
FB13 LD BC,$0006
FB16 LDIR
FB18 RET
Works out where in the high score table to place the score.
HighScore_Position FB19 DEC A Using Highscore_Table_Name as a base, work out where to place the new score.
  • Decrease $1B by one...
  • Loads $1A as the low-order byte; HL=$001A
  • Times by $10; HL=$1A0
  • Add $6000=61A0
FB1A LD L,A
FB1B LD H,$00
FB1D ADD HL,HL
FB1E ADD HL,HL
FB1F ADD HL,HL
FB20 ADD HL,HL
FB21 LD DE,$6000
FB24 ADD HL,DE
FB25 RET Return.
HighScore_Something FB26 LD HL,$5BC0 Stores Dueller_01 at FB55.
New_HighScore_7 FB29 LD ($FB55),HL
FB2C CALL $FBF2
FB2F CALL HighScore_Input
FB32 LD HL,($FB55)
FB35 CP $0D
FB37 RET Z
FB38 CP $0C
FB3A JR Z,New_HighScore_9
FB3C LD C,A
FB3D LD A,L
FB3E CP $D1
FB40 JR NC,New_HighScore_7
FB42 LD A,C
FB43 CP $20
FB45 JR Z,New_HighScore_8
FB47 CP $61
FB49 JR C,New_HighScore_7
FB4B CP $7B
FB4D JR NC,New_HighScore_7
FB4F SUB $20
New_HighScore_8 FB51 LD (HL),A
FB52 INC HL
FB53 JR New_HighScore_7
FB55 DEFW $0000 Cache.
FB57 RRA
New_HighScore_9 FB58 LD A,L
FB59 CP $C1
FB5B JR C,New_HighScore_7
FB5D DEC HL
FB5E LD (HL),$20
FB60 JR New_HighScore_7
Returns a single keypress.
HighScore_Input FB62 LD HL,$5C08 Keep looping around until any input is detected. This is achieved by writing $00 to LAST_K and looping until it's non-zero.
FB65 LD (HL),$00
HighScore_Input_Loop FB67 HALT
FB68 LD A,(HL)
FB69 AND A
FB6A JR Z,HighScore_Input_Loop
FB6C PUSH AF Store it on the stack for now.
FB6D LD DE,$0010 Makes a noise using the BEEP routine.
Pitch Duration
$00C0 $0010
FB70 LD HL,$00C0
FB73 CALL $03B5
FB76 POP AF Return with the keypress in A.
FB77 RET
Prev: F950 Up: Map Next: FB78