pouët.net

Christmas Diamonds

Diamond for MS-DOS in 8086 assembly

Author: dmsc
Category: Christmas Challenge
System:   IBM PC and Compatibles
Language: Assembler
Len source code: 144
Len exe file:    32
Len code only:   32
Instructions:
  You can run the DIAMOND.COM executable in a DOS windows, remember to type CLS
  first to clear the screen.

  The included floppy disk image boots to MS-DOS 3.3, type DIAMOND at the DOS
  prompt to run the program.

  Note that this program does not terminate, and can take a few seconds to draw
  the complete pattern.

Description:
  This program calculates the position of the stars to draw using two different
  formulas:
            X = (N - 1) % 18
            Y = (N + 1) % 24

  And:
            X = 18 - (N - 1) % 18
            Y = (N + 1) % 24

  The first formula produces the descending diagonal lines, and the second
  formula produces the ascending diagonals.

  Only the points with Y >= 5 are plotted, this leaves 4 blank lines at the
  top of the screen.

  To assemble the program, use NASM, or AS86 or other similar assembler.

Comments:
  I included two source files, a commented one and a minimized source that is
  only 144 bytes of size.