Prev: 61913 Up: Map Next: 62054
62003: Restore background attribute data at Magic Knight's current location
Used by the routines at 39553 and 61823.
62003 LD DE,25048 Point DE at table of background attribute data
62006 LD A,(24841) Load A with Magic Knight's current y-coordinate (pixels)
62009 AND 248 Clear lowest three bits to round down to nearest multiple of 8
62011 LD L,A Load this value into HL...
62012 LD H,0 ...
62014 ADD HL,HL Multiply by four to obtain 32 × y-coordinate (characters)...
62015 ADD HL,HL ...
62016 LD A,(24840) Load A with Magic Knight's current x-coordinate (pixels)
62019 RRCA Divide this by eight, rounding down to nearest integer...
62020 RRCA ...to convert from pixels to characters...
62021 RRCA ...
62022 AND 31 ...
62024 LD C,A Load x-coordinate (characters) into BC...
62025 LD B,0 ...
62027 ADD HL,BC Add x-coordinate to 32 × y-coordinate in HL...
62028 LD BC,22528 ...then add this to start address of attribute file...
62031 ADD HL,BC ...so that HL points to required byte in attribute file
62032 LD B,4 Load B with 4 as Magic Knight is four characters tall
62034 PUSH BC Store BC (B = remaining number of character rows)
62035 LD A,(DE) Copy byte from table of background attribute data...
62036 LD (HL),A ...into attribute file
62037 INC HL Advance current position in attribute file
62038 INC DE Advance current position in table of background attribute data
62039 LD A,(DE) Copy byte from table of background attribute data...
62040 LD (HL),A ...into attribute file
62041 INC HL Advance current position in attribute file
62042 INC DE Advance current position in table of background attribute data
62043 LD A,(DE) Copy byte from table of background attribute data...
62044 LD (HL),A ...into attribute file
62045 INC DE Advance current position in table of background attribute data
62046 LD BC,30 Advance current position in attribute file by 30 bytes...
62049 ADD HL,BC ...i.e. down one character and left two characters
62050 POP BC Restore BC (B = remaining number of character rows)
62051 DJNZ 62034 If character rows to be coloured remain then loop back to 62034
62053 RET Return
Prev: 61913 Up: Map Next: 62054