Prev: 36273 Up: Map Next: 36415
36321: Advance positions of stars on viewscreen by one timestep
Used by the routine at 31688.
36321 LD A,70 Load A with y-coordinate of viewscreen centre (pixels)
36323 RRCA Divide by 8 to get y-coordinate in characters...
36324 RRCA ...
36325 RRCA ...
36326 NEG Negate and add 21...
36328 ADD A,21 ...to adjust for fact that PLOT origin is at bottom-left of screen
36330 LD B,A Load y-coordinate (characters) into B
36331 LD A,128 Load A with x-coordinate of viewscreen centre (pixels)
36333 RRCA Divide by 8 to get x-coordinate in characters...
36334 RRCA ...
36335 RRCA ...
36336 LD C,A Load x-coordinate (characters) into C
36337 CALL 54148 Load HL with attribute file address for coordinates (C, B) (characters)
36340 LD (HL),0 Set attribute at this location to zero (black INK, black PAPER) to hide stars' origin
36342 LD IX,24832 Point IX at start of table of stars' movement data
36346 LD B,20 Load B with 20 (as there are 20 stars to process)
36348 PUSH BC Store BC (B = remaining number of stars to process)
The operand of the instruction at 36349 represents a delay constant. This is modified by the instruction at 31975.
36349 LD C,0 Load C with delay constant, outer loop
36351 LD B,30 Load B with 30 (delay constant, inner loop)
36353 DJNZ 36353 Pause for 30 cycles
36355 DEC C Decrease C by one
36356 JR NZ,36351 If C is not zero then loop back to 36351
36358 LD B,(IX+1) Load B with star's current y-coordinate
36361 LD C,(IX+0) Load C with star's current x-coordinate
36364 CALL 8933 PLOT the star to remove it from display (x=C, y=B)
36367 CALL 36499 Load BC with new (y,x) coordinates of a star depending upon the signs and magnitudes of its direction
36370 LD A,B If new y-coordinate is less than 33...
36371 CP 33 ...
36373 JR C,36388 ...then reset star to point of origin and generate a new direction and movement data and jump ahead to 36406
36375 CP 112 If new y-coordinate is 112 or more...
36377 JR NC,36388 ...then reset star to point of origin and generate a new direction and movement data and jump ahead to 36406
36379 LD A,C If new x-coordinate is less than 56...
36380 CP 56 ...
36382 JR C,36388 ...then reset star to point of origin and generate a new direction and movement data and jump ahead to 36406
36384 CP 198 If new x-coordinate is less than 198...
36386 JR C,36393 ...then skip ahead to 36393
36388 CALL 36273 Reset star to point of origin and generate a new direction and movement data
36391 JR 36406 Advance to next star
36393 LD A,C If new x-coordinate is zero...
36394 AND A ...
36395 JR Z,36388 ...then reset star to point of origin and generate a new direction and movement data and jump ahead to 36406
36397 LD (IX+0),C Update star's coordinates in table at 24832 with new position data...
36400 LD (IX+1),B ...
36403 CALL 8933 PLOT the star to add it to display (x=C, y=B)
36406 POP BC Restore BC (B = remaining number of stars to process)
36407 LD DE,9 Advance IX by nine bytes to data for next star...
36410 ADD IX,DE ...
36412 DJNZ 36348 Decrease remaining number of stars to process and loop back to 36348
36414 RET Return
Prev: 36273 Up: Map Next: 36415