Manic Miner: Routine at 927F

| Routines

927F: Draw Willy to the screen buffer at 6000

Used by the routine at 923A.
927F | LD A,($8068) | Pick up Willy's y-coordinate from 8068
9282 | LD IXh,$83 | Point IX at the entry in the screen buffer address lookup table at 8300 that corresponds to Willy's y-coordinate
9285 | LD IXl,A
9287 | LD A,($806A) | Pick up Willy's direction and movement flags from 806A
928A | AND $01 | Now E=0x00 if Willy is facing right, or 0x80 if he's facing left
928C | RRCA
928D | LD E,A
928E | LD A,($8069) | Pick up Willy's animation frame (0-3) from 8069
9291 | AND $03 | Point DE at the sprite graphic data for Willy's current animation frame (see 8200)
9293 | RRCA
9294 | RRCA
9295 | RRCA
9296 | OR E
9297 | LD E,A
9298 | LD D,$82
929A | LD B,$10 | There are 16 rows of pixels to copy
929C | LD A,($806C) | Pick up Willy's screen x-coordinate (0-31) from 806C
929F | AND $1F
92A1 | LD C,A | Copy it to C
92A2 | LD A,(IX+$00) | Set HL to the address in the screen buffer at 6000 that corresponds to where we are going to draw the next pixel row of the sprite graphic
92A5 | LD H,(IX+$01)
92A8 | OR C
92A9 | LD L,A
92AA | LD A,(DE) | Pick up a sprite graphic byte
92AB | OR (HL) | Merge it with the background
92AC | LD (HL),A | Save the resultant byte to the screen buffer
92AD | INC HL | Move HL along to the next cell to the right
92AE | INC DE | Point DE at the next sprite graphic byte
92AF | LD A,(DE) | Pick it up in A
92B0 | OR (HL) | Merge it with the background
92B1 | LD (HL),A | Save the resultant byte to the screen buffer
92B2 | INC IX | Point IX at the next entry in the screen buffer address lookup table at 8300
92B4 | INC IX
92B6 | INC DE | Point DE at the next sprite graphic byte
92B7 | DJNZ $92A2 | Jump back until all 16 rows of pixels have been drawn
92B9 | RET |