Taking a stack and printing it in reverse order in UART

By : Kira E.
Source: Stackoverflow.com

So basically I have a class where the teachers designed the program that we use, and they basically said "Do these labs with no background information".

Right now I have to make a RPN calculator using assembly and I have gotten all of it coded except i have to print it in reverse order (the stack).

It would be easy, except we are using 2 digit numbers in each stack slot.

My simple question is how can I take a 2 digit number and split it into each bit.

An example would be having the number 52 and splitting the bits into 5 (then sends through 5 in UART) and 2 (then sends 2 through UART) so the output would be 52.

By : Kira E.


To get the digits of a number, divide by the base (in this case base 10 I assume). The remainder is the least significant digit; the quotient is the remaining digits. Repeat for more digits.

With no divide instruction, and only two digits, here's a cheesy approach:

quotient = 0;

while (number 

This video can help you solving your question :)
By: admin