A station in orbit, going round and not yet dockable
S1 of the station: it exists, it orbits, it wraps, it is drawn. Docking is deliberately not here - the point of stopping at this rung is to fly up and find out whether matching a four pixel a frame target feels good before any rules are written about what happens when you reach it. IT NEEDS NO PHYSICS OF ITS OWN. A body at 64 sixteenths is exactly what a circular orbit is under the rules already here: the pull and the swing cancel at that speed at ANY height, because gravity never falls off and the moon is a cylinder that does not rotate. So the station is a position, a constant, and the same fourteen bit wrap the lander uses. That also means there is no prograde or retrograde to choose - nothing privileges a direction, which is what makes a second station going the other way a thing that can exist later. Four rows above the world's origin: off the top of a forty column screen and comfortably inside a wide one, so it is somewhere to go that the zoom is needed to see. It starts half a moon away and a lap is 256 frames, a little over four seconds, so it has to be found but will not stay lost. Its column is the middle of the screen plus how far round it is from the lander, wrapped to fourteen bits - which measures the long way round whenever it is behind, so anything past the half way point becomes a negative offset instead. Off the edge needs no test at all: a sprite's X is signed and sixteen bits, so a station three hundred pixels to the left is asked for at minus a hundred and forty and the device declines. Blue, and that is not taste. White is counted to find the ceiling warning, cyan to find the landing pads, magenta is the instruments and yellow is the lander. Blue is the one ink no check measures, and picking a measured one has broken a test twice already. toPixelsSigned is factored out of showLander, since the station wants the same sign-extended conversion. Four checks, each seen to fail on its own break. Measured going round at 244 pixels in sixty frames, off the far side of the moon, and back on the other edge.
This commit is contained in:
+220
-12
@@ -100,9 +100,11 @@ everyFrame:
|
||||
CALL zoomButton
|
||||
CALL fall
|
||||
CALL move
|
||||
CALL moveStation
|
||||
CALL follow
|
||||
CALL touchdown
|
||||
CALL showLander
|
||||
CALL showStation
|
||||
CALL showDrift
|
||||
CALL showFall
|
||||
CALL showFuel
|
||||
@@ -158,6 +160,28 @@ putTiles:
|
||||
OUTA 0xE7
|
||||
INIA 0x01
|
||||
OUTA 0xE8 ; Blit.
|
||||
|
||||
OUTA 0xE0 ; Bank one again, A still holding the one the blit above wanted.
|
||||
SETD.1 StationArtAt
|
||||
SETD.0 StationArt
|
||||
STD.0.1
|
||||
LDA.1
|
||||
OUTA 0xE1
|
||||
INCD.1
|
||||
LDA.1
|
||||
OUTA 0xE2
|
||||
INIA 0d4
|
||||
OUTA 0xE3
|
||||
INIA 0x32
|
||||
OUTA 0xE4
|
||||
INIA 0x80
|
||||
OUTA 0xE5 ; Tile 202, one tile on again.
|
||||
RSTA
|
||||
OUTA 0xE6
|
||||
INIA 0x40
|
||||
OUTA 0xE7
|
||||
INIA 0x01
|
||||
OUTA 0xE8 ; Blit.
|
||||
RET
|
||||
|
||||
; ---- A moon, one column at a time ----
|
||||
@@ -1183,27 +1207,164 @@ follow:
|
||||
RET
|
||||
|
||||
; ---- The lander, put where it now is ----
|
||||
showLander:
|
||||
SETD.0 DownLow
|
||||
CALL toPixels
|
||||
; ---- Round it goes, one orbital speed a frame ----
|
||||
moveStation:
|
||||
SETD.0 StationLow
|
||||
SETD.1 StationSpeed
|
||||
CALL addWord
|
||||
SETD.0 StationHigh
|
||||
LDA.0
|
||||
INIB 0x3F
|
||||
AND
|
||||
STQ.0 ; The same wrap the lander has: 2^14 sixteenths round.
|
||||
RET
|
||||
|
||||
; ---- Signed, which it did not have to be while the view never moved ----
|
||||
;
|
||||
; toPixels shifts a sixteen bit position down four and masks what is left to twelve bits, so
|
||||
; a lander above the world's origin comes back as a large POSITIVE number rather than a small
|
||||
; negative one. That was harmless while the top of the screen was the origin: such a lander
|
||||
; was off the picture either way. Now that the wide view starts twenty four rows higher it is
|
||||
; on the picture, and it has to be on the right part of it.
|
||||
; ---- Where that puts it on the screen ----
|
||||
;
|
||||
; The lander is always at the middle, so the station's column is the middle plus HOW FAR ROUND
|
||||
; IT IS FROM THE LANDER. That difference is taken in the moon's own arithmetic and wrapped to
|
||||
; fourteen bits, which measures it the long way round whenever the station is behind: over
|
||||
; half a moon ahead IS under half a moon behind, so anything past the half way point is turned
|
||||
; into a negative offset instead.
|
||||
;
|
||||
; Off the edge needs no test. A sprite's X is signed and sixteen bits, so a station three
|
||||
; hundred pixels to the left is asked for at minus a hundred and forty and the device declines
|
||||
; to draw it, which is a comparison this does not have to make.
|
||||
showStation:
|
||||
SETD.0 StationLow
|
||||
LDA.0
|
||||
SETD.1 AcrossLow
|
||||
LDB.1
|
||||
CCF
|
||||
SUB
|
||||
SETD.1 GapLow
|
||||
STQ.1
|
||||
SETD.0 StationHigh
|
||||
LDA.0
|
||||
SETD.1 AcrossHigh
|
||||
LDB.1
|
||||
SUB ; And the borrow the half below left.
|
||||
MVQA
|
||||
INIB 0x3F
|
||||
AND
|
||||
SETD.1 GapHigh
|
||||
STQ.1
|
||||
|
||||
SETD.0 GapLow
|
||||
CALL toPixels ; Nought to 1023 pixels, which is the whole moon.
|
||||
SETD.0 PixelHigh
|
||||
LDA.0
|
||||
INIB 0x02
|
||||
AND
|
||||
BRQ stationAhead ; Under 512, so it is ahead and the offset stands.
|
||||
LDA.0
|
||||
INIB 0d4
|
||||
CCF
|
||||
SUB
|
||||
STQ.0 ; Less a whole moon, which makes it a distance backwards.
|
||||
stationAhead:
|
||||
|
||||
SETD.0 PixelLow
|
||||
LDA.0
|
||||
SETD.1 HalfScreen
|
||||
LDB.1
|
||||
CCF
|
||||
ADD
|
||||
SETD.1 StationAt
|
||||
STQ.1
|
||||
SETD.0 PixelHigh
|
||||
LDA.0
|
||||
SETD.1 HalfScreen
|
||||
INCD.1
|
||||
LDB.1
|
||||
ADD
|
||||
SETD.1 StationAt
|
||||
INCD.1
|
||||
STQ.1
|
||||
|
||||
; And its row, which moves with the view exactly as the lander's does.
|
||||
SETD.0 StationDownLow
|
||||
CALL toPixelsSigned
|
||||
SETD.0 PixelLow
|
||||
LDA.0
|
||||
SETD.1 ShipYAdd
|
||||
LDB.1
|
||||
CCF
|
||||
ADD
|
||||
SETD.1 StationTop
|
||||
STQ.1
|
||||
SETD.0 PixelHigh
|
||||
LDA.0
|
||||
SETD.1 ShipYAdd
|
||||
INCD.1
|
||||
LDB.1
|
||||
ADD
|
||||
SETD.1 StationTop
|
||||
INCD.1
|
||||
STQ.1
|
||||
|
||||
INIA 0d4
|
||||
OUTA 0xE3
|
||||
INIA 0xC0
|
||||
OUTA 0xE4
|
||||
INIA 0x60
|
||||
OUTA 0xE5 ; Sprite six begins ninety six bytes in.
|
||||
INIA 0xCA
|
||||
OUTA 0xE9 ; Tile 202.
|
||||
INIA 0x04
|
||||
OUTA 0xE9 ; ---- Attribute four, blue ----
|
||||
;
|
||||
; Not taste. White is what the ceiling warning is counted in, cyan
|
||||
; is what a landing pad is counted in, magenta is the instruments
|
||||
; and yellow is the lander. Blue is the one ink no check measures,
|
||||
; and picking a measured one has broken a test twice already.
|
||||
SETD.0 StationAt
|
||||
LDA.0
|
||||
OUTA 0xE9
|
||||
INCD.0
|
||||
LDA.0
|
||||
OUTA 0xE9 ; X.
|
||||
SETD.0 StationTop
|
||||
LDA.0
|
||||
OUTA 0xE9
|
||||
INCD.0
|
||||
LDA.0
|
||||
OUTA 0xE9 ; Y.
|
||||
INIA 0x11
|
||||
OUTA 0xE9 ; One tile by one.
|
||||
RSTA
|
||||
OUTA 0xE9 ; No flags.
|
||||
OUTA 0xE9
|
||||
OUTA 0xE9
|
||||
OUTA 0xE9
|
||||
OUTA 0xE9 ; No target size, which HERE means its natural one.
|
||||
OUTA 0xE9 ; And no depth.
|
||||
RET
|
||||
|
||||
; ---- A world position in pixels, with its sign kept ----
|
||||
;
|
||||
; toPixels shifts a sixteen bit position down four and masks what is left to twelve bits, so a
|
||||
; position above the world's origin comes back as a large POSITIVE number rather than a small
|
||||
; negative one. That was harmless while the top of the screen WAS the origin: anything up
|
||||
; there was off the picture either way. Now that the wide view starts twenty four rows higher
|
||||
; it is on the picture, and it has to be on the right part of it.
|
||||
toPixelsSigned:
|
||||
CALL toPixels
|
||||
SETD.0 PixelHigh
|
||||
LDA.0
|
||||
INIB 0x08
|
||||
AND
|
||||
BRQ showLanderDown
|
||||
BRQ toPixelsSignedDone
|
||||
LDA.0
|
||||
INIB 0xF0
|
||||
OR
|
||||
STQ.0 ; The twelfth bit was the sign, so the top nibble is too.
|
||||
showLanderDown:
|
||||
toPixelsSignedDone:
|
||||
RET
|
||||
|
||||
showLander:
|
||||
SETD.0 DownLow
|
||||
CALL toPixelsSigned
|
||||
INIA 0d4
|
||||
OUTA 0xE3
|
||||
INIA 0xC0
|
||||
@@ -2592,6 +2753,53 @@ EmptyText:
|
||||
CrashedText:
|
||||
"Crashed."
|
||||
|
||||
; ---- The station, which is a body and not a special case ----
|
||||
;
|
||||
; A circular orbit is exactly what a thing at orbital speed DOES under the rules already here:
|
||||
; the pull and the swing cancel at 64 sixteenths, at any height, because gravity never falls
|
||||
; off and the moon wraps. So the station needs no physics of its own - a position, a constant,
|
||||
; and the same wrap the lander uses.
|
||||
;
|
||||
; Four rows above the world's origin, which is off the top of a forty column screen and
|
||||
; comfortably inside a wide one. That is deliberate: it makes the station a reason to use the
|
||||
; zoom rather than something that can be flown to without it.
|
||||
;
|
||||
; It starts half a moon away, so it has to be found. At four pixels a frame a lap is 256
|
||||
; frames, a little over four seconds, so it will not stay lost for long.
|
||||
StationLow:
|
||||
0xA0
|
||||
StationHigh:
|
||||
0x34
|
||||
StationDownLow:
|
||||
0x00
|
||||
StationDownHigh:
|
||||
0xFE ; Minus 512 sixteenths, which is four rows up.
|
||||
StationSpeed:
|
||||
0x40 0x00 ; Orbital speed, and the whole of its behaviour.
|
||||
|
||||
; How far round the moon the station is from the lander, and where that puts it on the screen.
|
||||
GapLow:
|
||||
0x00
|
||||
GapHigh:
|
||||
0x00
|
||||
StationAt:
|
||||
0x00 0x00
|
||||
StationTop:
|
||||
0x00 0x00
|
||||
|
||||
StationArt:
|
||||
0x00 0x00 0x01 0x01 0x01 0x01 0x00 0x00
|
||||
0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00
|
||||
0x01 0x01 0x00 0x01 0x01 0x00 0x01 0x01
|
||||
0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
|
||||
0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
|
||||
0x01 0x01 0x00 0x01 0x01 0x00 0x01 0x01
|
||||
0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00
|
||||
0x00 0x00 0x01 0x01 0x01 0x01 0x00 0x00
|
||||
|
||||
StationArtAt:
|
||||
#Reserve 0d2
|
||||
|
||||
LanderArt:
|
||||
0x00 0x00 0x01 0x01 0x01 0x01 0x00 0x00
|
||||
0x00 0x01 0x01 0x01 0x01 0x01 0x01 0x00
|
||||
|
||||
Reference in New Issue
Block a user