Just checking on that Blake7 code:
I want to use the assembler code together with CC65, so want to change from XA65 syntax to CA65.
Really struggling with the macros for Telestrat alignment though:
Code: Select all
#ifdef TELESTRAT_ALIGN
#define PROTECT(X) .dsb (((X)&3)-((*+3)&3))&3,$ea
#define PROTECT2(X,Y) .dsb (((X)&3)-((*+(Y)+3)&3))&3,$ea
#else
as CA65 does not have the .dsb function.
From what I understand, the .repeat function in CA65 should do more or less the same, so tried to convert to:
Code: Select all
TELESTRAT_ALIGN = $01
.ifdef TELESTRAT_ALIGN
.macro protect count1
.repeat (((count1)&3)-((*+3)&3))&3
nop
.endrepeat
.endmacro
.macro PROTECT2 count1, count2
.repeat (((count1)&3)-((*+(count2)+3)&3))&3
nop
.endrepeat
.endmacro
.else
.macro PROTECT x
.endmacro
.macro PROTECT2 x, y
.endmacro
.endif
But that does not work and gives an 'Error: Constant expression expected' compiler error on calling the macro like this:
Code: Select all
protect __fdc_sector_1
__fdc_sector_1:
sta FDC_sector_register
So apparently my CA65 macro does only take a constant as input, not a variable like the program counter at compilation?
So questions?
- Am I correct that these NOPs are only needed for Telestrat compatibility and that I can completely ignore them if dropping Telestrat support?
- What exactly should the macro do? There are comments around the macro explaining, but think I still miss the core of it. If I see 'PROTECT(FDC_sector_register)', Input variable apparently is the FDC register address ($312 in this case), the &3 causes the address to be multiples of 4, the * is the program counter of the compiled line, the +3 &3 on that is getting to the next multiple of four, result is the difference between the two as multiple of 4? Or do I miss something?
- If so, then anyone has a suggestion on doing this in CA65? Or should I just drop it by dropping Telestrat support?