Prev: 52924 Up: Map Next: 53019
52937: Store background bitmap data at Magic Knight's current location
Used by the routine at 53150.
See also analogous routine at 53185
52937 LD DE,23813 Point DE at table of bitmap data for Magic Knight at his current location
52940 LD A,(25157) Load HL with double Magic Knight's current y-coordinate (pixels)...
52943 LD L,A ...
52944 LD H,0 ...
52946 ADD HL,HL ...
52947 LD BC,26240 Point BC at table of display file addresses of start of each pixel row
52950 ADD HL,BC Add double y-coordinate as offset in HL
52951 LD (23420),HL Store pointer to entry for pixel row at Magic Knight's current y-coordinate
52954 LD A,(25156) Load A with Magic Knight's current x-coordinate (pixels)
52957 RRCA Divide by two
52958 PUSH AF Store AF (A = Magic Knight's current x-coordinate in pixels, divided by two)
52959 AND 3 Clear all but the lowest three bits...
52961 LD (25159),A ...and store the remaining value as Magic Knight's current frame index
52964 POP AF Restore AF (A = Magic Knight's current x-coordinate in pixels, divided by two)
52965 RRCA Divide Magic Knight's current x-coordinate in pixels by eight and remove remainder...
52966 RRCA ...
52967 AND 31 ...
52969 LD (23422),A Store value (Magic Knight's current x-coordinate in characters) at 23422...
52972 LD C,A ...and load into C
52973 LD B,32 Load B with 32 (as Magic Knight is 32 pixels tall)
52975 LD IX,(23420) Load IX with pointer to entry for pixel row at Magic Knight's current y-coordinate
52979 PUSH BC Store BC (B = remaining number of pixel rows to store, C = Magic Knight's x-coordinate in characters)
52980 LD L,(IX+0) Load display file address of pixel row at IX into HL...
52983 INC IX ...and advance IX to entry for next pixel row down...
52985 LD H,(IX+0) ...
52988 INC IX ...
52990 LD B,0 Set B to zero (BC = Magic Knight's current x-coordinate in characters)
52992 ADD HL,BC Add BC to HL as offset
52993 LD A,(HL) Copy three bytes of graphic data from display file address...
52994 LD (DE),A ...into table of background bitmap data...
52995 INC HL ...as Magic Knight can only occupy three consecutive character blocks horizontally...
52996 INC DE ...
52997 LD A,(HL) ...
52998 LD (DE),A ...
52999 INC HL ...
53000 INC DE ...
53001 LD A,(HL) ...
53002 LD (DE),A ...
53003 INC DE ...
53004 POP BC Restore BC (B = remaining number of pixel rows to store, C = Magic Knight's x-coordinate in characters)
53005 DJNZ 52979 Decrease B (remaining number of pixel rows to store) and loop back to 52979 if non-zero for next pixel row
53007 LD HL,23813 Copy contents of table of bitmap data for Magic Knight at his current location to table of background bitmap data 23909...
53010 LD DE,23909 ...
53013 LD BC,96 ...
53016 LDIR ...
53018 RET Return
Prev: 52924 Up: Map Next: 53019