Prev: A01A Up: Map Next: A071
A035: Wave morale flag
This waves the morale flag up and down.
Used by the routines at main_loop and menu_screen.
wave_morale_flag A035 LD HL,$A12F Point HL at the game counter
A038 INC (HL) Increment the game counter in-place
Wave the flag on every other turn.
A039 LD A,(HL) Now fetch the game counter
A03A AND $01 Is its bottom bit set?
A03C RET NZ Return if so
A03D PUSH HL Save the game counter pointer
A03E LD A,($A13C) Fetch morale
A041 LD HL,$A140 Point HL at currently displayed morale
A044 CP (HL) Is the currently displayed morale different to the actual morale?
A045 JR Z,wave_morale_flag_2 It's equal - jump straight to wiggling the flag
A047 JP NC,wave_morale_flag_0 Actual morale exceeds displayed morale - jump to the increasing case
Decreasing morale.
A04A DEC (HL) Decrement displayed morale
A04B LD HL,($A141) Get the current screen address of the morale flag
A04E CALL next_scanline_down Given a screen address, return the same position on the next scanline down
A051 JR wave_morale_flag_1 Jump over increasing morale block
Increasing morale.
wave_morale_flag_0 A053 INC (HL) Increment displayed morale
A054 LD HL,($A141) Get the current screen address of the morale flag
A057 CALL next_scanline_up Given a screen address, returns the same position on the next scanline up
wave_morale_flag_1 A05A LD ($A141),HL Set the screen address of the morale flag
Wiggle and draw the flag.
wave_morale_flag_2 A05D LD DE,$DA6B Point DE at bitmap_flag_down
A060 POP HL Restore the game counter pointer
A061 BIT 1,(HL) Is bit 1 set?
A063 JR Z,wave_morale_flag_3 Skip next instruction if not
Note that the last three rows of the bitmap_flag_up bitmap overlap with the first three of the bitmap_flag_down bitmap.
A065 LD DE,$DA29 Point DE at bitmap_flag_up
wave_morale_flag_3 A068 LD HL,($A141) Get the screen address of the morale flag
A06B LD BC,$0319 Plot the flag always at 24x25 pixels in size
A06E JP plot_bitmap Exit via plot_bitmap
Prev: A01A Up: Map Next: A071