Prev: 38749 Up: Map Next: 38844
38795: Reset star to point of origin and generate a new direction and movement data
Used by the routines at 38884 and 38961.
Input
IX Points to an entry in table of stars' movement data at 25614
38795 CALL 38486 Set new random seed and load LSB of this into A
38798 AND 31 Discard bits five to seven
38800 SUB 15 Subtract 15
38802 LD B,A Load result into B (random number -15 to 16) (y-component of star's direction)
38803 CALL 38486 Set new random seed and load LSB of this into A
38806 AND 31 Discard bits five to seven
38808 SUB 15 Subtract 15
38810 LD C,A Load result into C (random number -15 to 16) (x-component of star's direction)
38811 LD A,128 Add to 128 (set bit 7) in C...
38813 ADD A,C ...
38814 LD C,A ...(random number 113 to 144)
38815 LD A,B Add 87 to B...
38816 ADD A,87 ...
38818 LD B,A ...(random number 72 to 103)
38819 CP 87 If A is not 87 (i.e. y-direction component is not zero)...
38821 JR NZ,38828 ...skip ahead to 38828
38823 LD C,A If A (loaded into C) is 128... [bug]
38824 CP 128 ...
38826 JR Z,38795 ...then restart this routine to generate two new random numbers/seeds
38828 LD D,87 Load D (initial y-coordinate) with 87
38830 LD E,128 Load E (initial x-coordinate) with 128
38832 PUSH DE Store DE
38833 CALL 39016 Set up star's movement data based upon starting position and direction
38836 POP DE Restore DE
38837 LD (IX+0),E Set star's initial coordinates as (128, 87)...
38840 LD (IX+1),D ...
38843 RET Return
Prev: 38749 Up: Map Next: 38844