Prev: B980 Up: Map Next: B9EC
B9BB: Move a record up or down the world by its speed
Used by the routines at build_ship_sprite, place_collision_box and move_object.
As move_across for the y (+4 page, +5 line, +6 fraction, +9 +A speed, down positive): a page is 160 lines, $18 to $B7, and the pages do not wrap.
Input
IX the record
Output
H the page down
L the line
E the fraction
move_down B9BB LD H,(IX+$05) HL = line and fraction plus the speed; moving down: in the page still
B9BE LD L,(IX+$06)
B9C1 LD D,(IX+$09)
B9C4 LD E,(IX+$0A)
B9C7 ADD HL,DE
B9C8 LD E,L
B9C9 LD L,H
B9CA LD H,(IX+$04)
B9CD LD C,(IX+$05)
B9D0 LD A,L
B9D1 BIT 7,D
B9D3 JR NZ,move_down_1
B9D5 CP $B8
B9D7 JR NC,move_down_0
B9D9 CP C
B9DA RET NC
move_down_0 B9DB SUB $A0 into the page below
B9DD LD L,A
B9DE INC H
B9DF RET
move_down_1 B9E0 CP $18 moving up: in the page still
B9E2 JR C,move_down_2
B9E4 CP C
B9E5 RET C
B9E6 RET Z
move_down_2 B9E7 ADD A,$A0 into the page above
B9E9 LD L,A
B9EA DEC H
B9EB RET
Prev: B980 Up: Map Next: B9EC