43static void blit_define_bltu(
Environment * _environment,
int _op,
char * _a,
char * _c ) {
50 outline0(
"; bltu C = (2^bpp-1) if A > 0 (threshold)");
62 outline1(
"JR Z, %sthreshold1", label );
69 outline1(
"JR Z, %sthreshold2", label );
77 outline1(
"JR Z, %sthreshold3", label );
85 outline1(
"JR Z, %sthreshold4", label );
97 outline1(
"JR Z, %sthreshold1", label );
104 outline1(
"JR Z, %sthreshold2", label );
111 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 2 ) {
115 }
else if ( _op == ( 1 << _environment->
currentModeBW ) + 1 ) {
125 unsigned char value = 0;
135 value = ( ( _op & 0x1 ) );
136 value |= ( ( ( _op & 0x2 ) ) << 3 );
137 value = value | ( value << 1 ) | ( value << 2 ) | ( value << 3 );
140 value = ( ( _op & 0x8 ) >> 3 );
141 value |= ( ( ( _op & 0x2 ) ) << 1 );
142 value |= ( ( ( _op & 0x4 ) ) << 2 );
143 value |= ( ( ( _op & 0x1 ) ) << 6 );
144 value = value | ( value << 1 );
154static void blit_define_bltb(
Environment * _environment,
int _op,
char * _a,
char * _b,
char * _d ) {
165 }
else if ( _op == 1 ) {
172 }
else if ( _op == 2 ) {
179 }
else if ( _op == 3 ) {
183 }
else if ( _op == 4 ) {
187 }
else if ( _op == 5 ) {
188 outline0(
"; bltb C = A if B>0, 0 if B=0");
267void blit_define(
Environment * _environment,
char * _name,
int _sop,
int _mop,
int _smop,
int _iop,
int _dop,
int _idop,
int _top ) {
274 cpu_jump( _environment, skipLabel );
285 blit_define_bltu( _environment, _sop,
"B",
"H" );
288 blit_define_bltu( _environment, _mop,
"IYH",
"L" );
291 blit_define_bltb( _environment, _smop,
"H",
"L",
"D" );
294 blit_define_bltu( _environment, _iop,
"D",
"H" );
297 blit_define_bltu( _environment, _dop,
"IYL",
"L" );
300 blit_define_bltb( _environment, _idop,
"H",
"L",
"D" );
303 blit_define_bltu( _environment, _top,
"D",
"E" );
314static const char BLIT_SOURCES_REGISTER[][4] = {
332 memset( &_environment->
blit, 0,
sizeof(
Blit ) );
334 _environment->
blit.
name = strdup( _name );
337 cpu_jump( _environment, skipLabel );
350 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]