Oh, and you haven't had fun until you've written PowerPC assembly.

Archived topic from Iceteks, old topic ID:2393, old post ID:22488
Code: Select all
.data
hello_message db 'Hello, World!',0dh,0ah,'$'[code]
This creates a string variable. 0dh and 0ah are hex codes for 13 and 10. Those are ASCII codes which DOS uses to represent a newline and carriage return. The $ is the character DOS considers the termination of a string, much as just about every other system considers the null byte.
[code] mov ax,@data
mov ds,ax[code]
This initializes the computer. It tells the CPU where to find the data in the program in memory.
[code] mov ah,9[code]
This sets the mode to "output a string".
[code] mov dx,offset hello_message[code]
This stores the location of the string variable.
[code] int 21h[code]
This calls interrupt 33 in BIOS which does the actual work of printing out the string.
[code] mov ax,4C00h[code]
This sets the mode to "end the program and clean up".
[code] int 21h[code]
Again, we call interrupt 33 in BIOS which does the exiting and cleaning up.
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:2393, old post ID:22490[/size][/color]