![]() |
Routines |
| Prev: AFE9 | Up: Map | Next: B0E4 |
|
Used by the routine at build_ship_sprite.
Draws add-on n, from its graphic in addon_graphics at its place in the buffer from addon_places, and raises the sprite's height (ship_height) to the byte before the graphic if that is more. If the graphic has a mask -- anything but $FF after the picture -- it is ANDed onto the buffer first (addon_mask_and_draw); then the picture is ORed on. Rows in the buffer are 6 bytes apart.
The mask test has a catch: a mask whose first byte is $FF is taken as no mask at all.
|
||||||||
| fit_addon | B09C | LD HL,addon_graphics | DE = its graphic (addon_graphics) | |||||
| B09F | LD C,(IX+$00) | |||||||
| B0A2 | DEC C | |||||||
| B0A3 | CALL table_word | |||||||
| B0A6 | EX DE,HL | |||||||
| B0A7 | PUSH DE | HL = its place in the buffer (addon_places); keep both | ||||||
| B0A8 | LD A,(IX+$00) | |||||||
| B0AB | LD C,A | |||||||
| B0AC | DEC C | |||||||
| B0AD | LD HL,addon_places | |||||||
| B0B0 | CALL table_word | |||||||
| B0B3 | POP DE | |||||||
| B0B4 | PUSH DE | |||||||
| B0B5 | PUSH HL | |||||||
| B0B6 | DEC DE | the sprite has to be at least as tall as the byte before the graphic says | ||||||
| B0B7 | LD A,(DE) | |||||||
| B0B8 | INC DE | |||||||
| B0B9 | LD B,A | |||||||
| B0BA | LD A,(ship_height) | |||||||
| B0BD | CP B | |||||||
| B0BE | JR NC,fit_addon_0 | |||||||
| B0C0 | LD A,B | |||||||
| B0C1 | LD (ship_height),A | |||||||
| fit_addon_0 | B0C4 | LD A,(DE) | the width (in A') and height (ground_cell); step over the picture, width times height bytes | |||||
| B0C5 | LD B,A | |||||||
| B0C6 | EX AF,AF' | |||||||
| B0C7 | INC DE | |||||||
| B0C8 | LD A,(DE) | |||||||
| B0C9 | LD (ground_cell),A | |||||||
| B0CC | INC DE | |||||||
| B0CD | LD C,A | |||||||
| B0CE | XOR A | |||||||
| fit_addon_1 | B0CF | ADD A,C | ||||||
| B0D0 | DJNZ fit_addon_1 | |||||||
| B0D2 | LD C,A | |||||||
| B0D3 | EX DE,HL | |||||||
| B0D4 | ADD HL,BC | |||||||
| B0D5 | EX DE,HL | |||||||
| B0D6 | LD A,(DE) | $FF after it: no mask | ||||||
| B0D7 | CP $FF | |||||||
| B0D9 | JR Z,addon_mask_and_draw_2 | |||||||
| B0DB | EX AF,AF' | A' = the height, C = the width; into the mask loop (addon_mask_and_draw) | ||||||
| B0DC | LD B,A | |||||||
| B0DD | LD A,(ground_cell) | |||||||
| B0E0 | EX AF,AF' | |||||||
| B0E1 | LD C,B | |||||||
| B0E2 | JR addon_mask_and_draw_0 | |||||||
| Prev: AFE9 | Up: Map | Next: B0E4 |