Conway in NASM

And here we go again with vibe coding: this time with Claude, I translated the Turbo Pascal version of Conway into Netwide Assembler or NASM for Linux 64-bit.

In comparison with previous experiments I did with ChatGPT (like the ones for Scala or ANSI C) I had the impression of having to go through one or two more iterations than with ChatGPT, to correct some compiler and linker errors.

Other than that, the final result was 100% functional and perfect, and I have the impression that Claude is slightly faster in code generation than ChatGPT. All in all, as you can imagine, I’m impressed, and I’ll keep on exploring.

The result, as usual, it’s available on GitLab:

section .bss
    world resq SIZE * SIZE          ; Current world state
    world_copy resq SIZE * SIZE     ; Copy for evolution
    generation resq 1               ; Generation counter

section .text
    global main
    extern printf, nanosleep, exit

main:
    push rbp
    mov rbp, rsp

    ; Initialize world
    call init_world

    ; Main loop
    call main_loop

    ; Exit program
    mov rdi, 0
    call exit

    pop rbp
    ret

So now I have a good opportunity to try to learn NASM, with a piece of code that does something I know very well.