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.

2.3 KB
Raw Blame
mov rbp,0x10100000
cmp dword [rbp],0
jnz a
mov dword [rbp],1
mov dword [rbp+4],68
mov dword [rbp+8],20480
mov dword [rbp+12],24576
mov dword [rbp+16],220
mov dword [rbp+20],-384
xor ecx,ecx
ib:
cmp ecx,50
jae a
mov eax,ecx
xor edx,edx
mov ebx,10
div ebx
inc eax
mov [rbp+rcx*4+64],eax
inc ecx
jmp ib
a:
test r13d,1
jz b
sub dword [rbp+4],3
b:
test r13d,2
jz pc
add dword [rbp+4],3
pc:
cmp dword [rbp+4],2
jge p2
mov dword [rbp+4],2
p2:
cmp dword [rbp+4],134
jle bxs
mov dword [rbp+4],134
bxs:
mov eax,[rbp+8]
add eax,[rbp+16]
cmp eax,512
jge bx2
mov eax,512
neg dword [rbp+16]
bx2:
cmp eax,39936
jle bx3
mov eax,39936
neg dword [rbp+16]
bx3:
mov [rbp+8],eax
call hb
test eax,eax
jz by
neg dword [rbp+16]
by:
mov eax,[rbp+12]
add eax,[rbp+20]
cmp eax,512
jge by2
mov eax,512
neg dword [rbp+20]
by2:
cmp eax,29952
jle by3
mov eax,29952
neg dword [rbp+20]
by3:
mov [rbp+12],eax
call hb
test eax,eax
jz cp
neg dword [rbp+20]
cp:
cmp dword [rbp+20],0
jle drw
mov eax,[rbp+12]
sar eax,8
cmp eax,105
jl drw
cmp eax,111
jg drw
mov ebx,[rbp+8]
sar ebx,8
mov ecx,[rbp+4]
sub ecx,2
cmp ebx,ecx
jl drw
add ecx,28
cmp ebx,ecx
jg drw
neg dword [rbp+20]
sub ebx,[rbp+4]
sub ebx,12
imul ebx,ebx,24
mov [rbp+16],ebx
drw:
mov rdi,r15
xor ecx,ecx
clr:
cmp ecx,19200
jae db0
mov dword [rdi+rcx*4],0x101420
inc ecx
jmp clr
db0:
xor esi,esi
dl0:
cmp esi,50
jae dp
mov eax,[rbp+rsi*4+64]
test eax,eax
jz dn
imul edx,eax,0x283044
xor edx,0xFF2030
mov eax,esi
push rdx
xor edx,edx
mov ebx,10
div ebx
mov r9d,eax
imul r9d,r9d,8
add r9d,12
mov r8d,edx
imul r8d,r8d,15
add r8d,4
pop rdx
mov r10d,13
mov r11d,6
call dr
dn:
inc esi
jmp dl0
dp:
mov r8d,[rbp+4]
mov r9d,108
mov r10d,24
mov r11d,4
mov edx,0x33EEFF
call dr
mov r8d,[rbp+8]
sar r8d,8
mov r9d,[rbp+12]
sar r9d,8
mov r10d,3
mov r11d,3
mov edx,0xFFFFFF
call dr
xor eax,eax
jmp exit
hb:
mov eax,[rbp+12]
sar eax,8
sub eax,12
cmp eax,0
jl hm
cmp eax,40
jge hm
mov ecx,eax
shr ecx,3
mov eax,[rbp+8]
sar eax,8
sub eax,4
cmp eax,0
jl hm
cmp eax,150
jge hm
xor edx,edx
mov ebx,15
div ebx
cmp eax,10
jge hm
imul ecx,ecx,10
add ecx,eax
cmp dword [rbp+rcx*4+64],0
je hm
mov dword [rbp+rcx*4+64],0
mov eax,1
ret
hm:
xor eax,eax
ret
dr:
mov eax,r9d
imul rax,r14
lea rdi,[r15+rax]
lea rdi,[rdi+r8*4]
mov ebx,r11d
dy:
xor ecx,ecx
dxl:
cmp ecx,r10d
jae dyn
mov [rdi+rcx*4],edx
inc ecx
jmp dxl
dyn:
add rdi,r14
dec ebx
jnz dy
ret