In x86 assembly code Write a code that prints a line on the

In x86 assembly code:

Write a code that prints a line on the screen.

Solution

section   .text
   global _start       ;must be declared for using gcc
_start:                     ;entry point
   mov   edx, len    ;message length
   mov   ecx, msg    ;message to write
   mov   ebx, 1        ;file descriptor (stdout)
   mov   eax, 4        ;system call number (sys_write)
   int   0x80        ;call kernel
   mov   eax, 1        ;system call number (sys_exit)
   int   0x80        ;call kernel

section   .data

msg   db   \'Welcome to chegg\',0xa   ; string
len   equ   $ - msg           ;length of string

In x86 assembly code: Write a code that prints a line on the screen.Solutionsection .text global _start ;must be declared for using gcc _start: ;entry point mov

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site