Question: I am having an issue developing a program that calculates a polynomial function. I know how to do an MUL(Multiple) and IDIV (Division) but fail

I am having an issue developing a program that calculates a polynomial function. I know how to do an MUL(Multiple) and IDIV (Division) but fail to develop the instruction to create a program to calculate a polynomial function exercise. We required writing certain coding format to be complete this exercise for assembly code. I need a help to solve this problem and tomorrow night?

Goal: To become familiar with allocating memory for your program, gain experience in dealing with 8-bit numbers including signed numbers and 16-bit numbers, and understand and use some basic instructions such as arithmetic instructions.

Instruction:

1. Write an assembly program to calculate the value of following polynomial function.

2. Use MUL and IDIV instructions.

3. Use DS.B and DS.W to create variables with the right sizes to store and retrieve data.

4. Have an EQU section, a data section, and a code section.

5.use following formula to raise a number to the desirable power: x2 = x*x, x3 = x2*x and x5 = x2*x3. Please save every calculation result to memory. Please pay great attention to the issue of data size: Should a piece of data be stored in one byte or two bytes?

I am having an issue developing a program that calculates a polynomial

This example coding format that is required of us to create this exercise:

;File Name:

;Date:

;Purpose:

;Procedure:

;

;

;Test:

;

;

;*****************************************************************

; export symbols

;*****************************************************************

;For absolute assembly: this is the application entry point

ABSENTRY Main

;*****************************************************************

; Include derivative-specific definitions

;*****************************************************************

;The microcontroller chip used by Dragon12-plus2 board

INCLUDE 'mc9s12dg256.inc'

;*****************************************************************

; Symbolic constant(EQU) section

;*****************************************************************

DATA EQU RAMStart ;use $1000 - $1FFF for data

STACK EQU RAMEnd+1 ;use $2000 - $3FFF for stack

CODE EQU $4000 ;use flash ROM $4000 - $7FFF for code

;*****************************************************************

; Data section

;*****************************************************************

ORG DATA

;*****************************************************************

; Main program section

;*****************************************************************

ORG CODE

Main:

LDS #STACK

Repeat LDAA #$5A ;A = $5A

LDAB #$12 ;B = $12

ABA ;Do A + B, the sume is in A: A = $6C

STAA $1050 ;save the sunm to RAM location $1050

BRA Repeat ;repeat this process forever

;*****************************************************************

; Subroutine section

;*****************************************************************

;*****************************************************************

; Interrupt Vectors

;*****************************************************************

ORG $FFFE

DC.W Main ;Reset Vector

f(x) = x-6. +120 0sxs6

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!