Consider the following program program written in 6502 assembler language. ; load the accumulator with the value e LDA #0 loopl: ; compare the accumulator with the value 5 CMP #5 BEQ outsidel ; if the comparison was equal jump to outsidel STA $D020 ; store the value in the accumulator somewhere CLC ; clear the carry flag ; add 1 to the accumulator ADC #1 JMP loop1 ; jump to loop1 outsidel: ; return from subroutine RTS How many times will the loop in this code run? (1.e. how many times does the sTA instruction get executed?) Assuming that: • this is running on a processor with a 5 stage pipeline • each stage takes 1 cycle • instructions that change the flow of code (BEQ, JMP, RTS) empty the pipeline after the instruction has run • the pipeline starts empty. How many cycles will this program take to run?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Assembly language 

Consider the following program program written in 6502 assembler language.
; load the accumulator with the value 0
LDA #0
loop1:
; compare the accumulator with the value 5
BEQ outsidel ; if the comparison was equal jump to outsidel
CMP #5
STA $D020
; store the value in the accumulator somewhere
CLC
; clear the carry flag
ADC #1
; add 1 to the accumulator
JMP loop1
; jump to loop1
outsidel:
RTS
; return from subroutine
How many times will the loop in this code run? (i.e. how many times does the sTA İnstruction get executed?)
Assuming that:
• this is running on a processor with a 5 stage pipeline
• each stage takes 1 cycle
• instructions that change the flow of code (BEQ, JMP, RTS) empty the pipeline after the instruction has run
• the pipeline starts empty.
How many cycles will this program take to run?
Transcribed Image Text:Consider the following program program written in 6502 assembler language. ; load the accumulator with the value 0 LDA #0 loop1: ; compare the accumulator with the value 5 BEQ outsidel ; if the comparison was equal jump to outsidel CMP #5 STA $D020 ; store the value in the accumulator somewhere CLC ; clear the carry flag ADC #1 ; add 1 to the accumulator JMP loop1 ; jump to loop1 outsidel: RTS ; return from subroutine How many times will the loop in this code run? (i.e. how many times does the sTA İnstruction get executed?) Assuming that: • this is running on a processor with a 5 stage pipeline • each stage takes 1 cycle • instructions that change the flow of code (BEQ, JMP, RTS) empty the pipeline after the instruction has run • the pipeline starts empty. How many cycles will this program take to run?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY