A saved score or a small asset can pick up an accidental changed byte. A streaming checksum gives the loader something to compare before using the data, without needing to hold a second copy of the whole message.

Include, initialise and call
Reserve CRC, DATA as 2 contiguous private bytes in that order. Include the helper once. Call streaming_crc8_init at the intended reset boundary: it clears every named byte, including input fields. Set the starting values afterwards, then call streaming_crc8_step for each intended service.
Initialise, feed the counted payload bytes one at a time and store the final CRC separately. A reader recomputes over the same span and compares with the stored value. Do not accidentally include the stored checksum in one side’s payload but exclude it on the other.
CRC is the retained eight-bit remainder and DATA is the next input byte. Initialise once per message, then call step for each byte in order. This is a non-reflected, left-shifting CRC with initial remainder zero and no final XOR; the qualified polynomials are 07 and 31, with the x⁸ term implicit. DATA survives and CRC is replaced. Producer and consumer must agree on every parameter and the exact covered bytes.
Reusable initialisation and service
; SPDX-License-Identifier: MIT
; A Streaming CRC-8. Contiguous private bytes: CRC, DATA.
; 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.
streaming_crc8_init:
clr.b CRC
clr.b DATA
rts
streaming_crc8_step:
move.b CRC,d0
move.b DATA,d2
eor.b d2,d0
moveq #7,d1
crc_bit:
add.b d0,d0
bcc.s crc_next
eori.b #CRC_POLY,d0
crc_next:
dbra d1,crc_bit
move.b d0,CRC
rts
component_end:State, registers and ownership
Two bytes, one persistent remainder and one input. The demonstration feeds the ASCII bytes of 123456789. It finishes at hexadecimal F4 for polynomial 07 and A2 for polynomial 31. These are this implementation’s directly checked message results, not a claim that every CRC-8 convention has the same answer.
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 streaming_crc8_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:
CRC: dc.b 0
DATA: 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 #49,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #50,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #51,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #52,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #53,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #54,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #55,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #56,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #57,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
else
move.b #49,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #50,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #51,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #52,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #53,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #54,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #55,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #56,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
move.b #57,DATA
ifne BROKEN
move.b #0,CRC
bsr checked_step
else
bsr checked_step
endif
bsr emit_state
endif
rtsThe display fields are CRC, DATA; remaining display fields are zero. Each is one hexadecimal byte. The normal row is F4 39 00 00 00 00 00 00. 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 build uses polynomial 31 instead of 07. Both are complete specified parameter sets here; changing the polynomial on only one side makes otherwise identical payloads disagree.
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:
CRC: dc.b 0
DATA: 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 A2 39 00 00 00 00 00 00. 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 clears CRC before every byte. Only the last byte contributes to the final result, which becomes AF for the normal polynomial instead of F4. Reset once at the message boundary, then retain the remainder between calls.
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:
CRC: dc.b 0
DATA: 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 46 code bytes, 0 immutable data bytes and 2 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.
Exactly eight bit stages per input byte, with a conditional polynomial XOR in each stage. No lookup table is required. A 256-byte table can trade ROM space for fewer per-byte operations, but that is a separate implementation and is not measured here.
An eight-bit CRC has only 256 results and cannot detect every possible change. It checks accidental corruption; it is not authentication or protection against someone deliberately editing a save. Wider CRCs, table-based updates and other parameter conventions need separate contracts and vectors. Saving atomically and validating the file length remain separate concerns.
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.