Assembly Code is hardest(i think) programming language in whole world! its low-level programming language because when you compile and run your assembly application you are directly contacting with Microprocessor and you are closest to hardware. Assembly code isn't like other high-level languages, for example you can't make a program for Graphis card or you can't assembly nothing with C++. Many operating systems are maked in Assembly Code (Linux, DOS...). Every compiled Assembly application is coded directly in binary code.
Im gonna show you basic text printing program in assembly.
- Code: Select all
ORG 100h
mov ah, 09
mov dx, msg
int 21h
mov ah, 01
int 21h
mov ah, 4Ch
int 21h
msg db 'Hello World!', 0Ah, '$'
Now explanation:
That is place in memory where we want to put our program. Thats standard for basic programs. In english it means "ORGANIZE 100h" 100h is hexadecimal number.
- Code: Select all
ORG 100h
We are moving a value of 9 in AH, but whats AH? every processor have 4 general registers where he stores data(ax,bx,cx,dx), AH means A HIGH, why HIGH? because we want to set register A to run first, or if we type AL(wich means A LOW) the A register will run after all HIGH set registers are executed. There is alot of register 16-bytes register, 32-byt and 64-byt. These ones are 16-byt. And by the way why we are moving 9 bytes in AH? because when we move 9 thats means that we are going to print some text.
- Code: Select all
mov ah, 09
This one means that we are creating and moving variable "msg" to dx register. If you want to print some text in assembly applications you are need to create variable and give it a value(insert a text in variable).
- Code: Select all
mov dx, msg
Int 21h means that you are going to execute all command that you are typed above, and to stop all other.(mov dx, msg and other...)
- Code: Select all
int 21h
We are moving a value of 1 to register ah, we told microprocessot that we are making PAUSE command in program, so the program will wait keyboard input.
- Code: Select all
mov ah, 01
This means, after keyboard input, exit the program.
- Code: Select all
mov ah, 4Ch
And finaly! we are giving string value to our 'msg' variable! and then print it.
- Code: Select all
msg db 'Hello World!', 0Ah, "$"
Happy Coding!
-Th3V01D-






