pouët.net

Poprask by Řrřola [web]

; Poprask
; a 32-byte intro by Rrrola <rrrola@gmail.com>
; greets to everyone who thinks 32 bytes are not enough

; Why:
; I wanted to make a variation of Blake 32 (45-degree turns,
; [x,y] -> [x+y, y-x]) with a Zima-like nonlinearity.
; In the end I couldn't find a way to restrict all colors
; to 16..31 while keeping the nonlinearity, but it was fun.

; What is it:
; A recursive feedback fractal.
; The function is [x, y] -> [x + y*(y-x) + t, y - x + t/256].
; The blocking shape is two right triangles.

org 100h ; assume ah=0 bx=0 bp=09?? [0]=20cd [2]=9f??
  mov al,0x13
  int 10h      ; 320x200, 256 colors

M les si,[bx]  ; si=20cd(iteration) es=~9fff(screen segment)
  mul di       ; dh=y dl=x

L mov al,dh
  sub dh,dl
  mul dh       ; y*(y-x)
  sub dx,bp    ;<- add time, can be anywhere between L and dec
               ; (can modify the blocking shape)
  add dl,ah    ; cf = blocking shape hit?
  dec si       ; zf = last iteration? (si==0)
;  inc si      ; inverse colors
  jnbe L       ; end when blocked (cf) or last iteration (zf)

  xchg ax,si
  add ax,0xac53 ; al=0x1f-i ah=0xcd, close enough to 0xcccd
;  add ax,0xac42 ; al=0x10+i  ; inverse colors
  stosb

; You can save 1 byte, but the starting time will be random:
; use "sub dx,[fs:0x46c]" instead of "sub dx,bp"
; and remove these lines:
    loop M     ; do 65536 pixels before hlt (18.2 fps)
    hlt
    dec bp

  jmp M