Skip to content

Qwen3-0.6B inference (12 KB), bare-metal bootable OS (22 KB), and from-scratch Mini-GPT trainer with live Braille TUI (32 KB) in 100% pure x86-64 NASM assembly. Zero C, zero libc, zero dependencies.

1.6 KB
Raw Blame
mov rbp,0x10100000
cmp dword [rbp],0
jnz a
mov dword [rbp],1
mov dword [rbp+4],40
mov dword [rbp+8],10
mov dword [rbp+3424],1
mov dword [rbp+3744],2
mov dword [rbp+4064],3
a:
inc dword [rbp+12]
test r13d,1
jz b
cmp dword [rbp+4],2
jle b
dec dword [rbp+4]
b:
test r13d,2
jz c
cmp dword [rbp+4],77
jge c
inc dword [rbp+4]
c:
test r13d,4
jz d
cmp dword [rbp+8],2
jle d
dec dword [rbp+8]
d:
test r13d,8
jz e
cmp dword [rbp+8],56
jge e
inc dword [rbp+8]
e:
test r13d,16
jz f
mov eax,[rbp+8]
imul eax,eax,80
add eax,[rbp+4]
cmp dword [rbp+rax*4+64],0
jnz f
mov ecx,[rbp+12]
and ecx,3
jnz g
mov ecx,1
g:
mov [rbp+rax*4+64],ecx
f:
mov r8d,58
sy:
cmp r8d,0
jl ren
mov r9d,1
sx:
cmp r9d,79
jge syn
mov eax,r8d
imul eax,eax,80
add eax,r9d
mov ecx,[rbp+rax*4+64]
test ecx,ecx
jz sxn
lea ebx,[rax+80]
cmp dword [rbp+rbx*4+64],0
jnz dg
mov [rbp+rbx*4+64],ecx
mov dword [rbp+rax*4+64],0
jmp sxn
dg:
mov edx,r8d
add edx,[rbp+12]
and edx,1
shl edx,1
sub edx,1
lea esi,[r9d+edx]
cmp esi,1
jl sxn
cmp esi,78
jg sxn
lea esi,[rbx+rdx]
cmp dword [rbp+rsi*4+64],0
jnz sxn
mov [rbp+rsi*4+64],ecx
mov dword [rbp+rax*4+64],0
sxn:
inc r9d
jmp sx
syn:
dec r8d
jmp sy
ren:
xor r8d,r8d
ry:
cmp r8d,60
jae fin
xor r9d,r9d
rx:
cmp r9d,80
jae ryn
mov eax,r8d
imul eax,eax,80
add eax,r9d
mov ecx,[rbp+rax*4+64]
mov edx,0x101420
test ecx,ecx
jz rc
imul edx,ecx,0x101800
add edx,0xC09020
rc:
cmp r9d,[rbp+4]
jne rp
cmp r8d,[rbp+8]
jne rp
mov edx,0xFFFFFF
rp:
mov eax,r8d
shl eax,1
imul rax,r14
mov ebx,r9d
shl ebx,1
lea rdi,[r15+rax]
lea rdi,[rdi+rbx*4]
mov [rdi],edx
mov [rdi+4],edx
add rdi,r14
mov [rdi],edx
mov [rdi+4],edx
inc r9d
jmp rx
ryn:
inc r8d
jmp ry
fin:
xor eax,eax
jmp exit