Using the flat assembler (fasm), write a program that converts an integer from -100 to 100 to text.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
New to assembly language!! need help as to what exactly i need to put into the fasm assembler. (including syntax) Output screenshot would help alot too (:
**Converting an Integer to Text Using Flat Assembler (fasm)**

This section demonstrates how to write a program using the Flat Assembler (fasm) to convert an integer ranging from -100 to 100 into text.

### Partial Algorithm to Convert an Integer to Text

1. Perform integer division of the user's number by 10 using the `idiv` instruction. Store the result into two variables: Quotient and the remainder into `edx`.
2. Compare the Quotient to 2 and jump to the label `Twenty` if equal. Compare the Quotient to 3 and jump to the label `Thirty` if equal. Continue in this fashion for other comparisons.

#### Detailed Steps in the Algorithm:

- **Twenty:**
    ```plaintext
    Output "twenty"
    Jump to OnesDigit
    ```

- **Thirty:**
    ```plaintext
    Output "thirty"
    Jump to OnesDigit
    ```

- **OnesDigit:**
    ```plaintext
    Compare `edx` (Remainder) to 1 and jump to `One` if equal.
    Compare `edx` (Remainder) to 2 and jump to `Two` if equal.
    ```

- **One:**
    ```plaintext
    Output "one"
    Jump to Ending
    ```

- **Two:**
    ```plaintext
    Output "two"
    Jump to Ending
    ```

### Example Outputs

This x86 assembly program converts an integer to text. Below are some examples of inputs and their corresponding outputs.

**Example 1:**
```
Enter an integer from -100 to 100: 73
seventy-three
```

**Example 2:**
```
Enter an integer from -100 to 100: -100
negative one hundred
```
This examples illustrate how the program processes the input integer and outputs the correct text representation. 

The algorithm involves logically splitting the input number into its components and directing the assembly flow to output the corresponding text.
Transcribed Image Text:**Converting an Integer to Text Using Flat Assembler (fasm)** This section demonstrates how to write a program using the Flat Assembler (fasm) to convert an integer ranging from -100 to 100 into text. ### Partial Algorithm to Convert an Integer to Text 1. Perform integer division of the user's number by 10 using the `idiv` instruction. Store the result into two variables: Quotient and the remainder into `edx`. 2. Compare the Quotient to 2 and jump to the label `Twenty` if equal. Compare the Quotient to 3 and jump to the label `Thirty` if equal. Continue in this fashion for other comparisons. #### Detailed Steps in the Algorithm: - **Twenty:** ```plaintext Output "twenty" Jump to OnesDigit ``` - **Thirty:** ```plaintext Output "thirty" Jump to OnesDigit ``` - **OnesDigit:** ```plaintext Compare `edx` (Remainder) to 1 and jump to `One` if equal. Compare `edx` (Remainder) to 2 and jump to `Two` if equal. ``` - **One:** ```plaintext Output "one" Jump to Ending ``` - **Two:** ```plaintext Output "two" Jump to Ending ``` ### Example Outputs This x86 assembly program converts an integer to text. Below are some examples of inputs and their corresponding outputs. **Example 1:** ``` Enter an integer from -100 to 100: 73 seventy-three ``` **Example 2:** ``` Enter an integer from -100 to 100: -100 negative one hundred ``` This examples illustrate how the program processes the input integer and outputs the correct text representation. The algorithm involves logically splitting the input number into its components and directing the assembly flow to output the corresponding text.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY