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 (Table B.4). Addresses wrap around, so that for the last location in memory, the relative address + 1 of 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, 3
COPY 2, @2
What does it do?
c. Rewrite Dwarf using symbols, so that it looks more like a typical assembly language program.
This question was answered on: Jul 11, 2017
Need a similar solution fast, written anew from scratch? Place your own custom order
We have top-notch tutors who can help you with your essay at a reasonable cost and then you can simply use that essay as a template to build your own arguments. This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student. New solution orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.