Re: [Tuxnes-devel] yet more asm stuff--carry f
Brought to you by:
tmmm
From: Jim U. <ji...@3e...> - 2001-04-17 17:07:48
|
At 12:02pm on 2001 April 17, Rigel did write: > >> let's say the operation is sh left, so in C: > >> modified=orig<<1; > >> carryf = modified ^ orig; // ^ is xor operator (?) > > >Um... try, for example, orig=1. This gives carryf = 3. > >xoring won't work except by chance. ;) > > >For ASL, try something like > >carryf = (orig & 0x80) ? 1 : 0; > >or equivalently > >carryf = (orig & 0x80) >> 7; > > >Grab a copy of an (unencumbered) C 6502 core (e.g. Nofrendo) because > >it will tell you exactly how every instruction works in a high-level > >language. > I thought anything non-zero was true (even in asm)? I was working under that assumption, (assuming makes an ass out of "u" and "me"...). But ASL when A=01 does not carry. -- ji...@3e... / 0x43340710 / 517B C658 D2CB 260D 3E1F 5ED1 6DB3 FBB9 4334 0710 |