Skip to navigation

Elite on the BBC Micro

Drawing Saturn on the loading screen

How the loader draws the dot-based Saturn in Elite's epic loading screen

This deep dive is a work in progress. It covers the drawing of Saturn in the PLL1 routine in the loader.

Part 1 (PLL1) x 1280 - planet
-----------------------------

Draw pixels at (x, y) where:

    r1 = random number from 0 to 255
    r2 = random number from 0 to 255
    (r1^2 + r2^2) < 128^2

    y = r2, squished into 64 to 191 by negation

    x = SQRT(128^2 - (r1^2 + r2^2)) / 2

Part 2 (PLL2) x 477 - stars
---------------------------

Draw pixels at (x, y) where:

    x = random number from 0 to 255
    y = random number from 0 to 255
    (x^2 + y^2) div 256 > 17

Part 3 (PLL3) x 1280 - rings
----------------------------

Draw pixels at (x, y) where:

    r5 = random number from 0 to 255
    r6 = random number from 0 to 255
    r7 = r5, squashed into -32 to 31

    32 <= ((r6 + r7)^2 + r5^2 + r6^2) / 256 < 80

    Either this is true:

      ((r6 + r7)^2 + r6^2) / 256 >= 16

    or both these are true:

      ((r6 + r7)^2 + r6^2) / 256 < 16
      r5 >= 128

    x = r5 + r7
    y = r5