| Ant Attack | Routines |
| Prev: 8097 | Up: Map | Next: 80D3 |
|
Used by the routine at DRAW_HERE.
A sprite frame is 64 bytes: 16 rows of mask, graphic, mask, graphic. Frame f lives 64f bytes above PLAY, so the frame number is the address, less PLAY, divided by 64 -- the sprites are at SPRITES (frames $68-$7F) and MORE_SPRITES (frames $DC-$FF).
|
||||||||||||
| DRAW_SPRITE | 80A0 | PUSH BC | BC = the row step. | |||||||||
| 80A1 | LD C,E | |||||||||||
| 80A2 | LD B,D | |||||||||||
| 80A3 | LD A,(IX+$00) | The frame number. | ||||||||||
| 80A6 | INC IX | |||||||||||
| 80A8 | LD E,$00 | DE = 64 x the frame number: the frame's first byte. | ||||||||||
| 80AA | RRA | |||||||||||
| 80AB | RR E | |||||||||||
| 80AD | RRA | |||||||||||
| 80AE | RR E | |||||||||||
| 80B0 | AND $3F | |||||||||||
| 80B2 | ADD A,$80 | |||||||||||
| 80B4 | LD D,A | |||||||||||
| 80B5 | CALL PLANE_TO_BUFFER | HL = where the sprite goes in the render buffer. | ||||||||||
| 80B8 | LD A,$10 | Sixteen rows. | ||||||||||
| DRAW_SPRITE_0 | 80BA | PUSH AF | ||||||||||
| 80BB | EX DE,HL | The left byte: mask out, then OR in the graphic... | ||||||||||
| 80BC | LD A,(DE) | |||||||||||
| 80BD | AND (HL) | |||||||||||
| 80BE | INC HL | |||||||||||
| 80BF | OR (HL) | |||||||||||
| 80C0 | INC HL | |||||||||||
| 80C1 | LD (DE),A | |||||||||||
| 80C2 | INC E | ...and the right byte. | ||||||||||
| 80C3 | LD A,(DE) | |||||||||||
| 80C4 | AND (HL) | |||||||||||
| 80C5 | INC HL | |||||||||||
| 80C6 | OR (HL) | |||||||||||
| 80C7 | INC HL | |||||||||||
| 80C8 | LD (DE),A | |||||||||||
| 80C9 | EX DE,HL | Down a row. | ||||||||||
| 80CA | ADD HL,BC | |||||||||||
| 80CB | POP AF | |||||||||||
| 80CC | DEC A | |||||||||||
| 80CD | JR NZ,DRAW_SPRITE_0 | |||||||||||
| 80CF | LD E,C | Give DE back. | ||||||||||
| 80D0 | LD D,B | |||||||||||
| 80D1 | POP BC | |||||||||||
| 80D2 | RET | |||||||||||
| Prev: 8097 | Up: Map | Next: 80D3 |