This is a brief review for some topics of ECE220.
Since this website cannot render asm code blocks properly, I used nasm instead — though this is actually LC-3 assembly code.
I. Purpose and Description 1. Purpose This program serves as a review for:
LC3 basics (including I/O) Run-time stack Recursion (LC3 implementation) Linked list (LC3 implementation) Binary tree (LC3 implementation) 2. Descriptions This file primarily serves as a direct LC-3 translation of a C program that prints a file directory structure. The content to be printed is pre-stored in specific data structures. The program prints this content to the console in a pre-order traversal with a specified output format (see desired output for details). To fully cover the previous purposes and simulate how C programs are translated into lower-level assembly language, all user-defined C functions are implemented on a run-time stack. Additionally, we’ve implemented our own “system call” equivalent to “OUT” and “PUTS” (corresponding to C’s printf() function). We name them “PRINT_A_CHAR” and “PRINT_A_STRING” respectively. These subroutines don’t utilize a run-time stack, just as typical system calls in real-world machines. Their implementation is exactly the same as how LC-3 machine implements “OUT” and “PUTS” in its System Space (from x0450 to x0462). The provided test case is absolutely not exhaustive. It was primarily generated by Gemini, and I’ve only revised some grammar mistakes to ensure it works properly for LC-3 syntax. Feel free to add any additional test cases. 3. Data Structure Design (1) Data Structure for Folders and Files Data Structure of Files in a Folder (linked list):
...