Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9 . ( 5 0 pts ) . Build an assembly language subroutine named Normalize that will take an argument on the stack and transform

9.(50 pts). Build an assembly language subroutine named Normalize that will take an argument on
the stack and transform it as per the following description. If the value of the argument is odd, your
subroutine should just return the original argument on the stack. If the value of the argument is greater
than the value in R0, your subroutine should subtract the value in R1 from the value of the argument
and return the new value of the argument by placing it on the stack. If the value of the argument is less
than the value in R1, your subroutine should add the value of R0 to the value of the argument and
return the new value of the argument by placing it on the stack. Your subroutine must be placed at
address 0x20 in program memory and must use only instructions that are contained in the CS150 AVR
instruction subset. The following code shows how your subroutine will be used:
...
push R30 ; push R30 value onto stack
call Normalize ; Normalize the value
pop R30 ; put result into R30
...(Note: Only these 30 instructions should be used ADD, ADC, CP, CPI, NEG, COM, AND, ANDI, EOR, OR, ORI, LSR, ASR, BRBC, BRBS, JMP, RJMP, CALL, RCALL, RET, RETI, MOV, IN, OUT, LDI, LDS, PUSH, POP, NOP, STS)

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

Logidata+ Deductive Databases With Complex Objects Lncs 701

Authors: Paolo Atzeni

1st Edition

354056974X, 978-3540569749

More Books

Students also viewed these Databases questions