Prev: 63005 Up: Map Next: 63134
63040: Draw axe to screen
Used by the routines at 46560 and 46784.
Input
A Frame number (32, 116, 117, 118 or 119)
63040 PUSH HL Store HL
63041 LD DE,28248 Point DE at 28248
63044 ADD A,A Double A...
63045 LD H,0 ...load into HL...
63047 LD L,A ...
63048 ADD HL,HL ...double again...
63049 ADD HL,HL ...and again to get 8 times original A value...
63050 ADD HL,DE ...and add DE to this
At this point, HL points to one of the five sets of axe frame graphic data (28504, 29176, 29184, 29192 or 29200).
63051 PUSH HL Copy HL into IX...
63052 POP IX ...
63054 LD BC,(23677) Load value in coordinate storage into BC (holds x- and y-coordinates of axe)
63058 CALL 63134 Load HL with display file address for coordinates in BC
63061 LD C,A Load pixel-within-byte "address" into C
63062 LD B,8 Load 8 into B (as axe graphic data comprises 8 pixel rows)
63064 LD D,(IX+0) Load a byte of axe graphic data into D
63067 LD A,C Load pixel-within-byte "address" into A
63068 OR A Check if we're dealing with pixel zero...
63069 JR Z,63128 ...and if so, skip ahead to 63128
63071 XOR A Set A to zero
63072 LD E,A Copy into E
63073 PUSH BC Store BC (B=graphic row counter, C=pixel-within-byte "address")
63074 LD B,C Copy pixel-within-byte "address" into B
63075 SRL D Shift graphic data right one bit (rightmost bit goes into carry flag)
63077 RRA Rotate carry flag into leftmost bit of A, shifting other bits right
63078 SCF Set carry flag
63079 RR E Rotate (set) carry flag into leftmost bit of E, shifting other bits right, and resetting carry flag
63081 DJNZ 63075 Repeat loop to shift graphic right another pixel if necessary
63083 EX AF,AF' Switch AF registers
63084 LD A,E Load A with value in E (set bits represent number of pixels by which axe graphic has been shifted right)
63085 POP BC Restore BC (B=graphic row counter, C=pixel-within-byte "address")
63086 LD A,D Load left part of axe graphic data into A
63087 LD E,(HL) Load E with graphic data currently at axe's position on screen
63088 XOR E Blend axe graphic data with what is already on screen at its position to make things look more natural...
63089 LD (HL),A ...and write new graphic data back to screen
63090 INC HL Advance right one byte in display file
63091 EX AF,AF' Switch registers to restore right part of axe graphic data to A
63092 LD E,(HL) Load E with graphic data currently at axe's position on screen
63093 XOR E Blend axe graphic data with what is already on screen at its position to make things look more natural...
63094 LD (HL),A ...and write new graphic data back to screen
63095 DEC HL Move left one byte in display file
63096 INC IX Advance IX to next row of axe graphic data
63098 INC H Increase H by 1 (i.e. advance HL by 256)
63099 LD A,H If at least one of the three rightmost bits of H are set (i.e. we haven't crossed over from one third of the display to the next third) then skip ahead to 63124 (as HL now points to next pixel row down)
63100 AND 7
63102 JR NZ,63124
63104 LD A,H Else we must have been in the bottom pixel row of a character row, so decrease H by 8 (1 to go back up, then 7 pixel rows up to the top of that character row)
63105 SUB 8
63107 LD H,A
63108 LD A,L Advance L by 32 bytes to move down one character row, so now the top of the next character row down...
63109 ADD A,32 ...
63111 LD L,A ...
63112 JR NC,63124 If L hasn't gone over 256 (i.e. we haven't moved 32 bytes on from the top pixel row of the bottom character row of the third) then skip ahead to 63124 else move down by a third
63114 LD A,H
63115 ADD A,8
63117 LD H,A
63118 XOR 88 If we have not reached the start of the attribute file...
63120 JR NZ,63124 ...then skip ahead to 63124
63122 LD H,64 ...else wrap back round to the start of display file again
63124 DJNZ 63064 Decrease B (remaining number of pixel rows to draw) and loop back to 63064
63126 POP HL Restore HL
63127 RET Return
63128 XOR A Set A to zero
63129 EX AF,AF' Switch registers
63130 XOR A Set A to zero
63131 LD E,A Set E to zero as axe graphic hasn't been shifted
63132 JR 63086 Jump back to 63086
Prev: 63005 Up: Map Next: 63134