Skip to content

Instantly share code, notes, and snippets.

@shermnonic
Last active April 15, 2026 20:14
Show Gist options
  • Select an option

  • Save shermnonic/c6e1a01bd9b7ca60251f873ffffcda88 to your computer and use it in GitHub Desktop.

Select an option

Save shermnonic/c6e1a01bd9b7ca60251f873ffffcda88 to your computer and use it in GitHub Desktop.
bvis238 for TweetX86
; My favourite effect code formatted to be pasted here http://twt86.co/
; 386dx25.de
mov ax, 13h
int 10h
push 0A000h
pop es
MAINLOOP
mov di, VBUF+320
mov cx, 64000 - 2*320
CONV
xor ax, ax
add ax, [di-1] ; Sum up kernel taps
add ax, [di+1]
add ax, [di-320]
add ax, [di+320]
sub ax, 4*31 ; Use VGA palette gradient between 31 and 95
shr ax, 2 ; Average (/4) for diffusion
and al, 63
add al, 31+1 ; Increment for dynamics, and shift to palette
mov [di], al ; Update pixel at [di]
inc di
loop CONV
mov si, VBUF
xor di, di
mov cx, 64000 / 4
rep movsd
in al, 60h
and al, 127
dec al
jnz MAINLOOP
VBUF db "386dx25"

Run the code on twt86.co

Binary code in base64 encoding:

uBMAzRBoAKAHv4EBuYD3McADRf8DRQEDhcD+A4VAAYPofMHoAiQ/BCCIBUfi4b5BADH/uYA+82al5GAkf/7IdcgzODZkeDI1

bvsi238

@shermnonic

Copy link
Copy Markdown
Author

Size-coding attempt:

  • les trick
  • no VBUF
  • ds = es for direct video mem access via [di+x]
  • no clean palette shift
  • no escape ;-)
        mov     al, 13h
        int     10h
        les     bx, [0]
        push    es
        pop     ds
MAINLOOP
        mov     cx, 64000 - 2*320
CONV
        xor     ax, ax
        add     ax, [di-1]      ; Sum up kernel taps
        add     ax, [di+1]
        add     ax, [di-320]
        add     ax, [di+320]

        shr     ax, 2           ; Average (/4) for diffusion
        and     al, 63
        add     al, 33          ; Magic increment
        
        stosb                   ; Update pixel
        loop    CONV
        jmp     MAINLOOP

Run on twt86.co
Base64: sBPNEMQeAAAGH7mA9zHAA0X/A0UBA4XA/gOFQAHB6AIkPwQhquLm6+E=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment