A fast-falling character can cross a thin platform between two updates without ever having its feet exactly on the top. Compare the old and proposed bottom edges, then snap the feet to the surface when the downward path crosses it.

Include, initialise and call
Reserve LANDED, SNAP, ACTOR_X, ACTOR_W, PREV_BOTTOM, NEW_BOTTOM, PLATFORM_X, PLATFORM_W, PLATFORM_Y, DROP as 10 contiguous private bytes in that order. Include the helper once. Call one_way_platform_init at the intended reset boundary: it clears every named byte, including input fields. Set the starting values afterwards, then call one_way_platform_step for each intended service.
Initialise once, supply the old and proposed geometry, then service before committing a fall. On LANDED, place the bottom at SNAP and let the caller decide vertical velocity and grounded state. Test each candidate platform as needed; selecting among several surfaces requires the nearest valid top along the path, not an arbitrary last result.
ACTOR_X/ACTOR_W and PLATFORM_X/PLATFORM_W describe unsigned horizontal half-open intervals. Each span includes X and stops just before X + width, so touching edges alone do not overlap. Width zero rejects contact; widened endpoints may reach 510. PREV_BOTTOM and NEW_BOTTOM are unsigned old/proposed bottom coordinates, increasing downwards. Landing requires horizontal overlap and PREV_BOTTOM ≤ PLATFORM_Y ≤ NEW_BOTTOM, with DROP zero. LANDED is replaced with 1 on contact; SNAP becomes PLATFORM_Y on contact and otherwise NEW_BOTTOM. Stationary feet exactly on top count as contact. All inputs survive.
Reusable initialisation and service
; SPDX-License-Identifier: MIT
; Land on a One-way Platform. Contiguous private bytes: LANDED, SNAP, ACTOR_X, ACTOR_W, PREV_BOTTOM, NEW_BOTTOM, PLATFORM_X, PLATFORM_W, PLATFORM_Y, DROP.
; init clears all fields; set inputs afterwards. No I/O, waits or IRQ ownership.
; D0-D3/A0-A1/CCR change; D4-D7/A2-A6 survive.
one_way_platform_init:
clr.b LANDED
clr.b SNAP
clr.b ACTOR_X
clr.b ACTOR_W
clr.b PREV_BOTTOM
clr.b NEW_BOTTOM
clr.b PLATFORM_X
clr.b PLATFORM_W
clr.b PLATFORM_Y
clr.b DROP
rts
one_way_platform_step:
clr.b LANDED
move.b NEW_BOTTOM,SNAP
tst.b DROP
bne.s platform_done
tst.b ACTOR_W
beq.s platform_done
tst.b PLATFORM_W
beq.s platform_done
move.b PREV_BOTTOM,d0
cmp.b PLATFORM_Y,d0
bhi.s platform_done
move.b NEW_BOTTOM,d0
cmp.b PLATFORM_Y,d0
blo.s platform_done
moveq #0,d0
move.b PLATFORM_X,d0
moveq #0,d1
move.b PLATFORM_W,d1
add.w d1,d0
moveq #0,d1
move.b ACTOR_X,d1
cmp.w d0,d1
bhs.s platform_done
moveq #0,d0
move.b ACTOR_W,d0
add.w d1,d0
moveq #0,d1
move.b PLATFORM_X,d1
cmp.w d0,d1
bhs.s platform_done
move.b #1,LANDED
move.b PLATFORM_Y,SNAP
platform_done:
rts
component_end:State, registers and ownership
Ten bytes, with LANDED and SNAP first for inspection. Both horizontal intervals use widened arithmetic. The vertical coordinates do not wrap: crossing the byte coordinate seam is outside this contract and needs a wider world representation.
D0–D3/A0–A1/CCR may change; D4–D7/A2–A6 survive. A direct BSR/JSR needs four return-address stack bytes.
The implementation binds fixed symbols and has one mutation owner. Independent users need separate state blocks and scoped/renamed labels, including routine labels; sharing the same bindings means sharing the state. Do not let an interrupt and the main loop mutate the same block without an explicit ownership policy.
The bootable caller takes over Copper/bitplane/interrupt/DMA resources and explicitly disarms all eight sprites. It does not restore Workbench. These are caller presentation choices, not dependencies of the reusable helper.
A caller you can adapt
The buildable program supplies bindings and include order. Its separate client retains state between calls. checked_step calls the public one_way_platform_step entry and checks register sentinels; emit_state records diagnostics. Your game can call the public entry directly, remove the diagnostics and consume the documented outputs.
Bindings, buildable caller and include order
section code,code_c
CUSTOM = 0
BROKEN = 0
COYOTE_STEPS = 4
BUFFER_STEPS = 4
TEXT_CAP = 8
PROPERTY_COUNT = 16
STREAM_BYTES = 13
CRC_POLY = 7
include "caller.inc"
include "exercise.inc"
component_start:
include "component.inc"
include "data.inc"
include "cases.inc"
even
include "display.inc"
include "../../framework/turn-deadline/font.inc"
code_end:
STATE:
LANDED: dc.b 0
SNAP: dc.b 0
ACTOR_X: dc.b 0
ACTOR_W: dc.b 0
PREV_BOTTOM: dc.b 0
NEW_BOTTOM: dc.b 0
PLATFORM_X: dc.b 0
PLATFORM_W: dc.b 0
PLATFORM_Y: dc.b 0
DROP: dc.b 0
even
ready: dc.w 0
preview: dcb.b 8,0
OUTPUT: dcb.b 1300,0
even
signature: dc.b "198XPLAYTOOLS00",0
even
copperlist:
dc.w $08e,$2c81,$090,$2cc1,$092,$0038,$094,$00d0
dc.w $100,$1200,$102,0,$104,0,$108,0,$10a,0
dc.w $180,$012,$182,$fff
copbpl:
dc.w $0e0,0,$0e2,0
dc.w $ffff,$fffe
plane: dcb.b 10240,0A separate client retaining state between calls
preview_rules:
ifne CUSTOM
move.b #20,ACTOR_X
move.b #16,ACTOR_W
move.b #90,PREV_BOTTOM
move.b #110,NEW_BOTTOM
move.b #10,PLATFORM_X
move.b #64,PLATFORM_W
move.b #100,PLATFORM_Y
move.b #1,DROP
ifne BROKEN
bsr checked_step
move.b NEW_BOTTOM,d0
cmp.b PLATFORM_Y,d0
beq.s bad_platform_done_0_custom
move.b d0,SNAP
clr.b LANDED
bad_platform_done_0_custom:
else
bsr checked_step
endif
bsr emit_state
else
move.b #20,ACTOR_X
move.b #16,ACTOR_W
move.b #90,PREV_BOTTOM
move.b #110,NEW_BOTTOM
move.b #10,PLATFORM_X
move.b #64,PLATFORM_W
move.b #100,PLATFORM_Y
move.b #0,DROP
ifne BROKEN
bsr checked_step
move.b NEW_BOTTOM,d0
cmp.b PLATFORM_Y,d0
beq.s bad_platform_done_0
move.b d0,SNAP
clr.b LANDED
bad_platform_done_0:
else
bsr checked_step
endif
bsr emit_state
endif
rtsThe display fields are LANDED, SNAP, ACTOR_X, ACTOR_W, PREV_BOTTOM, NEW_BOTTOM, PLATFORM_X, PLATFORM_W; later state bytes are retained in the full packet. Each is one hexadecimal byte. The normal row is 01 64 14 10 5A 6E 0A 40. This is a completed state observation, not a recording of an actual character jumping, a camera scrolling or an asset being displayed.
Make it your own
The custom caller sets DROP to 1. The same downward crossing now passes through the platform, returning LANDED zero and SNAP equal to the proposed bottom 110. The caller decides how long drop-through remains active.
Maintained custom configuration or caller
section code,code_c
CUSTOM = 1
BROKEN = 0
COYOTE_STEPS = 2
BUFFER_STEPS = 2
TEXT_CAP = 4
PROPERTY_COUNT = 16
STREAM_BYTES = 13
CRC_POLY = 49
include "caller.inc"
include "exercise.inc"
component_start:
include "component.inc"
include "data.inc"
include "cases.inc"
even
include "display.inc"
include "../../framework/turn-deadline/font.inc"
code_end:
STATE:
LANDED: dc.b 0
SNAP: dc.b 0
ACTOR_X: dc.b 0
ACTOR_W: dc.b 0
PREV_BOTTOM: dc.b 0
NEW_BOTTOM: dc.b 0
PLATFORM_X: dc.b 0
PLATFORM_W: dc.b 0
PLATFORM_Y: dc.b 0
DROP: dc.b 0
even
ready: dc.w 0
preview: dcb.b 8,0
OUTPUT: dcb.b 1300,0
even
signature: dc.b "198XPLAYTOOLS00",0
even
copperlist:
dc.w $08e,$2c81,$090,$2cc1,$092,$0038,$094,$00d0
dc.w $100,$1200,$102,0,$104,0,$108,0,$10a,0
dc.w $180,$012,$182,$fff
copbpl:
dc.w $0e0,0,$0e2,0
dc.w $ffff,$fffe
plane: dcb.b 10240,0The custom row is 00 6E 14 10 5A 6E 0A 40. These records qualify the named builds and inputs; another layout, format or input domain needs explicit bounds and fresh execution evidence.
Common mistake and repair
The wrong client retains a contact only when the proposed bottom equals the platform top. It discards the correctly detected 90→110 crossing of top 100, so a fast fall misses the surface. Compare the interval crossed, not just equality at the endpoint.
Select the deliberately wrong client
section code,code_c
CUSTOM = 0
BROKEN = 1
COYOTE_STEPS = 4
BUFFER_STEPS = 4
TEXT_CAP = 8
PROPERTY_COUNT = 16
STREAM_BYTES = 13
CRC_POLY = 7
include "caller.inc"
include "exercise.inc"
component_start:
include "component.inc"
include "data.inc"
include "cases.inc"
even
include "display.inc"
include "../../framework/turn-deadline/font.inc"
code_end:
STATE:
LANDED: dc.b 0
SNAP: dc.b 0
ACTOR_X: dc.b 0
ACTOR_W: dc.b 0
PREV_BOTTOM: dc.b 0
NEW_BOTTOM: dc.b 0
PLATFORM_X: dc.b 0
PLATFORM_W: dc.b 0
PLATFORM_Y: dc.b 0
DROP: dc.b 0
even
ready: dc.w 0
preview: dcb.b 8,0
OUTPUT: dcb.b 1300,0
even
signature: dc.b "198XPLAYTOOLS00",0
even
copperlist:
dc.w $08e,$2c81,$090,$2cc1,$092,$0038,$094,$00d0
dc.w $100,$1200,$102,0,$104,0,$108,0,$10a,0
dc.w $180,$012,$182,$fff
copbpl:
dc.w $0e0,0,$0e2,0
dc.w $ffff,$fffe
plane: dcb.b 10240,0
The BROKEN branch is visible in the client. repaired.asm restores the normal selection; its executable matches demo exactly. Spectrum tape filenames may differ while loaded CODE remains identical. The fault is a labelled experiment, not a suggested alternative.
Cost, limits and verification
The measured layout has 180 code bytes, 0 immutable data bytes and 10 private state bytes. Alignment, stack usage, diagnostic tables and display machinery are additional. The extents come from the loaded program’s symbols, not from counting source lines.
Two horizontal interval comparisons and two vertical comparisons, with no per-pixel stepping. On 6502/Z80 a carry from an endpoint addition represents an endpoint beyond 255; 68000 uses widened words. The caller’s search over platforms is additional work.
This tests a horizontal one-way top, not walls, ceilings, slopes or a full swept-AABB solver. Teleports and large coordinate jumps need an explicit policy. Moving platforms also need relative motion and carried movement. The static rectangle-overlap routines remain useful for other contact tests.
Four native runs use A500 OCS PAL with Kickstart 1.3 and an OFS cold-boot disk; Asm198x 0.0.72 and Emu198x 0.44.2, with Build198x 0.2.9 for disk mastering. Each checks 64 boundary/varied/error cases, dirty initialisation and every state of a separate sequential client against an independent integer model. This is not exhaustive coverage of every possible byte combination. Source/tool/firmware hashes, immutable loaded code/data, native startup/completion, preserved-register sentinels, helper/data sizes, screenshot bytes/pixels and exact repair are checked. Deliberately altered observations must fail. Firmware is hashed, never distributed.