Skip Navigation

Computer Organization and Architecture (10th Edition) View more editions
88% (304 ratings)
for this book

  • 509 step-by-step solutions
  • Solved by professors & experts
  • iOS, Android, & web
Chapter: Problem:

Core War is a programming game introduced to the public in the early 1980s [DEWD84], which was popular for a period of 15 years or so. Core War has four main components: a memory array of 8000 addresses; a simplified assembly language Redcode; an executive program called MARS (an acronym for Memory Array Redcode Simulator); and the set of contending battle programs. Two battle programs are entered into the memory array at randomly chosen positions; neither program knows where the other one is. MARS executes the programs in a simple version of time-sharing. The two programs take turns; a single instruction of the first program is executed, then a single instruction of the second, and so on. What a battle program does during the execution cycles allotted to it is entirely up to the programmer. The aim is to destroy the other program by ruining its instructions. In this problem and the next several, we use an even simpler language, called CodeBlue, to explore some Core War concepts.

CodeBlue contains only five assembly language statements and uses three addressing modes (Below Table). Addresses wrap around, so that for the last location in memory, the relative address of +1 refers to the first location in memory. For example, ADD #4, 6 adds 4 to the contents of relative location 6 and stores the results in location 6; JUMP @5 transfers execution to the memory address contained in the location five slots past the location of the current JUMP instruction.

a. The program Imp is the single instruction COPY 0, 1. What does it do?

b. The program Dwarf is the following sequence of instructions:

ADD #4, 3COPY 2, @2JUMP –2DATA 0

What does it do?

c. Rewrite Dwarf using symbols, so that it looks more like a typical assembly language program.

Table: CodeBlue Assembly Language

(a) Instruction Set




set at current location


copies source A to destination B


adds A to B, putting result in B


transfer execution to A


if B = 0, transfer to A

(b) Addressing Modes





# followed by value

This is an immediate mode, the operand value is in the instruction.



The value represents an offset from the current location, which contains the operand.


@ followed by value

The value represents an offset from the current location; the offset location contains the relative address of the location that contains the operand.

Sample Solution
Chapter: Problem:
  • Step 1 of 3

    a. Purpose of Copy 0, 1:

    • The above instruction when executed copies itself to next location.

    • Instruction just copied is pointed by the program counter incremented.

    • Program Imp scans entire memory location placing copy of itself in every memory location, erasing or removing old data.

    Thus, “Copy 0, 1”copies itself in all the memory locations.

  • Step 2 of 3

    b. Purpose of dwarf program

    Given dwarf program with following sequence:

    ADD #4, 3

    Copy 2,@2

    Jump -2

    DATA 0


    ADD #4, 3:

    • With the above instruction, the immediate value “4” is added with the contents of 3 locations down, i.e., adds immediate value “4” to DATA location.

    Copy 2,@2:

    • The above instruction copies data to two locations down. i.e., that is moves to DATA which holds “4”.

    • Again COPY moves 4 locations down from DATA location.

    Jump -2:

    • Jumps to the address of previous two locations that is jump to ADD instruction.

    Thus, Process continues and data is writer in every 4th memory location.

  • Step 3 of 3

    c. Rewriting dwarf program using symbols:

    L1 ADD #4, mptr ; add immediate value “4” with location pointed by ; mptr

    COPY 2, @mptr ; copies data to the location pointed by mptr.

    JUMP L1 ; jump to first instruction

    mptr DATA 0


    • The instructions “ADD #4, mptr” add immediate value “4” with location pointed by mptr.

    • Second instruction “COPY 2, @mptr” copies data to the location pointed by mptr.

    • Third instruction jumps to the address where L1 is pointed and process continues with the last instruction and writes the data in every 4th memory location.

Corresponding Textbook

Computer Organization and Architecture 10th edition 9780134102061 0134102061
Computer Organization and Architecture | 10th Edition
9780134102061ISBN-13: 0134102061ISBN: William StallingsAuthors:
Alternate ISBN: 9780134101613
Frequently asked questions
What are Chegg Study step-by-step Computer Organization And Architecture 10th Edition Solutions Manuals?

Chegg Solution Manuals are written by vetted Chegg Computer Architecture experts, and rated by students - so you know you're getting high quality answers. Solutions Manuals are available for thousands of the most popular college and high school textbooks in subjects such as Math, Science (Physics, Chemistry, Biology), Engineering (Mechanical, Electrical, Civil), Business and more. Understanding Computer Organization And Architecture 10th Edition homework has never been easier than with Chegg Study.

Why is Chegg Study better than downloaded Computer Organization And Architecture 10th Edition PDF solution manuals?

It's easier to figure out tough problems faster using Chegg Study. Unlike static PDF Computer Organization And Architecture 10th Edition solution manuals or printed answer keys, our experts show you how to solve each problem step-by-step. No need to wait for office hours or assignments to be graded to find out where you took a wrong turn. You can check your reasoning as you tackle a problem using our interactive solutions viewer.


How is Chegg Study better than a printed Computer Organization And Architecture 10th Edition student solution manual from the bookstore?

Our interactive player makes it easy to find solutions to Computer Organization And Architecture 10th Edition problems you're working on - just go to the chapter for your book. Hit a particularly tricky question? Bookmark it to easily review again before an exam.


Can I get help with questions outside of textbook solution manuals?

You bet! Chegg Study Expert Q&A is a great place to find help on problem sets and Computer Architecture study guides. Just post a question you need help with, and one of our experts will provide a custom solution. You can also find solutions immediately by searching the millions of fully answered study questions in our archive.

How do I view solution manuals on my smartphone?
