
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write the following code segment in MARIE assembly language. (Hint: Turn the for loop into a while loop):
Sum = 0;
for X = 1 to 10 do
Sum = Sum + X;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- This question asks you to write programs in assembler language. You are recommended to use no more than 200 words in your answer to this question. A microprocessor is wired into a sensing control circuit so that the memory locations 80 and 81 each contain the values 0 or 1. Memory location 84 is connected to a motor controller. When the value in 84 is 0 the motor is off. When it is 1 the motor is on. Write a program to switch on the motor when the values in locations 80 and 81 are both 1, and to switch off the motor when the values in locations 80 and 81 are both 0. Your program should start at memory location 10. You can only use the assembly language instructions, MOV, JMP and JNZ introduced in Book 3. Assume that the MOV instruction updates the flags with the status register. Explain how your program works and meets the specification.arrow_forwardIn simple words, describe the final data pointer register.arrow_forwardUsing the following C code and assembly code answer the following; C: long int nothingGreater(long int num) { if (num > 240) { return 240 - num; } else { return num; } } Assembly: 0x00000000004004ed <+0>: push %rbp 0x00000000004004ee <+1>: mov %rsp,%rbp 0x00000000004004f1 <+4>: mov %rdi,-0x8(%rbp) 0x00000000004004f5 <+8>: cmpq $0xf0,-0x8(%rbp) 0x00000000004004fd <+16>: jle 0x40050a <nothingGreater+29> 0x00000000004004ff <+18>: mov $0xf0,%eax 0x0000000000400504 <+23>: sub -0x8(%rbp),%rax 0x0000000000400508 <+27>: jmp 0x40050e <nothingGreater+33> 0x000000000040050a <+29>: mov -0x8(%rbp),%rax 0x000000000040050e <+33>: pop %rbp 0x000000000040050f <+34>: retq The instruction mov $0xf0,%eax at address 0x4004ff puts a value into register %eax but there are no other references to %eax in the program. Which instruction makes use of this value? What is the address of the instruction (0x-prefixed hex)? What…arrow_forward
- Please change this C code to Assembly program(x86 and ARM assembly gcc) #include <stdio.h>int main() { unsigned guess; /* current guess for prime */ unsigned factor; /* possible factor of guess */ unsigned limit; /* find primes up to this value */ printf("Find primes up to: "); scanf("%u", &limit); printf("2\n"); /* treat first two primes as special case */ printf("3\n"); guess = 5; /* initial guess */ while ( guess <= limit ) { /* look for a factor of guess */ factor = 3; while ( factor*factor < guess && guess % factor != 0 ) factor += 2;if ( guess % factor != 0 ) printf("%d\n", guess); guess += 2; /* only look at odd numbers */ }printf("Recieves a number(limit) and prints its all divisors"); for(int i = 1; i <= limit; i++) { if((limit%i) == 0){ printf("\n%d", i); } } return 0; }arrow_forwardIs the assembly language version of a FOR loop, WHILE loop, DO WHILE loop, GOTO loop function the same or different? If different,identify the differences. Your comparison should be based on: Number of registers used Number of jumps (iterations) Total number of operationsarrow_forward7. Print 10, 9, 8, ... 0, using loop. a. Write the while loop pseudocode. b. Write it in MARIE's assembly language.arrow_forward
- Using the following C code and assembly code answer the following; C: long int nothingGreater(long int num) { if (num > 240) { return 240 - num; } else { return num; } } Assembly: 0x00000000004004ed <+0>: push %rbp 0x00000000004004ee <+1>: mov %rsp,%rbp 0x00000000004004f1 <+4>: mov %rdi,-0x8(%rbp) 0x00000000004004f5 <+8>: cmpq $0xf0,-0x8(%rbp) 0x00000000004004fd <+16>: jle 0x40050a <nothingGreater+29> 0x00000000004004ff <+18>: mov $0xf0,%eax 0x0000000000400504 <+23>: sub -0x8(%rbp),%rax 0x0000000000400508 <+27>: jmp 0x40050e <nothingGreater+33> 0x000000000040050a <+29>: mov -0x8(%rbp),%rax 0x000000000040050e <+33>: pop %rbp 0x000000000040050f <+34>: retq a. What's the starting address of nothingGreater in memory (specify in hex starting with 0x; you may omit leading zeroes)? b. What register is the argument stored in when the function starts (give the 3-letter abbreviation with a % beforehand)?arrow_forwardIn assembly MIPS I need to write a programp the prompts the user for two intergers(in a subroutine – call it twice), calculates the product of the integers (also in a subroutine) and prints the product with simple descriptive text (also in a subroutine). I need to make 3 little subroutinesarrow_forwardcomputer fundamental-hack assembly languagearrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education