Prev: 39200 Up: Map Next: 39989
39224: Draw Magic Knight (erase old frame and draw new frame)
Magic Knight is erased from his old position and redrawn at his new position. If Magic Knight has y-velocity (i.e. he is moving up or down with or without horizontal motion) then this is done in three stages, each depending on the magnitude of his y-velocity. If he is not moving up or down, then the three stages are still followed, but with zero y-velocity, stages 1 and 3 do nothing. The three stages are (with Y = magnitude of Magic Knight's y-velocity):
1 - If Magic Knight is moving down then the bottom Y pixel rows of the new frame are drawn, or if Magic Knight is moving up then the bottom Y pixels of the old frame are erased.
2 - If Magic Knight is moving down then the remaining 32-Y pixel rows of the new frame are drawn and the first 32-Y pixel rows of the old frame are erased, or if Magic Knight is moving up then the first 32-Y pixel rows of the new frame are drawn and the remaining 32-Y pixel rows of the old frame are erased.
3 - If Magic Knight is moving down then the remaining Y pixel rows of the old frame are erased, or if Magic Knight is moving up then the remaining Y pixel rows of the new frame are drawn.
Used by the routines at 27176, 27495, 28092 and 33180.
Input
A Always zero
39224 PUSH IX Store IX
39226 ADD A,A Multiply A by eight...
39227 ADD A,A ...
39228 ADD A,A ...
39229 LD B,0 ...and load into BC...
39231 LD C,A ...
39232 LD HL,25387 Point HL at Magic Knight's current data (x- and y-coordinates, etc.)
39235 ADD HL,BC Add eight times original A value as offset to this
39236 PUSH HL Store HL
39237 LD A,(HL) Load Magic Knight's x-coordinate into A...
39238 LD (23329),A ...and copy to 23329...
39241 LD C,A ...and C
39242 INC HL Advance HL to Magic Knight's y-coordinate
39243 LD A,(HL) Load Magic Knight's y-coordinate into A...
39244 LD (23330),A ...and copy to 23330...
39247 LD B,A ...and B
39248 INC HL Advance HL to Magic Knight's current frame to erase...
39249 LD A,(HL) ...
39250 LD (23328),A ...and copy to 23328
39253 INC HL Advance HL by two bytes to Magic Knight's current x-velocity...
39254 INC HL ...
39255 LD E,(HL) Load Magic Knight's current x-velocity into E
39256 INC HL Advance HL to Magic Knight's current y-velocity...
39257 LD D,(HL) ...and load into D
39258 INC HL Advance HL to Magic Knight's attribute...
39259 LD A,(HL) ...and load into A
39260 LD (23337),A Copy Magic Knight's attribute into 23337
39263 INC HL Advance HL to Magic Knight's update-attributes-at-Magic-Knight's-predicted-position flag (reset is 255, any other value is set) load into A and copy into 23338
39264 LD A,(HL)
39265 LD (23338),A
39268 LD A,C Load Magic Knight's x-coordinate into A
39269 ADD A,E Add Magic Knight's x-velocity to give predicted x-coordinate
39270 LD (23331),A Store at 23331
39273 LD A,B Load Magic Knight's y-coordinate into A
39274 ADD A,D Add Magic Knight's y-velocity to give predicted y-coordinate
39275 LD (23332),A Store at 23332
39278 LD A,(23338) Load update-attributes-at-Magic-Knight's-predicted-position flag (stored earlier) into A
39281 CP 255 If this is not 255 (i.e. no components to override)...
39283 CALL NZ,39989 ...then update attributes at Magic Knight's predicted position
39286 XOR A Set bytes 23316 - 23318 to zero...
39287 LD (23317),A ...
39290 LD (23316),A ...
39293 LD (23318),A ...
39296 LD A,C Set three least significant bits of Magic Knight's x-coordinate to zero (i.e. set pixel-within-character to zero)...
39297 AND 248 ...
39299 LD C,A ...
39300 LD A,(23331) Load predicted x-coordinate (pixels) into A
39303 AND 248 Set three least significant bits of Magic Knight's predicted x-coordinate to zero (i.e. set pixel-within-character to zero)
39305 SUB C If x-coordinate and predicted x-coordinate are now the same (i.e. Magic Knight is not changing his position in characters) then skip ahead to 39331
39306 JP Z,39331
39309 JP P,39323 If x-coordinate is smaller than predicted x-coordinate (i.e. Magic Knight is moving right) then skip ahead to 39323
[Magic Knight is moving left]
39312 LD A,1 Set...
39314 LD (23316),A ...Magic-Knight-is-leaving-his-current-character-position-and-going-left flag and...
39317 LD (23318),A ...Magic-Knight-is-leaving-his-current-character-position flag
39320 JP 39331 Skip ahead to 39331 (over Magic Knight is moving right section)
[Magic Knight is moving right]
39323 LD A,1 Set...
39325 LD (23317),A ...Magic-Knight-is-leaving-his-current-character-position-and-going-right flag and...
39328 LD (23318),A ...Magic-Knight-is-leaving-his-current-character-position flag
39331 LD A,(23332) Load predicted y-coordinate (pixels) into 23324...
39334 LD (23324),A ...
39337 LD A,(23330) Load current y-coordinate (pixels) into 23325...
39340 LD (23325),A ...
39343 LD A,(23331) Load predicted x-coordinate (pixels) into 23322...
39346 LD (23322),A ...
39349 LD A,(23329) Load current x-coordinate (pixels) into 23323...
39352 LD (23323),A ...
39355 LD A,(25390) Load Magic Knight's current frame into 23326...
39358 LD (23326),A ...
39361 LD A,(23328) Load Magic Knight's current frame to erase into 23327...
39364 LD (23327),A ...
39367 LD A,(23317) Load Magic-Knight-is-leaving-his-current-character-position-and-going-right flag into 23314...
39370 LD (23314),A ...
39373 LD A,(23316) Load Magic-Knight-is-leaving-his-current-character-position-and-going-left flag into 23315...
39376 LD (23315),A ...
39379 LD A,D Load Magic Knight's current y-velocity into A
39380 OR A If y-velocity is positive (Magic Knight moving downwards)...
39381 JP P,39432 ...then jump ahead to 39432
39384 LD A,(23330) Load current y-coordinate (pixels) into 23324...
39387 LD (23324),A ...
39390 LD A,(23332) Load predicted y-coordinate (pixels) into 23325...
39393 LD (23325),A ...
39396 LD A,(23329) Load current x-coordinate (pixels) into 23322...
39399 LD (23322),A ...
39402 LD A,(23331) Load predicted x-coordinate (pixels) into 23323...
39405 LD (23323),A ...
39408 LD A,(23328) Load Magic Knight's current frame to erase into 23326...
39411 LD (23326),A ...
39414 LD A,(25390) Load Magic Knight's current frame number into 23327...
39417 LD (23327),A ...
39420 LD A,(23316) Load Magic-Knight-is-leaving-his-current-character-position-and-going-left flag into 23314...
39423 LD (23314),A ...
39426 LD A,(23317) Load Magic-Knight-is-leaving-his-current-character-position-and-going-right flag into 23315...
39429 LD (23315),A ...
39432 LD A,D Load Magic Knight's current y-velocity into A
39433 BIT 7,A If y-velocity is positive (moving downwards)...
39435 JP Z,39440 ...then skip ahead to 39440
39438 NEG Negate negative velocity
39440 LD (23319),A Load magnitude of y-velocity into 23319
39443 LD A,(23325) Load current / predicted y-coordinate into A
39446 ADD A,31 Add 31 (as Magic Knight is 32 pixels high) to get current / predicted y-coordinate of bottom of Magic Knight's feet...
39448 LD (23325),A ...and store back at 23325
39451 LD A,(23324) Load current / predicted y-coordinate into A
39454 ADD A,31 Add 31 (as Magic Knight is 32 pixels high) to get current / predicted y-coordinate of bottom of Magic Knight's feet...
39456 LD (23324),A ...and store back at 23324
39459 LD H,0 Also load into HL...
39461 LD L,A ...
39462 ADD HL,HL Double value (to use as offset in WORD lookup table)
39463 LD DE,26064 Point DE at table of display file addresses of starts of each pixel row
39466 ADD HL,DE Add double y-coordinate as offset to start of table of display file addresses in HL
39467 LD (23320),HL Store at 23320
39470 LD E,(HL) Load memory address of start of this pixel row into DE...
39471 INC HL ...
39472 LD D,(HL) ...
39473 LD C,0 Load C with zero
39475 LD A,(23322) Load Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (pixels) into A
39478 SRL A Rotate three least significant bits (pixel-within-character) of x-coordinate out of A...
39480 RR C ...and into three most significant bits of C...
39482 SRL A ...
39484 RR C ...
39486 SRL A ...
39488 RR C ...
39490 LD H,0 Load HL with remaining value in A (x-coordinate in characters)...
39492 LD L,A ...
39493 LD (23301),HL Store at 23301
39496 LD A,(23318) If Magic-Knight-is-leaving-his-current-character-position flag is reset...
39499 OR A ...
39500 JP Z,39513 ...then skip ahead to 39513
39503 LD A,(23314) If Magic-Knight-changing-character-position-to-right flag (moving down / horizontally) or Magic-Knight-changing-character-position-to-left flag (moving up) is set then skip ahead to 39513
39506 OR A
39507 JP NZ,39513
39510 LD (23312),HL Load predicted (moving down / horizontally) or current (moving up) x-coordinate (pixels) into 23312
39513 ADD HL,DE Add x-coordinate (HL) as offset to display file address of start of row (DE) in HL
39514 LD (23296),HL Store display file address at 23296
39517 LD A,C Load A with pixel-within-character coordinate (in 3 MS bits of C)
39518 RLCA Rotate left to get into least significant 3 bits of A...
39519 RLCA ...
39520 RLCA ...
39521 LD (23300),A Store at 23300
39524 LD H,0 Load Magic Knight's current frame to draw (moving down / horizontally) or current frame to erase (moving up) into HL...
39526 LD A,(23326) ...
39529 LD L,A ...
39530 ADD A,A Multiply A by four...
39531 ADD A,A ...
39532 LD L,A Load into HL again (so now HL contains 4x original value)
39533 ADD HL,HL Multiply by 16...
39534 ADD HL,HL ...
39535 ADD HL,HL ...
39536 ADD HL,HL ...so now HL contains 4 × 16 (i.e. 64) times original value (as Magic Knight frame graphics are 64 bytes long)
39537 LD DE,63475 Point DE at last byte of "Magic Knight frame 0" graphic data
39540 ADD HL,DE Add HL as offset (to point to last byte of required frame)
39541 LD (23298),HL Store at 23298
39544 LD C,0 Load C with zero
39546 LD A,(23323) Load Magic Knight's current (moving down / horizontally) or predicted (moving up) x-coordinate (pixels) into A
39549 SRL A Rotate three least significant bits of predicted x-coordinate (pixel-within-character) out of A...
39551 RR C ...and into most significant three bits of C...
39553 SRL A ...
39555 RR C ...
39557 SRL A ...
39559 RR C ...
39561 LD H,0 Load HL with remaining value in A (x-coordinate in characters)...
39563 LD L,A ...
39564 LD (23308),HL Store this at 23308
39567 LD A,(23318) If Magic-Knight-is-leaving-his-current-character-position flag is reset...
39570 OR A ...
39571 JP Z,39584 ...then skip ahead to 39584
39574 LD A,(23315) If Magic-Knight-changing-character-position-to-left flag (moving down / horizontally) or Magic-Knight-changing-character-position-to-right flag (moving up) is set then skip ahead to 39584
39577 OR A
39578 JP NZ,39584
39581 LD (23312),HL Load predicted (moving down / horizontally) or current (moving up) x-coordinate (characters) into 23312
39584 LD A,C Load A with pixel-within-character coordinate (in three most significant bits)
39585 RLCA Rotate data from most significant to least significant three bits...
39586 RLCA ...
39587 RLCA ...
39588 LD (23307),A Store at 23307
39591 LD H,0 Load Magic Knight's current frame to erase (moving down / horizontally) or current frame to draw (moving up) into HL...
39593 LD A,(23327) ...
39596 LD L,A ...
39597 ADD A,A Multiply A by four...
39598 ADD A,A ...
39599 LD L,A Load into HL again (so now HL contains 4x original value)
39600 ADD HL,HL Multiply by 16...
39601 ADD HL,HL ...
39602 ADD HL,HL ...
39603 ADD HL,HL ...so now HL contains 4 × 16 (i.e. 64) times original value (as Magic Knight frame graphics are 64 bytes long)
39604 LD DE,63475 Point DE at last byte of "Magic Knight frame 0" graphic data
39607 ADD HL,DE Add HL as offset (to point to last byte of required frame)
39608 LD (23305),HL Store at 23305
39611 LD A,(23318) If Magic-Knight-is-leaving-his-current-character-position flag is set...
39614 OR A ...
39615 JP NZ,39624 ...then skip ahead to 39624
39618 LD HL,(23301) Load Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (characters) into HL...
39621 LD (23312),HL ...and store at 23312
39624 LD A,(23319) If magnitude of y-velocity is zero...
39627 OR A ...
39628 JR Z,39696 ...then skip ahead to 39696
39630 LD HL,(23298) Load HL with pointer to last byte of Magic Knight current graphic frame (to draw [moving down / horizontally] or erase [moving up])
39633 LD B,A Load magnitude of y-velocity into B
[This section draws / erases only bottom Y pixel rows, where Y is magnitude of Magic Knight's y-velocity. e.g. draw / erase 7 pixel rows if Magic Knight's y-velocity magnitude = 7]
39634 PUSH BC Store BC (B = magnitude of y-velocity)
39635 LD D,(HL) Load byte of graphic data (right-hand column) into D
39636 DEC HL Move back to previous byte of graphic data
39637 LD B,(HL) Load byte of graphic data (left-hand column) into B
39638 DEC HL Move back to previous byte of graphic data (right-hand column, row above)
39639 PUSH HL Store HL (pointer to current position in graphic data)
39640 LD C,0 Load C with zero (i.e. clear bits for loading of graphic data)
39642 LD A,(23300) Load A with Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (pixel-within-character) as stored previously and if value is zero then skip ahead to 39658 (i.e. printing graphic data as-is with no need to shift bits for pixel-within-character offset)
39645 OR A
39646 JP Z,39658
39649 RR B Move graphic data one pixel right through D and into C...
39651 RR D ...
39653 RR C ...
39655 DEC A Decrease A (as one less pixel space left to deal with)
39656 JR NZ,39649 If A is not zero (i.e. not all pixels yet dealt with) then loop back to 39649 for next one
39658 LD HL,(23296) Load HL with display file address of bottom of Magic Knight's feet: predicted (moving down / horizontally) or current (moving up)
39661 LD A,B Print the three consecutive 8-pixel strips to display file, XORring with what is already there...
39662 XOR (HL) ...
39663 LD (HL),A ...
39664 INC HL ...
39665 LD A,D ...
39666 XOR (HL) ...
39667 LD (HL),A ...
39668 INC HL ...
39669 LD A,C ...
39670 XOR (HL) ...
39671 LD (HL),A ...
39672 LD HL,(23320) Point HL at entry for display file address of start of pixel row at Magic Knight's feet: predicted (moving down / horizontally) or current (moving up) in table at 26064
39675 DEC HL Load display file address of start of pixel row above this into DE...
39676 LD D,(HL) ...
39677 DEC HL ...
39678 LD E,(HL) ...
39679 LD (23320),HL ...and place decreased pointer (y-coordinate offset, pixels) back at 23320
39682 LD HL,(23301) Load Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (characters) into HL
39685 ADD HL,DE Add as offset to display file address of start of relevant pixel row in HL
39686 LD (23296),HL Store as memory address to print next graphic data
39689 POP HL Restore HL (pointer to current position in graphic data)
39690 POP BC Restore BC (B = magnitude of y-velocity)
39691 DJNZ 39634 Loop back to 39634
[This section calculates remaining number of pixel rows to be drawn]
39693 LD (23298),HL Store current position in graphic data at 23298
39696 LD HL,(23320) Point HL at entry for display file address of start of pixel row current position (part-way through drawing Magic Knight) in table at 26064
39699 LD E,(HL) Load display file address of start of this pixel row into DE...
39700 INC HL ...
39701 LD D,(HL) ...
39702 LD HL,(23312) Load HL with Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (characters)
39705 ADD HL,DE Add to HL as offset
39706 LD (23310),HL Store at 23310 (display file address of leftmost part of Magic Knight at current pixel row, mid-drawing)
39709 LD A,(23319) Load magnitude of y-velocity into A
39712 SUB 32 Subtract 32 (as Magic Knight is 32 pixels high)...
39714 NEG ...and negate to get number of pixel rows still to draw (i.e. 32-n here, but drew other n in loop between 39634 - 39691)
[This section loads the graphic data to draw / erase]
39716 EX AF,AF' Swap registers
39717 LD HL,(23298) Load HL with current position in Magic Knight graphic data
39720 LD D,(HL) Load two bytes of graphic data into D and C, reading backwards...
39721 DEC HL ...
39722 LD C,(HL) ...
39723 DEC HL ...
39724 LD (23298),HL Store updated position in graphic data at 23298
39727 LD B,0 Blank out bitmap data in B
39729 LD L,0 Blank out bitmap data in L
39731 LD A,(23300) Load A Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (pixel-within-character)
39734 OR A If this is zero...
39735 JP Z,39747 ...then skip ahead to 39747
39738 RR C Move graphic data one pixel right through D and into B...
39740 RR D ...
39742 RR B ...
39744 DEC A Decrease number of remaining pixels to shift
39745 JR NZ,39738 If there are still pixels to shift, loop back to 39738
39747 LD A,(23314) If Magic-Knight-changing-character-position-to-right flag (moving down / horizontally) or Magic-Knight-changing-character-position-to-left flag (moving up) is reset then skip ahead to 39759
39750 OR A
39751 JP Z,39759
39754 LD L,B Move data from C, through D, then B to L...
39755 LD B,D ...
39756 LD D,C ...
39757 LD C,0 ...
[This section loads the graphic data to erase / draw]
39759 EXX Swap registers
39760 LD HL,(23305) Point HL' at current position (initially last byte) of Magic Knight graphic frame (Magic Knight's current frame to erase [moving down / horizontally] or current frame to draw [moving up])
39763 LD D,(HL) Load two bytes of graphic data into D' and C', reading backwards...
39764 DEC HL ...
39765 LD C,(HL) ...
39766 DEC HL ...
39767 LD (23305),HL Store updated position in graphic data at 23305
39770 LD B,0 Blank out bitmap data in B'
39772 LD L,0 Blank out bitmap data in L'
39774 LD A,(23307) Load A Magic Knight's current (moving down / horizontally) or predicted (moving up) x-coordinate (pixel-within-character)
39777 OR A If this is zero...
39778 JP Z,39790 ...then skip ahead to 39790
39781 RR C Move graphic data one pixel right through D and into B...
39783 RR D ...
39785 RR B ...
39787 DEC A Decrease remaining number of pixels to shift
39788 JR NZ,39781 If there are still pixels left to shift, then loop back to 39781
39790 LD A,(23315) If Magic-Knight-changing-character-position-to-left flag (moving down / horizontally) or Magic-Knight-changing-character-position-to-right flag (moving up) is reset then skip ahead to 39802
39793 OR A
39794 JP Z,39802
39797 LD L,B Move data from C', through D', then B' to L'...
39798 LD B,D ...
39799 LD D,C ...
39800 LD C,0 ...
At this point:
  • L, B, D, C contain graphic data to print, from current position in Magic Knight's current frame to draw (moving down / horizontally) or current frame to erase (moving up)
  • L', B', D', C' contain graphic data to print, from current position in Magic Knight's current frame to erase (moving down / horizontally) or current frame to draw (moving up)
39802 LD IX,(23310) Load IX with display file address of leftmost part of Magic Knight at current pixel row, mid-drawing
39806 LD A,C XOR together values from C, C' and current location in display file...
39807 EXX ...erasing old and drawing new graphic data...
39808 XOR C ...
39809 EXX ...
39810 XOR (IX+0) ...
39813 LD (IX+0),A ...and print at current location in display file
39816 INC IX Advance right one character
39818 LD A,D XOR together values from D, D' and current location in display file...
39819 EXX ...erasing old and drawing new graphic data...
39820 XOR D ...
39821 EXX ...
39822 XOR (IX+0) ...
39825 LD (IX+0),A ...and print at current location in display file
39828 INC IX Advance right one character
39830 LD A,B XOR together values from B, B' and current location in display file...
39831 EXX ...erasing old and drawing new graphic data...
39832 XOR B ...
39833 EXX ...
39834 XOR (IX+0) ...
39837 LD (IX+0),A ...and print at current location in display file
39840 INC IX Advance right one character
39842 LD A,L XOR together values from L, L' and current location in display file...
39843 EXX ...erasing old and drawing new graphic data...
39844 XOR L ...
39845 EXX ...
39846 XOR (IX+0) ...
39849 LD (IX+0),A ...and print at current location in display file
39852 LD HL,(23320) Point HL' at entry for display file address of start of pixel row current position (part-way through drawing Magic Knight) in table at 26064
39855 DEC HL Load display file address of start of pixel row above this into DE'...
39856 LD D,(HL) ...
39857 DEC HL ...
39858 LD E,(HL) ...
39859 LD (23320),HL ...and place decreased pointer (y-coordinate offset, pixels) back at 23320
39862 LD HL,(23312) Load HL' with Magic Knight's predicted (moving down / horizontally) or current (moving up) x-coordinate (characters)
39865 ADD HL,DE Add x-coordinate (HL') as offset to display file address of start of row (DE') in HL'
39866 LD (23310),HL Store at 23310 (display file address of leftmost part of Magic Knight at current pixel row, mid-drawing)
39869 EX AF,AF' Swap registers (A = number of pixel rows still to draw)
39870 DEC A Decrease A by one, as there is now one less pixel row to draw
39871 JP NZ,39716 If there are still more pixel rows to draw, then loop back to 39716
39874 LD A,(23319) If magnitude of y-velocity is zero...
39877 OR A ...
39878 JR Z,39973 ...then skip ahead to 39973 (nothing more to draw / erase)
39880 LD HL,(23320) Point HL at entry for display file address of start of pixel row current position (part-way through drawing Magic Knight) in table at 26064
39883 LD E,(HL) Load memory address of start of this pixel row into DE...
39884 INC HL ...
39885 LD D,(HL) ...
39886 LD HL,(23308) Load HL with Magic Knight's current (moving down / horizontally) or predicted (moving up) x-coordinate (characters)
39889 ADD HL,DE Add as offset to display file address of start of relevant pixel row in HL
39890 LD (23303),HL Store at 23303 (current position to print to)
39893 LD HL,(23305) Load HL with current position in frame of Magic Knight graphic data, for Magic Knight's current frame to erase [moving down / horizontally] or current frame to draw [moving up]
39896 LD B,A Load magnitude of y-velocity into B
[This section draws / erases only top Y pixel rows, where Y is magnitude of Magic Knight's y-velocity. e.g. draw / erase 7 pixel rows if Magic Knight's y-velocity magnitude = 7)
39897 PUSH BC Store BC (B = magnitude of y-velocity)
39898 LD D,(HL) Load byte of graphic data (right-hand column) into D
39899 DEC HL Move back to previous byte of graphic data
39900 LD B,(HL) Load byte of graphic data (right-hand column) into B
39901 DEC HL Move back to previous byte of graphic data
39902 PUSH HL Store HL (pointer to current position in graphic data)
39903 LD C,0 Load C with zero (i.e. clear bits for loading of graphic data)
39905 LD L,0 Load L with zero (i.e. clear bits for loading of graphic data)
39907 LD A,(23307) Load A with Magic Knight's current (moving down / horizontally) or predicted (moving up) x-coordinate (pixel-within-character) as stored previously and if value is zero then skip ahead to 39923 (i.e. printing graphic data as-is with no need to shift bits for pixel-within-character offset)
39910 OR A
39911 JP Z,39923
39914 RR B Move graphic data one pixel right through D and into C...
39916 RR D ...
39918 RR C ...
39920 DEC A Decrease A (as one less pixel space left to deal with)
39921 JR NZ,39914 If A is not zero (i.e. not all pixels yet dealt with) then loop back to 39649 for next one
39923 LD IX,(23303) Load current position in display file to print to into IX
39927 LD A,B Print the three consecutive 8-pixel strips to display file, XORring with what is already there...
39928 XOR (IX+0) ...
39931 LD (IX+0),A ...
39934 INC IX ...
39936 LD A,D ...
39937 XOR (IX+0) ...
39940 LD (IX+0),A ...
39943 INC IX ...
39945 LD A,C ...
39946 XOR (IX+0) ...
39949 LD (IX+0),A ...
39952 LD HL,(23320) Point HL at entry for display file address of start of pixel row for current mid-drawing position: predicted (moving down / horizontally) or current (moving up) in table at 26064
39955 DEC HL Load display file address of start of pixel row above this into DE...
39956 LD D,(HL) ...
39957 DEC HL ...
39958 LD E,(HL) ...
39959 LD (23320),HL ...and place decreased pointer (y-coordinate offset, pixels) back at 23320
39962 LD HL,(23308) Load HL with Magic Knight's current (moving down / horizontally) or predicted (moving up) x-coordinate (characters)
39965 ADD HL,DE Add as offset to display file address of start of relevant pixel row in HL
39966 LD (23303),HL Store at 23303 (current position to print to)
39969 POP HL Restore HL (pointer to current position in graphic data)
39970 POP BC Restore BC (B = magnitude of y-velocity)
39971 DJNZ 39897 Loop back to 39897 for next pixel row up
39973 POP HL Restore HL (pointer to Magic Knight's current data, stored at 39639)
39974 LD BC,(23331) Load BC with Magic Knight's predicted x-coordinate (pixels)
39978 LD (HL),C Set Magic Knight's current x-coordinate to be value in predicted x-coordinate
39979 INC HL Advance HL to Magic Knight's y-coordinate
39980 LD (HL),B Set Magic Knight's current y-coordinate to be value in predicted y-coordinate
39981 INC HL Advance HL to Magic Knight's current frame to erase
39982 LD A,(25390) Set this to same as Magic Knight's current frame number (as it is now drawn, so on the next call to this routine it will be the one to be erased)
39985 LD (HL),A
39986 POP IX Restore IX
39988 RET Return
Prev: 39200 Up: Map Next: 39989