Question: Can use the trap vector information 0x30 postToChat(R0) 0x31 player.getTilePos() --> R0, R1, R2 0x32 player.setTilePos(R0, R1, R2) 0x33 getBlock(R0, R1, R2) --> R3 0x34

Can use the trap vector information

0x30 postToChat(R0)
0x31 player.getTilePos() --> R0, R1, R2
0x32 player.setTilePos(R0, R1, R2)
0x33 getBlock(R0, R1, R2) --> R3
0x34 setBlock(R0, R1, R2, R3)
0x35 getHeight(R0, R2) --> R1
0x36 printRegisters()

Write an LC-3 assembler program that places a rectangle of grass blocks underneath the player.

The assembly file contains two predefined constants, X_DIST and Z_DIST, that specify the dimensions of the rectangle (see Figure 6 for an illustration). Your code should work for all non-negative values of X_DIST and Z_DIST, including 0.

The rectangle should be made of grass blocks (block ID #2). d) The rectangle should be centred 1 unit under the player tile, so that after the rectangle is created, the player is standing on top of it.

X X X_DIST = 2 Z_DIST = 3 N X_DIST = 0

 

X X X_DIST = 2 Z_DIST = 3 N X_DIST = 0 Z_DIST = 2 N Figure 6: Illustration of the rectangles that should be built for X_DIST = 2, Z_DIST = 3 (on the left) and X_DIST =0, Z_DIST = 2 (on the right).

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!