Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Execution Section Objectives: This exercise aims to help you understand which and how hardware components change while Assembly code gets executed and translates to

Program Execution Section Objectives: This exercise aims to help you understand which and how hardware components change while Assembly code gets executed and translates to the circuits. 1. Observe and understand how the code outputs on the screen data stored in memory 2. Observe and understand how the code stores data in memory 3. Get familiar with the CPU circuits that each instruction changes 4. Get familiar with the pre-assigned roles of each circuit.

Please fill out the document below.

image text in transcribed

Program Execution Section Objectives: This exercise aims to help you understand which and how hardware components change while Assembly code gets executed and translates to the circuits.

1. Observe and understand how the code outputs on the screen data stored in memory

2. Observe and understand how the code stores data in memory

3. Get familiar with the CPU circuits that each instruction changes

4. Get familiar with the pre-assigned roles of each circuit.

Description: Below is the code that calculates the users age in dog years. Given that, The .data segment starts at the address 0x1000 in main memory The .code segment start at the address 0x2000 in cache memory The age the user types in when they are prompted is 20 write down the changes in variables and registers for each instruction. Assume that when the OFFSET operator in used, only the address of the variable is fetched, NOT the data. The first 4 instructions are given. You can stop after the instruction exit Here is the code:

image text in transcribed

this is the actual code.

Code in typing:

TITLE Dog years (demo1.asm) ; Description: This program gets the age of the user and calculates their age in dog years (age x 7). INCLUDE Irvine32.inc .data age DWORD ? ; User's age hi_there BYTE "Hi there, this is John",0 ; Greeting the user prompt1 BYTE "Can I have your age please?",0 ; Gets age output BYTE "So, your age in dog years is: ",0 ; Reposts dog age byebye BYTE "Thanks for passing by, have a great day!",0 ; Bye bye .code main PROC ; Greet the user mov EDX, OFFSET hi_there ; Set up for call to WriteString and greet the user call WriteString call Crlf ; Gets the user's age mov EDX, OFFSET prompt1 ; Asks the user's age call WriteString call Crlf call ReadInt ; Reads the users age. Age in EAX call Crlf ; Calculate the dog years and stores the dog age mov EBX, 7 mul EBX mov age, EAX ; Stores the users dog age. Dog age also in EAX ; Reports the dog years and says bye mov EDX, OFFSET output call WriteString mov EAX, age call WriteDec call Crlf mov EDX, OFFSET byebye call WriteString call Crlf exit ;exit to operating system main ENDP END main

TITLE Dog years (demo1.asm) ; Description: This program gets the age of the user and calculates their age in dog years (age 7 ). INCLUDE Irvine32.inc .data \( \begin{array}{lll}\text { age } & \text { DWORD ? } & \text {; User's age } \\ \text { hi_there BYTE } & \text { "Hi there, this is John",0 } & \text {; Greeting the user } \\ \text { prompt1 BYTE } & \text { "Can I have your age please?",0 } & \text {; Gets age } \\ \begin{array}{l}\text { output } \\ \text { byebye }\end{array} & \text { BYTE "So, your age in dog years is: ",0 } & \text {; Reposts dog age }\end{array} \) .code main PROC ; Greet the user mov EDX, OFFSET hi_there ; Set up for call to WriteString and greet the user call WriteString call Crlf ; Gets the user's age movcallcallcallcallEDX,OFFSETprompt1WriteStringCrlfReadlntCrlf;Askstheusersage;Readstheusersage.AgeinEAX ; Reports the dog years and says bye movcallmovcallcallmovcallcallexitEDX,OFFSEToutputWriteStringEAX,ageWriteDecCrIfEDX,OFFSETbyebyeWriteStringCrlf main ENDP END main TITLE Dog years (demo1.asm) ; Description: This program gets the age of the user and calculates their age in dog years (age 7 ). INCLUDE Irvine32.inc .data \( \begin{array}{lll}\text { age } & \text { DWORD ? } & \text {; User's age } \\ \text { hi_there BYTE } & \text { "Hi there, this is John",0 } & \text {; Greeting the user } \\ \text { prompt1 BYTE } & \text { "Can I have your age please?",0 } & \text {; Gets age } \\ \begin{array}{l}\text { output } \\ \text { byebye }\end{array} & \text { BYTE "So, your age in dog years is: ",0 } & \text {; Reposts dog age }\end{array} \) .code main PROC ; Greet the user mov EDX, OFFSET hi_there ; Set up for call to WriteString and greet the user call WriteString call Crlf ; Gets the user's age movcallcallcallcallEDX,OFFSETprompt1WriteStringCrlfReadlntCrlf;Askstheusersage;Readstheusersage.AgeinEAX ; Reports the dog years and says bye movcallmovcallcallmovcallcallexitEDX,OFFSEToutputWriteStringEAX,ageWriteDecCrIfEDX,OFFSETbyebyeWriteStringCrlf main ENDP END main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

List and describe three contingency leadership theories.

Answered: 1 week ago