Assembling the code is how assembly is translated to machine code.The process is done by a utility program called an assembler.
Op-code is represented by a mnemonic that performs the low level operation or task.
Assembler
When translating to op-codes , the symbolic names and mnemonics are resolved to object codes.
Here is some example code for Hello World program on x86 DOS:
.model tiny
.code
org 100h
main proc
mov ah,9 ; Display String Service
mov dx,offset hello_message ; Offset of message (Segment DS is the right segment in .COM files)
int 21h ; call DOS int 21h service to display message at ptr ds:dx
retn ; returns to address 0000 off the stack
; which points to bytes which make int 20h (exit program)
hello_message db 'Hello, world!$'
main endp
end main
OUTPUT:
Hello, world!
No comments:
Post a Comment