//// imported
#include "../_sdk/emit.h"
//фы script эрфю т рёёхьсыхЁх яю ъюьрэфх DW яшёрЄ№ uint64_t т Їрщы, эю єърчрЄхы№ шэъЁхьхэЄшЁютрЄ№ Єюы№ъю эр 1
//#include "sizesz80.h"
//тхчфх, уфх эєцхэ ёЄЁюъют√щ ярЁрьхЄЁ, шёяюы№чєхЄё _joined
//(ъЁюьх call - Єрь _callee, ш ъЁюьх loadrg/b - Єрь _const)
//т ъюэЎх ы■сюую т√ўшёыхэш (put, call, jpiffalse) фхыры _jpflag = 0x00 (шэрўх яЁхф√фє∙хх "юяЄшьшчшЁютрээюх" ёЁртэхэшх ьюцхЄ шёяюЁЄшЄ№ эют√щ єёыютэ√щ яхЁхїюф)
//юёЄртшы Єюы№ъю т jpiffalse, Є.ъ. юёЄры№э√х эх ьюуєЄ с√Є№ "юяЄшьшчшЁютрээ√ьш"
EXPORT VAR PCHAR _callee; //эрчтрэшх т√ч√трхьющ яЁюЎхфєЁ√ (ё єў╕Єюь ьюфєы )
EXPORT VAR UINT _lencallee;
EXTERN PCHAR _joined; //ртЄюьхЄър
EXTERN UINT _lenjoined;
EXTERN PCHAR _const; //ёЄрЁр ъюэёЄрэЄр
EXTERN UINT _lenconst;
EXPORT VAR BYTE _exprlvl; //уыєсшэр т√Ёрцхэш (тхЁїэшщ єЁютхэ№ == 1)
//тэх°эшх яЁюЎхфєЁ√ (шч rgs) - todo т codegen эх шёяюы№чютрЄ№ rgs
EXTERN BYTE _rnew;
EXTERN BYTE _rold;
EXTERN BYTE _rold2;
EXTERN BYTE _rold3;
//rg pool
PROC getnothing FORWARD(); //ёюїЁрэшЄ№ ЁхушёЄЁ√ ш срщЄ√ т ёЄхъх ш юётюсюфшЄ№
//PROC getmainrg FORWARD(); //тч Є№ RMAIN=new ш юётюсюфшЄ№ юёЄры№э√х ЁхушёЄЁ√
PROC getmain2rgs FORWARD(); //тч Є№ RMAIN=old, RMAIN2=new ш юётюсюфшЄ№ юёЄры№э√х ЁхушёЄЁ√ //фы call2rgs
//PROC getmain3rgs FORWARD(); //фы call3rgs
PROC getmain4rgs FORWARD(); //фы call4rgs
PROC setmainrg FORWARD(); //єёЄрэютшЄ№ яЁшчэръш, ъръ сєфЄю ь√ яюыєўшыш Ёхчєы№ЄрЄ т ЁхушёЄЁх //фы call2rgs
PROC setmain2rgs FORWARD(); //єёЄрэютшЄ№ яЁшчэръш, ъръ сєфЄю ь√ яюыєўшыш Ёхчєы№ЄрЄ т ЁхушёЄЁрї //фы call4rgs
PROC rgs_initrgs FORWARD();
////
#define _RGBUFSZ (BYTE)(_NRGS+0x01)
//яЁшюЁшЄхЄ√ ЁхушёЄЁют:
CONST BYTE _RMAIN = 0x01; /**HL*/ /**ЁхушёЄЁ Ёхчєы№ЄрЄр ш яхЁтюую ярЁрьхЄЁр ёЄрэфрЁЄэ√ї ЇєэъЎшщ*/
CONST BYTE _RMAIN2= 0x02; /**DE*/ /**ЁхушёЄЁ тЄюЁюую ёыютр Ёхчєы№ЄрЄр ш тЄюЁюую ярЁрьхЄЁр ёЄрэфрЁЄэ√ї ЇєэъЎшщ*/
CONST BYTE _RMAIN3= 0x03;
CONST BYTE _RMAIN4= 0x04;
CONST PCHAR _RNAME[_RGBUFSZ] = {
"", //0 яєёЄющ
"HL",
"DE",
"BC",
"IX"
};
CONST PCHAR _RHIGH[_RGBUFSZ] = {
"", //0 яєёЄющ
"H",
"D",
"B",
"HX"
};
CONST PCHAR _RLOW[_RGBUFSZ] = {
"", //0 яєёЄющ
"L",
"E",
"C",
"LX"
};
VAR BYTE _rproxy;
VAR BOOL _fused;
VAR BOOL _azused; //A ёюфхЁцшЄ яЁртшы№э√щ 0/эх0 яюёых ёЁртэхэш
VAR INT _funcstkdepth;
VAR BYTE _jpflag; //0=OR A:JZ, 1=JZ, 2=JNZ, 3=JNC, 4=JC
EXPORT CONST BYTE _typesz[32] = { //ЁрчьхЁ Єшяр т срщЄрї фы ЄрЁухЄр //чфхё№ эх шёяюы№чєхЄё
_SZ_BYTE/**T_BYTE */, //фы тёхї ЄрЁухЄют
_SZ_REG/**T_UINT */, //фы тёхї ЄрЁухЄют
_SZ_REG/**T_INT */, //фы тёхї ЄрЁухЄют
_SZ_BOOL/**T_BOOL */,
_SZ_LONG/**T_LONG */,
_SZ_BYTE/**T_CHAR */,
_SZ_LONG/**T_FLOAT*/,
0x00/**unknown*/,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
_SZ_REG/**T_PBYTE */,
_SZ_REG/**T_PUINT */,
_SZ_REG/**T_PINT */,
_SZ_REG/**T_PBOOL */,
_SZ_REG/**T_PLONG */,
_SZ_REG/**T_PCHAR */,
_SZ_REG/**T_PFLOAT*/,
_SZ_REG/** */,
_SZ_REG, _SZ_REG, _SZ_REG, _SZ_REG, _SZ_REG, _SZ_REG, _SZ_REG, _SZ_REG //pointer to...
};
CONST BYTE _typeshift[32] = { //log ЁрчьхЁ Єшяр (n фы 2^n срщЄ) фы ЄрЁухЄр //чфхё№ эх шёяюы№чєхЄё
_RL_BYTE/**T_BYTE */, //фы тёхї ЄрЁухЄют
_RL_REG/**T_UINT */, //фы тёхї ЄрЁухЄют
_RL_REG/**T_INT */, //фы тёхї ЄрЁухЄют
_RL_BOOL/**T_BOOL */,
_RL_LONG/**T_LONG */,
_RL_BYTE/**T_CHAR */,
_RL_LONG/**T_FLOAT*/,
0x00/**unknown*/,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
_RL_REG/**T_BYTE */,
_RL_REG/**T_UINT */,
_RL_REG/**T_INT */,
_RL_REG/**T_BOOL */,
_RL_REG/**T_LONG */,
_RL_REG/**T_CHAR */,
_RL_REG/**T_PFLOAT*/,
_RL_REG/** */,
_RL_REG, _RL_REG, _RL_REG, _RL_REG, _RL_REG, _RL_REG, _RL_REG, _RL_REG //pointer to...
};
PROC initrgs FORWARD(); //юўшёЄшЄ№ ёюёЄю эш ЁхушёЄЁют ш срщЄют (шёяюы№чєхЄё т cemitfunc)
//////////// ьхыъшх яЁюЎхфєЁ√ фы ёюъЁр∙хэш ўшёыр ъюэёЄрэЄ
EXPORT PROC var_alignwsz()
{
}
EXPORT PROC var_db() //фюёЄєяэю шч compile фы ёЄЁюъ!
{
varstr( "\tDB " );
}
EXPORT PROC asm_db() //ъюёЄ√ы№ фы ъюэёЄрэЄэ√ї ьрёёштют ёЄЁюъ TODO
{
asmstr( "\tDB " );
}
EXPORT PROC var_dw() //фюёЄєяэю шч compile!
{
varstr( "\tDW " );
}
PROC var_dl()
{
varstr( "\tDL " );
}
EXPORT PROC var_ds() //фюёЄєяэю шч compile!
{
varstr( "\tDS " );
}
PROC asm_add_eol()
{
asmstr( "\tDW CMD_ADD" ); endasm();
}
PROC asm_sub_eol()
{
asmstr( "\tDW CMD_SUB" ); endasm();
}
PROC asm_mul_eol()
{
asmstr( "\tDW CMD_MUL" ); endasm();
}
PROC asm_div_eol()
{
asmstr( "\tDW CMD_DIV" ); endasm();
}
PROC asm_addfloat_eol()
{
asmstr( "\tDW CMD_ADDFLOAT" ); endasm();
}
PROC asm_subfloat_eol()
{
asmstr( "\tDW CMD_SUBFLOAT" ); endasm();
}
PROC asm_mulfloat_eol()
{
asmstr( "\tDW CMD_MULFLOAT" ); endasm();
}
PROC asm_divfloat_eol()
{
asmstr( "\tDW CMD_DIVFLOAT" ); endasm();
}
PROC asm_divsigned_eol()
{
asmstr( "\tDW CMD_DIVSIGNED" ); endasm();
}
PROC asm_negfloat_eol()
{
asmstr( "\tDW CMD_NEGFLOAT" ); endasm();
}
PROC asm_if0goto()
{
asmstr( "\tDW CMD_IF0GOTO," );
}
PROC asm_goto()
{
asmstr( "\tDW CMD_GOTO," );
}
PROC asm_dup_eol()
{
asmstr( "\tDW CMD_DUP" ); endasm();
}
PROC asm_drop_eol()
{
asmstr( "\tDW CMD_DROP" ); endasm();
}
PROC asm_swap_eol()
{
asmstr( "\tDW CMD_SWAP" ); endasm();
}
PROC asm_readvar_eol()
{
asmstr( "\tDW CMD_READVAR" ); endasm();
}
PROC asm_writevar_eol()
{
asmstr( "\tDW CMD_WRITEVAR" ); endasm();
}
PROC asm_const()
{
asmstr( "\tDW CMD_CONST," );
}
PROC asm_ret_eol()
{
asmstr( "\tDW CMD_RET" ); endasm();
}
PROC asm_call()
{
asmstr( "\tDW CMD_CALL," );
}
PROC asm_and_eol()
{
asmstr( "\tDW CMD_AND" ); endasm();
}
PROC asm_or_eol()
{
asmstr( "\tDW CMD_OR" ); endasm();
}
PROC asm_xor_eol()
{
asmstr( "\tDW CMD_XOR" ); endasm();
}
PROC asm_eq_eol()
{
asmstr( "\tDW CMD_EQ" ); endasm();
}
PROC asm_moreeq_eol()
{
asmstr( "\tDW CMD_MOREEQ" ); endasm();
}
PROC asm_moreeqsigned_eol()
{
asmstr( "\tDW CMD_MOREEQSIGNED" ); endasm();
}
PROC asm_eqfloat_eol()
{
asmstr( "\tDW CMD_EQFLOAT" ); endasm();
}
PROC asm_moreeqfloat_eol()
{
asmstr( "\tDW CMD_MOREEQFLOAT" ); endasm();
}
PROC asm_inv_eol()
{
asmstr( "\tDW CMD_INV" ); endasm();
}
PROC asm_rst()
{
asmstr( "\tDW CMD_RST," );
}
PROC asm_shr_eol()
{
asmstr( "\tDW CMD_SHR" ); endasm();
}
PROC asm_shrsigned_eol()
{
asmstr( "\tDW CMD_SHRSIGNED" ); endasm();
}
PROC asm_shl_eol()
{
asmstr( "\tDW CMD_SHL" ); endasm();
}
PROC asm_mod_eol()
{
asmstr( "\tDW CMD_MOD" ); endasm();
}
PROC asm_done_eol()
{
asmstr( "\tDW CMD_DONE" ); endasm();
}
PROC asm_1_eol()
{
asmstr( "\tDW CMD_CONST,1" ); endasm();
}
PROC asm_floattoint_eol()
{
asmstr( "\tDW CMD_FLOATTOINT" ); endasm();
}
PROC asm_inttofloat_eol()
{
asmstr( "\tDW CMD_INTTOFLOAT" ); endasm();
}
PROC asm_readconstvar()
{
asmstr( "\tDW CMD_READCONSTVAR," );
}
PROC asm_writeconstvar()
{
asmstr( "\tDW CMD_WRITECONSTVAR," );
}
PROC asm_incconstvar()
{
asmstr( "\tDW CMD_INCCONSTVAR," );
}
PROC asm_decconstvar()
{
asmstr( "\tDW CMD_DECCONSTVAR," );
}
PROC emitinc()
{
asm_1_eol();
asm_add_eol();
}
PROC emitdec()
{
asm_1_eol();
asm_sub_eol();
}
PROC emitcall(PCHAR s)
{
asm_call(); asmstr( s ); endasm();
}
///////////////////////////////////
//фюёЄєяэ√ шч commands
PROC unproxy()
{
}
PROC proxy(BYTE r)
{
}
///////////////////////////////////////////////////////////
//яЁюЎхфєЁ√ ё ьр°шээ√ь ъюфюь фы rgs
PROC emitpushrg(BYTE rnew)
{
//unproxy(); //todo юяЄшьшчшЁютрЄ№
//asm_push(); asm_rname(rnew); endasm();
//INC _funcstkdepth;
}
PROC emitpoprg(BYTE rnew) //ЁхушёЄЁ єцх яюьхўхэ т getrfree/getrg
{
//asm_pop(); asm_rname(rnew); endasm();
//DEC _funcstkdepth;
}
PROC emitmovrg(BYTE rsrc, BYTE rdest) //эх чрърч√трхЄ ш эх юётюсюцфрхЄ (ёь. emitmoverg)
{
//asm_push(); asm_rname(rsrc); endasm();
//asm_pop(); asm_rname(rdest); endasm();
}
///////////////////////////////////////////////////////////////////////////////////////
//¤Єш яЁюЎхфєЁ√ ухэхЁшЁє■Є ъюф
//эхфюёЄєяэ√ шч ъюьяшы ЄюЁр, фюёЄєяэ√ шч commands
EXPORT PROC emitasmlabel(PCHAR s)
{
asmstr(s); /**asmc( ':' );*/ endasm();
}
EXPORT PROC emitfunclabel(PCHAR s)
{
asmstr(s); /**asmc( ':' );*/ endasm();
}
EXPORT PROC emitvarlabel(PCHAR s)
{
varstr(s); /**varc( ':' );*/ endvar();
}
EXPORT PROC emitexport(PCHAR s) //todo тёхуфр _joined
{
asmstr("\tEXPORT "); asmstr(s); endasm();
}
EXPORT PROC emitvarpreequ(PCHAR s)
{
}
EXPORT PROC emitvarpostequ()
{
}
EXPORT PROC varequ(PCHAR s)
{
varstr(s); varc('=');
}
EXPORT FUNC UINT varshift(UINT shift, UINT sz)
{
//IF (sz >= 4) shift = (shift+3)&(UINT)(-4);
//asmstr(_joined); asmc('='); asmuint(shift); endasm();
varequ(_joined); /**varstr(_joined); varc('=');*/ varuint(shift); endvar();
RETURN shift;
}
PROC emitjpmainrg() //"jp (hl)"
{
//эр ¤ЄюЄ ьюьхэЄ фы яЁхфёърчєхьюёЄш тёх ЁхушёЄЁ√ фюыцэ√ с√Є№ ётюсюфэ√
//(ёхщўрё ¤Єю яюыєўшЄё ртЄюьрЄшўхёъш, эю схч storergs ш ё ЁхчхЁтшЁютрэшхь ЁхушёЄЁют эрфю юётюсюцфрЄ№ тЁєўэє■)
unproxy();
getnothing(); //getnothingword();
asmstr("unsupported: emitjpmainrg()"); endasm();
}
PROC emitcallmainrg() //"call (hl)"
{
//эр ¤ЄюЄ ьюьхэЄ фы яЁхфёърчєхьюёЄш тёх ЁхушёЄЁ√ фюыцэ√ с√Є№ ётюсюфэ√
//(ёхщўрё ¤Єю яюыєўшЄё ртЄюьрЄшўхёъш, эю схч storergs ш ё ЁхчхЁтшЁютрэшхь ЁхушёЄЁют эрфю юётюсюцфрЄ№ тЁєўэє■)
unproxy();
getnothing(); //getnothingword();
asmstr("unsupported: emitcallmainrg()"); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitjp()
{
//эр ¤ЄюЄ ьюьхэЄ фы яЁхфёърчєхьюёЄш тёх ЁхушёЄЁ√ фюыцэ√ с√Є№ ётюсюфэ√
//(ёхщўрё ¤Єю яюыєўшЄё ртЄюьрЄшўхёъш, эю схч storergs ш ё ЁхчхЁтшЁютрэшхь ЁхушёЄЁют эрфю юётюсюцфрЄ№ тЁєўэє■)
unproxy();
getnothing(); //getnothingword();
asm_goto(); asmstr(_joined); endasm();
}
PROC emitbtoz() //яхЁхф jp!
{
//ёЁрчє яюёых ёЁртэхэш эх эрфю, эю тфЁєу ь√ ўшЄрхь BOOL
}
PROC emitless()
{
asm_moreeq_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitlesssigned()
{
asm_moreeqsigned_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitlessb()
{
emitless();
}
PROC emitlessfloat()
{
asm_moreeqfloat_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitlesseq()
{
asm_swap_eol();
asm_moreeq_eol();
_jpflag = 0x00;
}
PROC emitlesseqsigned()
{
asm_swap_eol();
asm_moreeqsigned_eol();
_jpflag = 0x00;
}
PROC emitlesseqb()
{
emitlesseq();
}
PROC emitlesseqfloat()
{
asm_swap_eol();
asm_moreeqfloat_eol();
_jpflag = 0x00;
}
PROC emitmore()
{
asm_swap_eol();
asm_moreeq_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitmoresigned()
{
asm_swap_eol();
asm_moreeqsigned_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitmoreb()
{
emitmore();
}
PROC emitmorefloat()
{
asm_swap_eol();
asm_moreeqfloat_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitmoreeq()
{
asm_moreeq_eol();
_jpflag = 0x00;
}
PROC emitmoreeqsigned()
{
asm_moreeqsigned_eol();
_jpflag = 0x00;
}
PROC emitmoreeqb()
{
emitmoreeq();
}
PROC emitmoreeqfloat()
{
asm_moreeqfloat_eol();
_jpflag = 0x00;
}
PROC emiteqfloat()
{
asm_eqfloat_eol();
_jpflag = 0x00;
}
PROC emitneqfloat()
{
asm_eqfloat_eol();
asm_inv_eol();
_jpflag = 0x00;
}
PROC emitjpiffalse()
{
//эр ¤ЄюЄ ьюьхэЄ фы яЁхфёърчєхьюёЄш тёх ЁхушёЄЁ√ фюыцэ√ с√Є№ ётюсюфэ√
//(ёхщўрё ¤Єю яюыєўшЄё ртЄюьрЄшўхёъш, эю схч storergs ш ё ЁхчхЁтшЁютрэшхь ЁхушёЄЁют эрфю юётюсюцфрЄ№ тЁєўэє■)
//unproxy();
getnothing(); //getnothingword();
IF (_jpflag == 0x02) {asm_eq_eol(); //asmstr("NZ");
}ELSE IF (_jpflag == 0x03) {asm_moreeq_eol(); asm_inv_eol(); //asmstr("NC");
}ELSE IF (_jpflag == 0x04) {asm_moreeq_eol(); //asmc('C');
}ELSE IF (_jpflag == 0x01) {asm_eq_eol(); asm_inv_eol(); //asmc('Z');
};
asm_if0goto();
asmstr(_joined);
endasm();
_fused = +FALSE;
_jpflag = 0x00;
}
PROC emitret()
{
//unproxy();
asm_ret_eol();
}
PROC emitaddfloat()
{
asm_addfloat_eol();
}
PROC emitsubfloat()
{
asm_subfloat_eol();
}
PROC emitmulbyte()
{
asm_mul_eol();
}
PROC emitmuluint()
{
asm_mul_eol();
}
PROC emitmullong()
{
asm_mul_eol();
}
PROC emitmulfloat()
{
asm_mulfloat_eol();
}
PROC emitdivbyte()
{
asm_div_eol();
}
PROC emitdivint()
{
asm_divsigned_eol();
}
PROC emitdivuint()
{
asm_div_eol();
}
PROC emitdivlong()
{
asm_div_eol();
}
PROC emitdivfloat()
{
asm_divfloat_eol();
}
PROC emitnegfloat()
{
asm_negfloat_eol();
}
PROC emitshlbyte()
{
asm_shl_eol();
}
PROC emitshluint()
{
asm_shl_eol();
}
PROC emitshllong()
{
asm_shl_eol();
}
PROC emitshrbyte()
{
asm_shr_eol();
}
PROC emitshrint()
{
asm_shrsigned_eol();
}
PROC emitshruint()
{
asm_shr_eol();
}
PROC emitshrlong()
{
asm_shr_eol();
}
PROC emitcallproc()
{
_jpflag = 0x00;
emitcall(_callee);
}
PROC emitloadrg(BOOL high) //ЁхушёЄЁ єцх чрэ Є ўхЁхч getrfree
{
asm_const();
asmstr(_const);
//IF (high) {asmstr( ">>32"/**WORDBITS*/ );
//}ELSE {asmstr( "&0xffffffff"/**WORDMASK*/ );
//};
endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitloadrg0() //ЁхушёЄЁ єцх чрэ Є ўхЁхч getrfree
{
asm_const(); asmc('0'); endasm();
}
PROC emitloadb() //ръъєьєы ЄюЁ єцх чрэ Є ўхЁхч getfreea
{
asm_const(); asmstr(_const); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitgetrg(BOOL high) //ЁхушёЄЁ єцх чрэ Є ўхЁхч getrfree
{
// asm_const(); asmstr(_joined);
//IF (high) {asmc('+'); asmc('1');
//};
// endasm();
// asm_readvar_eol();
asm_readconstvar();
asmstr(_joined); endasm();
}
PROC emitgetb() //ръъєьєы ЄюЁ єцх чрэ Є ўхЁхч getfreea
{
// asm_const(); asmstr(_joined); endasm();
// asm_readvar_eol();
asm_readconstvar();
asmstr(_joined); endasm();
}
PROC emitputrg(BOOL high) //ld [],new
{
//_jpflag = 0x00;
// asm_const(); asmstr(_joined);
//IF (high) {asmc('+'); asmc('1');
//};
// endasm();
// asm_swap_eol();
// asm_writevar_eol();
asm_writeconstvar();
asmstr(_joined); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitputb()
{
//_jpflag = 0x00;
// asm_const(); asmstr(_joined); endasm();
// asm_swap_eol();
// asm_writevar_eol();
asm_writeconstvar();
asmstr(_joined); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitshl1rg()
{
asm_1_eol();
asm_shl_eol();
}
PROC emitshl1b()
{
asm_1_eol();
asm_shl_eol();
}
PROC emitinvb() //~A -> A
{
asm_inv_eol();
}
PROC emitinvrg()
{
asm_inv_eol();
}
PROC emitnegrg()
{
asm_inv_eol();
emitinc();
}
PROC emitztob()
{
IF (_exprlvl != 0x01) { //if (a == b)
asm_eq_eol();
_fused = +FALSE; //шэрўх уы■ъ яЁш if ((a==b))
//_jpflag = 0x00;
}ELSE {
//_fused = +TRUE;
_jpflag = 0x02;
};
}
PROC emitinvztob()
{
//asmstr(";emitinvztoa exprlvl="); asmuint(_exprlvl); endasm();
IF (_exprlvl != 0x01) { //if (a != b)
asm_eq_eol();
asm_inv_eol();
_fused = +FALSE; //шэрўх уы■ъ яЁш if ((a!=b))? todo test //тючьюцхэ уы■ъ ifnot ((a!=b))
//_jpflag = 0x00;
}ELSE {
//_fused = +TRUE;
_jpflag = 0x01;
};
}
/*
PROC emitcytob()
{
//asmstr(";emitcytoa exprlvl="); asmuint(_exprlvl); endasm();
IF (_exprlvl != 0x01) { //if (a < b)
unproxy();
asm_sbc(); asm_a(); asm_comma_a_eol();
_rproxy = _rnew;
//_fused = +FALSE;
//_jpflag = 0x00;
}ELSE {
//_fused = +TRUE;
_jpflag = 0x03;
};
}
*/
/**
PROC emitinvcytob()
{
//asmstr(";emitinvcytoa exprlvl="); asmuint(_exprlvl); endasm();
IF (_exprlvl != 0x01) { //if (a >= b)
emitccf();
unproxy();
asm_sbc(); asm_a(); asm_comma_a_eol();
_rproxy = _rnew;
//_fused = +FALSE;
//_jpflag = 0x00;
}ELSE {
//_fused = +TRUE;
_jpflag = 0x04;
};
}
*/
/**
PROC emitSxorVtob() //яюёых subflags, ЁрчЁхчхЁтшЁєхЄ A
{
asmstr( "\tRLA" ); endasm(); //sign
asm_jp(); asmstr( "PO,$+4" ); endasm();
emitccf();
emitcytob();
}
*/
/**
PROC emitinvSxorVtob() //яюёых subflags, ЁрчЁхчхЁтшЁєхЄ A
{
asmstr( "\tRLA" ); endasm(); //sign
asm_jp(); asmstr( "PE,$+4" ); endasm();
emitccf();
emitcytob();
}
*/
PROC emitxorrg() //old^new => old
{
asm_xor_eol();
}
PROC getxorb() //RGA^RGA2 -> RGA
{
asm_xor_eol();
_fused = +TRUE; //^^
}
PROC emitorrg() //old|new => old
{
asm_or_eol();
}
PROC getorb() //RGA|RGA2 -> RGA
{
asm_or_eol();
_fused = +TRUE; //||
}
PROC emitandrg() //old&new => old
{
asm_and_eol();
}
PROC getandb() //RGA&RGA2 -> RGA
{
asm_and_eol();
_fused = +TRUE; //&&
}
PROC emitaddrg() //old+new => old
{
asm_add_eol();
}
PROC emitadcrg() //old+new => old
{
//asm_add_eol();
asmstr("unsupported: emitadcrg()"); endasm();
}
PROC emitaddb() //old+new
{
asm_add_eol();
}
PROC emitaddbconst() //new8+<const>
{
emitloadb();
asm_add_eol();
}
PROC emitsubrg() //old-new => old
{
asm_sub_eol();
}
PROC emitsbcrg() //old-new => old
{
//asm_sub_eol();
asmstr("unsupported: emitsbcrg()"); endasm();
}
PROC emitsubb() //old-new
{
asm_sub_eol();
}
PROC emitsubbconst() //new8-<const>
{
emitloadb();
asm_sub_eol();
}
PROC emitsubflags(BYTE rnew, BYTE rold) //r2-r1 => CY,sign,overflow
{
asm_sub_eol();
//TODO!!!
_fused = +TRUE;
}
PROC emitsubbflags(BYTE anew, BYTE aold) //a2-a1 => CY
{ //sign,overflow эх эєцхэ!
asm_sub_eol();
//TODO!!!
_fused = +TRUE;
}
PROC emitsubz() //old-new => Z
{
//_fused = +TRUE;
}
PROC emitsubbz() //old-new => Z
{
//_fused = +TRUE;
}
PROC emitsubbzconst() //new-<const> => Z
{
emitloadb();
emitsubbz();
}
PROC emitsublongz() //old2-new, old3-old => Z
{
//TODO!!!
asm_drop_eol();
asm_drop_eol();
asm_drop_eol();
_fused = +TRUE;
}
PROC emitpokerg() //эютюх чряшё√трхь т ёЄрЁє■ ыюърЎш■ ярь Єш
{
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitpokeb() //эютюх чряшё√трхь т ёЄрЁє■ ыюърЎш■ ярь Єш
{
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitpokelong() //old2(addr), old(high), new(low)
{
//TODO!!!
asm_drop_eol();
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
/**
PROC asm_lda_mrgname_eol(BYTE r)
{
asm_lda_comma(); asm_mrgname(r); endasm();
}
*/
PROC emitpeekrg() //[new] => new
{
asm_readvar_eol();
}
PROC emitpeekb()
{
asm_readvar_eol();
}
PROC emitpeeklong() //[old] => old(high),new(low)
{
//TODO!!!
asm_readvar_eol();
asm_dup_eol();
}
PROC emitrgtob() //эхы№ч єсшЁрЄ№ - ёяхЎшЇшўэю
{
}
PROC emitbtorg()
{
}
PROC emitinttofloat()
{
asm_inttofloat_eol();
}
PROC emitfloattoint()
{
asm_floattoint_eol();
}
PROC emitincrg_byname()
{
// asm_const(); asmstr(_joined); endasm();
// asm_dup_eol();
// asm_readvar_eol();
// emitinc();
// asm_writevar_eol();
asm_incconstvar();
asmstr(_joined); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitincb_bypoi()
{
asm_dup_eol();
asm_readvar_eol();
emitinc();
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
/**
PROC emitinclong() //todo
{
asm_inc(); asm_open(); asm_rname(_rnew); asm_close(); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
*/
PROC emitdecrg_byname()
{
// asm_const(); asmstr(_joined); endasm();
// asm_dup_eol();
// asm_readvar_eol();
// emitdec();
// asm_writevar_eol();
asm_decconstvar();
asmstr(_joined); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitdecb_bypoi()
{
asm_dup_eol();
asm_readvar_eol();
emitdec();
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
/**
PROC emitdeclong() //todo
{
asm_dec(); asm_open(); asm_rname(_rnew); asm_close(); endasm();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
*/
PROC emitincrg_bypoi() //[old], new free
{
asm_dup_eol();
asm_readvar_eol();
emitinc();
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
PROC emitdecrg_bypoi() //[old], new free
{
asm_dup_eol();
asm_readvar_eol();
emitdec();
asm_writevar_eol();
_fused = +FALSE; //ъюэхЎ т√ўшёыхэш
}
/////////////
EXPORT PROC initcode()
{
_jpflag = 0x00;
}
EXPORT PROC endcode()
{
}
PROC initrgs()
{
rgs_initrgs();
_azused = +FALSE;
_fused = +FALSE; //ьюцэю ёфхырЄ№ юфэє яЁюЎхфєЁє initif фы ¤Єюую (т√ч√трЄ№ т эрўрых if, while, until)
_rproxy = 0x00;
}
PROC emitfunchead()
{
initrgs();
}
PROC setmainb()
{
//setmainrg(); //Ёхчєы№ЄрЄ т RMAIN
//_rproxy = _RMAIN;
}
PROC prefernoregs()
{
getnothing(); //Єръ т√уюфэхх inc/dec
}