Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an assembly program that will create a word namely “number” and assign it

ID: 3722786 • Letter: W

Question

Write an assembly program that will create a word namely “number” and assign it a value of 0x000F. [Remember this value is stored in binary form in the computer] Your program should store the binary representation of the ‘number’ in a ‘strOut’ variable and do the sys_write call to print out the binary representation in the standard output in 16 bit form.
The output will look like this
0000000000001111
Write an assembly program that will create a word namely “number” and assign it a value of 0x000F. [Remember this value is stored in binary form in the computer] Your program should store the binary representation of the ‘number’ in a ‘strOut’ variable and do the sys_write call to print out the binary representation in the standard output in 16 bit form.
The output will look like this
0000000000001111
Write an assembly program that will create a word namely “number” and assign it a value of 0x000F. [Remember this value is stored in binary form in the computer] Your program should store the binary representation of the ‘number’ in a ‘strOut’ variable and do the sys_write call to print out the binary representation in the standard output in 16 bit form.
The output will look like this
0000000000001111

Explanation / Answer

section .text global _start ;must be declared for linker (gcc) _start: ;tell linker entry point mov edx,1 ;message length mov ecx,strIut ;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 strOut DB 'number' cx = 16 ; 16 bits to output bin_loop: rcl al,1 ; move most significant bit into CF setc bl ; bl = 0 or 1 by CF (80386 instruction) add bl,'0' ; turn that 0/1 into '0'/'1' ASCII char call display_bl ; must preserve al and cx loop bin_loop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote