Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Problem Statement You must write a program in LC-3 assembly language to print a single ASCII character to the monitor using a large font. In the file...

Problem Statement

You must write a program in LC-3 assembly language to print a single ASCII character to the monitor using a large font.

In the file called lab12.asm starting at the label FONT_DATA, we have provided font data that map each extended (8-bit) ASCII character into an 8-bit-wide by 16-bit-high picture of the character. In memory, each such picture is represented using 8 bits in each of 16 contiguous memory locations, and the pictures for each of the 256 possible characters are then simply stored consecutively in memory. The complete set of font data thus occupy a total of 4096 = 16 × 256 LC-3 memory locations.

The FONT_DATA is arranged in the order of their ASCII encodings. The first 16 addresses (0-15) in the FONT_DATA correspond to ASCII x00, the NULL character. The next 16 addresses (16-31) correspond to ASCII x01, the SOH character. So you should use the ASCII encoding of the letters you will print to find the addresses in FONT_DATA.

You must add appropriate assembly code and pseudo-ops to lab12.asm to print a given string to the screen that is specified in a separate file. For example, in the file cases/letter1.asm, you will find:

Address

Contents

Meaning

x5000x002E'.'x5001x0040'@'x5002x0048'H'

Input values to your program are stored in memory locations starting at x5000, as shown in the table above. Address x5000 contains the character that you should print for every bit set to 0 in the font data (in the example above, you will print '.' ) Address x5001 contains the character that you should print for every bit set to 1 in the font data (in the example above, you will print '@' ) The character that you must print is in address x5002. For the example values shown in the table above for the file cases/letter1.asm, your program should produce the output shown below, which you can also find in cases/letter1.sol.

For your convenience, in the figure below we have added line numbers to illustrate the inclusion of all lines.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

........

........

@@...@@.

@@...@@.

@@...@@.

@@...@@.

@@@@@@@.

@@...@@.

@@...@@.

@@...@@.

@@...@@.

@@...@@.

........

........

........

........

The font data for the capital letter 'H' can be seen from the example. Remember that address x5000 contains the character that you should print for every bit set to 0 in the font data; in the example above, '.' is printed. Address x5001 contains the character that you should print for every bit set to 1 in the font data; in the example above, '@' is printed. Since we only have to store 8 bits of information, but the LC-3 has an addressability of 16 bits, we have chosen that the 8 bits of interest are stored in the upper 8 bits of the word in memory, and the lower 8 bits are simply set to zero. (We will talk more about this design choice later.) We can thus observe that the first two lines contain x0000. The next four lines contain xC600 (11000110 followed by eight more 0s). The seventh line contains xFE00 (11111110 followed by eight more 0s). The next five lines contain xC600. And the last four lines contain x0000.

Somewhere in FONT_DATA, you will then find the following information for the capital letter 'H':

.FILL   x0000

.FILL   x0000

.FILL   xC600

.FILL   xC600

.FILL   xC600

.FILL   xC600

.FILL   xFE00

.FILL   xC600

.FILL   xC600

.FILL   xC600

.FILL   xC600

.FILL   xC600

.FILL   x0000

.FILL   x0000

.FILL   x0000

.FILL   x0000

By changing the values in memory locations x5000 and x5001 your program should create different visualizations. For example, in the file cases/letter2.asm we have:

Address

Contents

Meaning

x5000x0020' ' (space)x5001x002A'*'x5002x0048'H'

Your program should produce the output shown below, which you can also find in cases/letter2.sol 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

**   **

**   **

**   **

**   **

*******

**   **

**   **

**   **

**   **

**   **

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question