[Rpcemu] Code review

Timmermans, Andre andre.timmermans at atos.net
Wed Feb 22 04:17:16 PST 2012


Ok,

With the '~' missing in the comments I have finally understand what the procedure does:
- it loads the flags in cl register
- clears the N and Z flags in preperation for the non-shift part of the instruction emulated
- if there is a shift, performs the shift and updates the C flag

Or rewritten like in te code:
- it loads the flags in cl register
- if there is a shift, clears N, Z and C flags; performs the shift; set C flag if required
- else just clears N and Z flags

Ok, in that case the code itself is correct.

André

> -----Original Message-----
> From: rpcemu-bounces at riscos.info 
> [mailto:rpcemu-bounces at riscos.info] On Behalf Of Tom Walker
> Sent: mercredi 22 février 2012 10:39
> To: rpcemu at riscos.info
> Subject: Re: [Rpcemu] Code review
> 
> >       if (!(opcode&0xFF0)) /*No shift*/
> >         {
> >                addbyte(0x8A); addbyte(0x0D); 
> addlong(pcpsr+3); /*MOVB *pcpsr,%cl*/
> >                generateload(opcode&0xF);
> >                addbyte(0x80); addbyte(0xE1); 
> addbyte(~0xC0); /*AND $ZFLAG+NFLAG,%cl*/
> >                return 1;
> >        }
> >
> >No shift but clears C flag.
> 
> There's an '~' missing from the comment but clearly visible 
> in the code - it's clearing Z and N but leaving C intact.
> 
> 
> >Second example:
>> >                       addbyte(0x80); addbyte(0xE1); 
> addbyte(~0xC0); /*AND $ZFLAG+NFLAG,%cl*/
> > Here if temp is 0, there is no shift but it clears C flag.
> 
> Same here.
> 
> 
> Tom 
> 
> _______________________________________________
> Rpcemu mailing list
> Rpcemu at riscos.info
> http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu
> 
> 



More information about the Rpcemu mailing list