Thursday, 22nd December 2005
Brass has got a new macro preprocessor, that hopefully makes the work of people writing things like the macro-driven TI ASM API easier, and will generate less redundant code.
TASM only supports simple find-and-replace macros; so, for example:
#define draw_sprite(x,y,sprite) ld a,x\ ld b,y\ ld hl,sprite\ call put_sprite draw_sprite(10,43,my_sprite) ; Generates the following: ld a,10 ld b,43 ld hl,my_sprite call put_sprite draw_sprite(a,43,hl) ; Generates the following: ld a,a ; Rubbish! ld b,43 ld hl,hl ; Not going to work... call put_sprite
Brass, however, supports more intelligent macros - like this example shows. It will switch between a variety of different macros, depending on the arguments passed in.