Routines
 Prev: 36415 Up: Map Next: 36499
36434: Set up star movement data based upon starting position and direction
Used by the routine at 36273.
Input
B y component of star direction added to initial y-coordinate (random number 55 to 86)
C x component of star direction added to initial x-coordinate (random number 113 to 144)
D Initial y-coordinate of star (70) (pixels)
E Initial x-coordinate of star (128) (pixels)
IX Points to an entry in table of stars' movement data at 24832
36434 LD A,B Load (DIR-Y + INIT-Y) into A
36435 SUB D Subtract initial y-coordinate to leave y-component of direction in A
36436 LD D,1 Set D to 1 (because star is moving up)
36438 JR NC,36444 If y-component is positive (i.e. star is moving up) then skip ahead to 36444
36440 CPL Negate negative y-direction component...
36441 INC A ...
36442 LD D,255 Set D to -1 (because star is moving down)
36444 LD B,A Load magnitude of y-component into B
36445 LD A,C Load (DIR-X + INIT-X) into A
36446 SUB E Subtract initial x-coordinate to leave x-component of direction in A
36447 LD E,1 Set D to 1 (because star is moving 1 pixel right)
36449 JR NC,36455 If x-component is positive (i.e. star is moving right) then skip ahead to 36455
36451 CPL Negate negative x-direction component...
36452 INC A ...
36453 LD E,255 Set E to -1 (because star is moving 1 pixel left)
36455 LD C,A Load magnitude of x-component into C
36456 LD (IX+3),D Store y-direction at byte 4
36459 LD (IX+2),E Store x-direction at byte 3
36462 LD (IX+5),D Store y-direction at byte 6
36465 LD (IX+4),E Store x-direction at byte 5
36468 LD A,C Load magnitude of x-component into A
36469 CP B If magnitude of y-component is less than or equal to magnitude of x-component...
36470 JR NC,36481 ...then skip ahead to 36481
36472 LD (IX+8),C Store magnitude of x-component at byte 9
36475 LD (IX+2),0 Set byte 3 to zero
36479 JR 36491 Skip ahead to 36491
36481 OR C If magnitude of x-component is zero...
36482 RET Z ...then return
36483 LD (IX+8),B Store magnitude of y-component at byte 9
36486 LD B,C Load magnitude of x-component into B
36487 LD (IX+3),0 Store zero at byte 4
36491 LD (IX+7),B Store magnitude of x-/y-component at byte 8
36494 LD A,B Load magnitude of x-/y-component into A...
36495 LD (IX+6),A ...and store at byte 7
36498 RET Return
 Prev: 36415 Up: Map Next: 36499