Reference no: EM133694191
Programming Studio
Overview
This assignment will assess learning goals in computer architecture, focusing on assembly code programming.
The tasks include:
Writing programs in LC-3 assembly language to demonstrate your understanding of loops, branches, subroutines, two's complement, and traps.
Converting between hexadecimal, binary and assembly representations of an LC-3 program.
Simulating a computer architecture via an existing Little Computer 3 (LC-3) virtual machine, written in C++.
Configuring all the required development tools (Minecraft Java Edition, Visual Studio Code
+ LC-3 extension, laser, Git, etc.)
Learning Outcome 1: Analyse and solve computing problems; design and develop suitable algorithmic solutions; implement and debug algorithmic solutions using modern skills and practices in the C++ programming language.
Learning Outcome 2: Apply fundamentals of computer architecture, operating systems, and system deployment to the design and development of medium-sized software applications.
Learning Outcome 3: Demonstrate skills for self-directed learning, reflection, and evaluation of your own and your peers work to improve professional practice.
The aim of this assignment is to hone your LC-3 programming skills, using the game Minecraft as a testbed. This section will get you started with creating an LC-3 development environment and understanding how to write LC-3 programs that interact with Minecraft.
Communicating with Minecraft via LC-3.
LC-3 is a simple language that offers no native way of communicating with Minecraft. To get around this, we have provided a modified LC-3 virtual machine that contains additional TRAP routines for this purpose. The additional TRAPs are summarised in the table below.
Notes:
TRAP 0x36 (printRegisters) is provided for debugging purposes, since unlike the LC-3 web simulator shown in class, the virtual machine included with the starter code does not provide an easy way of inspecting the register values.
Function arguments and return values are passed via the registers. For example, TRAP 0x35 (getHeight) assumes that the x and z arguments are passed via registers R0 and R2 respectively and outputs the return value to R1.
For this assignment, you must not modify the provided virtual machine in any way. The only files in the starter repo that you should edit are the *.asm files and README.md.
LC-3 Programming Challenges
Write an LC-3 assembler program that checks whether the player is within a certain Manhattan distance of a specified "goal" point.
Place your code in the assembly file "manhattan_dist.asm".
The assembly file contains predefined constants, G_X, G_Y and G_Z, that specify the position of the goal point.
An additional predefined constant, GOAL_DIST, specifies the distance bound to be checked. You may assume that GOAL_DIST > 0.
The Manhattan distance between the player and the goal point is given by: dmanhattan = |(playerPos.x - G_X)| + |(playerPos.y - G_Y)|+ |(playerPos.z - G_Z)| If this inequality is met, the program should output "The player is within Manhattan
distance of the goal" to Minecraft chat. Otherwise, it should output the following string to the Minecraft chat: "The player is outside the goal bounds".
Write an LC-3 assembler program that converts a number stored in memory into its binary representation in the Minecraft world.
Place your code in the assembly file "write_binary.asm".
The number to convert is specified in the LC-3 starter file as NUMBER_TO_CONVERT.
You can assume that the number to convert will always be non-negative.
Use air (block ID #0) to represent zeroes and stone blocks (block ID #1) to represent 1s.
The least significant bit should be written to (playerPos.x + 1, playerPos.y, playerPos.z).
The next bit should be written to (playerPos.x + 2, playerPos.y, playerPos.z) and so on (see Figure 1 for a visual explanation).
Since the word size in LC-3 is 16 bits, your program should always output 16 blocks, writing extra zeroes as air blocks if necessary.
Write an LC-3 assembler program that reads two 16-bit binary words from the Minecraft world (formatted as in Problem 2 above) and adds them together, writing the answer to the Minecraft world in binary.
Place your code in the assembly file "binary_addition.asm".
The first number should be read from a line of 16 blocks starting at: (playerPos.x + 1, playerPos.y, playerPos.z+1)
and extending to:
(playerPos.x + 16, playerPos.y, playerPos.z+1)
The second number should be read from a line of 16 blocks starting at: (playerPos.x + 1, playerPos.y, playerPos.z + 2)
and extending to:
(playerPos.x + 16, playerPos.y, playerPos.z + 2)
The result should be written to a line of 16 blocks starting at: (playerPos.x + 1, playerPos.y, playerPos.z + 3)
and extending to:
(playerPos.x + 16, playerPos.y, playerPos.z + 3) See Figure 2 below for a visual explanation.
Attachment:- Programming Studio.rar