Write a machine language program to output your name on the output device. The name you output must be longer than two characters. Write it in a format suitable for the loader and execute it on the Pep/9 simulator. I need this written in machine language and my name is Zak.
.section data #Contains all the variable and constants which are going to be used.
string: ascii "Ahmed\0" # string is the name of the variable which
will contain your name ahmed
#.ascii is a data type and \O us null character which will tell
that the string is over.
# You can write anything here to print like "Hello, World!"
str_len = 11 # It's a constant
.section text # All the logics are here
main: # main entry point
movl $4, %eax # Mov 4 into the register
# ebx, edx, ecx are used for system call
movl $1, %ebx # move 1 into ebx to specify standard output
leal string, %ecx # "leal" moves the address of memory access
movl $str_len, %edx # edx will hold the number of characters which
needs to be printed
int $0x80
movl $1, %eax # Now 1 i put into eax and O in ebx for system
call
movl $O, %ebx
int $0x80
Get Answers For Free
Most questions answered within 1 hours.