public void Visit(NotEquals m) { sw.WriteLine(Tabs() + "// !="); sw.WriteLine(Tabs() + "param1 = param_stack_pop();"); sw.WriteLine(Tabs() + "param2 = param_stack_pop();"); sw.WriteLine(Tabs() + "param_stack.push(param1 != param2);"); }
/// <summary> /// compare and push inverse of z flag /// </summary> /// <param name="m"></param> public void Visit(NotEquals m) { sw.WriteLine("\t ; building != statement"); /* * Console.WriteLine("Pop stack into a"); * Console.WriteLine("Pop stack into b"); * Console.WriteLine("compare a,b"); * Console.WriteLine("push ! zero flag onto stack"); * * Console.WriteLine("Pop stack into a"); */ PopAndCompare(); // Console.WriteLine("Compare a,b"); sw.WriteLine("\tphp ; flags -> a"); sw.WriteLine("\tpla"); sw.WriteLine("\tlsr a ; put z bit in rightmost place"); sw.WriteLine("\tand #1 ; mask off 0 bit"); sw.WriteLine("\tclc"); sw.WriteLine("\tadc #1 ; flip it"); sw.WriteLine("\tand #1 ; mask off 0 bit (again)"); sw.WriteLine("\tpha ; push result of != "); // Console.WriteLine("push z flag onto stack"); }
public void Visit(NotEquals m) { sw.WriteLine("\tnop ;!="); sw.WriteLine("\tpop ax"); sw.WriteLine("\tpop bx"); sw.WriteLine("\tcmp ax,bx"); sw.WriteLine("\tpushf"); sw.WriteLine("\tpop ax"); sw.WriteLine("\tnot ax"); sw.WriteLine("\tand ax,64; isolate z flag"); sw.WriteLine("\tmov cx,6"); sw.WriteLine("\tshr ax,cl; z-> position 0"); sw.WriteLine("\tpush ax"); }
public void Visit(NotEquals m) { sw.WriteLine("\t;!="); sw.WriteLine("\tpuls a"); sw.WriteLine("\tsta temp"); sw.WriteLine("\tpuls a"); sw.WriteLine("\tcmpa temp"); sw.WriteLine("\ttfr cc,a"); sw.WriteLine("\tcoma ; flip bits"); sw.WriteLine("\tanda #4 ; isolate z flag"); sw.WriteLine("\tlsra ; z-> position 0"); sw.WriteLine("\tlsra"); sw.WriteLine("\tpshs a"); }
public void Visit(NotEquals m) { sw.WriteLine("\t; != statement"); sw.WriteLine("\tpop af"); sw.WriteLine("\tpop bc"); sw.WriteLine("\tcp b"); sw.WriteLine("\t;jr nz,4"); sw.WriteLine("\tdb 20h ; jrnz"); sw.WriteLine("\tdb 4"); sw.WriteLine("\tld a,0"); sw.WriteLine("\t;jr 2"); sw.WriteLine("\tdb 18h; jr"); sw.WriteLine("\tdb 2"); sw.WriteLine("\tld a,1"); sw.WriteLine("\tpush af "); }