Re: [cc65] Best way to get aligned memory...

Date view Thread view Subject view

From: Greg King (gngking_at_erols.com)
Date: 2003-01-16 23:51:12


-----Original Message-----
From: Christian Krüger
Date: Thursday, January 16, 2003, 06:19 AM
>
> ----8<----------------------------------------------------------
> >
> >      .export _buffer
> >
> > BUFSIZE         = 1024
> > BUFALIGN        = 4             ; Must be a power of 2
> >
> >      .bss
> > buf: .res BUFSIZE + BUFALIGN - 1
> > _buffer = (buf + BUFALIGN - 1) .AND (~(BUFALIGN - 1) .AND $FFFF)
> >
> ----8<----------------------------------------------------------
>
> will not work (cc65 2.9.0) (_buffer seems to be zero), and I'm not
> sure if it could work.
> In my understanding, the value of 'buf' can only resolved by the linker.
> So, the '_buffer' equation have to be also done by the linker?
> Is the linker capable of resolving assembler equations?

Uz meant to say ".BITAND".

Here is a more compact source version of his code:
--------------------------- buffer.s ----------------------------

        .export _buffer

BUFSIZE         = 1024
BUFALIGN        = 4 - 1         ; Double-word alignment

        .bss
buf:    .res    BUFSIZE + BUFALIGN

_buffer = (buf + BUFALIGN) & ~BUFALIGN

-----------------------------------------------------------------

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-01-16 23:50:54 CET