C · Local Linux terminal
Place colored characters on a Linux terminal
Online version: https://fpga.labsland.com/altera/embedded-systems/lab-05/part-01/
Your computer
A terminal can act as a character display. You supply a row, a column, a color and a symbol. Use a Linux terminal at least 32 columns by 30 rows and a C compiler. Knowing how to compile a short C program is enough for this activity.
Extract the worksheet pack, enter its starter directory and run:
cc -std=c11 -O2 -Wall -Wextra -Werror terminal.c -o terminal
./terminal
Look for a cyan A, a cyan B and seven yellow stars. Press Enter to clear the picture and restore the cursor. The intended coordinates are A at (2,2), B at (28,10) and the stars in column 15 from rows 3 to 9. Coordinates in these instructions are written as (column,row), starting at 1.
| Mark | Intended column, row | Observed column, row |
|---|---|---|
| A | 2, 2 | |
| B | 28, 10 | |
| First star | 15, 3 | |
| Last star | 15, 9 |
Find the call that emits the cursor-position command. Predict what its first number means, change the call, rebuild, and repeat the observation. Explain why checking A alone would let the bug pass. Add a green C at (9,5) and give the escape sequence that positions it. If you interrupt the program before pressing Enter, type reset to restore your terminal.
Original LabsLand activity following FPGAcademy Embedded Systems Lab 5, Part I. Original handout · MIT
