Prev: 63499 Up: Map Next: 63598
63504: Draw a graphic with lookup index A at character coordinates (C, B)
Used by the routines at 39883 and 42638.
Input
A Index of graphic to draw in graphic data lookup table at 29272
B y-coordinate (characters) for printing item
C x-coordinate (characters) for printing item
D (entry at 63507) Graphic height (characters)
E (entry at 63507) Graphic width (characters)
63504 LD DE,1026 Set D (height) to 4 and E to 2 (width)
This entry point is used by the routines at 47193, 63494 and 63499.
63507 PUSH HL Store HL
63508 PUSH DE Store DE
63509 PUSH AF Store AF
63510 LD A,C Load x-coordinate to draw item into instruction at 63570...
63511 LD (63571),A ...
63514 LD A,B Multiply y-coordinate by 8...
63515 ADD A,A ...
63516 ADD A,A ...
63517 ADD A,A ...
63518 LD L,A ...and load into HL...
63519 LD H,0 ...
63521 ADD HL,HL Double again (so now 16 times y-coordinate, as 8 pixels in a character block, and two bytes per entry in data at 65140)
63522 LD DE,65140 Point DE at table of display file addresses of start of each pixel row
63525 ADD HL,DE Advance by 16 times y-coordinate to point HL at entry for start of item's current pixel row
63526 PUSH HL Transfer this value into IX...
63527 POP IX ...
63529 POP AF Restore A (graphic index of item to draw)...
63530 LD L,A ...and load into HL...
63531 LD H,0 ...
63533 ADD HL,HL Multiply by four (as there are two WORD entries for each graphic in the table at 29272)...
63534 ADD HL,HL ...
63535 LD BC,29272 Point BC at start of graphics data lookup table at 29272...
63538 ADD HL,BC ...and add offset to point to entry for item of interest
63539 LD E,(HL) Load graphic data address for this graphic into DE...
63540 INC HL ...
63541 LD D,(HL) ...
63542 INC HL ...
63543 CALL 64632 Load next value in table (address of graphic data for this object's mask) into HL
63546 POP BC Restore BC (B = height, C = width)
63547 LD A,B Load height into A...
63548 ADD A,A ...and multiply by eight...
63549 ADD A,A ...
63550 ADD A,A ...
63551 EX AF,AF' Swap A and A'
63552 LD B,C Copy graphic width into B...
63553 LD A,C ...and A'...
63554 LD (63574),A ...and modify instruction at 63573 with this value also
63557 EX AF,AF' Swap A and A'
63558 EX DE,HL Swap DE (now pointer to object's mask graphic data) and HL (now pointer to object's graphic data)
63559 EXX Switch registers
63560 LD C,A Load C with eight times graphic's height
63561 PUSH BC Store BC (C = remaining number of pixel rows to draw, initially eight times graphic's height)
63562 LD L,(IX+0) Load HL' with display file address of start of pixel row at object's y-coordinate...
63565 LD H,(IX+1) ...
63568 LD B,0 Set B' to zero
The operand of the instruction at 63570 represents the x-coordinate at which to draw the item. This is modified by the instruction at 63511.
63570 LD C,0 Set C' to x-coordinate of item
63572 ADD HL,BC Add x-coordinate as offset to address of start of pixel row in HL' (HL' now points at display file address to begin drawing)
The operand of the instruction at 63573 represents the width of the graphic to draw. This is modified by the instruction at 63554.
63573 LD B,0 Load B with graphic width
63575 EXX Switch registers
63576 LD A,(DE) Load graphic data byte from graphic mask data into A
63577 EXX Switch registers
63578 AND (HL) Modify mask data by AND-ing with contents of display file allowing scenery in background to show; set pixels are transparent
63579 EXX Switch registers
63580 OR (HL) Modify modified mask data by OR-ing with object graphic data byte from graphic data
63581 INC HL Advance HL to next byte in object graphic data
63582 INC DE Advance DE to next byte in object graphic mask data
63583 EXX Switch registers
63584 LD (HL),A Load masked graphic data byte into display file
63585 INC HL Advance HL to next byte in display file
63586 DJNZ 63575 Loop back to 63575 for next column of object graphic data
63588 INC IX Advance IX by two bytes to next address in table of addresses of starts of pixel rows...
63590 INC IX ...
63592 POP BC Restore BC (C = remaining number of pixel rows to draw)
63593 DEC C Decrease remaining number pixel rows to draw
63594 JR NZ,63561 If not zero (i.e. still need to draw at least one more pixel row of graphic data) then loop back to 63561
63596 POP HL Restore HL
63597 RET Return
Prev: 63499 Up: Map Next: 63598