Skip to content

Test 1: the dot on a flat plane

This is the first program of the game. The two sides work together: Fortran (the B side) calculates, and Assembly (the A side) draws. The panels show the work for the yellow dot, at the moment it is on the line.

A cassette tape with a handwritten label: "A Side. Assembly - the first language of the machine."

A What the machine does

The routine sine_y and the pixel write, for the dot on the screen now.

    Waiting for the copy of the PC to start…

    Speed:

    The buttons press the keys of the program: 1 to 5 for the speed, Space for pause, N for one step. The panels follow the yellow dot at each speed.

    A cassette tape with a handwritten label: "B Side. Fortran, the language that speaks maths."

    B The maths behind it

    What the Fortran laboratory calculated for this angle, before the game ran.

      How it works

      1. B The laboratory (lab/sine_table.f90) calculates 256 sine values. The 8086 has no verbs for decimal-point numbers. Thus, Fortran changes each value into a whole number: 256 means 1.0.
      2. A The game (src/spike.asm) reads the table, draws the curve, and moves a yellow dot along it. It waits for each screen refresh, so the dot does not tear. The keys 1 to 5 change the speed, Space pauses, N moves one step, and Esc stops the program.
      3. A The test (test/check.asm) runs the same routine (src/sine_y.inc) for all 256 angles in DOSBox without a screen. It writes the answers to a file.
      4. B The checker (lab/check_y.f90) calculates the same answers again and compares them. If one answer is different, GitHub Actions stops and does not publish the site.
      The two sides agree
      256 / 256
      answers from the check
      Error from exact maths
      1 px
      the cost of whole-number arithmetic
      Size of the game
      760 bytes
      SPIKE.COM, 8086 instructions only
      Size of the table
      512 bytes
      256 values, 2 bytes each

      Next: test 2a gives the same dot a third direction, depth. All tests are on the game page.

      The words that each program uses

      Each program is a text in its language. The pills show the words that the dictionaryalready has. "New words" are real words of the language that the dictionary does not have yet: they are good words to learn next.

      A src/spike.asm· 136 lines · The game (test 1): draws the curve and moves the dot

      43 dictionary words: MOVAXBXDXSIDIES[ ]BYTEDBDWXLATADDSUBINCMULANDORXORCMPTESTJMPJE / JZJNE / JNZJB / JACALLRETlabel:ORGBITS%includeINCBIN;,hINTINT 16h, AH=00hINT 16h, AH=01hINT 10h, AX=0013hINT 10h, AX=0003hINA000h3DAh

      New words (2): ALCPU

      A src/sine_y.inc· 19 lines · The shared routine: one angle in, one screen row out

      15 dictionary words: MOVAXBXCXSI[ ]ADDIMULNEGSHLSARRETlabel:;,

      New words (1): CL

      A test/check.asm· 42 lines · The test: runs sine_y for 256 angles and writes the rows to a file

      23 dictionary words: MOVAXBXCXDXSI[ ]DBINCXORCMPJB / JACALLlabel:ORGBITS%includeTIMESINCBIN;,hINT

      New words (4): AHALCPUJC

      B lab/sine_table.f90· 27 lines · The laboratory: makes the sine table

      26 dictionary words: INTEGERREAL::=PARAMETERINT8 / INT16REAL64+ -* /( )SIN / COSNINTINT( )DOMAXVAL / MINVALPROGRAMENDUSEIMPLICIT NONE!PRINTWRITEOPENCLOSE'(F8.2)'ISO_FORTRAN_ENV

      New words (3): ACOSINTRINSICONLY

      B lab/check_y.f90· 48 lines · The checker: compares the A-side rows with its own answers

      37 dictionary words: INTEGERREAL::=PARAMETERINT8 / INT16REAL64+ -* /( )ABSSIN / COSNINTINT( )IANDISHFT / SHIFTAIF ... THEN ... END IFDOSTOPERROR STOPMERGE== /= < > <= >=MAXVAL / MINVALCOUNTPROGRAMENDUSEIMPLICIT NONE!&PRINTWRITEREADOPENCLOSE'(F8.2)'ISO_FORTRAN_ENV

      New words (4): ACOSINTRINSICONLYTRIM

      The copy of the PC

      The page uses js-dos 8.4.1, a copy of DOSBox that runs in the browser. This site keeps its own copy of the files, so the player does not load code from other servers. The side menu of the player is hidden. js-dos uses the GNU General Public License version 2: see the notice and thelicense.