writerveggieastroprof
My Journal

Previous Entry :: Next Entry

Mood:
Paying Attention to Details

Read/Post Comments (0)
Share on Facebook



Small Steps (In A Computer Program) Add Up to a Long Journey

Student "edition" found at {csi dot journalspace dot com}.

Maybe I shouldn't have started this blog now, not with everything that's been going on.

In the first time that I've had a THIRD meeting of my Computer Circuit Fundamentals lecture class for the seventh week (because of having Thursday classes on a Tuesday) of the second term, I taught them how to display a number with several digits to the right of the decimal point in assembly language.

To make it simpler for the first operation like this, I limited it for now to having a two digit value in the numerator and a one digit number in the denominator. Besides that, the denominator cannot be a zero because no division by zero can be computed, so the value can only be from one to nine.

There was a third input that had to be given, and this is the number of decimal places that the value has to be computed, again only up to nine, but this time allowing for zero to be entered.

Next the first division was done, where the integer remainder was placed in one of the registers and set aside. But the quotient had to be checked if it was one digit or two digits.

If it was two digits, they had to separate the tens digit from the ones digit and display the higher digit first. But since this is another division with the ones digit being placed in the register for the remainder, the remainder for the first division has to be preserved by placing it either in the stack or in a temporary variable or an unused register.

By display, by the way, I meant placing the values in a string in order. After the integer part was placed in the string, they had to store also the decimal point before computing the decimals.

There was a question in this part of the flowchart for the students to find out how many characters the string can have maximum.

Now the remainder from the first division has to be placed in the numerator after being multiplied by ten, then divided by the denominator again.

The integer quotient is now placed in the string, since it is always a single digit.

With the denominator, the same procedure as above is repeated, as long as there are still decimal digits to be displayed.

Session 1377 needs to salvage code from previous programs. Class dismissed.


Read/Post Comments (0)

Previous Entry :: Next Entry

Back to Top

Powered by JournalScape © 2001-2010 JournalScape.com. All rights reserved.
All content rights reserved by the author.
custsupport@journalscape.com