A base speaks in the window, not into the world
Two bugs with one cause. The console draws into the map, so a message printed while flying was a message the lander then flew over - and printing scrolls, so every one of them moved the whole world up a row. The window is at a screen position and forty cells wide, and neither is true of it. So the window is two rows now: the gauge, and whatever there is to say. The letters are ordinary tiles, because the character generator starts at the space and glyph n is character n less thirty two. The rest of the row is blanked after every message, or a short one would leave the tail of a long one behind it. Opening the throttle wipes the line, because a message that outlived the moment would be read as describing this one. The crash still goes to the console, deliberately: it is the last thing the program says and it should survive the program. A or Start continues from a message as readily as a key does. Somebody flying on a controller should not have to reach for the keyboard to say they have read something. AND TWO TESTS WENT WITH IT, which is the interesting part. cosmosLanderSoft and cosmosLanderPadOne asserted on lines in a transcript, and the lines moved off the console - so both went on passing while checking nothing at all. A test that asserts a side effect rather than the thing itself is always one refactor from being decorative. What they were for is now checked in the picture, where the message actually is. The lander check moved earlier too. The window grew to two rows, so by 1.5 million cycles the lander had climbed behind the status bar - the window doing exactly what it should, and leaving the check counting six pixels of a forty pixel lander. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
bfb515e23b
commit
caf5e1f99d
@@ -457,8 +457,8 @@ putLander:
|
||||
; The letters are ordinary tiles. The character generator starts at the space, so glyph n is
|
||||
; character n plus thirty two - which makes F, U, E and L into 38, 53, 37 and 44.
|
||||
putGauge:
|
||||
INIA 0x01
|
||||
OUTA 0x3D ; One row tall.
|
||||
INIA 0x02
|
||||
OUTA 0x3D ; Two rows: the gauge, and whatever there is to say.
|
||||
RSTA
|
||||
OUTA 0x3E ; At the top of the screen.
|
||||
|
||||
@@ -680,9 +680,14 @@ fallResting:
|
||||
BRQ fallNotUp
|
||||
CALL takeFuel
|
||||
BRQ fallNotUp ; Nothing in the tank, so nothing out of the engine.
|
||||
RSTA
|
||||
SETD.0 Landed
|
||||
LDA.0
|
||||
BRA fallAlreadyUp
|
||||
RSTA
|
||||
STA.0 ; Lifting off, which is the only way to stop being landed.
|
||||
SETD.0 EmptyText
|
||||
CALL sayInWindow ; And whatever the base said goes with it.
|
||||
fallAlreadyUp:
|
||||
SETD.0 SpeedDown
|
||||
SETD.1 PadUp
|
||||
CALL addWord
|
||||
@@ -1103,13 +1108,24 @@ touchdownStop:
|
||||
touchdownDone:
|
||||
RET
|
||||
|
||||
; A key, asked for rather than waited on, so one already pressed counts.
|
||||
; ---- A key, or a button ----
|
||||
;
|
||||
; Somebody flying on a controller should not have to reach for the keyboard to say "yes, I
|
||||
; read that". A or Start does it, and so does any key - asked for rather than waited on, so
|
||||
; one already pressed counts.
|
||||
waitKey:
|
||||
CALL readPad
|
||||
SETD.0 Held
|
||||
LDA.0
|
||||
INIB 0x50 ; A, or Start.
|
||||
AND
|
||||
BNQ waitKeyDone
|
||||
INA 0x01
|
||||
INIB 0x01 ; READY
|
||||
AND
|
||||
BRQ waitKey
|
||||
INA 0x00
|
||||
waitKeyDone:
|
||||
RET
|
||||
|
||||
; ---- Put down exactly on the ground ----
|
||||
@@ -1140,6 +1156,53 @@ restOnSurface:
|
||||
STA.0
|
||||
RET
|
||||
|
||||
; ---- A line of text, into the window ----
|
||||
;
|
||||
; DP0 names a string. It goes into window row one and the rest of the row is BLANKED, so a
|
||||
; short message never leaves the tail of a long one behind it.
|
||||
;
|
||||
; Into the window rather than out of the console, which is the whole of two bugs at once. The
|
||||
; console draws into the map, so a message printed while flying was a message the lander then
|
||||
; flew over - and printing scrolls, so every one of them moved the whole world up a row.
|
||||
; The window is at a screen position and forty cells wide, and neither is true of it.
|
||||
;
|
||||
; The letters are ordinary tiles: the character generator starts at the space, so glyph n is
|
||||
; character n less thirty two.
|
||||
sayInWindow:
|
||||
INIA 0d5
|
||||
OUTA 0xE3
|
||||
INIA 0xC1
|
||||
OUTA 0xE4
|
||||
RSTA
|
||||
OUTA 0xE5 ; Window row one begins at 0xC100.
|
||||
SETD.1 SayAt
|
||||
STA.1
|
||||
|
||||
sayCell:
|
||||
LDA.0
|
||||
BRA sayBlank ; The string has ended, so the rest of the row is nothing.
|
||||
INIB 0d32
|
||||
CCF
|
||||
SUB
|
||||
OUTQ 0xE9
|
||||
INIA 0x07
|
||||
OUTA 0xE9 ; Scheme seven, white, which is nothing else on this screen.
|
||||
INCD.0
|
||||
BRI sayNext
|
||||
sayBlank:
|
||||
OUTA 0xE9
|
||||
OUTA 0xE9 ; A is nought here, and DP0 stays put so it stays nought.
|
||||
sayNext:
|
||||
SETD.1 SayAt
|
||||
LDA.1
|
||||
INCA
|
||||
STA.1
|
||||
INIB 0d40
|
||||
CCF
|
||||
SUB
|
||||
BNQ sayCell
|
||||
RET
|
||||
|
||||
; ---- What a base does when a lander arrives ----
|
||||
;
|
||||
; Empty and at a base: it hands over cargo for the base ACROSS THE MOON, two along, so the
|
||||
@@ -1172,8 +1235,8 @@ arrive:
|
||||
STA.0 ; And DP0 is still Carrying, from reading it.
|
||||
CALL payFuel
|
||||
SETD.0 DeliveredText
|
||||
SWI osPrintString
|
||||
BRI arriveSaid
|
||||
CALL sayInWindow
|
||||
RET
|
||||
|
||||
arriveLoad:
|
||||
; Two along, round a moon of four bases, which is the far side of it.
|
||||
@@ -1190,21 +1253,17 @@ arriveLoad:
|
||||
SETD.0 Carrying
|
||||
STA.0
|
||||
SETD.0 LoadedText
|
||||
SWI osPrintString
|
||||
BRI arriveSaid
|
||||
CALL sayInWindow
|
||||
RET
|
||||
|
||||
arriveWrong:
|
||||
SETD.0 WrongText
|
||||
SWI osPrintString
|
||||
BRI arriveSaid
|
||||
CALL sayInWindow
|
||||
RET
|
||||
|
||||
arriveNowhere:
|
||||
SETD.0 LandedText
|
||||
SWI osPrintString
|
||||
|
||||
arriveSaid:
|
||||
INIA 0x0A
|
||||
OUTA 0x00
|
||||
CALL sayInWindow
|
||||
RET
|
||||
|
||||
; ---- Paid ----
|
||||
@@ -1475,6 +1534,8 @@ LandColumn:
|
||||
0x00
|
||||
AtBase:
|
||||
0x00
|
||||
SayAt:
|
||||
0x00
|
||||
|
||||
; ---- What is aboard, and whether the feet are down ----
|
||||
;
|
||||
@@ -1486,14 +1547,17 @@ Carrying:
|
||||
Landed:
|
||||
0x00
|
||||
|
||||
; ---- Forty cells is the row, so forty characters is the limit ----
|
||||
LandedText:
|
||||
"Down in the middle of nowhere. Nothing here."
|
||||
"Nowhere in particular. Nothing here."
|
||||
LoadedText:
|
||||
"Loaded. Take it to the base across the moon."
|
||||
"Loaded. Take it across the moon."
|
||||
DeliveredText:
|
||||
"Delivered. Eighty units of fuel."
|
||||
WrongText:
|
||||
"Not the base this cargo is for."
|
||||
EmptyText:
|
||||
0x00
|
||||
CrashedText:
|
||||
"Crashed."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user