compiler code, need done before noon

Jun 25th, 2015
Steve1995
Category:
Computer Science
Price: $60 USD

Question description

The Assembly code compilation may be challenging, but the program has to be saved and submitted through a Notepad++ document. You can download notepad++ if you do not have a current copy. Clickhere to download the Notepad++ software. After you download the Notepad++ editor, type in your code and save it. Then it can be copied and pasted and run in an online compiler

Click here to compile and execute assembly code.

  1. Compile and execute the existing Assembly code on the left side of the screen. The following is the code that should be displayed: (Complineonline, n.d.) 

section .text

global _start ;must be declared for using gcc

_start: ;tell linker 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 'Hello, world!',0xa ;our dear string

len equ $ - msg ;length of our dear string

When you click on the compile and execute button, the following results in the right screen will display:

Compiling main.asm source code....
$nasm -f elf main.asm 2>&1

Linking the program....
$ld -m elf_i386 -s -o demo *.o 2>&1

Executing the program....
$demo

Hello, world!

2. Modify the code to display the following four lines:

Hello, world!

CE 242 is an awesome and fun class!

CTU is a great University!

I love the USA!

Part 3 Tasks: Week 5

  1. Convert the following binary code into ASCII Text. Please show your work and do not use an online converter.

01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000011 01010100 01010101

Write your full name in Binary code separated in bytes. For example, the name of the president of the USA in binary code is

Barak Obama

01000010

01100001

01110010

01100001

01101011

00100000

01001111

01100010

01100001

01101101

01100001

Show your work.

  1. What are the advantages of using Fixed-Length number representation in Assembly in contrast to JAVA? Explain, and give examples.
  2. What are the benefits and drawbacks between assigning a real number and an integer in Assembly? Why do you need either or both? Give examples.
  3. Compile this assembly code that uses arrays. (Tutorialspoint, n.d.)

section .text

global _start ;must be declared for linker (ld)

_start:

mov eax,3 ;number bytes to be summed

mov ebx,0 ;EBX will store the sum

mov ecx, x ;ECX will point to the current element to be summed

top: add ebx, [ecx]

add ecx,1 ;move pointer to next element

dec eax ;decrement counter

jnz top ;if counter not 0, then loop again

done:

add ebx, '0'

mov [sum], ebx ;done, store result in "sum"

display:

mov edx,1 ;message length

mov ecx, sum ;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

global x

x:

db 2

db 4

db 3

sum:

db 0

Click here to compile and execute assembly code.

Change the program to display F as a sum of the array.


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Purdue University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
pmallory
Dec 4th, 2016
" Totally impressed with results!! :-) "
mixedballz
Nov 25th, 2016
" excellent work as always thanks for the help "
Five Star Tutor
Nov 23rd, 2016
" Outstanding Job!!!! "
kiln82
Nov 12th, 2016
" awesome work thanks "
darnay
Nov 3rd, 2016
" The best tutor out there!!!! "
likeplum4
Oct 29th, 2016
" Excellent work as usual "
kpcutie
Oct 7th, 2016
" Excellent job "
Joemoe
Sep 28th, 2016
" <3 it, thanks for saving me time. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1830 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors