Pointer offset trickery: one register as both offset and counter

Shift the pointers to the end of the buffer, negate width — and the loop runs until widthq crawls up to zero. No cmp, no separate counter.


    
Where the load points — [srcq + widthq]
[
srcq
+
widthq
] =
address
srcq has been moved past the end of the buffer in advance, so a negative widthq brings the address back inside. widthq grows toward zero — the window slides right.
Memory — src buffer, 32 bytes (1000–1031) · src2 = constants 10 (not shown)
CPU — registers
srcq
src pointer
1000
src2q
src2 pointer
2000
widthq
offset and counter
32
FLAGS:
m0empty
m1empty
read window [srcq+widthq] written back (+10) window marker