Tiny68kIDE is a small classic 68k Mac editor prototype built with Retro68. It targets System 7-era Macintosh environments and currently focuses on a simple editable text buffer, line numbers, basic syntax highlighting, scrollbars, file open/save, and selectable LF/CRLF save mode.
Now back to the first couple of words in this readme. It is supposed to be small, it's supposed to be able to run on very little ram and fit even the smallest disks. If you go through the commits and actually try compiling from various commits you'll see I really tried to keep both the binary small and the memory impact small. In the last iterations I focused on the performance and made the highlighting actually optional. Slow machines like my Mac Plus really do make a difference in performance if the toggle is off.
I would welcome any improvements, additions or simply any issues or pull requests to make this even better replacement to the modern editors full of distractions.
A very important disclaimer: This was written with a great help of various LLMs as I am quite rusty in C (last time really I wrote C with confidence was more than 15 years ago). If I found a piece of code that would work I often asked the LLM to help me annotate it so I understand why or how a thing works. (and it definitely helped me with grammar and stylistic.
The normal build command is:
make buildThis runs build_68k.sh, which configures CMake with the Retro68 toolchain and builds into build-68k.
Useful commands:
make build
make cleanThe build script defaults to:
~/Retro68-build/toolchain/m68k-apple-macos/cmake/retro68.toolchain.cmake
Override paths with:
RETRO68_PREFIX=/path/to/Retro68-build/toolchain make build
TOOLCHAIN_FILE=/path/to/retro68.toolchain.cmake make build
BUILD_DIR=/tmp/tiny68kide-build make build
JOBS=4 make buildsrc/main.c owns the classic Mac application shell:
- Toolbox startup and shutdown
- Main editor window, menus, event loop, and command dispatch
- File open/save dialogs
- Scrollbar layout and resize handling
- Status bar drawing and the LF/CRLF toggle
src/about.c owns the About window:
- Opens a normal closable document-style window
- Draws the About contents
- Tracks whether a Toolbox
WindowPtrbelongs to the About window
src/editor.c owns the editor core:
- Text buffer stored in a movable Handle
- Caret movement, blinking, insertion, deletion, and clicks
- Text drawing, line numbers, and visible viewport state
- Internal LF-only text storage
- Save-length calculation and LF/CRLF conversion on copy-out
src/highlight.c owns syntax highlighting:
- Loads
resources/highlight.txt - Parses keyword groups
- Draws highlighted source lines
include/editor.h and include/highlight.h are the public boundaries between these pieces.
The app follows the classic Mac pattern:
- Code changes state or layout.
- It calls
InvalRect(). - The system later sends
updateEvt. main.chandlesupdateEvtwithBeginUpdate(), redraws, then callsEndUpdate().
For the editor window, drawEditorWindowContents() redraws:
- Editor text and gutter
- Status bar
- Grow icon
Resize handling lives in resizeEditorWindow(). After SizeWindow(), it calls layoutEditorWindow() and invalidates the full editor window so the next update event repaints the new bounds.
Menu commands and Cmd-key shortcuts both go through AppCommand in src/main.c.
Current commands:
- About
- Open
- Save
- Syntax Highlighting
- Help > Syntax Highlighting
- Help > Opening Files and Directories
- Toggle Line Endings
- Quit
This keeps menu handling and keyboard shortcuts from drifting apart.
The editor starts in plain text mode for fast redraws on slower 68k Macs.
Use File > Syntax Highlighting or press Cmd-R to toggle highlighting. When enabled, Tiny68kIDE loads highlight.txt; disabling highlighting frees the loaded token table again.
Use Help > Syntax Highlighting for a short in-app explanation of the toggle and highlight.txt rule format.
Use Help > Opening Files and Directories for a short in-app explanation of File > Open, File > Open Directory, and the left browser pane.
The editor stores text internally with LF line endings.
When a file is opened:
- CRLF and old Mac CR are normalized to LF internally.
- The original line-ending style is detected where possible.
When a file is saved:
- LF mode writes internal text directly.
- CRLF mode expands each LF to CRLF.
editor_get_save_length()reports the required output buffer size before saving.
The current mode is shown in the bottom status bar as LF or CRLF. Click the label, use File > Line Endings, or press Cmd-L to toggle it.
Good next areas to improve:
- Error reporting for failed open/save operations.
- Dirty-document tracking and save confirmation on quit/open.
- Better scrollbar thumb behavior and page-up/page-down amounts.
- Selection support.
- Larger-file handling and less full-window redraw.
- More complete keyboard navigation.
The code is intentionally plain C and fairly direct. When changing behavior, prefer keeping the boundary clear: main.c should handle Toolbox/application concerns, while editor.c should handle text state and drawing.