Re: A89: Addx
[Prev][Next][Index][Thread]
Re: A89: Addx
This is sort of off topic, but do you know where I could get a free z80
manual?
- Matt
Zoltan Kocsi wrote:
>
> Scott Noveck writes:
> > That's the free one from Motorola, right? I've been trying to figure out how
> > to order it. . .
>
> Two ways to do it. One is that you download it from their website and
> read the PDF file on-line or print it out (with their newer CPUs
> that's your only option - they decided not to print 1000+ page manuals).
>
> The other possibility is to visit the following URL:
>
> http://www.mot-sps.com/home/lit_ord.html
>
> and order the book(s) you need (it is a free service). You must know the
> book's code number, which may or may not be easy to guess. If you are
> about programming info, try the M68000PM/AD which encodes the book
> titled "Programmer's Reference Manual" and includes all the 68k
> processors except the 68060 and the CPU32+ and it includes the
> 68881/882 FPUs and the 68851 PMMU as well. It is SW info only but a
> quite detailed one.
>
> > So let's say that I have a "decimal" number being represented in a word, so
> > that the upper byte is the integer portion and the lower byte is the decimal
> > portion - therefore:
> >
> > <00000010|10000000> represents 2.5 (the upper byte is 1*2^1, the lower byte
> > _represents_ 2^-1, or .5)
> >
> > If I have this word in d1 want to round it off the get rid of the decimal
> > portion, will this work?
> >
> > round:
> > clr.w d3
> > lsr.w #8,d1 ;integer part remains, x flag is set if the
> > ;MSB in the decimal portion is set
> > addx.w d3,d1 ;A68k won't allow addx.w #0,d1 - they must both be dx's
> >
>
> Yes, that will work. If you really want to save d3, though, you can do
> this:
>
> lsr.w #7,d1 ; MSB of the fractional is in bit 0
> add.w #1,d1 ; Round it up
> lsr.w #1,d1 ; Get rid of the bottom bit
>
> Note that this is longer (and slower) than the addx method but it
> saves you a register.
>
> Regards,
>
> Zoltan
Follow-Ups:
References: