; Tri.asm - sierpinski fractal, assembles to 33 bytes. Tested using TASM.
; Note - only compatible with MS-DOS, due to startup register state.
; Originally written by James Smith
; Modifications by Daniel Deptford (redmercury@gmail.com)
; If some of the registers look to be initially set in an "undefined" state, that's
; because MS-DOS actually sets them to be in a known state at startup.
.model tiny
CODESEG
STARTUPCODE
lds si,[bx]
mov al,13h ; initialise graphics mode:
int 10h ; 320x200x256 at 0xa000
; Do the triangle
push ds
pop si
looper: xor al,[si] ; Initially assumes al=0. Ok?
mov [si-319],al
mov al,[si]
dec si
jnz looper
int 16h ; keystroke? ah is already 0
; Tidy up
mov ax,3 ; return from graphics mode,
int 10h ; back to text
ret
ENDS
END