How skx/cpmulator works
Project Type and Core Purpose
This is a CP/M emulator written in Go, designed to run CP/M binaries by emulating the CP/M operating system environment. The system needs to represent both the emulated CP/M architecture and the modern implementation components.
Main Components
A. Core Emulation Layer:
• Z80 CPU Emulation (via external library)
• Memory Management System (memory/ package)
• CP/M System Components (cpm/ package)
• BDOS (Basic Disk Operating System)
• BIOS (Basic Input/Output System)
B. I/O Subsystem:
• Console Input Handler (consolein/ package)
• Console Output Handler (consoleout/ package)
• Multiple terminal emulation drivers (ADM-3A, ANSI)
• File System Interface (fcb/ package)
C. Command Processors:
• Default CCP (Console Command Processor)
• Enhanced CCPZ
• Built-in Commands Implementation
D. Runtime Environment:
• Drive Management System
• File System Abstraction
• Debug/Logging System
┌─────────────────────────────────────────────────────┐
• User Interface │
• (CCP/CCPZ Command Processor & Terminal Emulation) │
• ┤
• CP/M Emulation Layer │
• ┬──────────────────┬──────────────────┤
• BDOS │ BIOS │ Memory Manager │
• (cpm_bdos.go)│ (cpm_bios.go) │ (memory/) │
• ┴──────────────────┴──────────────────┤
• I/O Abstraction Layer │
• ┬──────────────────┬──────────────────┤
• Console In │ Console Out │ File System │
• (consolein/) │ (consoleout/) │ (fcb/) │
• ┴──────────────────┴──────────────────┤
• Host System Interface │
• (File System, Terminal, Debug Logging) │
• ┘
Important Elements to Highlight
• Blue: Core CP/M emulation components
• Green: I/O subsystems
• Yellow: User interface components
• Gray: Host system interfaces
• Command flow from CCP to BDOS/BIOS
• File system operations through FCB
• I/O operations through console handlers
• Memory access patterns
c. Special Features:
• Debug logging system
• Drive/Directory mapping
• Extension mechanisms
• Printer output redirection
Implementation Details to Note
• Memory map (0x0000 - 0xFE00)
• Locations of CCP, BDOS, and BIOS in memory
• Relationship between host directories and CP/M drives
• Syscall implementation status
External Interfaces
• Integration with host file system
• Console I/O handling
• Debug logging outputs
• Printer output redirection
Remember to highlight the extensibility points where the system can be configured or modified, such as the console drivers and CCP implementations.