Question: Write an LC - 3 assembler program that converts a number stored in memory into its binary representation in the Minecraft world. a ) Place

Write an LC-3 assembler program that converts a number stored in memory into its binary
representation in the Minecraft world.
a) Place your code in the assembly file "write_binary.asm".
b) The number to convert is specified in the LC-3 starter file as NUMBER_TO_CONVERT.
c) You can assume that the number to convert will always be non-negative.
d) Use air (block ID #0) to represent zeroes and stone blocks (block ID #1) to represent 1s.
i) The least significant bit should be written to (playerPos.x, playerPos.y, playerPos.z+1).
ii) The next bit should be written to (playerPos.x, playerPos.y, playerPos.z+2) and so on
(see Figure 1 for a visual explanation).
iii) 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.
Figure 1: Illustration of how to output the binary representation in Minecraft. The number
represented here is 237=0000000011101101. The least significant bit is closest to the player. \table[[\table[[Trap],[Vector]],Alias,Function,Description],[0\times 28,chat/CHAT,postToChat(R0),\table[[Outputs a null terminating],[string starting at the],[address contained in R0 to],[the Minecraft chat.]]],[0\times 29,getp/GETP,\table[[player.getTilePos()-->],[R0,R1,R2]],\table[[Gets the position of the],["tile" that the player is],[currently on. The x,y and],[z coordinates are output in],[registers R0, R1 and R2],[respectively.]]],[0\times 2A,setp/SETP,\table[[player.setTilePos(R0,R1,],[R2)]],\table[[This function moves the],[player to the tile (x, y,],[z)=(R0, R1, R2).]]],[0x2B,getb/GETB,\table[[\table[[getBlock(R0, R1, R2)-->],[R3]]]],\table[[This function retrieves the],[ID of the block at tile (x,],[y,z)=(R0,R1,R2) and],[returns it to R3.]]],[0\times 2C,setb/SETB,setBlock (R0, R1, R2, R3),\table[[This function changes the],[ID of the block at tile (x,],[y,z)=(R0,R1,R2) to the],[value stored in R3.]]],[0\times 2D,geth/GETH,getHeight(R0, R2)--> R1,\table[[This function calculates],[the y-position of the],[highest non-air block at],[(x,z)=(R0,R2) and],[returns the value to R1.]]],[0\times 27,reg/REG,printRegisters(),\table[[Outputs the current],[register values to the],[console.]]]]
Notes:
TRAP 0x27(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.
Write an LC - 3 assembler program that converts a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!