Converting from one base to another?
|
04-09-2016, 10:02 PM
Post: #1
|
|||
|
|||
Converting from one base to another?
Hello again all,
I have another newbie programming question. As you may have seen, I developed an 8080 emulator that uses M1 as a single column array for the program memory. The 8080 instructions are stored as decimal numbers. I have been entering only very short test programs by hand to exercise my emulator so far. I have the code from my system monitor in my vintage IMSAI system that allows a few activities, such as dump memory from one address to another, enter code byte by byte into memory, and goto a memory location and start executing. I would like to enter this code into my M1 array for my emulator. I have the code as hexadecimal numbers. So, I tried to create a small program to allow me to enter hex bytes, and store them as decimal numbers. I figured I would be clever and simply change the Base to Hexadecimal for the hex entry, and then change the Base to Decimal to store the number into M1. Here's the code: Code:
Unfortunately for me, this is not working. The program as written works just fine if I enter normal decimal numbers. However, if I enter 0A, 0B, 0C... it stores away 0. Also, if I try A, B, C, D, E, or F, I get unusual numbers instead of the expected 10, 11, 12, 13, 14, or 15. This method of changing the Base is not working for me. Am I on the right track, or will I have to enter two-character strings and do the whole conversion myself? Thanks for listening. Your advice would be very much appreciated. smp |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)