Hi Andy,
Good! It's an appropriate day to appreciate what we got from our mothers, whether they're still around or not. Happy Mother's Day to anyone qualified! No reason you can't have a good day in any case.
There's a generic answer to "Why doesn't my code work?": "Something you believe to be true is not true." To get more specific than that, we'll probably need more information. What did you do? What happened? Nasm's job is to "shut up and assemble", ld's is to "shut up and link". If you see any output from either, pay close attention - often there's a clue there. When you try to run it, do you get no output, garbage output, "can't execute binary file", or what? The most confusing one I've seen is "no such file"... even though "myprog" is right there! It's because, by default, ld looks for "/lib/ld-linux,so.1" and only "...so.2" exists. You shouldn't run into that unless you're trying to link against C (or other) libraries. Easiest fix is to use gcc, but we can tell ld the "right" interpreter/dynamic-linker, too.
Here's a 64-bit example. Maybe you'll have better luck with it.
; nasm -f elf64 myprog.asm
; ld -o myprog myprog.o
global _start
section .data
msg db "Hello 64-bit world!", 10
msg_size equ $ - msg
section .text
_start:
mov rdi, 1
mov rsi, msg
mov rdx, msg_size
mov rax, 1
syscall
mov rdi, 42
mov rax, 3Ch
syscall
As Betov used to say, "Courage!"
Best,
Frank