Question: 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.

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:

Program Execution Section Objectives: This exercise aims to help you understand which

And The ducument

and how hardware components change while Assembly code gets executed and translates

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!