Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Value of Flags

3 views
Skip to first unread message

josmatt...@gmail.com

unread,
Sep 30, 2007, 2:19:26 PM9/30/07
to
a. If the last operation performed on a computer with an 8-bit word
was an addition in which the two operands were 2 and 3, what would be
the value of the following flags?
Carry, zero, overflow, sign, even parity and half-
carry.

b. What if the operands are -1 and +1?

Nick Maclaren

unread,
Sep 30, 2007, 2:23:23 PM9/30/07
to

We've got a right one, 'ere :-(

I hope that his supervisor is reading this ....


Regards,
Nick Maclaren.

josmatt...@gmail.com

unread,
Sep 30, 2007, 2:27:30 PM9/30/07
to

oh..could you just help me out here..these are just
assignments...thats it...

Patrick de Zeester

unread,
Sep 30, 2007, 2:30:33 PM9/30/07
to

...and to benefit from those you should figure out the answers yourself.

josmatt...@gmail.com

unread,
Sep 30, 2007, 2:39:17 PM9/30/07
to
On Sep 30, 2:30 pm, Patrick de Zeester <inva...@invalid.invalid>
wrote:

sure..iam trying..but in case if you folks could help, i would
appreciate it...

John Ahlstrom

unread,
Sep 30, 2007, 2:44:49 PM9/30/07
to


What was wrong with Nick's help:

> 1) Find someone else on the course who actually attended.
> 2) Ask them for a copy of the reading list.
> 3) Beg, buy, borrow or steal some of the books on that list.
> 4) Read the indices to find out one that has Booth's algorithm.
> 5) Read the book.
> 6) Answer the question.


--
The best form of nuclear energy
is indeed gravity contained fusion
with the reactor >150e09m away.

josmatt...@gmail.com

unread,
Sep 30, 2007, 2:48:30 PM9/30/07
to

I cannot see any help from Nick....

Erik Trulsson

unread,
Sep 30, 2007, 4:27:01 PM9/30/07
to
josmatt...@gmail.com <josmatt...@gmail.com> wrote:
> a. If the last operation performed on a computer with an 8-bit word
> was an addition in which the two operands were 2 and 3, what would be
> the value of the following flags?
> Carry, zero, overflow, sign, even parity and half-
> carry.

That depends. Most computers do not have all those flags (Exercise: Find
one computer that actually has all of them.) so several of the flags will
not have any value at all.
And even for those computers that do have those flags it is not certain
that an addition will modify any of them.

>
> b. What if the operands are -1 and +1?

The same.


--
<Insert your favourite quote here.>
Erik Trulsson
ertr...@student.uu.se

Paul Pluzhnikov

unread,
Sep 30, 2007, 4:31:36 PM9/30/07
to
"josmatt...@gmail.com" <josmatt...@gmail.com> writes:

>> ...and to benefit from those you should figure out the answers yourself.
>
> sure..iam trying..

Apparently not very hard (hint: the questions are trivial).

> but in case if you folks could help

You might get help if you ask less trivial questions, *and*
explain what your specific difficulty is, e.g. by following
advice from http://catb.org/~esr/faqs/smart-questions.html

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

Joe Pfeiffer

unread,
Sep 30, 2007, 5:28:01 PM9/30/07
to
"josmatt...@gmail.com" <josmatt...@gmail.com> writes:

Why on earth would we want to do your homework for you? You've been
assigned these problems to help you learn the material, now go away
and do them.

John L

unread,
Sep 30, 2007, 9:05:16 PM9/30/07
to
In article <1191176366....@57g2000hsv.googlegroups.com>,

josmatt...@gmail.com <josmatt...@gmail.com> wrote:
>a. If the last operation performed on a computer with an 8-bit word
>was an addition in which the two operands were 2 and 3, what would be
>the value of the following flags?
> Carry, zero, overflow, sign, even parity and half-
>carry.

Oh, for heavens sake. The answers are obviously 12, 3, 4, 1, 9, and
blue.

> b. What if the operands are -1 and +1?

Trick question, they'll cancel each other out and there won't be any
flag values.

Bill Todd

unread,
Sep 30, 2007, 10:53:11 PM9/30/07
to
josmatt...@gmail.com wrote:
> a. If the last operation performed on a computer with an 8-bit word
> was an addition in which the two operands were 2 and 3, what would be
> the value of the following flags?

Nothing, unless something actually depends on them.

- bill

Andrew McLaren

unread,
Oct 1, 2007, 2:33:17 AM10/1/07
to
<josmatt...@gmail.com> wrote ...

>
> sure..iam trying..but in case if you folks could help, i would
> appreciate it...

(jumping on the bandwagon ...)

A few weeks ago, you tried to get help with several maths problems in
sci.math; and folks explained to you back then that it is NOT appropriate to
ask for help with assignments in Usenet newsgroups. You should have got the
message by now: do your homework yourself. Do not ask newsgroups.

These are actually pretty straightforward assignment questions. They are
suitable for an introductory course in computer architecture. They are not
hard, difficult or tricky questions. If you can't solve these questions on
your own, unaided, then you probably don't have an aptitude for computer
architecture; possibly not for any aspect of computing. If you are really
struggling, and not just looking for easy ways out, maybe you should enroll
some other course?


Terje Mathisen

unread,
Oct 1, 2007, 4:51:23 AM10/1/07
to

You're in luck, we _really_ love assignments here! :-)

In fact, we have a competition to see who can come up with the best answer.

If you take a look in the archives from exactly one, two or three years
ago, you'll notice that comp.arch aways get a short burst of requests
like yours around this time of the academic year.

Terje

--
- <Terje.M...@hda.hydro.com>
"almost all programming can be viewed as an exercise in caching"

Thomas Lindgren

unread,
Oct 1, 2007, 7:12:21 AM10/1/07
to
"josmatt...@gmail.com" <josmatt...@gmail.com> writes:

This link may be the answer to your problems:

http://www.walmartstores.com/GlobalWMStoresWeb/navigate.do?catg=218

Best,
Thomas
--
Thomas Lindgren "It was all very mechanical -- but
that's the way planetside life is." -- RAW

Gavin Scott

unread,
Oct 1, 2007, 4:59:19 PM10/1/07
to
Terje Mathisen <terje.m...@hda.hydro.com> wrote:

> You're in luck, we _really_ love assignments here! :-)
> In fact, we have a competition to see who can come up with the best answer.

But honestly the quality of the entries in this competition have been
rather sub-par lately. I believe that real competition-quality responses
are likely to be much more instructive to the original questioner
than all the "go do your own homework" posts.

G.

Nick Maclaren

unread,
Oct 1, 2007, 5:13:18 PM10/1/07
to

In article <13g2nt7...@news.supernews.com>,

True. I once managed to reply with a perfectly correct answer to a
first-year statistics question, using a technique that isn't covered
in undergraduate courses. If the questioner had looked it up, he would
have learnt something; if he had just quoted it, his examiner would.

But I did give this idiot a perfectly good algorithm to solve his
problem :-)


Regards,
Nick Maclaren.

Shangai Knight

unread,
Oct 1, 2007, 8:14:54 PM10/1/07
to
Hey Kid,

These questions are quite simple. They are also the basics of any EE/
CS/CE program.
If you cant find it in you to dig out the answers by yourself, you
need to find something else that tickles you pink.

Dont waste your life. Go ahead, switch majors to Art History or
Political Science or whatever that gets *you* riled up. Or if you like
those organic chemistry reactions, genetics is a pretty neat area.

Also, it is not 1999 anymore. Hiring managers want "real candidates".
If they can sniff a coaster out, they probably will.

Why settle for a mediocre life?

-SK

Chris Thomasson

unread,
Oct 1, 2007, 11:30:20 PM10/1/07
to
"Thomas Lindgren" <***********@*****.***> wrote in message
news:87przz2...@dev.null...

> "josmatt...@gmail.com" <josmatt...@gmail.com> writes:
>
>> On Sep 30, 2:23 pm, n...@cus.cam.ac.uk (Nick Maclaren) wrote:
>> > We've got a right one, 'ere :-(
>> >
>> > I hope that his supervisor is reading this ....
>> >
>> > Regards,
>> > Nick Maclaren.
>>
>> oh..could you just help me out here..these are just
>> assignments...thats it...
>>
>
> This link may be the answer to your problems:
>
> http://www.walmartstores.com/GlobalWMStoresWeb/navigate.do?catg=218
[...]

OUCH!

Quadibloc

unread,
Oct 2, 2007, 1:12:25 AM10/2/07
to

For one thing, these questions are very obviously homework assignment
questions.

For another, they're very simple introductory questions. So, if the
answers aren't obvious to you from your textbook, or from what the
instructor did in class, just about any introductory book on
computers...

well, perhaps you need to choose the right *kind* of introductory
book.

The "small computer handbook" from Digital explained this kind of
stuff quite well.

John Savard

Quadibloc

unread,
Oct 2, 2007, 1:17:47 AM10/2/07
to
josmatt...@gmail.com wrote:
> sure..iam trying..but in case if you folks could help, i would
> appreciate it...

These are such simple questions that we can't just give you a little
help.

Oh, maybe I *can* help a *little*.

Have you ever seen an old-style mechanical adding machine?

Suppose it only had a display of four digits.

If it had 9995 in the window, and you tried to add 6, what do you
think would happen?

Of course, your homework assignment is about binary, not decimal.

If you had 131 nails, and you could put ten nails in a small box, and
ten small boxes in a big box, and you packed the nails up as much as
you could, how many boxes would you have (not counting boxes inside
other boxes) and of what kinds, and how many left-over nails would you
have?

The world of binary is like the world of decimal, except the small
boxes hold two nails, and the big boxes hold two small boxes. And so
on to bigger boxes.

Once you have thought hard about this, you may have the conceptual
framework you need to understand your lessons.

John Savard

Spoon

unread,
Oct 2, 2007, 5:49:03 AM10/2/07
to
John L wrote:

> Joseph wrote:
>
>> What if the operands are -1 and +1?
>
> Trick question, they'll cancel each other out and there won't be any
> flag values.

Like when a electron meets a positron?

Del Cecchi

unread,
Oct 2, 2007, 2:06:36 PM10/2/07
to

More like when a hole meets an electron, or perhaps when hole meets
offspring.

Jeffrey Dutky

unread,
Oct 3, 2007, 12:33:32 AM10/3/07
to

Ok, everyone, fun's over, it's time to have pity on the poor kid
(besides, his homework is probably well past due by now)

For the first question, we have to think about how this hypothetical 8-
bit computer will actually do the math and what the meanins of the
different flags are:

An 8-bit machine has words made up of two 4-bit digits, so the two
operands are 02 and 03 (first digit is 0 and the second digit is 2 or
3). When we add these two together we get 05, but we can't put a 5 in
a 4-bit field, so we carry the 2 to the second field and we get 23 (in
twos complement notation, of course) as the result (you can easily
convert this back to decimal notation from twos complement).

Since we performed a carry we set the carry flag to 2
Since the resulting value is not zero we set the zero flag also to 1
(by standard convention)
No overflow occured, so overflow is 0
The sign of the result is positive so we set sign to 1 (by standard
convention)
Even parity is calculated by multiplying the upper and lower fields
(1*4) and setting the parity flag if the result is even, so even
parity is 1
The half carry flag is set when a value of 1/2 is carried from the
upper field, which didn't happen in this case, so we set the half-
carry flag to 0.

Now, as for the second problem: Here we need to understand how to
represent negative values in a twos complement 8-bit machine. Twos
complement indicates a negative value by subtracting the absolute
value from a maximum value in all fields (33). So, we now have two
operands -1 (32) and 1 (01). Again we add the two values together to
get 33 (wich translates to decimal 0). Here are the flag values:

carry: 0 (no carry occurred)
zero: 1 (the twos complement value is NOT zero)
overflow: 0 (no overflow occurred)
sign: 1 (the value of zero is positive by standard convention)
even parity: 0 (3*3 = 9, which is odd)
half carry: 0

I hope that helps.

Spoon

unread,
Oct 3, 2007, 4:16:28 AM10/3/07
to
Jeffrey Dutky wrote:

> The half carry flag is set when a value of 1/2 is carried from the
> upper field, which didn't happen in this case, so we set the half-
> carry flag to 0.

I'd set the half-carry flag to 0.5

Quadibloc

unread,
Oct 3, 2007, 8:57:46 PM10/3/07
to
Jeffrey Dutky wrote:
> even parity: 0 (3*3 = 9, which is odd)

2 + 3 is 5.

Which is odd, all right...

but it's 00000101

so an even number of 1 bits are set. Even parity, therefore, is
present. (Parity as in parity checking, not as in number theory... let
alone particle physics.)

John Savard

ken...@cix.compulink.co.uk

unread,
Oct 4, 2007, 6:43:10 AM10/4/07
to
In article <1191386012.5...@o80g2000hse.googlegroups.com>,
jeff....@gmail.com (Jeffrey Dutky) wrote:

> An 8-bit machine has words made up of two 4-bit digits,

Not the ones I remember like the Video Genie unless you were using BCD.
That used a Z80 with an 8 bit data bus.

Ken Young

Stephen J. Rush

unread,
Oct 11, 2007, 5:41:32 AM10/11/07
to

The Z-80 has a half-carry flag, inherited from the 8080, along with the
"decimal adjust" instructions intended for handling BCD data.

My advice to the OP would have been: "Drop the course. If you're in over
your head this early, you haven't got a snowball's chance of passing." In
fact, if his Clue Level is that low, he probably needs to change majors to
something like Art History Education.

Morten Reistad

unread,
Oct 17, 2007, 4:51:05 AM10/17/07
to
In article <1191301945.0...@22g2000hsm.googlegroups.com>,

Quadibloc <jsa...@ecn.ab.ca> wrote:
>josmatt...@gmail.com wrote:
>> a. If the last operation performed on a computer with an 8-bit word
>> was an addition in which the two operands were 2 and 3, what would be
>> the value of the following flags?
>> Carry, zero, overflow, sign, even parity and half-
>> carry.
>>
>> b. What if the operands are -1 and +1?
>
>For one thing, these questions are very obviously homework assignment
>questions.
>
>For another, they're very simple introductory questions. So, if the
>answers aren't obvious to you from your textbook, or from what the
>instructor did in class, just about any introductory book on
>computers...

So, you need to learn to use search engines and fast lookups in
textbooks if you don't want your classes to interfere with your
fraternity activities.

Or, you could, study ..

-- mrr

0 new messages