Commodore Plus/4 Text Mode Cursor Movement Explained
The Commodore Plus/4 utilized a dedicated video chip known as the TED to manage display functions, including cursor positioning within text mode. This article explores the specific memory addresses, hardware registers, and BASIC commands used to control cursor movement on the system. Readers will gain insight into the technical mechanisms behind screen navigation and how programmers interacted with the text buffer to manipulate cursor location efficiently.
The TED Chip Architecture
Unlike the Commodore 64, which relied on the VIC-II chip, the Plus/4 employed the 7360 TED (Text Editing Device) chip. This integrated circuit handled video display, sound, and memory refresh duties. In text mode, the TED was responsible for rendering the character matrix and managing the hardware cursor blink. The chip did not rely on a sprite for the cursor; instead, it inverted the character cell at the current coordinate to indicate position. This method ensured that cursor movement was tightly coupled with the text editing capabilities of the Kernal ROM, allowing for smooth navigation without the overhead of sprite management.
Memory Addresses and Cursor Position
The system Kernal maintained the current cursor coordinates in specific RAM locations within the zero page. Memory address $0326 stored the horizontal column position, while address $0327 stored the vertical row position. These values ranged from 0 to 39 for columns and 0 to 24 for rows, reflecting the standard 40x25 text screen resolution. While reading these addresses provided the current location, simply poking new values into them did not immediately move the visible cursor. To update the physical display after changing these memory locations, software had to trigger a specific Kernal routine that synchronized the RAM values with the TED chip’s internal registers.
BASIC Commands and Control Codes
For users operating within Commodore BASIC 3.5, cursor movement was most commonly achieved through PRINT statements utilizing PETSCII control codes. Specific numeric codes corresponded to directional movements, such as cursor up, down, left, and right. For example, printing character code 145 moved the cursor down, while code 141 moved it up. This allowed programmers to navigate the screen without direct memory manipulation. Additionally, the HOME command reset the cursor to the top-left corner, effectively clearing the navigation state. These high-level commands abstracted the underlying hardware complexity, making text formatting accessible to casual users.
Programming and Kernal Routines
Advanced programmers often bypassed BASIC to achieve faster cursor control using machine language. The primary method involved loading the desired X and Y coordinates into the accumulator and Y register, respectively, and calling the Kernal PLOT routine located at $FFCC. This subroutine validated the coordinates to ensure they remained within screen boundaries and then updated the TED hardware registers. Direct manipulation via the PLOT routine was essential for high-speed text scrolling or custom input fields where the latency of BASIC interpretation was unacceptable. By leveraging these low-level routines, developers could ensure precise and responsive cursor behavior during intensive text processing tasks.