Prev: 38980 Up: Map Next: 39081
39016: Set up star movement data based upon starting position and direction
Used by the routine at 38795.
Input
B y component of star direction added to initial y-coordinate (random number 72 to 103)
C x component of star direction added to initial x-coordinate (random number 113 to 144)
D Initial y-coordinate of star (87) (pixels)
E Initial x-coordinate of star (128) (pixels)
IX Points to an entry in table of stars' movement data at 25614
39016 LD A,B Load (DIR-Y + INIT-Y) into A
39017 SUB D Subtract initial y-coordinate to leave y-component of direction in A
39018 LD D,1 Set D to 1 (because star is moving up)
39020 JR NC,39026 If y-component is positive (i.e. star is moving up) then skip ahead to 39026
39022 CPL Negate negative y-direction component...
39023 INC A ...
39024 LD D,255 Set D to -1 (because star is moving down)
39026 LD B,A Load magnitude of y-component into B
39027 LD A,C Load (DIR-X + INIT-X) into A
39028 SUB E Subtract initial x-coordinate to leave x-component of direction in A
39029 LD E,1 Set D to 1 (because star is moving 1 pixel right)
39031 JR NC,39037 If x-component is positive (i.e. star is moving right) then skip ahead to 39037
39033 CPL Negate negative x-direction component...
39034 INC A ...
39035 LD E,255 Set E to -1 (because star is moving 1 pixel left)
39037 LD C,A Load magnitude of x-component into C
39038 LD (IX+3),D Store y-direction at byte 4
39041 LD (IX+2),E Store x-direction at byte 3
39044 LD (IX+5),D Store y-direction at byte 6
39047 LD (IX+4),E Store x-direction at byte 5
39050 LD A,C Load magnitude of x-component into A
39051 CP B If magnitude of y-component is less than or equal to magnitude of x-component...
39052 JR NC,39063 ...then skip ahead to 39063
39054 LD (IX+8),C Store magnitude of x-component at byte 9
39057 LD (IX+2),0 Set byte 3 to zero
39061 JR 39073 Skip ahead to 39073
39063 OR C If magnitude of x-component is zero...
39064 RET Z ...then return
39065 LD (IX+8),B Store magnitude of y-component at byte 9
39068 LD B,C Load magnitude of x-component into B
39069 LD (IX+3),0 Store zero at byte 4
39073 LD (IX+7),B Store magnitude of x-/y-component at byte 8
39076 LD A,B Load magnitude of x-/y-component into A...
39077 LD (IX+6),A ...and store at byte 7
39080 RET Return
Prev: 38980 Up: Map Next: 39081