Prev: 29174 Up: Map Next: 29330
29272: If Magic Knight is on the bridge and USS Pisces is not at Gangrole then draw viewscreen starfield
Used by the routine at 28101.
29272 LD A,(23701) If Magic Knight's current room is not 1 (USS Pisces, 1, The Bridge)...
29275 CP 1 ...
29277 RET NZ ...then return
29278 LD A,(23700) If the USS Pisces' current location is 20 (Gangrole)...
29281 CP 20 ...
29283 RET Z ...then return
29284 LD A,255 Store 255 at 23694 and 23696...
29286 LD (23696),A ...to preserve attributes already on screen...
29289 LD (23694),A ...
29292 LD A,(23700) Load the USS Pisces' current location into H and L...
29295 LD H,A ...so that HL points to an address in ROM (pseudo-random data)...
29296 LD L,A ...
29297 LD B,50 Load B with 50 (as we are PLOTting 50 stars)
29299 PUSH BC Store BC (remaining number of stars to PLOT)
29300 INC HL Advance HL by one byte
29301 LD A,(HL) Load A with byte at HL
29302 AND 63 Clear bits 6 and 7
29304 CP 56 If this y-coordinate value is 56 or more...
29306 JP NC,29300 ...then loop back to 29300 to get next byte value
29309 LD B,A Load this pseudo-random value (0-55) into B (y-coordinate)
29310 INC HL Advance HL by one byte
29311 LD A,(HL) Load A with byte at HL
29312 AND 127 Clear bit 7
29314 LD C,A Load this x-coordinate value (0-127) into C (x-coordinate)
29315 PUSH HL Store HL (current address in ROM)
Stars are PLOTted as pixels using the ROM PLOT routine. Therefore, coordinates are relative to the bottom-left of the display. The x-coordinate increases towards the right of the display while the y-coordinate increases towards the top. Stars are always PLOTted ABOVE the planet rendered on the viewscreen, therefore the lower-left bound of the rectangular area for displaying stars ("star area") under this system is (64, 56) pixels. The upper-right bound is (191, 111) pixels.
29316 LD HL,14400 Load H and L with the y- and x-coordinates (56 and 64, respectively) of the lower-left of the viewscreen's "star area"
29319 ADD HL,BC Add B and C (pseudo-random values) to H and L respectively as offsets
29320 PUSH HL Transfer values from H (56-111) and L (64-191)...
29321 POP BC ...to B and C
29322 CALL 8933 PLOT the pixel (x=C, y=B)
29325 POP HL Restore HL (current address in ROM)
29326 POP BC Restore BC (remaining number of stars to PLOT)
29327 DJNZ 29299 Decrease remaining number of stars and loop back to 29299
29329 RET Return
Prev: 29174 Up: Map Next: 29330