[cc65] repeating code blocks

Date view Thread view Subject view

From: Groepaz (groepaz_at_gmx.net)
Date: 2000-05-20 22:10:11


hy ppl!

am i just blind or is there really no possibility to repeat code blocks (eg
in macros) ?! i thought it was a quite common thing to have macros like eg

.MACRO MAKEBLOCKS A1,A2,A3,A4,A5
      .FOR I=A1,I-A2,I=I+1
        .FOR II=0,II-(A3-1),II=II+1
          .BYTE A4
        .NEXT
        .BYTE A5
      .NEXT
.ENDMACRO

(this is like i used it in 6502tasm)

thing is, that i was converting some old sources to ca65 syntax and found that
almost all of them use macros like this ;=P naturally rewriting them all to
work without these would be pain-in-the ass so my question is, what would be
the way to do it in ca65 ? ;=P

oh, and one completely different thing... i found the defaults that ld65 uses
for MEMORY and SEGMENT attributes a little confusing (say, not quite what one
would expect).

*maybe* this is even a linker bug or i am just doing sth wrong ;=P

like, i used a linker-file like:

MEMORY {
        STARTADR:
               start = $07fe
               size = $02
        SCREENRAM1:
               start = $0800
               size = $0400
        SCREENRAM2:
               start = $0c00
               size = $0400
        CODERAM:
               start = $2000
               size = $2000
}
SEGMENTS {
        START:
               load = STARTADR
               type = rw;
        SCREEN1:
               load = SCREENRAM1
               type = rw
        SCREEN2:
               load = SCREENRAM2
               type = rw
        CODE:
               load = CODERAM
               type = rw
}

... the code was basically structured like:


		.segment "START"
		.db $00,$08

		.segment "SCREEN1"
		.incbin "scrn1.bin"	
		.segment "SCREEN2"
		.incbin "scrn2.bin"	

		.segment "CODE"
		.include "bogus.s"

... what one would expect from the above is, an output file like this:

$0800-	scrn1.bin
$0c00-  scrn2.bin
$2000-  assembled "bogus.s"

and that even, regardless the size of the scrn1/scrn2.bin files (as long as
they dont exceed their segment size).

but instead, the linker puts them seamlessly one after the other, since
"fill=no" is the default value. maybe this is conveniant for use with
compilers, but i think "fill=yes" would be more like what you would want
when hand-writing asm code ;=P

just my 10 cents ... etc hehe

gpz
----------------------------------------------------------------------
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 : 2001-12-14 22:05:36 CET