Re: A86: TI-86 VAT


[Prev][Next][Index][Thread]

Re: A86: TI-86 VAT




> Has anybody writen 32 bit addition/subtraction routines?
> I doubt I'll need 32b division or multiplication routines
> (I can imagine how many cycles 32 bit division takes on
> an 8 bit processor...) but I know there are routines for
> * and / on ticalc.org. Is addition really simple, or has
> nobody bothered to write them yet?


32-bit? Four bytes.. umm.. sure I think all you have to do is something
like this

Source:
LSB [BYTE 1] [BYTE 2] [BYTE 3] [BYTE 4] MSB
            /\             /\            /\              /\
          ADD        ADC       ADC         ADC
            \/            \/             \/              \/
Destination:
LSB [BYTE 1] [BYTE 2] [BYTE 3] [BYTE 4] MSB

I think that is all you do. ADC just adds the carry. So when you add the
first two bytes and if it overflows, the overflow is added to the next set
of bytes
that you add.. This is like the approach they use to add numbers in
electronics,
they use full 1-bit chained adders, If I recall correctly.

And subtractions are similar too, SUB and SBC combos I believe. 

Later,
	Matt


Follow-Ups: