Prev: 39125 Up: Map Next: 39200
39175: Shift odd ball graphic data right by C pixels and load into D (L.H.S.) and A' (R.H.S.)
On exiting this routine, A' will hold the remainder of the graphic data for an Odd Ball. So if the graphic data in D and A' were displayed side-by-side then we would have a complete row of Odd Ball graphic data, shifted right by C (input) pixels.
Used by the routine at 39125.
Input
C Pixel-within-byte "address"
D A byte of graphic data for an Odd Ball
Output
D Right-shifted partial byte of graphic data for an Odd Ball
A' Remainder of the graphic data for an Odd Ball
E Set bits represent number of pixels to the right that the Odd Ball graphic has been shifted
39175 LD A,C Load pixel-within-byte "address" into A
39176 OR A Check if we're dealing with pixel zero...
39177 JR Z,39195 ...and if so, skip ahead to 39195
39179 XOR A Set A to zero
39180 LD E,A Copy into E
39181 PUSH BC Store BC (B=graphic row counter, C=pixel-within-byte "address")
39182 LD B,C Copy pixel-within-byte "address" into B
39183 SRL D Shift graphic data right one bit (rightmost bit goes into carry flag)
39185 RRA Rotate carry flag into leftmost bit of A, shifting other bits right
39186 SCF Set carry flag
39187 RR E Rotate (set) carry flag into leftmost bit of E, shifting other bits right, and resetting carry flag
39189 DJNZ 39183 Repeat loop to shift graphic right another pixel if necessary
39191 EX AF,AF' Switch AF registers
39192 LD A,E Load A with value in E (set bits represent number of pixels by which Odd Ball graphic has been shifted right)
39193 POP BC Restore BC (B=graphic row counter, C=pixel-within-byte "address")
39194 RET Return
39195 XOR A Set A to zero
39196 EX AF,AF' Switch registers
39197 XOR A Set A to zero
39198 LD E,A Set E to zero as Odd Ball graphic hasn't been shifted
39199 RET Return
Prev: 39125 Up: Map Next: 39200