Prev: 61625 Up: Map Next: 61720
61638: Store background bitmap data at Magic Knight's current location
Used by the routine at 61860.
See also analogous routine at 61913
61638 LD DE,24576 Point DE at table of bitmap data for Magic Knight at his current location
61641 LD A,(24841) Load HL with double Magic Knight's current y-coordinate (pixels)...
61644 LD L,A ...
61645 LD H,0 ...
61647 ADD HL,HL ...
61648 LD BC,65140 Point BC at table of display file addresses of start of each pixel row
61651 ADD HL,BC Add double y-coordinate as offset in HL
61652 LD (23412),HL Store pointer to entry for pixel row at Magic Knight's current y-coordinate
61655 LD A,(24840) Load A with Magic Knight's current x-coordinate (pixels)
61658 RRCA Divide by two
61659 PUSH AF Store AF (A = Magic Knight's current x-coordinate in pixels, divided by two)
61660 AND 3 Clear all but the lowest three bits...
61662 LD (24843),A ...and store the remaining value as Magic Knight's current frame index
61665 POP AF Restore AF (A = Magic Knight's current x-coordinate in pixels, divided by two)
61666 RRCA Divide Magic Knight's current x-coordinate in pixels by eight and remove remainder...
61667 RRCA ...
61668 AND 31 ...
61670 LD (23414),A Store value (Magic Knight's current x-coordinate in characters) at 23414...
61673 LD C,A ...and load into C
61674 LD B,32 Load B with 32 (as Magic Knight is 32 pixels tall)
61676 LD IX,(23412) Load IX with pointer to entry for pixel row at Magic Knight's current y-coordinate
61680 PUSH BC Store BC (B = remaining number of pixel rows to store, C = Magic Knight's x-coordinate in characters)
61681 LD L,(IX+0) Load display file address of pixel row at IX into HL...
61684 INC IX ...and advance IX to entry for next pixel row down...
61686 LD H,(IX+0) ...
61689 INC IX ...
61691 LD B,0 Set B to zero (BC = Magic Knight's current x-coordinate in characters)
61693 ADD HL,BC Add BC to HL as offset
61694 LD A,(HL) Copy three bytes of graphic data from display file address...
61695 LD (DE),A ...into table of background bitmap data...
61696 INC HL ...as Magic Knight can only occupy three consecutive character blocks horizontally...
61697 INC DE ...
61698 LD A,(HL) ...
61699 LD (DE),A ...
61700 INC HL ...
61701 INC DE ...
61702 LD A,(HL) ...
61703 LD (DE),A ...
61704 INC DE ...
61705 POP BC Restore BC (B = remaining number of pixel rows to store, C = Magic Knight's x-coordinate in characters)
61706 DJNZ 61680 Decrease B (remaining number of pixel rows to store) and loop back to 61680 if non-zero for next pixel row
61708 LD HL,24576 Copy contents of table of bitmap data for Magic Knight at his current location to table of background bitmap data 24672...
61711 LD DE,24672 ...
61714 LD BC,96 ...
61717 LDIR ...
61719 RET Return
Prev: 61625 Up: Map Next: 61720