This assignment requires you to use functions from the math library to calculate trigonometric results.

Write functions to do each of the following:

Calculate the adjacent length of a right triangle given the hypotenuse and the adjacent angle.

Calculate the opposite length of a right triangle given the hypotenuse and the adjacent angle.

Calculate the adjacent angle of a right triangle given the hypotenuse and the opposite length.

Calculate the adjacent angle of a right triangle given the adjacent and opposite lengths.

These must be four separate functions. You may not do math in the main program for this assignment.

As the main program, include test code that asks for all three lengths and the angle, runs the calculations to determine the other results, and prints them out.

Also remember to include coding comments explaining what each function does, what it returns, and what could cause an error

# Category: Computer and Web Programming : Assembly Code Program

## Helpful Information: To solve Assembly programs, it is often useful to first cre

Helpful Information:

To solve Assembly programs, it is often useful to first create the algorithm which can be in pseudocode

or a language like Java. Based on your limited understanding of assembly, the programs for this

assignment will be limited to using:

a) Integers (either signed or unsigned) and strings.

b) Addition and/or subtraction operations only.

c) The programs will be constructed using just a main method.

d) All variables will be global variables – in Java terms, these would be static class variables (There

will be NO local variables.)

e) Loops and jumps

f) Arrays including the length property

You cannot use these because you do not know how yet:

a) Local variables

b) IF or SWITCH statements

c) Multiplication, division, modulus

d) Math library functions

You must fully comment your assembly programs. The pseudo-code or Java program code will be useful

for these comments.

The IRVINE library will be used in all the programs. No other libraries can be used.

To print a single character, use the WriteChar library function. The character to be printed is placed in

the AL register before calling WriteChar. The value in AL must be the actual character or the ASCII value

of the character.

.code

mov AL, ˈ*ˈ ; stores the asterisk character in the AL register

call WriteChar ; prints the character in the AL register

Important Requirements for these programs:

a) For this assignment, you are restricted to the following Irvine Library functions:

ReadInt ReadDec CrLf WriteString WriteChar

WriteInt WriteDec WriteBin WriteHex

b) You must fully comment your assembly programs. The pseudo-code or Java program code will be

useful for these comments.

c) You are restricted to only instructions and operators discussed in the lectures to the end of Module

5.

d) Make sure your name, course code, term, assignment number, date, question number are included

at the beginning of every program as a comment.

e) Use meaningful descriptive variable names.

f) Your code must be submitted. Programs which do not assemble and run will have a maximum grade

of 60%.

Questions:

A) [20 marks] Write an assembly program that uses a loop to calculate the first thirty values of a

number sequence described by the formula: F(0) = 1, F(1) = 4, F(2) = 3, F(3) = 2, and then F(n) =

2*F(n-1) + Fib(n-4) for n >=4. Your program needs to print the values as a comma separated – the

first four values are simply printed and the remaining values are calculated using a loop.

Here is the logic for the loop to calculate the values for F(n) where n > 3:

int a = 1, b = 4, c = 3, d = 2;

int current = 2 * d + a; //current = F(4)

for( int i = 4; i < n; ++i ) {
//at this point, current = F(i)
a = b;
b = c;
c = d;
d = current;
current = 2 *d + a;
}
//at this point, current = F(n)
Place each value in the EAX register and display it using the WriteDec library function. Use the
WriteString library function to print a string “, “,0 which is a comma, a space and a null terminator
and the CrLf function to print a newline character when you are finished (see Chapter 5.4.3, pages
158-70).
The output would be something like this:
1, 4, 3, 2, 5, 14, 31, 64, 133, 280, …
question B)
[10 marks] Create an array of 20 WORD values initialized to zero. Using a loop, populate the array
with a sum series where the first element will be 1, the second will be 3 (1+2), the third will be 6
(1+2 +3), etc… Using second loop, print the values in the array so that ever number is separated by
a comma and a space.
BONUS: 1 mark if you do not print the comma after the last number.

## Just have to add font and color from templates to existing project Instructions

Just have to add font and color from templates to existing project

Instructions

Continue work on your coding document by adding style to a heading using the color palette provided in your client’s brand style guide. In addition to color, consider adding other styling aspects such as size, font, and so forth. Upload a link to the selected web hosting site in Brightspace providing your instructor with an accessible link.

Make sure you read the CSS tutorial in the resources section and watch the Infobase videos.

Note: Additional resources have been provided for you in the Brand Style Guides ZIP folder. They include difficult-to-find fonts for the Town client and image resources for both clients. You do not need to add images in this task, but you can become familiar with the resources as you continue to work.

To complete this assignment, review the External Styling Guidelines and Rubric PDF document.

## Write a MASM program that uses subtraction to do division. The program generates

Write a MASM program that uses subtraction to do division. The program generates two random numbers. The first number is the dividend, and the second number is the divisor. The second number divides the first number. The program uses a loop to repeatedly subtract the second number from the first number.

When the loop ends the program displays the dividend, the divisor, the quotient, and the remainder

What are the dividend, quotient, divisor, and remainder?

dividend = quotient x divisor + remainder

To write the program, translate the following pseudocode to MASM.

quotient = 0

remainder = 0

while dividend > divisor

dividend = dividend – divisor

quotient = quotient + 1

end while

remainder = dividend

## need help adding onto already built code. assembly language prompt: create progr

need help adding onto already built code. assembly language

prompt: create program that will ask the user the time and date (see format below), and pack it up into MS-DOS File Date format, display that number, and then unpack it and display it display it to the screen

When asking the user for the date, ask for the Date, Month, and Year and read in each as a Dec (ReadDec). The MS-DOS File Date is

Bit index # Num of Bits

Day 0-4 5

Month: 5-8 4

Year: 9-15 7

The year is stored as number of years since 1980

So 31st Dec 1999 would be store as 31, 12, and 19 in binary

day month year

31 12 19

11111 1100 0010011

modify code as you wish: ->

INCLUDE Irvine32.inc

INCLUDE macros.inc

.data

day WORD 10

month WORD 11

year WORD 2021

.code

main PROC

;

;

mov dx, year

sub dx, 1980

; add month

shl dx, 4

add dx, month

;

shl dx, 5

add dx, day

movzx eax, dx

mov ebx, TYPE WORD

call WriteBinB

call CRLF

mwriteln “0101 0011 0110 1010”

mov ax, dx

and ax, 011111b

call WriteInt

call CRLF

;month

mov ax, dx

;shr ax, 5

;and ax, 01111b

and ax, 0111100000b

shr ax, 5

call WriteInt

call CRLF

;year

mov ax, dx

shr ax, 9

add ax, 1980

call WriteInt

call CRLF

exit

main ENDP

END main

## Recursion must be used otherwise assignment gets a zero. Must be in LC-3 assembl

Recursion must be used otherwise assignment gets a zero. Must be in LC-3 assembly language program. Instructions are very thorough and everything that is required is in the instructions. I am an undergrad so please don’t use too advanced methods. One of the files ill attach will have the instructions we use.

The first file is some code and comments provided, the second file is the actual assignment instructions, and the last file is some of the instruction we use.

## Write a MASM program that generates one random number between 10 and 99. Let us

Write a MASM program that generates one random number between 10 and 99. Let us call this number the original random number. Then generate 2 random numbers between 10 and 99 until the sum of the 2 numbers equals the original random number. For each pair of random numbers, display on one line, the original random number, the pair of random numbers and their sum.

## [ARM] Write a complete 1 function only in ARM 32 bit assembly language (Not x86

[ARM] Write a complete 1 function only in ARM 32 bit assembly language (Not x86 and the ARM assembly code must run on a 32-bit processor) that implements Conway’s Game of Life.

ARM 32 bit assembly language will implement based on the following ONE SIMPLE below FUNCTION (in C language):

void gameLife(unsigned char * source, unsinged char * destination, size_t row, size_t col);

## This assignment requires you to use functions from the math library to calculate

This assignment requires you to use functions from the math library to calculate trigonometric results.

Write functions to do each of the following:

Calculate the adjacent length of a right triangle given the hypotenuse and the adjacent angle.

Calculate the opposite length of a right triangle given the hypotenuse and the adjacent angle.

Calculate the adjacent angle of a right triangle given the hypotenuse and the opposite length.

Calculate the adjacent angle of a right triangle given the adjacent and opposite lengths.

These must be four separate functions. You may not do math in the main program for this assignment.

As the main program, include test code that asks for all three lengths and the angle, runs the calculations to determine the other results, and prints them out.

Be sure to include code comments that say what the function is, what it returns (if anything) and what could cause an error. This program is to be written in Python.

## This assignment requires you to let the user enter a list of courses, but stop t

This assignment requires you to let the user enter a list of courses, but stop them if they enter a sixth and insist that they delete one. The result will be an interactive program – it will keep running until the user commands it to stop.

This program is more extensive than the ones you have written so far. Allocate significantly more time to it.

Create an empty list of courses.

Prompt the user for a course they wish to enter, or to type “EXIT” if they wish to stop entering courses.

Add the course to the end of the list of courses.

If the list of courses is up to six, print out the list of courses with good formatting (one course per line, along with a list header), and ask them which one they want to drop.

Print a number next to each course, and ask for a number of the course to drop. For example, if the user wants to drop the first course entered, they should enter “1”, and if they want to drop the last course entered, they should enter 6.

For both the printout and the user input you will need to convert between Python’s zero-based list numbers and the one-based list numbers you present to the user!

Go back and ask for another course.

When the user finally types “EXIT”, print out their list of courses with good formatting (as above), and stop.

Make sure to include coding comments that say the function name, what the function does, what each of the parameters does, if anything gets returned and what can go wrong