Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. [20 Points] Write a subroutine that multiplies the top nibble and the bottom nibble of a number in W and returns the result

  

4. [20 Points] Write a subroutine that multiplies the top nibble and the bottom nibble of a number in W and returns the result in W. The setup and call of the subroutine are below. Fill in the details between the label Mult_nybbles and the RETURN instruction. Keep your routine less than about 20 instructions, but use any algorithm you like. Hint 1: Split the nybbles into two different registers using ANDWF with a bit mask. Hint 2: keep it simple - remember what you did in grade school. Hint 3: there are more than on solution, if it gets the job done within the about 20 instructions... (feel free to use back of page, but please mark clearly that you have). ; Variable declarations VarA VarB VarC Index EQU H' 20' ; Use these as you wish! EQU H'21' EQU H' 22' EQU H' 23' Constants (for testing) NybbleA EQU H'3' NybbleB EQU H'7' ; Start of code Load_W MOVLW NybbleA Put 0x3 into VarA was MOVWF VarA SWAPF ADDLW VarA, W NybbleB CALL Mult_nybbles MOVWF VarC Mult_nybbles; Write your code below ; Should be NybbleA* NybbleB (0x15) Cero.com

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_2

Step: 3

blur-text-image_3

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions