Test 2b: wrong values, and the check
This is the program of test 2a with one wrong word. The assembler accepts it, and the program runs. But half of the values are wrong. The front half of the path looks correct. The back half is gone: its dots are all over the screen. This is why each test has a check.

A The wrong word
In path_point, the program halves (angle − 128) to make X = 1.5 × (angle − 128).
sar dx, 1right: SAR keeps the signshr dx, 1wrong: SHR puts a 0 in the top bit
The top bit of a 16-bit number is its sign. For a negative number, SHR clears it. Thus, a small negative number becomes a very large positive number.
Waiting for the copy of the PC to start…
Compare with the correct picture in test 2a. The floor is correct, because it does not use path_point.

B What the check sees
The correct answer from the laboratory, and the answer of the wrong program, for the dot now.
The check report
The test program runs the wrong routines for all 256 angles and writes the answers to P3DW.BIN. The checker (lab/check_3d.f90) compares them with its own answers. This is its output:
File: P3DW.BIN
A side and B side agree on 128 of 256 points
Largest difference from the exact maths: 14596 pixel(s)
ERROR STOP The A side and the B side disagree.Each square is one angle, from 0 (the back) to 255 (the front). Red: the check found a wrong answer. Green: the answer is correct. The outlined square is the dot on the screen now.
Why the build needs the check
- The assembler does not know what you mean.
SHRandSARare both correct 8086 words. NASM makes a program from each, with no warning. - A picture can hide an error. Here the error is easy to see. A difference of one pixel is not easy to see. In test 2a, a change of one number by one pixel made the check fail. The check sees each number, not the picture.
- The check names the wrong points. The list of wrong angles (0 to 127) shows where to look: only the negative numbers are wrong. That points to the sign, and to
SHR. - The check guards the site. GitHub Actions runs
game/build.shfor each change. If the check of a real test fails, the build stops, and the site does not change. For this page, the build does the opposite: it requires the check to fail on the wrong program. If the check does not find the error, the check itself is broken, and the build stops.
The wrong program comes from the same files as test 2a. NASM builds it with the switch -dWRONG_SIGN, which changes only the one word (see src/path3d.inc).
Next: test 3a turns the wave around the center of the 3D space.