Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
The carry flag   Message List  
Reply | Forward Message #13881 of 15019 |
Re: [gbadev] Re: The carry flag

On Wed, Apr 02, 2003 at 05:58:48PM +0100, Eddie Edwards wrote:
> > you completely missed my point. i was pointing out the problem with
> > operating the carry bit in this manner.
>
> You haven't pointed out any problem at all. What *is* the problem with
> operating the carry bit in this manner?
>
> If there's a genuine problem with the ARM architecture that has somehow gone
> unnoticed for 15 years I'd like to know what it is.

Can you justify why the carry flag should be set in this case?

> mov r10,#0x7f000000
> mov r11,#0x1fc00000
> adds r12,r10,r11,LSL #2 (0x7f00_0000+0x7F00_0000==0xfe00_0000), carry
> flag set !?!?

I confirmed that this is does occur (at least in the VisualBoy
emulator). This is not right. The ARM manual says that the carry may
be set by the output of the barrel shifter on logical instructions,
but is set by the ALU on arithmetic instructions. In this case there
is neither a carry from the shift or the addition.

I tried the case of:

mov r10,#0x7f000000
mov r11,#0x7f000000
adds r12,r10,r11

which results in the same final operands and it works correctly, so
the problem seems shift related.

Bizarre. When should I trust that the CPU will set the flag correctly
and when not? Does anyone know if this is documented, and is there a
description of what class of operands it fails on? It would be hard
to believe it has gone unnoticed for 15 years.

--
Jay Dresser /
gbadev
@
dresserfamily
.
org




Thu Apr 3, 2003 12:21 am

JTGD
Offline Offline
Send Email Send Email

Forward
Message #13881 of 15019 |
Expand Messages Author Sort by Date

... You haven't pointed out any problem at all. What *is* the problem with operating the carry bit in this manner? If there's a genuine problem with the ARM...
Eddie Edwards
eddie@...
Send Email
Apr 2, 2003
5:20 pm

... Can you justify why the carry flag should be set in this case? ... I confirmed that this is does occur (at least in the VisualBoy emulator). This is not...
Jay Dresser
JTGD
Offline Send Email
Apr 3, 2003
12:16 am

... You're simply labouring under a misunderstanding of how carry flags work. The only thing incorrect here is following SUBS with ADC. There is no meaning to...
Eddie Edwards
eddie@...
Send Email
Apr 3, 2003
2:16 am

Is there a quick and simple test for detecting the SP version ? over the older GBA? I have a help page screen that lists controls for GBA, and wish to display...
Bollo
bolloxim
Offline Send Email
Apr 3, 2003
9:35 am

... unfortunately, no. there isn't even a long and complicated test for detecting the SP. it's totally transparent to the programmer. regards, matthew....
matthew conte
whatwouldbig...
Offline Send Email
Apr 3, 2003
1:28 pm

Hi Bollo, I asked this on the gbadev.org forums, and there was no method known as of yet. I tried dumping the BIOS as well, to see if anything had changed,...
Dennis Munsie
bea_dennis
Offline Send Email
Apr 3, 2003
7:27 pm

but doesn't final fantasy tactics advance change its colors depending on whether its running on the GBA or the SP? if so, then there must be some way to detect...
Akshay Dhalwala
akdjr
Offline Send Email
Apr 4, 2003
12:02 am

Doesn't FFTA use a menu to select the color settings? I could've sworn that I had read that someplace. dennis...
Dennis Munsie
bea_dennis
Offline Send Email
Apr 4, 2003
2:36 am

Metroid Fusion asks you if you are using headphones or internal speaker and changes the sound depending on your selection. Although its nice to autodetect to...
Aaron Isaksen
aisaksen@...
Send Email
Apr 4, 2003
2:35 am

Hi, You can choose the color settings from the menu. There are even settings for when you're playing through the Gameboy Player for the NGC. Bye, Collin ... ...
Collin van Ginkel
fleppes2001
Offline Send Email
Apr 4, 2003
8:24 am

... that would also be a reliable way to make sure you are on a gba ;) cheers, x -- chris@... Postmodernism is german romanticism with better ...
CK
x@...
Send Email
Apr 4, 2003
10:59 am

... OK, I can't reproduce it now with the same conditions as before, so I retract my complaint. If I investigate again, I will confirm on actual hardware. It...
Jay Dresser
JTGD
Offline Send Email
Apr 3, 2003
9:36 am

Hi Jay, ... Both correct. CMP is *exactly* just SUBS without a destination register. ... <=> BCC. ... Well you should avoid BCC/BCS except (a) after ADD and...
Eddie Edwards
eddie@...
Send Email
Apr 3, 2003
1:27 pm

... maybe an old speccy owner that still cant resist any 6502-ish behaviour no matter what? :o) gpz...
Groepaz
groepaz2000
Offline Send Email
Apr 3, 2003
2:17 am

... yes, I was taking about the old 6502 (history of the Arm being the replacement for the 6502 in acorn computers) (still it was sbc without the sub etc etc)....
Mike Wynn
mike.wynn@...
Send Email
Apr 2, 2003
2:43 am

of course this might very well be purely academic, but the result is still incorrect regardless of how you turn it. ((0-0)+0+(c)) should never result in 1. as...
Morten Pedersen
escapekey@...
Send Email
Apr 2, 2003
11:36 pm

... Academically, does Peano arithmetic define 'c'? What's incorrect academically is to use the carry flag for anything other than carrying from less...
Damian Yerrick
yerricde
Offline Send Email
Apr 2, 2003
11:54 pm

... This really perplexed me so I tried it out myself as a sanity check. I was unable to reproduce this behaviour either in VBA or on the hardware. ?!?...
Chris Hayton
you_oughta_b...
Offline Send Email
Apr 3, 2003
2:16 am

i cant reproduce it either so i probably forgot the s bit or something anyway, cheers all ... From: "Chris Hayton" <chayton@...> To:...
Morten Pedersen
escapekey@...
Send Email
Apr 3, 2003
9:36 am
 First  |  |  Next > Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help