Comparing AI Coding Models for Low-Level Development: A UEFI Graphics Application Case Study

    This article examines how different types of AI coding models perform when developing a graphical application in a pure UEFI Shell environment. Using a Snake game as a practical case, it focuses on engineering planning, environment constraints, debugging, file-system safety, emulator setup, maintainability, and prompt design rather than promoting any specific model. The analysis shows why low-level development requires human oversight beyond code generation.

    Developing applications on top of an operating system usually means relying on mature window systems, input frameworks, graphics libraries, and debugging tools. In a pure UEFI Shell environment, however, developers must handle many of these fundamentals themselves. Display output, keyboard input, memory management, the build process, boot media, and the runtime environment are tightly coupled.

    This makes UEFI application development a useful test of an AI coding model’s real engineering capabilities.

    This article does not promote or recommend a specific model. Instead, it analyzes the performance of different types of AI coding models through a practical low-level graphics development task.

    1. Case Study: Building a Graphical Game in a Firmware Environment

    The goal of the project was to develop a Snake game that could run in a pure UEFI Shell environment without operating system support. The program would execute directly in the environment provided by the firmware. Graphics output would rely on the UEFI Graphics Output Protocol, while keyboard input would come from firmware-level keyboard services.

    The planned features included:

    • Chinese menus, status information, and control instructions;
    • Direction-key and letter-key controls;
    • Game rendering through a graphics frame buffer;
    • Double buffering to reduce screen tearing;
    • Gradually increasing difficulty based on the player’s score;
    • Obstacles in advanced levels;
    • Simple particle effects when food is collected;
    • Pause, resume, and restart support;
    • Startup and execution in an independent firmware emulation environment.

    This was not a large project, but it involved a broad range of engineering concerns, including the build system, firmware protocols, graphics rendering, input processing, state-machine design, and runtime configuration.

    For an AI coding model, the main challenge was not generating several hundred lines of game logic. The real challenge was correctly understanding the constraints: there was no operating system, no conventional window system, and no standard desktop graphics library.

    2. Three Development Iterations and the Collaboration Model

    The development process can be divided into three stages.

    First Iteration: Building a Runnable Baseline

    The first iteration focused on completing the smallest possible working loop:

    1. Initialize the UEFI application;
    2. Obtain the Graphics Output Protocol;
    3. Clear the screen and draw a basic background;
    4. Create the snake, food, and boundaries;
    5. Read keyboard input;
    6. Implement snake movement and collision detection;
    7. Complete the application exit flow.

    At this stage, the prompt should not ask the model to implement every feature at once. A more reliable approach is to define the runtime constraints and directory structure first, ask the model to create a minimal project, and then add game logic incrementally.

    For example:

    1. Create a pure UEFI application project in the current working directory.
    2. Requirements:
    3. 1. Do not depend on operating system graphics libraries.
    4. 2. Render graphics through the UEFI Graphics Output Protocol.
    5. 3. First implement the background, boundary, and one movable square.
    6. 4. Do not add audio, particles, or complex menus yet.
    7. 5. After each modification, explain the changed files, build command, and verification method.

    This staged approach makes build failures easier to classify. Developers can determine whether a problem belongs to project configuration, protocol usage, or application logic instead of asking the model to repeatedly guess across a large codebase.

    Second Iteration: Adding Interaction and Visual Effects

    Once the baseline could start successfully, the next stage added levels, obstacles, particle effects, and pause functionality. The model now had to manage more state, including:

    • The current game state: start, running, paused, or over;
    • The current level and upgrade thresholds;
    • The snake’s coordinate array;
    • Food and obstacle positions;
    • Input state for the current frame;
    • Particle-object lifetimes;
    • The back buffer and display buffer.

    Without clearly defined data structures and state-transition rules, a model may simply append every feature to the main loop. The code can then become difficult to maintain very quickly. Prompts should therefore explicitly require a state machine and modular design.

    A reasonable logical separation is:

    1. Initialization module: Set up the graphics environment, input environment, and game state
    2. Input module: Read keys and convert them into unified control events
    3. Logic module: Update the snake, food, obstacles, and levels
    4. Collision module: Handle boundary, self, and obstacle collisions
    5. Rendering module: Draw the background, snake, food, text, and particles
    6. Main-loop module: Control time steps, pause state, and refresh timing

    This structure helps the model generate better-organized code and allows developers to locate problems more easily during later debugging.

    Third Iteration: Localization and Usability Improvements

    The third iteration focused on Chinese menus, status displays, control instructions, and visual details. Text rendering in a low-level environment is more complicated than in a desktop application. Developers must consider font sources, character encoding, glyph rendering, and available screen space.

    If the runtime environment does not provide a built-in Chinese font service, simply asking the model to “display Chinese” may result in an unusable implementation. More practical options include:

    • Using built-in bitmap glyphs;
    • Creating a glyph table for only a limited set of characters;
    • Converting messages into pre-rendered bitmaps;
    • Falling back to English or pinyin when resources are limited;
    • Keeping text rendering completely separate from game logic.

    This illustrates an important limitation: AI coding models can generate code quickly, but they cannot replace a developer’s basic understanding of the target runtime environment.

    3. Two Typical Problems in Low-Level Development

    3.1 Working-Directory Escapes and Project Contamination

    One of the clearest problems in the practice was that the model did not strictly follow the instruction to create the project only in the current directory. It could place dependency source code, build directories, tool directories, or configuration directories in the parent directory, resulting in a disorganized project structure.

    This is not necessarily a coding problem. It reflects a lack of boundary awareness when operating on the file system. The model may infer a directory layout that seems more conventional, while ignoring the user’s explicitly defined working scope.

    Recommended safeguards include:

    • Provide the absolute path of the current directory in the first prompt;
    • Explicitly prohibit access to parent and unrelated directories;
    • Require the model to list its plan before creating directories;
    • Require it to report the actual path after each group of file operations;
    • Use restricted permissions instead of granting unrestricted file-system access;
    • Define separate locations for source code, build artifacts, and external dependencies;
    • Manually inspect the directory tree before starting the build.

    A constraint can be expressed as follows:

    1. All source code, configuration files, and build artifacts must remain inside the current project directory.
    2. Do not create any files or folders in the parent directory.
    3. If an external dependency is genuinely required, stop and explain why. Do not download or write it automatically.
    4. Before creating any directory, list the target path and wait for confirmation.

    For AI coding tools, permission control is not an optional convenience. It is part of the safety model for low-level engineering.

    3.2 Incomplete Emulation Environments

    The second major problem was incomplete runtime-environment setup. A model may automatically obtain prebuilt firmware and emulator components to save compilation time. However, the resulting firmware image may not include a UEFI Shell, may lack a properly configured boot medium, and may not place the target application at the correct path.

    Therefore, a successful build does not mean that the application can run. At minimum, the following items must be verified:

    1. Whether the firmware emulator can start;
    2. Whether the firmware image includes a Shell environment;
    3. Whether the virtual disk or boot medium is mounted correctly;
    4. Whether the application file is located in an accessible directory;
    5. Whether the Graphics Output Protocol is available;
    6. Whether keyboard input services return the expected events;
    7. Whether the screen resolution and pixel format meet the rendering logic’s requirements.

    A more reliable approach is to separate the environment into three layers:

    • Build layer: Compiles and links the source code and generates the application file;
    • Boot layer: Provides the firmware image, boot medium, and Shell;
    • Validation layer: Starts the application, captures screen output, and records error information.

    Separating these layers makes troubleshooting clearer. Failure to generate the application belongs to the build layer. Failure to enter the Shell belongs to the boot layer. A black screen after entering the Shell is more likely related to graphics initialization or pixel-format handling.

    4. Capability Differences Between AI Coding Models

    When models perform the same task, their differences usually appear in several areas.

    Engineering Planning

    Stronger models analyze the target environment, dependencies, and validation path before creating files. Weaker models may immediately generate a large amount of code while overlooking the build system and boot process.

    For low-level projects, planning ability is often more important than code-generation speed. An incorrect directory structure or boot strategy can make all subsequent code impossible to validate.

    Adherence to Environment Constraints

    Whether a model strictly follows requirements such as “pure UEFI,” “no operating system,” and “use only the Graphics Output Protocol” is a key indicator of engineering reliability.

    Writing these requirements in the prompt is not enough. Developers should verify each iteration to ensure that the model has actually followed them. For example, they should check whether the model introduced a desktop graphics library, assumed the existence of file-system services, or used standard functions unavailable in the target environment.

    Self-Correction

    Errors in low-level development are often indirect. They may appear as a black screen, missing input, random crashes, screen tearing, or startup failure. A model’s ability to narrow down the problem using logs, directory trees, and visible symptoms is an important measure of its debugging capability.

    A high-quality collaboration process should require the model to provide:

    • Hypotheses about the error’s cause;
    • Possibilities that have already been ruled out;
    • The exact files that were modified;
    • Behavioral differences before and after the change;
    • The next command or operation required for verification.

    Code Maintainability

    Some models are effective at quickly producing demonstration code but tend to place all logic in a single source file and main loop. This may be acceptable for a one-time experiment, but additional features will quickly lead to tangled variables, tightly coupled state, and redundant rendering.

    A stronger model will proactively separate data structures, boundary checks, rendering interfaces, and state-machine logic, reducing the cost of future iterations.

    5. Prompting Methods for Low-Level Projects

    A useful prompt structure for low-level development is:

    Goal – Constraints – Steps – Verification – Rollback

    Goal

    Describe the final functionality and the environment in which the program will run.

    Constraints

    Specify which dependencies are prohibited, where files may be written, whether network access is allowed, and whether components may be downloaded automatically.

    Steps

    Require the model to complete one stage at a time. It should not modify the build system, rendering module, and game logic simultaneously.

    Verification

    After every modification, require the model to provide the build method, run method, and expected result.

    Rollback

    Ask the model to maintain clear change notes so that the project can return to the previous runnable version if a problem occurs.

    This method reduces the model’s opportunity to make unapproved assumptions and makes each result easier for the developer to review.

    6. Conclusions from the Practice

    Using an AI coding model to develop a UEFI graphics application is feasible, but it should not be treated as a fully automated code-generation task. Models are efficient at interface design, basic logic, and repetitive code. They still require human supervision when dealing with directory boundaries, runtime environments, protocol details, and abnormal behavior.

    Overall, evaluating whether a model is suitable for low-level development requires more than measuring how quickly it generates code. Developers should also examine whether the model can:

    • Correctly understand the target execution environment;
    • Strictly follow file-system and permission boundaries;
    • Establish a small, verifiable baseline first;
    • Distinguish build problems from runtime problems;
    • Continue debugging and correct its own mistakes;
    • Produce code that is structured and easy to extend.

    For developers, the most reliable strategy is to let the model assist with solution drafts, code generation, and error summaries while retaining human control over directory permissions, dependency introduction, runtime setup, and final acceptance.

    This is especially important in firmware, bootloader, and embedded development. An unapproved file operation or an incorrect assumption about the runtime environment can create far more troubleshooting work than the same mistake would cause in ordinary application development.