CMSC216 Project: Assembly Language II solution

$25.00

Original Work ?

Download Details:

  • Name: Project-5-w3spm6.zip
  • Type: zip
  • Size: 4.22 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

Overview

Write an assembly language program that accesses and makes use of C-subroutines.

Objectives

– Understand Assembly language code
– Interfacing C and Assembly code

Description

What to do

Implement a simple postfix to infix expression converter.
Your assembly language program should assume a string address is passed in via R0 as a packed C-style string.
Then run the simplified postfix to infix algorithm specified below, and return a new string in infix notation via R0.

Your code should call the following C-style functions, as necessary:
“`
// returns the length of string s
int _STRLEN(char *s);

// allocates and returns a string that is the concatenation of strings s1 and s2.
char *_CONCAT(char *s1, char *s2);

// If possible, allocates bytes from the heap. This is an all-or-nothing attempt
void *_ALLOC(unsigned long bytes);

// returns the number of items stored in stack
int _STACK_SIZE();

// adds s to the top of the stack.
void _PUSH(char *s);

// removes and returns the string at the top of the stack.
char *_POP();

// returns the string at the top of the stack, without modifying the stack.
char *_PEEK();
“`

Postfix to Infix Algorithm

Process each character of the input as follows:
1. If the character is blank, skip it.
2. If the character is a digit, put it onto the stack.
3. Otherwise, it is an operator.

* Pop the term2 off the stack
* Pop the term1 off the stack
* Concatenate: ‘(‘ + term1 + operator + term2 + ‘)’
* Push the concatenated string onto the stack

4. At the end of the input string, if there is only one thing on the stack, it is converted.

Running the code
Use VisUAL ARM emulator to test the code. You can download VisUAL at: https://salmanarif.bitbucket.io/visual/downloads.html

🚀 Custom Work, Just for You! 🚀

Can’t find the tutorial you need? No worries! We create custom, original work at affordable prices! We specialize in Computer Science, Software, Mechanical, and Electrical Engineering, as well as Health Sciences, Statistics, Discrete Math, Social Sciences, Law, and English.

✍️ Custom/Original Work Essays cost as low as $10 per page.
💻 Programming Custom Work starts from $50.

🔥 Get top-quality help now! 🔥

Get Your Custom Work