43static void blit_define_bltu(
Environment * _environment,
int _op,
char * _a,
char * _c ) {
48 outline0(
"; bltu C = (2^bpp-1) if A > 0 (threshold)");
60 outline1(
"JR Z, %sthreshold1", label );
67 outline1(
"JR Z, %sthreshold2", label );
75 outline1(
"JR Z, %sthreshold3", label );
83 outline1(
"JR Z, %sthreshold4", label );
95 outline1(
"JR Z, %sthreshold1", label );
102 outline1(
"JR Z, %sthreshold2", label );
109 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 2 ) {
113 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 1 ) {
123 unsigned char value = 0;
133 value = ( ( _op & 0x1 ) );
134 value |= ( ( ( _op & 0x2 ) ) << 3 );
135 value = value | ( value << 1 ) | ( value << 2 ) | ( value << 3 );
138 value = ( ( _op & 0x8 ) >> 3 );
139 value |= ( ( ( _op & 0x2 ) ) << 1 );
140 value |= ( ( ( _op & 0x4 ) ) << 2 );
141 value |= ( ( ( _op & 0x1 ) ) << 6 );
142 value = value | ( value << 1 );
152static void blit_define_bltb(
Environment * _environment,
int _op,
char * _a,
char * _b,
char * _d ) {
161 }
else if ( _op == 1 ) {
168 }
else if ( _op == 2 ) {
175 }
else if ( _op == 3 ) {
179 }
else if ( _op == 4 ) {
183 }
else if ( _op == 5 ) {
184 outline0(
"; bltb C = A if B>0, 0 if B=0");
263void blit_define(
Environment * _environment,
char * _name,
int _sop,
int _mop,
int _smop,
int _iop,
int _dop,
int _idop,
int _top ) {
268 cpu_jump( _environment, skipLabel );
279 blit_define_bltu( _environment, _sop,
"B",
"H" );
282 blit_define_bltu( _environment, _mop,
"IYH",
"L" );
285 blit_define_bltb( _environment, _smop,
"H",
"L",
"D" );
288 blit_define_bltu( _environment, _iop,
"D",
"H" );
291 blit_define_bltu( _environment, _dop,
"IYL",
"L" );
294 blit_define_bltb( _environment, _idop,
"H",
"L",
"D" );
297 blit_define_bltu( _environment, _top,
"D",
"E" );
308static const char BLIT_SOURCES_REGISTER[][4] = {
324 memset( &_environment->
blit, 0,
sizeof(
Blit ) );
326 _environment->
blit.
name = strdup( _name );
329 cpu_jump( _environment, skipLabel );
340 outline1(
"LD A, %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]