Depth: a ball behind the near pillars and in front of the far ones
The demo for what V5 added. Four pillars at four distances, each ONE 8 by 8 tile stretched to its own width and height, and a ball walking past all of them at a distance between two. What it shows is the thing an ordering cannot. The ball is sprite NOUGHT and every pillar is numbered after it, so table order puts the ball in front of all four - and it is still hidden behind two of them, because the depth buffer is asked per column. Caught mid-straddle in the checks: the ball is 48 wide and the pillar 32, so it shows on both sides and nowhere across the middle. Writing it found the conceptual trap in the feature, which is now written down where somebody will hit it. The pillars first carried their own distance in their entries AND wrote that same distance into their columns, so each was asked whether it was in front of itself - and 20 is not nearer than 20, so all four vanished. THE BUFFER IS WHAT HAS BEEN DRAWN AND A SPRITE'S DEPTH IS A QUESTION ASKED OF IT. Scenery writes it; it does not ask. Also found that a scheme only gives a colour to index one. The default palette sets each scheme's paper and ink and nothing between them, so art drawn in index two comes out black until a program writes a palette. And the fixture disk's root directory was full: four blocks, 32 entries, all taken, so adding an app failed the whole disk build. Loudly, which is the right way round - but it is a wall that moves for free, so it is eight blocks and 64 entries now. 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
cb898450b5
commit
fba1b553d2
@@ -24,6 +24,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -40,7 +41,7 @@ outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
crossed.txt 560
|
||||
27 files, 1 directory
|
||||
28 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -14,6 +14,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -29,7 +30,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> drive 1
|
||||
> dir
|
||||
other.txt 28
|
||||
|
||||
@@ -31,6 +31,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -46,7 +47,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -21,6 +21,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -36,7 +37,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -21,6 +21,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -36,7 +37,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -107,6 +107,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -122,7 +123,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -26,6 +26,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -41,7 +42,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
@@ -14,6 +14,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -29,7 +30,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> load
|
||||
load what?
|
||||
> load nosuch.sbx
|
||||
|
||||
@@ -12,6 +12,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -27,7 +28,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> load Say.sbx
|
||||
loaded, starting at 5000
|
||||
> run the disk took its time
|
||||
|
||||
@@ -21,6 +21,7 @@ Press.sbx 872
|
||||
Mode.sbx 48
|
||||
Flip.sbx 173
|
||||
Sprite.sbx 442
|
||||
Depth.sbx 672
|
||||
Crash.sbx 632
|
||||
vars.script 50
|
||||
blocks.script 343
|
||||
@@ -36,7 +37,7 @@ nonl.script 38
|
||||
outer.script 376
|
||||
inner.script 44
|
||||
loop.script 35
|
||||
26 files, 1 directory
|
||||
27 files, 1 directory
|
||||
> exit
|
||||
halted
|
||||
Execution halted.
|
||||
|
||||
+11
-2
@@ -65,11 +65,15 @@ for i in 1 2 3 4 5 6 7 8; do "$TOOL" put "$DISKS/sbfs.img" "filler$i.txt" >/dev/
|
||||
# to the hardware, so something has to check that one still gives the machine back.
|
||||
#
|
||||
# notes.txt is there so that loading something that is not a program can be tried too.
|
||||
# 512K, and four directory blocks for 32 files. It was 64K and 16, which was ample for a
|
||||
# 512K, and eight directory blocks for 64 files. It was 64K and 16, which was ample for a
|
||||
# disk that held programs and nothing else - but the native assembler reads SOURCE from
|
||||
# here, and the CosmOS sources alone are 104,142 bytes against the 65,536 a 256 block disk
|
||||
# holds. A machine that is going to assemble itself has to be able to hold its own source.
|
||||
"$TOOL" format "$DISKS/cosmos.img" 2048 4 >/dev/null
|
||||
#
|
||||
# Four blocks held 32 files and every one of them was taken, so adding an app failed the
|
||||
# whole disk build - loudly, which is the right way round, but it is a wall that moves for
|
||||
# free and there is no reason to stand next to it.
|
||||
"$TOOL" format "$DISKS/cosmos.img" 2048 8 >/dev/null
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/CosmOS/Source" \
|
||||
"$ROOT/Programs/CosmOS/Apps/greet.asm" -o "$WORK/greet.sbx" >/dev/null
|
||||
"$TOOL" put "$DISKS/cosmos.img" "$WORK/greet.sbx" >/dev/null
|
||||
@@ -135,6 +139,11 @@ for i in 1 2 3 4 5 6 7 8; do "$TOOL" put "$DISKS/sbfs.img" "filler$i.txt" >/dev/
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/CosmOS/Source" \
|
||||
"$ROOT/Programs/CosmOS/Apps/Sprite.asm" -o "$WORK/Sprite.sbx" >/dev/null
|
||||
"$TOOL" put "$DISKS/cosmos.img" "$WORK/Sprite.sbx" >/dev/null
|
||||
# Depth.sbx is the one that shows what a depth buffer is for: a ball behind two pillars and
|
||||
# in front of two others, decided per column rather than by any ordering of the table.
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/CosmOS/Source" \
|
||||
"$ROOT/Programs/CosmOS/Apps/Depth.asm" -o "$WORK/Depth.sbx" >/dev/null
|
||||
"$TOOL" put "$DISKS/cosmos.img" "$WORK/Depth.sbx" >/dev/null
|
||||
# Crash.sbx breaks in each of the four ways the system now catches, which is the only way to
|
||||
# reach a fault screen from a recorded test.
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/CosmOS/Source" \
|
||||
|
||||
@@ -1484,6 +1484,41 @@ timeout 30 "$EMU" --fast --cycles 60000000 --keyboard "$BUILD/ballgone.keys" \
|
||||
&& result ok "and the system takes the sprite down" "not one pixel of it left over the shell" \
|
||||
|| result no "and the system takes the sprite down" "$(countColour "$BUILD/ballgone.ppm" d04038) pixels still there"
|
||||
|
||||
# ---- A ball behind one pillar and in front of another ----
|
||||
#
|
||||
# Depth puts four pillars at four distances and walks a ball past them at a distance between
|
||||
# two of them. Caught here MID-STRADDLE across the nearest one: the ball is 48 pixels wide and
|
||||
# the pillar is 32, so parts of it show on both sides and none of it shows across the middle.
|
||||
#
|
||||
# What that proves is the thing an ordering cannot do. The ball is sprite NOUGHT and every
|
||||
# pillar is numbered after it, so table order puts the ball in front of all four - and it is
|
||||
# still hidden here, because the depth buffer is asked per column.
|
||||
#
|
||||
# The cycle count is tuned to catch it in that position. If CosmOS's size changes enough to
|
||||
# shift the boot, the first check below fails saying the ball is not straddling anything,
|
||||
# which is a request to re-tune rather than a bug in the device.
|
||||
python3 -c "open('$BUILD/depth.keys','wb').write(b'Depth\n' + b'\x00'*40000)"
|
||||
timeout 30 "$EMU" --fast --cycles 22000000 --keyboard "$BUILD/depth.keys" \
|
||||
--screen "$BUILD/depth.ppm" --disk "$ROOT/Tests/build/disks/cosmos.img" \
|
||||
--ram-disk 2048 "$BUILD/cosmos.bin" > "$BUILD/depth.out" 2>&1 || true
|
||||
read -r BALLLEFT BALLOVER BALLRIGHT PILLAR <<EOT
|
||||
$(python3 -c "
|
||||
d = open('$BUILD/depth.ppm', 'rb').read()
|
||||
px = d[d.index(b'255\n') + 4:]
|
||||
ball, pillar, w = bytes.fromhex('50c050'), bytes.fromhex('d04038'), 640
|
||||
def count(colour, lo, hi):
|
||||
return sum(1 for o in range(0, len(px), 3)
|
||||
if px[o:o + 3] == colour and lo <= (o // 3) % w <= hi)
|
||||
print(count(ball, 0, 79), count(ball, 80, 111), count(ball, 112, 200), count(pillar, 80, 111))
|
||||
" 2>/dev/null || echo "0 0 0 0")
|
||||
EOT
|
||||
[ "$BALLLEFT" -gt 0 ] && [ "$BALLRIGHT" -gt 0 ] \
|
||||
&& result ok "the ball is straddling the near pillar" "showing on both sides of it" \
|
||||
|| result no "the ball is straddling the near pillar" "left $BALLLEFT, right $BALLRIGHT - re-tune the cycle count"
|
||||
[ "$BALLOVER" = "0" ] && [ "$PILLAR" -gt 0 ] \
|
||||
&& result ok "and the near pillar hides the middle" "sprite nought, behind sprite one" \
|
||||
|| result no "and the near pillar hides the middle" "$BALLOVER ball pixels across a pillar of $PILLAR"
|
||||
|
||||
# ---- 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
|
||||
|
||||
Reference in New Issue
Block a user