🎯 Major Features & Improvements
VGA/EGA Graphics System Overhaul
- Complete VGA 256KB Support: Full implementation of VGA graphics modes with 256KB video memory using planar memory layout with 0xP3P2P1P0 byte packing
- EGA Graphics Modes: Added support for EGA 320x200x16 (0x0D), 640x200x16 (0x0E), and 640x350x16 (0x10) modes with proper plane expansion
- VGA Mode Implementation: Complete VGA 640x480x16 (0x12) and enhanced VGA 320x200x256 (0x13) rendering
- Chain4 Mode Support: Proper handling of VGA chain4 mode for 256-color graphics with
chain4flag invga_cache_t - Pixel Packing Optimization: Replaced
spread4_u32withega_pack8_from_planesfor improved clarity and code reuse across platforms - Enhanced Memory Access: Added
vga_mem_read16implementation and optimized memory read/write operations with 32-bit latch system - Plane Expansion LUT: Added 16-entry plane expansion lookup table for efficient bit-plane to pixel conversion
Cross-Platform Graphics Performance
- Unified Rendering Logic: Standardized graphics rendering across Windows, Linux, and Pico platforms
- Loop Unrolling: Optimized EGA/VGA rendering loops for improved performance
- Bitwise Operations: Replaced division with bitwise operations for better performance
- Memory Alignment: 4-byte alignment for PSRAM variables and video memory buffers
PSRAM & Memory Management
- Butter-PSRAM Support: Auto-detection and configuration for Butter-PSRAM hardware with dynamic GPIO pin detection (GPIO 8 for MURM20, GPIO 47 for PIMO, GPIO 19 default)
- Dynamic Memory Allocation: Runtime PSRAM size detection (16MB, 8MB, 4MB, 1MB) with validation through test patterns
- Memory Layout Optimization: 4-byte alignment for all PSRAM variables (
RAM,UMB,HMA,EMS) withaligned(4)attribute - Virtual Memory Enhancement: Enhanced XMS/EMS memory management with shared UMB support and proper alignment
- PSRAM Frequency Control: Configurable PSRAM frequency (166MHz default) with timing adjustments
- Memory Mapping: PSRAM mapped at 0x11000000 with optimized access patterns
Platform-Specific Improvements
Raspberry Pi Pico (RP2040/RP2350)
- CPU Frequency Handling: Dynamic frequency configuration - 504MHz for Pico2 with HDMI, 378MHz for other HDMI configurations, 500MHz default
- PSRAM GPIO Auto-Detect: Automatic detection of onboard PSRAM GPIO configurations with hardware-specific pinouts
- Flash Frequency Control: Configurable flash frequency (100MHz default) with build name integration (F100-P166-500MHz format)
- Build Configuration: Streamlined CMake configuration with platform-specific optimizations and conditional compilation
- Performance Optimization: Strategic register keyword usage and memory access optimizations with
#pragma GCC optimize("Ofast")
Windows/Linux Host Builds
- MiniFB Integration: Improved MiniFB graphics interface with cleaner code
- All Video Modes: Complete support for PX3 video modes across all platforms
- Build Fixes: Resolved compilation issues across different host platforms
🐛 Bug Fixes & Stabilization
Video System Fixes
- 40x25 Text Modes: Fixed rendering issues in 40-column text modes
- CGA Rendering: Corrected pointer types and rendering logic
- Palette Handling: Fixed incorrect palette usage in 640x350 EGA mode
- Boundary Checks: Removed redundant checks while maintaining safety
Memory Management Fixes
- XMS Alignment: Fixed 4-byte alignment for UMB memory blocks
- EMS Integration: Improved Expanded Memory Specification handling
- Memory Leaks: Resolved memory allocation and deallocation issues
- Swap System: Enhanced virtual memory swapping mechanisms
Audio & I/O Fixes
- Speaker Sample Integration: Fixed sound mixing logic for PC speaker
- Sound Blaster Emulation: Resolved swap-related sound card issues
- Port Handling: Improved I/O port access and timing
⚡ Performance Optimizations
Rendering Performance
- Bit Spreading Optimization: Fast bit spreading for EGA/VGA pixel processing
- Loop Unrolling: Reduced instruction count in critical rendering paths
- Memory Access Patterns: Optimized video memory access for better cache utilization
- Reduced Redundancy: Eliminated unnecessary buffer writes and calculations
Memory Performance
- Aligned Memory Access: 4-byte alignment for improved ARM architecture performance
- PSRAM Optimization: Optimized external PSRAM access patterns
- Virtual Memory: Improved page file access and caching
CPU Optimization
- Register Usage: Strategic use of register keyword for frequently accessed variables
- Bitwise Operations: Replaced expensive operations with faster alternatives
- Function Inlining: Critical path optimizations for better performance
🔧 Technical Improvements
Code Quality & Architecture
- Const Correctness: Added const qualifiers throughout codebase for better type safety
- Type Safety: Improved type handling with proper pointer arithmetic and casting
- Code Cleanup: Removed unused variables (
VIDEORAM,port3DAfrom graphics.h) and dead code paths - Header Organization: Better organization of include files and dependencies
- Variable Naming: Consistent naming conventions (e.g.,
ega_planesinstead of generic variables)
Memory Management Architecture
- Planar Memory Layout: VGA memory organized as 0xP3P2P1P0 (plane0 in lowest byte) for optimal 32-bit access
- 32-bit Latch System: Implemented VGA latch system for planar memory operations
- Memory Access Patterns: Optimized VIDEORAM indexing using bitwise AND instead of modulo operations
- Buffer Management: Unified buffer handling across graphics modes with proper alignment
Build System & Configuration
- CMake Streamlining: Removed complex conditional logic in favor of cleaner platform detection
- Build Naming: Enhanced build names with frequency information (F100-P166-500MHz format)
- Configuration Files: Added support for
config.286runtime configuration - Compilation Flags: Platform-specific optimization flags and conditional compilation
Full Changelog: v1.1.0...v2.0.0