|  | Routines | 
| Prev: 61860 | Up: Map | Next: 62003 | 
| 61913 | LD DE,25048 | Point DE at table of background attribute data | ||
| 61916 | LD A,(24841) | Load A with Magic Knight's current y-coordinate (pixels) | ||
| 61919 | AND 248 | Clear lowest three bits to round down to nearest multiple of 8 | ||
| 61921 | LD L,A | Load this value into HL... | ||
| 61922 | LD H,0 | ... | ||
| 61924 | ADD HL,HL | Multiply by four to obtain 32 × y-coordinate (characters)... | ||
| 61925 | ADD HL,HL | ... | ||
| 61926 | LD A,(24840) | Load A with Magic Knight's current x-coordinate (pixels) | ||
| 61929 | RRCA | Divide this by eight, rounding down to nearest integer... | ||
| 61930 | RRCA | ...to convert from pixels to characters... | ||
| 61931 | RRCA | ... | ||
| 61932 | AND 31 | ... | ||
| 61934 | LD C,A | Load x-coordinate (characters) into BC... | ||
| 61935 | LD B,0 | ... | ||
| 61937 | ADD HL,BC | Add x-coordinate to 32 × y-coordinate in HL | ||
| 61938 | PUSH HL | Store HL (32 × y-coordinate in characters) | ||
| 61939 | LD BC,22528 | Add this to start address of attribute file... | ||
| 61942 | ADD HL,BC | ...so that HL points to required byte in attribute file | ||
| 61943 | EX (SP),HL | Put attribute file address on top of stack and load HL with 32 × y-coordinate | ||
| 61944 | LD BC,23808 | Point BC at start of terrain interaction data table... | ||
| 61947 | ADD HL,BC | ...and add 32 × y-coordinate as offset in HL | ||
| 61948 | EX (SP),HL | Restore attribute file address to HL... | ||
| 61949 | POP IX | ...and load IX with terrain interaction address | ||
| 61951 | LD A,(24846) | Load C with Magic Knight's attribute... | ||
| 61954 | LD C,A | ... | ||
| 61955 | LD B,4 | Load B with 4 as Magic Knight is four characters tall | ||
| 61957 | PUSH BC | Store BC (B = remaining number of character rows) | ||
| 61958 | LD A,(HL) | Copy byte from attribute file... | ||
| 61959 | LD (DE),A | ...into table of background attribute data | ||
| 61960 | BIT 5,(IX+0) | If preserve-attribute terrain interaction flag is set for this character... | ||
| 61964 | JR NZ,61967 | ...then skip ahead to 61967 | ||
| 61966 | LD (HL),C | Set current attribute file byte to match Magic Knight's attribute | ||
| 61967 | INC HL | Advance current position in attribute file | ||
| 61968 | INC DE | Advance current position in table of background attribute data | ||
| 61969 | LD A,(HL) | Copy byte from attribute file... | ||
| 61970 | LD (DE),A | ...into table of background attribute data | ||
| 61971 | BIT 5,(IX+1) | If preserve-attribute terrain interaction flag is set for this character... | ||
| 61975 | JR NZ,61978 | ...then skip ahead to 61978 | ||
| 61977 | LD (HL),C | Set current attribute file byte to match Magic Knight's attribute | ||
| 61978 | INC HL | Advance current position in attribute file | ||
| 61979 | INC DE | Advance current position in table of background attribute data | ||
| 61980 | LD A,(HL) | Copy byte from attribute file... | ||
| 61981 | LD (DE),A | ...into table of background attribute data | ||
| 61982 | BIT 5,(IX+2) | If preserve-attribute terrain interaction flag is set for this character... | ||
| 61986 | JR NZ,61989 | ...then skip ahead to 61989 | ||
| 61988 | LD (HL),C | Set current attribute file byte to match Magic Knight's attribute | ||
| 61989 | INC DE | Advance current position in table of background attribute data | ||
| 61990 | LD BC,30 | Advance current position in attribute file by 30 bytes... | ||
| 61993 | ADD HL,BC | ...i.e. down one character and left two characters | ||
| 61994 | LD BC,32 | Advance current position in terrain interaction data table by 32 bytes... | ||
| 61997 | ADD IX,BC | ...i.e. down one character | ||
| 61999 | POP BC | Restore BC (B = remaining number of character rows) | ||
| 62000 | DJNZ 61957 | If character rows remain then loop back to 61957 | ||
| 62002 | RET | Return | ||
| Prev: 61860 | Up: Map | Next: 62003 |