An altitude bar, and orbital speed marked on the drift bar

The orbit takes the lander off the top of the screen, and the panel only
worked while the ground was in sight. Both other bars are rates: they say
how fast, and neither says where.

The altitude bar is height above the surface underneath, up the left edge,
half a pixel of bar to a pixel of sky - the flyable band is about 256
pixels and the screen is 200 tall, so pixel for pixel would run off the
top of the very screen it describes. Above the surface rather than above
some fixed line, so it reads NOUGHT the moment the lander is down.

The marks say where 64 sixteenths is. Without one that number is folklore:
a pilot can feel that somewhere around here the falling stops and has no
way to see where. The bar is a pixel a sixteenth from the middle at 160,
so the marks sit at 224 and at the two pixels before 96, adjacent rather
than overlapping - a bar at orbital speed would otherwise hide the thing
it is being measured against.

Both in magenta. Red and green are taken and they MEAN something here,
how fast and whether it can be landed with, and an altitude is neither.
White was the first choice and the ceiling check counts white to find its
warning, so it read a warning that was never up - the suite caught that.
Cyan was the second and it is the colour of a landing pad, which is
checked as whole cells of it.

groundLevel is factored out of restOnSurface, which had the same sum.

Three checks, each seen to fail on its own break. Two flights, because no
one flight holds both ends of the bar well: the climb reads 219 pixels and
the descent lands and then stays landed. They fly on their own keyboard
file - the shared one holds a key down every forty eight bytes for the
held-thruster check, so borrowing it flew the lander from the keyboard and
the controller at once and turned the gentle descent into a crash.
This commit is contained in:
Anachronaut
2026-09-03 20:57:16 -04:00
parent c514d5328e
commit 85029d3b85
12 changed files with 315 additions and 12 deletions
+66
View File
@@ -1966,6 +1966,72 @@ EOT
&& result ok "and no drift draws none" "a width of nought is a sprite that is not there" \
|| result no "and no drift draws none" "$STILLWIDE pixels of bar with nothing moving"
# ---- The altitude bar, and the mark that says where orbital speed is ----
#
# The orbit takes the lander OFF THE TOP OF THE SCREEN, which left an instrument panel that
# only worked while the ground was in sight. Two additions answer that: a bar up the left edge
# for how much sky is underneath, and a pair of marks on the drift bar showing where the
# sideways speed stops being a fall and starts being an orbit.
#
# BOTH HALVES OF THE BAR, because either alone is vacuous. A bar that was always full would
# pass "there is one while flying" and a bar that was never drawn would pass "there is none
# while landed" - it is the two together that say the thing is measuring something.
#
# Two flights, because no one flight holds both ends well. The climb reaches a bar of two
# hundred pixels and is nowhere near the edge of the claim; the descent lands and then STAYS
# landed, so its end of it cannot drift with the boot time the way the deleted orbit check
# did. One flight that did both spent four seconds airborne and read thirty pixels, which is a
# margin thin enough to be luck.
#
# The marks are checked BY POSITION rather than by counting, because position is the whole
# claim: 64 sixteenths is orbital speed, the bar is a pixel a sixteenth from the middle at
# 160, so the marks belong at 224 and at the two pixels before 96. A count would pass with
# them anywhere on the screen. Read off the landed frame, where nothing is drifting and the
# drift bar cannot be lying across them.
# ---- Its own keyboard file, and that is not fussiness ----
#
# $BUILD/lander.keys is not just the command that starts the program: it holds a key down
# every forty eight bytes, because the test that made it is checking that a HELD KEY keeps
# lifting. Borrowing it here meant the lander was being flown from the keyboard and the
# controller at once, and the gentle descent below arrived as a crash - which reads exactly
# like a broken altimeter and is nothing of the sort.
python3 -c "open('$BUILD/fly.keys','wb').write(b'Lander\n' + b'\x00' * 8000)"
python3 -c "open('$BUILD/climb.pad','wb').write(b'\x00' * 20 + b'\x09' * 300 + b'\x01' * 200 + b'\x00' * 6000)"
python3 -c "open('$BUILD/settle.pad','wb').write(b'\x00' * 150 + b'\x08' * 90 + b'\x00' * 8000)"
timeout 60 "$EMU" --fast --cycles 6000000 --keyboard "$BUILD/fly.keys" \
--pad "$BUILD/climb.pad" --screen "$BUILD/climb.ppm" \
--disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \
"$BUILD/cosmos.bin" > "$BUILD/climb.out" 2>&1 || true
timeout 60 "$EMU" --fast --cycles 9000000 --keyboard "$BUILD/fly.keys" \
--pad "$BUILD/settle.pad" --screen "$BUILD/settle.ppm" \
--disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \
"$BUILD/cosmos.bin" > "$BUILD/settle.out" 2>&1 || true
read -r FLYING RESTING MARKS <<EOT
$(python3 -c "
def magenta(path, low, high):
d = open(path, 'rb').read()
px = d[d.index(b'255\n') + 4:]
ink = bytes.fromhex('c860c0')
return [i % 320 for i in range(len(px) // 3)
if px[i * 3:i * 3 + 3] == ink and low <= i % 320 <= high]
# The bar is at the left edge; the marks are out where the drift bar is.
print(len(magenta('$BUILD/climb.ppm', 0, 20)),
len(magenta('$BUILD/settle.ppm', 0, 20)),
','.join(str(x) for x in sorted(set(magenta('$BUILD/settle.ppm', 21, 319)))) or 'none')
" 2>/dev/null || echo "0 0 none")
EOT
[ "$FLYING" -gt 100 ] \
&& result ok "a lander above the ground draws an altitude bar" "$FLYING pixels of it" \
|| result no "a lander above the ground draws an altitude bar" "$FLYING pixels of it"
# Sitting on a pad is nought sky underneath, and NOUGHT DRAWS NOTHING. An altimeter that still
# showed a third of itself on the ground is one nobody could read the rest of.
[ "$RESTING" = "0" ] \
&& result ok "and one sitting on the ground draws none" "a bar of nought is no bar at all" \
|| result no "and one sitting on the ground draws none" "$RESTING pixels still up"
[ "$MARKS" = "94,95,224,225" ] \
&& result ok "orbital speed is marked on the drift bar" "64 pixels either side of the middle" \
|| result no "orbital speed is marked on the drift bar" "marks at $MARKS"
# ---- Clearing puts the cursor back at the top ----
#
# A screen with nothing on it and a cursor half way down it is not a cleared screen. This