• Home
  • Blog
  • Brookhaven College Flat Assembler Converting Integer to Text Activity

Brookhaven College Flat Assembler Converting Integer to Text Activity

0 comments

I’m trying to study for my Computer Science course and I need some help to understand this question.

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

Below is a partial algorithm to convert an integer to text:
idiv user’s number by 10 and store eax into variable Quotient and edx into Remainder
compare Quotient to 2 and jump to Twenty if equal; compare Quotient to 3 and jump to Thirty if equal; etc.
Twenty:
Output “twenty”
Jump to OnesDigit
Thirty:
Output “thirty”
Jump to OnesDigit
OnesDigit:
compare Remainder to 1 and jump to One if equal; compare Remainder to 2 and jump to Two if equal; etc.
One:
Output “one”
Jump to Ending
Two:
Output “two”
Jump to Ending

Example outputs
This x86 assembly program converts an integer to text.

Enter an integer from -100 to 100: 73

seventy-three

Enter an integer from -100 to 100: -100

negative one hundred

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}