ronivek 0 Newbie Poster

Hi there,

I'm currently coding an assembly calculator program to run on an MC68332. I'm doing most of the work on a 68000 emulator for the time being until I have everything as I want it.

The program is fairly straightforward; I'll give a quick walkthrough below.

User enters a base symbol followed by a number in that base. e.g. $F3 or %1001 or 134(for decimal the base symbol is omitted)

User enters an operator for multiply, divide, subtract or add.

User once again enters a number; it can be in any of the three bases as mentioned above.

User enters an = followed by the base they would like the answer displayed in; once again using the appropriate symbol to choose.

The interface is all coded and working as it should.

The conversions work up to a point; and this is where I need a little bit of help!

I have tried to think of alternative ways to perform all the conversions; and although there seems to be some shortcuts for binary and hex; decimal is the main issue.

Currently I'm using multiply and divide commands to multiply the position digits by the corresponding base powers; this unfortunately limits the range of numbers to 2^16.

I have a 32*32->64 multiplication subroutine but in order to perform the conversion back I'm faced with coding a 64/32->64q:64r division subroutine.

The program should work for 2^64 signed integers by the way.

So the question is; is there an easier way for me to perform the conversions? Is there something I'm missing in the conversion algorithms?

Sorry if I haven't given enough information; I'm relatively new to all this.

Thanks in advance if anyone can give me any pointers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.