now wait just a minute Re: [Tuxnes-devel] yet more asm stuff--carry f
Brought to you by:
tmmm
From: Rigel <ri...@an...> - 2001-04-17 20:31:27
|
-- On Tue, 17 Apr 2001 12:43:35 Jim Ursetto wrote: >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. okay, technically, A = 0000 0001 (1,or 0x1). So when you sh left one bit, A = 0000 0010 (2, or 0x2). This is a binary carry! isn't it? Thus my crude xor would set the flag on any difference in orig and mod. It looks to me like the way you're doing it is setting the flag on overflow. e.g. A =1000 0000 (0x80) shifted left is A = 0000 0000 and an overflow exception occurs. Though you do have the darcnes C core on your side... Who needs Cupid? Matchmaker.com is the place to meet somebody. FREE Two-week Trial Membership at http://www.matchmaker.com/home?rs=200015 |