Hello..,,
I have programmed program for Addition,substraction,multiplication,division and branching.. but this one i dont know how to start and what to do...
What i know is :
also
I used to program microprocessor Z80.. this one is completely different..
I tried this :
But its not all what we need here to answer this question.
by the way the complete instruction set for this micro can be found here :
https://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
Hoping to get a good help from u...
thanks in advance...
Regards..
Can anyone show me how to write this program please?..I am required to write a program module to convert a BCD digit passed to it in the lower nibble of AccA to its ASCII character code. The upper nibble should be treated as a "don't care".
Return the ASCII code in AccA and save in a suitable memory location.
All other CPU register values are to remain unchanged.
Note: A program module is a routine that is called from the main program.
I have programmed program for Addition,substraction,multiplication,division and branching.. but this one i dont know how to start and what to do...
What i know is :
BCD digits represent the decimal numbers 0 through 9, using four bits. They are 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001.
The ASCII codes for the characters '0' through '9' are 48 through 57 in decimal, or 0x30 through 0x39 in hex.
To convert a BCD number in the lower nibble of AccA, you need to do two things:
1. Mask off the upper nibble of AccA (by ANDing it with 0x0F).
2. Add 0x30 to what's in AccA.
After that, save the contents of AccA to whatever memory location you're using.
The steps above assume that the caller to your module passes an actual BCD digit in AccA. You could add logic to guarantee that what is passed is a BCD digit by checking that the low nibble is greater than or equal to 0 and less than or equal to 9. (This test would come before step 1, above.)
also
Another approach that is used is this one.
1. Define a table that contains the 16 ASCII values for the digits 0 through 9 and A through F.
2. Use a lower nibble mask and add the resulting masked value as an offset into the table to fetch the ASCII value needed. For the upper digit, use an upper nibble mask together with a right-shift four bit positions. Then use the resulting value as an offset into the table to fetch the ASCII value needed.
I used to program microprocessor Z80.. this one is completely different..
I tried this :
ORG $2000 ; Start
ANDA $0F ; And accumulator A with 0F(Hex)
ADDA $30 ; Add 30(Hex) to accumulator A
STAA $2050 ; Store Acuumulator a in adress 2050
But its not all what we need here to answer this question.
by the way the complete instruction set for this micro can be found here :
https://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
Hoping to get a good help from u...
thanks in advance...
Regards..