diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/port.h | 2 | ||||
-rw-r--r-- | src/rops.h | 115 |
2 files changed, 71 insertions, 46 deletions
@@ -123,7 +123,7 @@ typedef short int16_32; #define LSB_FIRST #define STATIC static #define FASTCALL -#define PIXEL_FORMAT RGB555 +#define PIXEL_FORMAT RGB565 #define CHECK_SOUND() #define VOID void #define CPU_SHUTDOWN @@ -5,93 +5,119 @@ Raster Operations macros */ -#define ROP_CLEARTOP(a) \ - " bic " #a ", " #a ", #0b01000000000000000 \n" // ------------- -// RGB_555 +// RGB_565 // a.red = a.red - b.red // a.blue = a.blue - b.blue // a.green = a.green - b.green +/* #define ROP_SUB(a, b) \ - " bics " #b ", " #b ", #0b00000010000100000 \n"\ - " beq 999f \n"\ - " orr " #a ", " #a ", #0b00000010000100000 \n"\ - " orr " #a ", " #a ", #(1 << 31) \n"\ + " bics " #b ", " #b ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #0b10000000000000000 \n"\ " sub " #a ", " #a ", " #b " \n"\ - " tst " #a ", #0b00000000000100000 \n"\ + " tst " #a ", #0b00000000000100000 \n"\ + " biceq " #a ", " #a ", #0b00000000000011111 \n"\ + " tst " #a ", #0b00000100000000000 \n"\ + " biceq " #a ", " #a ", #0b00000011111100000 \n"\ + " tst " #a ", #0b10000000000000000 \n"\ + " biceq " #a ", " #a ", #0b01111100000000000 \n" +*/ +#define ROP_SUB(a, b) \ + " bics " #b ", " #b ", #0b00000100000100000 \n"\ + " beq 999f \n"\ + " orr " #a ", " #a ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #(1 << 31) \n"\ + " subs " #a ", " #a ", " #b " \n"\ + " bicpl " #a ", " #a ", #0b01111100000000000 \n"\ + " tst " #a ", #0b00000000000100000 \n"\ " biceq " #a ", " #a ", #0b00000000000011111 \n"\ - " tst " #a ", #0b00000010000000000 \n"\ - " biceq " #a ", " #a ", #0b00000001111100000 \n"\ - " tst " #a ", #0b01000000000000000 \n"\ - " bicne " #a ", " #a ", #0b01111110000000000 \n"\ + " tst " #a ", #0b00000100000000000 \n"\ + " biceq " #a ", " #a ", #0b00000011111100000 \n"\ "999:\n" // ------------- -// RGB_555 +// RGB_565 // if ZF set do ROP_SUB, else: // a.red = (a.red - b.red) / 2 // a.blue = (a.blue - b.blue) / 2 // a.green = (a.green - b.green) / 2 +/* #define ROP_SUB1_2(a, b) \ " movne " #a ", " #a ", lsr #1 \n"\ - " bicne " #a ", " #a ", #0b00000001000010000 \n"\ + " bicne " #a ", " #a ", #0b00000010000010000 \n"\ " movne " #b ", " #b ", lsr #1 \n"\ - " bicne " #b ", " #b ", #0b00000001000010000 \n"\ + " bicne " #b ", " #b ", #0b00000010000010000 \n"\ \ - " bics " #b ", " #b ", #0b00000010000100000 \n"\ - " beq 999f \n"\ - " orr " #a ", " #a ", #0b00000010000100000 \n"\ - " orr " #a ", " #a ", #(1 << 31) \n"\ + " bic " #b ", " #b ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #0b10000000000000000 \n"\ + " sub " #a ", " #a ", " #b " \n"\ + " tst " #a ", #0b00000000000100000 \n"\ + " biceq " #a ", " #a ", #0b00000000000011111 \n"\ + " tst " #a ", #0b00000100000000000 \n"\ + " biceq " #a ", " #a ", #0b00000011111100000 \n"\ + " tst " #a ", #0b10000000000000000 \n"\ + " biceq " #a ", " #a ", #0b01111100000000000 \n" +*/ + +#define ROP_SUB1_2(a, b) \ + " movne " #a ", " #a ", lsr #1 \n"\ + " bicne " #a ", " #a ", #0b00000010000010000 \n"\ + " movne " #b ", " #b ", lsr #1 \n"\ + " bicne " #b ", " #b ", #0b00000010000010000 \n"\ + \ + " bics " #b ", " #b ", #0b00000100000100000 \n"\ + " beq 999f \n"\ + " orr " #a ", " #a ", #0b00000100000100000 \n"\ + " orr " #a ", " #a ", #(1 << 31) \n"\ " subs " #a ", " #a ", " #b " \n"\ - " tst " #a ", #0b00000000000100000 \n"\ + " bicpl " #a ", " #a ", #0b01111100000000000 \n"\ + " tst " #a ", #0b00000000000100000 \n"\ " biceq " #a ", " #a ", #0b00000000000011111 \n"\ - " tst " #a ", #0b00000010000000000 \n"\ - " biceq " #a ", " #a ", #0b00000001111100000 \n"\ - " tst " #a ", #0b01000000000000000 \n"\ - " bicne " #a ", " #a ", #0b01111110000000000 \n"\ + " tst " #a ", #0b00000100000000000 \n"\ + " biceq " #a ", " #a ", #0b00000011111100000 \n"\ "999:\n" // ------------- -// RGB_555 +// RGB_565 // a.red = a.red + b.red // a.blue = a.blue + b.blue // a.green = a.green + b.green #define ROP_ADD(a, b) \ - " bics " #b ", " #b ", #0b00000010000100000 \n"\ + " bics " #b ", " #b ", #0b00000100000100000 \n"\ " beq 999f \n"\ - " bic " #a ", " #a ", #0b00000010000100000 \n"\ + " bic " #a ", " #a ", #0b00000100000100000 \n"\ " add " #a ", " #a ", " #b " \n"\ - " tst " #a ", #0b00000000000100000 \n"\ + " tst " #a ", #0b00000000000100000 \n"\ " orrne " #a ", " #a ", #0b00000000000011111 \n"\ - " tst " #a ", #0b00000010000000000 \n"\ - " orrne " #a ", " #a ", #0b00000001111100000 \n"\ - " tst " #a ", #0b01000000000000000 \n"\ - " orrne " #a ", " #a ", #0b00111110000000000 \n"\ - ROP_CLEARTOP(a) \ + " tst " #a ", #0b00000100000000000 \n"\ + " orrne " #a ", " #a ", #0b00000011111100000 \n"\ + " tst " #a ", #0b10000000000000000 \n"\ + " orrne " #a ", " #a ", #0b01111100000000000 \n"\ "999:\n" // ------------- -// RGB_555 +// RGB_565 // if ZF set do ROP_ADD, else: // a.red = (a.red + b.red) / 2 // a.blue = (a.blue + b.blue) / 2 // a.green = (a.green + b.green) / 2 #define ROP_ADD1_2(a, b) \ - " bic " #a ", " #a ", #0b00000010000100000 \n"\ - " bicne " #a ", " #a ", #0b00000100001000000 \n"\ - " bic " #b ", " #b ", #0b00000010000100000 \n"\ - " bicne " #b ", " #b ", #0b00000100001000000 \n"\ + " bic " #a ", " #a ", #0b00000100000100000 \n"\ + " bicne " #a ", " #a ", #0b00001000001000000 \n"\ + " bic " #b ", " #b ", #0b00000100000100000 \n"\ + " bicne " #b ", " #b ", #0b00001000001000000 \n"\ " add " #a ", " #a ", " #b " \n"\ " movne " #a ", " #a ", lsr #1 \n"\ - " tst " #a ", #0b00000000000100000 \n"\ + " tst " #a ", #0b00000000000100000 \n"\ " orrne " #a ", " #a ", #0b00000000000011111 \n"\ - " tst " #a ", #0b00000010000000000 \n"\ - " orrne " #a ", " #a ", #0b00000001111100000 \n"\ - " tst " #a ", #0b01000000000000000 \n"\ - " orrne " #a ", " #a ", #0b00111110000000000 \n"\ - ROP_CLEARTOP(a) + " tst " #a ", #0b00000100000000000 \n"\ + " orrne " #a ", " #a ", #0b00000011111100000 \n"\ + " tst " #a ", #0b10000000000000000 \n"\ + " orrne " #a ", " #a ", #0b01111100000000000 \n" typedef struct { @@ -140,4 +166,3 @@ void doRaster(ROPSTRUCT *rop); bool wouldRasterAlterStatus(ROPSTRUCT *rop); #endif - |