środa, 4 maja 2022 o 10:35:48 UTC+2 fir napisał(a):
overally ading this operatos is fairly easy
for example emiting xor
void Emit_xor(chunk right_operand)
{
if( unsigned(right_operand.beg) < max_temp_registers)
FlushOutAsm("\n xor eax (__t%d) ", unsigned(right_operand.beg) );
else {
if(CCI(right_operand)) FlushOutAsmChunkPE("\n xor eax ", right_operand, " " );
else {
int imp = FindImportInImportsTable(right_operand);
if(imp<0) FlushOutAsm("\n xor eax (%.*s) ", ChunkLength(right_operand), right_operand.beg );
else FlushOutAsm_MovImportVariableToEbx(imp),
FlushOutAsm("\n xor eax ebx "); }}
FlushOutAsm("\nmov (__t%d) eax ", temp_register);
}
it emits
//l.94 cc = 0x010103 <xor> 0x020202
mov eax 0x010103
xor eax 0x020202
mov (__t1) eax
mov eax (__t1)
mov (cc) eax
its unoptimised as i should not emit this __t1 lines but i will mend it later, adding floats and doubles to above i hope will not be so scary, though still i dont understand floats and partially understand doubles
i think at start i probably should add all operatos that are suporter by x86 assembly ant then see what i can build up as handy yet
may name this small project as floio(fir's library of inline operators)
the question is hovever what i sad: what to get there