Want more features on Pastebin? Sign Up, it's FREE!
Guest

33 byte sierpinski fractal

By: a guest on Jul 17th, 2011  |  syntax: None  |  size: 0.96 KB  |  views: 26,592  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ; Tri.asm - sierpinski fractal, assembles to 33 bytes.  Tested using TASM.
  2. ; Note - only compatible with MS-DOS, due to startup register state.
  3. ; Originally written by James Smith
  4. ; Modifications by Daniel Deptford (redmercury@gmail.com)
  5.  
  6. ; If some of the registers look to be initially set in an "undefined" state, that's
  7. ; because MS-DOS actually sets them to be in a known state at startup.
  8.  
  9.  
  10. .model tiny
  11. CODESEG
  12. STARTUPCODE
  13.         lds si,[bx]
  14.          mov al,13h           ; initialise graphics mode:
  15.          int 10h              ; 320x200x256 at 0xa000
  16. ; Do the triangle
  17.          push ds
  18.          pop si
  19. looper: xor al,[si]           ; Initially assumes al=0. Ok?
  20.          mov [si-319],al
  21.          mov al,[si]
  22.          dec si
  23.          jnz looper
  24.          int 16h              ; keystroke? ah is already 0
  25. ; Tidy up
  26.          mov ax,3              ; return from graphics mode,
  27.          int 10h              ; back to text
  28.          ret
  29. ENDS
  30. END
clone this paste RAW Paste Data