Prev: 6ECB Up: Map Next: 6F10
6EDE: Draw Gauge Line
Used by the routines at HandlerAccelerate and 6E32.
Input
HL Screen location to draw the gauge
A Current Gauge Level
DrawGaugeLine 6EDE SRL A C=A / 04.
6EE0 SRL A
6EE2 LD C,A
Decrease gauge count by 08 and keep looping around until what's left is < 08 - then handle this part separately.
DrawGaugeLine_Loop 6EE3 LD A,C A=gauge count - 08.
6EE4 SUB $08
6EE6 JR C,DrawGaugeScreen_Last If gauge count < 08 then jump to DrawGaugeScreen_Last.
6EE8 LD C,A C=gauge count.
6EE9 LD A,$FF A=FF (a full line of pixels to write to the screen).
6EEB CALL DrawGaugeScreen Call DrawGaugeScreen.
6EEE JR DrawGaugeLine_Loop Jump to DrawGaugeLine_Loop.
Handles drawing the last section of the gauge level.
DrawGaugeScreen_Last 6EF0 LD B,$00 Create an offset in BC (B=00 C=gauge count).
6EF2 PUSH HL Stash the gauge screen location temporarily.
6EF3 LD HL,$6F07 HL=GaugeData + offset.
6EF6 ADD HL,BC
6EF7 LD A,(HL) A=gauge data.
6EF8 POP HL Restore the gauge screen location from the stack.
6EF9 CALL DrawGaugeScreen Call DrawGaugeScreen.
6EFC XOR A A=00 (no pixels - i.e. masking).
Writes A to the screen.
DrawGaugeScreen 6EFD PUSH HL Stash the gauge screen location temporarily.
6EFE LD B,$07 B=07 (counter for number of lines to draw).
DrawGaugeScreen_Loop 6F00 LD (HL),A Write A to the screen location held by HL.
6F01 INC H Increment H by one to move onto the next row.
6F02 DJNZ DrawGaugeScreen_Loop Decrease counter by one and loop back to DrawGaugeScreen_Loop until counter is zero.
6F04 POP HL Restore the original gauge screen location from the stack.
6F05 INC L Increment L by one to move onto the next column.
6F06 RET Return.
Gauge data; each value corresponds to a "full" line for 09 decreasing values. This completes the "end" section when drawing a gauge line.
GaugeData 6F07 DEFB $00 udg28423_56x4
6F08 DEFB $80
6F09 DEFB $C0
6F0A DEFB $E0
6F0B DEFB $F0
6F0C DEFB $F8
6F0D DEFB $FC
6F0E DEFB $FE
6F0F DEFB $FF
Prev: 6ECB Up: Map Next: 6F10