43static void blit_define_bltu(
Environment * _environment,
int _op,
char * _a,
char * _c ) {
48 outline0(
"; bltu C = (2^bpp-1) if A > 0 (threshold)");
59 outline1(
"BEQ %sthreshold1", label );
65 outline1(
"BEQ %sthreshold2", label );
72 outline1(
"BEQ %sthreshold3", label );
79 outline1(
"BEQ %sthreshold4", label );
86 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 2 ) {
90 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 1 ) {
100 unsigned char value = 0;
110 value = ( ( _op & 0x1 ) );
111 value |= ( ( ( _op & 0x2 ) ) << 1 );
112 value = value | ( value << 2 ) | ( value << 4 ) | ( value << 6 );
122static void blit_define_bltb(
Environment * _environment,
int _op,
char * _a,
char * _b,
char * _d ) {
129 }
else if ( _op == 1 ) {
134 }
else if ( _op == 2 ) {
139 }
else if ( _op == 3 ) {
143 }
else if ( _op == 4 ) {
147 }
else if ( _op == 5 ) {
148 outline0(
"; bltb C = A if B>0, 0 if B=0");
204void blit_define(
Environment * _environment,
char * _name,
int _sop,
int _mop,
int _smop,
int _iop,
int _dop,
int _idop,
int _top ) {
209 cpu_jump( _environment, skipLabel );
217 blit_define_bltu( _environment, _sop,
"BLITS1",
"BLITR0" );
220 blit_define_bltu( _environment, _mop,
"BLITS2",
"BLITR1" );
223 blit_define_bltb( _environment, _smop,
"BLITR0",
"BLITR1",
"BLITR2" );
226 blit_define_bltu( _environment, _iop,
"BLITR2",
"BLITR0" );
229 blit_define_bltu( _environment, _dop,
"BLITS3",
"BLITR1" );
232 blit_define_bltb( _environment, _idop,
"BLITR0",
"BLITR1",
"BLITR2" );
235 blit_define_bltu( _environment, _top,
"BLITR2",
"BLITR3" );
244static const char BLIT_SOURCES_REGISTER[][10] = {
260 memset( &_environment->
blit, 0,
sizeof(
Blit ) );
262 _environment->
blit.
name = strdup( _name );
265 cpu_jump( _environment, skipLabel );
276 outline1(
"LDA %s", &BLIT_SOURCES_REGISTER[_source][0] );
char * cpu_blit_register_name(Environment *_environment, int _register)
void cpu_label(Environment *_environment, char *_label)
void cpu_blit_finalize(Environment *_environment)
void cpu_jump(Environment *_environment, char *_label)
void cpu_return(Environment *_environment)
void cpu_blit_initialize(Environment *_environment)
int variable_exists(Environment *_environment, char *_name)
Variable * variable_resize_buffer(Environment *_environment, char *_destination, int _size)
Resize the (static) size of a buffer.
Variable * variable_define(Environment *_environment, char *_name, VariableType _type, int _value)
Define a variable for the program.
void blit_define(Environment *_environment, char *_name, int _sop, int _mop, int _smop, int _iop, int _dop, int _idop, int _top)
Emit ASM code for BLIT IMAGE [image] AT [int],[int].
void blit_define_compound_binary(Environment *_environment, int _operation, int _operand1, int _operand2, int _result)
void blit_define_compound_unary(Environment *_environment, int _operation, int _operand, int _result)
void blit_define_begin_compound(Environment *_environment, char *_name)
void blit_define_compound_operand_to_register(Environment *_environment, int _register, int _source)
void blit_define_end_compound(Environment *_environment, int _result)
#define MAX_TEMPORARY_STORAGE
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
#define CRITICAL_BLIT_ALREADY_DEFINED(n)
char DATATYPE_AS_STRING[][16]