diff --git a/ugbc/src/targets/pc128op/bank_read.c b/ugbc/src/targets/pc128op/bank_read.c index d11b41392..fdd067985 100755 --- a/ugbc/src/targets/pc128op/bank_read.c +++ b/ugbc/src/targets/pc128op/bank_read.c @@ -136,3 +136,20 @@ void bank_read_vars( Environment * _environment, char * _bank, char * _address1, outline0("; end bank read") } + +void bank_read_vars_direct( Environment * _environment, char * _bank, char * _address1, char * _address2, char * _size ) { + + outline0("; bank read direct") + Variable * previous = bank_get( _environment ); + bank_set_var( _environment, _bank ); + Variable * bankAddress = bank_get_address_var( _environment, _bank ); + Variable * address1 = variable_retrieve_or_define( _environment, _address1, VT_ADDRESS, 0 ); + Variable * realAddress = variable_add( _environment, bankAddress->name, address1->name ); + Variable * size = variable_retrieve_or_define( _environment, _size, VT_WORD, 0 ); + + cpu_mem_move_direct2( _environment, realAddress->realName, _address2, size->realName ); + + bank_set_var( _environment, previous->name ); + outline0("; end bank read direct") + +} diff --git a/ugbc/src/targets/pc128op/bank_uncompress.c b/ugbc/src/targets/pc128op/bank_uncompress.c index 44bde2f6b..4a0986f4d 100755 --- a/ugbc/src/targets/pc128op/bank_uncompress.c +++ b/ugbc/src/targets/pc128op/bank_uncompress.c @@ -70,7 +70,7 @@ del banco), ed infine l'indirizzo di destinazione, che sarĂ  la memoria RAM. */ void bank_uncompress_semi_var( Environment * _environment, int _bank, int _address1, char * _address2 ) { - outline0("; bank uncompress") + outline0("; bank uncompress (1)") Variable * previous = bank_get( _environment ); bank_set( _environment, _bank ); int realAddress = 0x6000 + _address1; @@ -78,7 +78,7 @@ void bank_uncompress_semi_var( Environment * _environment, int _bank, int _addre sprintf(realAddressAsString, "$%4.4x", realAddress); cpu_msc1_uncompress_direct_direct( _environment, realAddressAsString, _address2 ); bank_set_var( _environment, previous->name ); - outline0("; end bank uncompress") + outline0("; end bank uncompress (1)") } @@ -98,7 +98,7 @@ void bank_uncompress_semi_var( Environment * _environment, int _bank, int _addre */ void bank_uncompress_vars( Environment * _environment, char * _bank, char * _address1, char * _address2 ) { - outline0("; bank uncompress") + outline0("; bank uncompress (2)") Variable * previous = bank_get( _environment ); bank_set_var( _environment, _bank ); Variable * bankAddress = bank_get_address_var( _environment, _bank ); @@ -107,6 +107,6 @@ void bank_uncompress_vars( Environment * _environment, char * _bank, char * _add Variable * address2 = variable_retrieve_or_define( _environment, _address2, VT_ADDRESS, 0 ); cpu_msc1_uncompress_indirect_indirect( _environment, realAddress->name, address2->name ); bank_set_var( _environment, previous->name ); - outline0("; end bank uncompress") + outline0("; end bank uncompress (2)") } diff --git a/ugbc/src/targets/pc128op/put_image.c b/ugbc/src/targets/pc128op/put_image.c index 5486f14fb..ddf456195 100755 --- a/ugbc/src/targets/pc128op/put_image.c +++ b/ugbc/src/targets/pc128op/put_image.c @@ -82,28 +82,41 @@ void put_image( Environment * _environment, char * _image, char * _x, char * _y, char bankWindowName[MAX_TEMPORARY_STORAGE]; sprintf( bankWindowName, "BANKWINDOW%2.2x", image->residentAssigned ); - cpu_compare_and_branch_16bit_const( _environment, bankWindowId, image->variableUniqueId, alreadyLoadedLabel, 1 ); - if ( image->uncompressedSize ) { - bank_uncompress_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName ); - } else { - bank_read_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName, image->size ); - } - cpu_store_16bit(_environment, bankWindowId, image->variableUniqueId ); - cpu_label( _environment, alreadyLoadedLabel ); + // cpu_compare_and_branch_16bit_const( _environment, bankWindowId, image->variableUniqueId, alreadyLoadedLabel, 1 ); + // if ( image->uncompressedSize ) { + // bank_uncompress_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName ); + // } else { + // bank_read_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName, image->size ); + // } + // cpu_store_16bit(_environment, bankWindowId, image->variableUniqueId ); + // cpu_label( _environment, alreadyLoadedLabel ); + + Variable * frameSize = variable_temporary( _environment, VT_WORD, "(temporary)"); + variable_store( _environment, frameSize->name, image->frameSize ); + Variable * bank = variable_temporary( _environment, VT_BYTE, "(temporary)"); + variable_store( _environment, bank->name, image->bankAssigned ); + Variable * offset = variable_temporary( _environment, VT_ADDRESS, "(temporary)"); if ( !sequence ) { if ( !frame ) { - ef936x_put_image( _environment, image->realName, x->realName, y->realName, "", "", image->frameSize, image->frameCount, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, "", "", image->frameSize, image->frameCount ); } else { - ef936x_put_image( _environment, image->realName, x->realName, y->realName, frame->realName, "", image->frameSize, image->frameCount, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, "", frame->realName, image->frameSize, image->frameCount ); } } else { if ( !frame ) { - ef936x_put_image( _environment, image->realName, x->realName, y->realName, "", sequence->realName, image->frameSize, image->frameCount, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, sequence->realName, "", image->frameSize, image->frameCount ); } else { - ef936x_put_image( _environment, image->realName, x->realName, y->realName, frame->realName, sequence->realName, image->frameSize, image->frameCount, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, sequence->realName, frame->realName, image->frameSize, image->frameCount ); } } + + Variable * address = variable_temporary( _environment, VT_ADDRESS, "(temporary)"); + variable_store( _environment, address->name, image->absoluteAddress ); + variable_add_inplace_vars( _environment, address->name, offset->name ); + bank_read_vars_direct( _environment, bank->name, address->name, bankWindowName, frameSize->name ); + ef936x_put_image( _environment, bankWindowName, x->realName, y->realName, NULL, NULL, image->frameSize, 0, _flags ); + } else { if ( !sequence ) { if ( !frame ) { @@ -132,20 +145,33 @@ void put_image( Environment * _environment, char * _image, char * _x, char * _y, char bankWindowName[MAX_TEMPORARY_STORAGE]; sprintf( bankWindowName, "BANKWINDOW%2.2x", image->residentAssigned ); - cpu_compare_and_branch_16bit_const( _environment, bankWindowId, image->variableUniqueId, alreadyLoadedLabel, 1 ); - if ( image->uncompressedSize ) { - bank_uncompress_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName ); - } else { - bank_read_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName, image->size ); - } - cpu_store_16bit(_environment, bankWindowId, image->variableUniqueId ); - cpu_label( _environment, alreadyLoadedLabel ); + // cpu_compare_and_branch_16bit_const( _environment, bankWindowId, image->variableUniqueId, alreadyLoadedLabel, 1 ); + // if ( image->uncompressedSize ) { + // bank_uncompress_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName ); + // } else { + // bank_read_semi_var( _environment, image->bankAssigned, image->absoluteAddress, bankWindowName, image->size ); + // } + // cpu_store_16bit(_environment, bankWindowId, image->variableUniqueId ); + // cpu_label( _environment, alreadyLoadedLabel ); + + Variable * frameSize = variable_temporary( _environment, VT_WORD, "(temporary)"); + variable_store( _environment, frameSize->name, image->frameSize ); + Variable * bank = variable_temporary( _environment, VT_BYTE, "(temporary)"); + variable_store( _environment, bank->name, image->bankAssigned ); + Variable * offset = variable_temporary( _environment, VT_ADDRESS, "(temporary)"); if ( !frame ) { - ef936x_put_image( _environment, bankWindowName, x->realName, y->realName, "", NULL, image->frameSize, 0, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, NULL, "", image->frameSize, 0 ); } else { - ef936x_put_image( _environment, bankWindowName, x->realName, y->realName, frame->realName, NULL, image->frameSize, 0, _flags ); + ef936x_calculate_sequence_frame_offset(_environment, offset->realName, NULL, frame->realName, image->frameSize, 0 ); } + + Variable * address = variable_temporary( _environment, VT_ADDRESS, "(temporary)"); + variable_store( _environment, address->name, image->absoluteAddress ); + variable_add_inplace_vars( _environment, address->name, offset->name ); + bank_read_vars_direct( _environment, bank->name, address->name, bankWindowName, frameSize->name ); + ef936x_put_image( _environment, bankWindowName, x->realName, y->realName, NULL, NULL, image->frameSize, 0, _flags ); + } else { if ( !frame ) { ef936x_put_image( _environment, image->realName, x->realName, y->realName, "", NULL, image->frameSize, 0, _flags );