Re: [cc65] lcc port to the c64

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2000-11-30 14:17:20


On Thu, Nov 30, 2000 at 01:36:50PM +0100, Groepaz wrote:
> btw... i recently started using ca65 somewhat more intensive, and i noticed
> that the missing 'repeat' type of thing really _IS_ a horrible thing ;/

The next release *will* have a .repeat statement. It will also have some other
goodies that make the macro facility something like a meta programming
language in the assembler.

Here is an example what is possible. The macro "BasicString" will take a
string argument, will output all characters but the last one as is, and will
set bit 7 on the last character:

	.macro	BasicString 	Arg

		; Check type of argument
		.if (.not .match (Arg, ""))
		.error "String argument expected"
		.exitmacro
		.endif

		; Check for an empty string
		.if (.strlen (Arg) = 0)
		.error "BasicString: argument cannot be the empty string";
		.exitmacro
		.endif

		; Warn for strings of length 1 since this is rather unusual
		.if (.strlen (Arg) = 1)
		.warning "BasicString: argument has length 1";
		.endif

		; Output all bytes up to the last one
		.repeat	.strlen (Arg)-1, I
		.byte	.strat (Arg, I)
		.endrep

		; Do the last byte
		.byte	.strat (Arg, .strlen(Arg)-1) | $80
	.endmacro

If you're able to compile the package from the sources, I would suggest to
give the latest snapshot a try. For one, it has several new features, second,
I'm as usual glad about any feedback:-)

> whatever, besides that..... ca65/ld65 ROX ;=)

Thanks!

> ps: while i am porting some code written in tasm, i am writing down all
>     the traps that came across my way.... i could supply that document
>     if you want to include that with your docs (a whole lot of ppl are
>     used to tasm so it might make sence)

I've already added a ".feature" command that allows to emulate several
features used by older assemblers. Having labels without leading colons is one
example, assignment to the PC pseudo variable (* = $2000) is another. While
ca65 can and will not emulate all other assemblers around, the .feature
command (which is also available as --feature command line option) makes
porting old sources easier. So, yes, I'm very interested in that document, and
if it is possible to add more such emulation features without breaking
anything in ca65, I will do it.

Regards


	Uz							 


--
Ullrich von Bassewitz                                  uz_at_musoftware.de



---------------------------------------------------------------------- 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:37 CET