Prev: B909 Up: Map Next: B998
B921: Handle the count down.
Used by the routine at Print_TerminalMessage.
CountDown B921 LD HL,(Plans_CountDownTime) Only count down if timer is set.
B924 LD A,L
B925 OR H
B926 RET Z
B927 LD HL,Plans_CountDownFrames See if a second has passed since last check.
B92A LD A,($5C78)
B92D SUB (HL)
B92E CP $32
B930 RET C Return if not.
B931 LD A,(HL) Update the check for next time.
B932 ADD A,$32
B934 LD (HL),A
B935 DEC HL Decrease count down by 1, keeping it in BCD format.
B936 DEC HL
B937 LD A,(HL)
B938 SUB $01
B93A DAA
B93B LD (HL),A
B93C LD ($C588),A
B93F INC HL Use any carry to decrease the 100s column.
B940 LD A,(HL)
B941 SBC A,$00
B943 DAA
B944 LD (HL),A
B945 LD ($C589),A
Draw LED digits
B948 LD A,$03
B94A LD BC,$5055 DF address to start drawing the LED numbers.
CountDown_Digit B94D PUSH AF
B94E LD HL,($C589)
B951 LD H,$00
B953 LD DE,Digit_LedLayout
B956 ADD HL,DE
B957 LD A,(HL)
B958 LD IX,Digit_Info Table of digit position and bitmap offsets.
CountDown_Led B95C LD DE,Mem_zeroes Default to a blank tile.
B95F SRL A
B961 JR NC,CountDown_0
B963 LD E,(IX+$01) Calculate bitmap of LED using the offset in the digit information.
B966 LD D,$00
B968 LD HL,Bmp_TimerLeds
B96B ADD HL,DE
B96C EX DE,HL
CountDown_0 B96D LD L,(IX+$00) Calculate the DF address using the offset information.
B970 LD H,$00
B972 ADD HL,BC
B973 EX DE,HL
B974 PUSH BC
B975 LD BC,$0010 Blit LED bitmap to the DF.
CountDown_BLitLed B978 LDI
B97A DEC DE
B97B INC D
B97C DEC C
B97D JR NZ,CountDown_BLitLed
B97F POP BC Reset screen address for top left of digit
B980 INC IX Move onto next LED infomration in table.
B982 INC IX
B984 CP $01
B986 JR NZ,CountDown_Led
B988 INC BC Move to next digit DF position.
B989 INC BC
B98A INC BC
B98B LD HL,$C588 Use next digit value stored in memory by count down.
B98E XOR A
B98F RLD
B991 INC HL
B992 LD (HL),A
B993 POP AF
B994 DEC A
B995 JR NZ,CountDown_Digit
B997 RET
Prev: B909 Up: Map Next: B998