Skip to content

Instantly share code, notes, and snippets.

@learosema
Last active August 27, 2023 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save learosema/a81938009bdca14e7dc0555e454efe64 to your computer and use it in GitHub Desktop.
Save learosema/a81938009bdca14e7dc0555e454efe64 to your computer and use it in GitHub Desktop.
Pseudorandom black and white pattern in DOS

Compile via NASM:

nasm.exe pattern.asm -fbin -o pattern.com
org 100h
section .text
entry: mov ax,0x13
int 0x10
mov di, 0xA000
mov es, di
xor di, di
mov cx, 0xfa00
loop: add bx, 0xf7ef
mov al,bl
mul bh
mov dx,di
ror dx,6
add ax,dx
and ax,1
dec ax
and ax, 0xf
mov es:[di],al
ror bx,6
inc di
dec cx
jnz loop
mov ah,0
int 0x16
mov ax,0x03
int 0x10
int 0x20
section .data
section .bss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment