Re: Pascal Compiler

From: Spiro Trikaliotis (ml-cbmhackers_at_trikaliotis.net)
Date: 2004-12-10 15:26:03

Hello,

* On Fri, Dec 10, 2004 at 01:55:01PM +0100 Baltissen, GJPAA (Ruud) wrote:
 
> But this last rountine delivers the result into the wrong order so I
> need my own routine to correct this !!! (Anyone has an idea why?
> Routine can be found at $BC9B.)

Yes, this routine does not more than shifting the FAC for appropriate
times. As the FP value is stored with most significant byte first, this
is the format which this routine returns.

> So I decided to make my own adder. The resulting routine needs only a
> few bytes extra then when using the Kernal routines. But I'm quite
> sure that it is much much faster.

Yes, this seems very likely.

> At this moment I'm facing more of these dilemmas: what about AND/OR/XOR-ing
> two bytes, should I use the original routines or make my own?

I believe your own will be much faster, so I would use them.

> But making my own routines raises again some more questions: I have
> bytes, integers, words and longints, do I have to create routines for
> every type?  The idea to solve this problem is to convert every type
> to longint, perform the needed aritmetic and to convert back again.
> But this comes close to converting them to FP. You see: dilemmas
> enough :(

No, I do not see the dilemma. For example for AND, OR, XOR, you can
write your routine to start with the MSB. For example:

AND32 LDA src+3
      AND mask+3
      STA dest+3
      LDA src+2
      AND mask+2
      STA dest+2
AND16 LDA src+1
      AND mask+1
      STA dest+1
AND8  LDA src
      AND mask
      STA dest
      RTS

This way, no conversion is needed. For ADD/SUB, you can do similar:
Write a 32 bit routine which starts with the LSB (as this is needed for
ADD/SUB). If you want to only add 16 bits, write the 16 bits into the
most significant bytes, and start at the point of bit 16.

Of course, if you want to do this "in place", that is, without copying
the variables around, to have to be a little bit more tricky. You have
to change the start address if the variables. Anyway, the same scheme
applies.


You see, no conversion is needed.


HTH,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.