Macro definition in WDC tools with embedded asm …

Hi all … I have been working on various stuff lately. On of the thing I’m working on is speed optimisation. For doing that I decided to start to make inline assembler into my code. Take a sneak peek at what i’m doing :

#ifdef __C_MACROS__

#define v_20    #$20
#define v_80    #$80

#define VRAMByteWrite(value,vramdst) \
        __VRAMByteWrite(value,vramdst,v_20,v_80)

#define __VRAMByteWrite(value,vramdst,v_20,v_80) asm { \
    sep        v_20;        \
    longa      off;         \
    lda        v_80;        \
    sta        $2115;       \
    rep        v_20;        \
    longa      on;          \
    lda        %%vramdst;   \
    sta        $2116;       \
    sep        v_20;        \
    longa      off;         \
    lda        %%value;     \
    sta        $2118;       \
    rep        v_20;        \
    longa      on;          \
}

#endif

This is an abstract of my new PPU.h include file. The usage of v_20 and v_80 is due to some limitation of the preprocessor comprared to what is possible with GCC by example. If you have an other syntax that work with WDC to include #$20 directly in the asm {} directive, shoot me a comment.

My 2k limit bug is still bugging me, the Eclipse howto might be finished this week since I’m almost done with the SNES_BaseProject. Something else is coming soon too.

++ Lint

Comments are closed.