I am attempting to learn Assembly (x86 Assembly on Windows using NASM) but am having trouble understanding what this is doing.

Can someone please explain line by line what this code is doing? I have commented the lines that I think I know what they do, but I'm not sure.

section .text ;text section : Where the code goes
org 0x100 ;Start location of the program?
	mov ah, 0x9 ;No idea
	mov dx, hello ;Moves hello into dx, not sure what dx is though (I know its a register)
	int 0x21 ;calls the OS interupt, to make it output?
	mov ax, 0x4c00 ;No idea
	int 0x21 ;Calls it again?
section .data ;Data section : where variables are stored
hello: db 'Hello, world!', 13, 10, '$' ; Don't get the '$' at the end

Thank you to anyone who helps me with this.

7 Years
Discussion Span
Last Post by Ancient Dragon

mov ax, 0x9 has to do with the outputting?

What is the other int 0x21 for?


int 21h is a general purpose interrupt with many different functions -- each function is identified by the value of the ax register. google for in21 functions and you will find them all.

If you want to learn assembly then the place to look is in a good book.


I understand this code now, thank you. Can you recommend any books?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.