Advanced Topics
You've mastered the basics. Now let's get fancy. This section covers advanced techniques, edge cases, and things you probably don't need but might find interesting. Or useful. Or both.
Custom Disk Sizes
Exact Sector Count Mode
The -x option creates images with exact sector counts, using non-standard sizes:
atrforge -x custom.atr file1.com file2.bas
This creates an image with exactly the number of sectors needed, which might not be a standard size. Useful when:
- You need a specific size
- You want to minimize disk space
- Standard sizes don't fit your needs
Note: These non-standard sizes may not work with all emulators or systems. Test first.
Minimum Size with Exact Mode
Combine -s and -x for specific sizes:
atrforge -s 360000 -x disk.atr files...
This creates an image of at least the specified size, using exact sector counts. The size is in bytes, but the actual image will be rounded to sector boundaries.
Bootloader Relocation Strategies
When to Relocate
Relocate the bootloader when:
- Your program loads at $600-$700
- You get memory conflicts
- Boot process fails
- You know the load address conflicts
Relocation Options
Page 6 ($600): Usually safe, recommended first try
atrforge -B 6 -b disk.atr program.com
Page 5 ($500): Possible, but riskier
atrforge -B 5 -b disk.atr program.com
Page 4 ($400): Possible, but even riskier
atrforge -B 4 -b disk.atr program.com
Testing Relocation
Always test relocated bootloaders:
- Create image with relocation
- Test in emulator first
- Verify program loads correctly
- Check for memory conflicts
- Test on real hardware if possible
Filesystem Optimization
Directory Structure
Organize files efficiently:
- Group related files in directories
- Keep directory depth reasonable (2-3 levels max)
- Use descriptive directory names
- Avoid too many small directories
File Placement
- Put frequently accessed files in root
- Put related files together
- Consider access patterns
- Balance organization with efficiency
Attribute Usage
Use attributes strategically:
- Protect system files (
+p) - Hide temporary files (
+h) - Mark archived files (
+a) - Don't overuse attributes
Batch Operations
Processing Multiple Images
Extract from multiple images:
for img in *.atr; do dir="${img%.atr}" mkdir -p "$dir" lsatr -X "$dir/" "$img" done
Convert multiple images:
for img in *.atr; do convertatr --sector-size 256 "$img" "converted/${img}" done
Creating Multiple Disks
Create disks for multiple programs:
for prog in *.com; do atrforge -b "${prog%.com}.atr" "$prog" done
Batch File Updates
Update files in multiple images:
for img in *.atr; do atrcp newfile.com "$img:NEWFILE.COM" done
Scripting Examples
Automated Disk Creation
Create a script for standard disk creation:
#!/bin/bash # create_disk.sh - Create a standard disk image DISK_NAME="$1" shift FILES="$@" atrforge "$DISK_NAME" \ system/ +p system/config.sys \ "$FILES"
Usage:
./create_disk.sh mydisk.atr file1.com file2.bas
Disk Maintenance Script
Script to verify and report on multiple images:
#!/bin/bash # check_disks.sh - Verify multiple disk images for img in *.atr; do echo "Checking $img..." if lsatr --verify "$img" > /dev/null 2>&1; then echo " OK" else echo " FAILED" fi done
Backup Script
Backup script for disk images:
#!/bin/bash # backup_disks.sh - Backup disk images with timestamps BACKUP_DIR="backups/$(date +%Y%m%d)" mkdir -p "$BACKUP_DIR" for img in *.atr; do cp "$img" "$BACKUP_DIR/${img%.atr}_$(date +%H%M%S).atr" done
Integration with Other Tools
Using with Emulators
Most Atari emulators support ATR images directly:
- Altirra
- Atari800
- Atari++
Just point the emulator at your ATR file. It's that simple.
Using with Disk Utilities
You can use atrforge images with other Atari disk utilities:
- Extract files, modify on Atari, recreate image
- Use Atari tools for filesystem operations
- Combine atrforge creation with Atari-side modification
Using with Version Control
ATR images are binary, but you can:
- Extract files and version control those
- Keep ATR images as release artifacts
- Use scripts to recreate images from version-controlled files
Advanced Conversion Techniques
Multi-Step Conversions
Convert in multiple steps:
# Step 1: Resize convertatr --resize 1440 small.atr medium.atr # Step 2: Convert sector size convertatr --sector-size 256 medium.atr large.atr # Step 3: Convert files convertatr --convert-utf8 --resize 2048 large.atr final.atr
Selective File Conversion
Convert specific files only:
# Extract files lsatr -X temp/ image.atr # Convert specific files atrcp --to-utf8 temp/file1.bas file1_utf8.bas atrcp --to-utf8 temp/file2.bas file2_utf8.bas # Recreate image atrforge --to-atascii newimage.atr file1_utf8.bas file2_utf8.bas temp/file3.com
Performance Optimization
Large Image Handling
For very large images (approaching 16MB):
- Process in smaller chunks if possible
- Close other applications
- Ensure adequate system memory
- Consider splitting across multiple images
Batch Processing
For processing many images:
- Process sequentially (not parallel)
- Clean up temporary files
- Monitor disk space
- Use scripts for automation
Edge Cases and Workarounds
Non-Standard Formats
If you encounter non-standard ATR formats:
- Try
lsatr --verifyfirst - Extract files and recreate if needed
- Check if format is actually supported
- Report unsupported formats
Corrupted Images
For corrupted images:
- Try
lsatr --verifyto assess damage - Attempt extraction (may get some files)
- Use
convertatrto rebuild structure - Extract and recreate if possible
Very Large Files
For files approaching disk size limits:
- Check actual file sizes
- Use largest available disk size
- Consider file compression (if supported)
- Split files if necessary
Advanced Attribute Usage
Attribute Combinations
Strategic attribute combinations:
- System files:
+ph(protected + hidden) - Backups:
+pa(protected + archived) - Temporary:
+h(hidden only) - Important:
+p(protected only)
Attribute Management
Manage attributes programmatically:
- Extract files, modify attributes on Atari, recreate
- Use scripts to set attributes consistently
- Document attribute usage
Custom Workflows
Development Workflow
For development work:
- Create development disk with tools
- Extract source files for editing
- Edit in modern editors (with UTF8 conversion)
- Add files back to disk
- Test in emulator
- Repeat
Archival Workflow
For archiving old disks:
- Verify images:
lsatr --verify - Extract all files:
lsatr -X archive/ - Document contents
- Create organized structure
- Backup everything
Distribution Workflow
For creating distribution disks:
- Organize files into directories
- Set appropriate attributes
- Create bootable image if needed
- Test thoroughly
- Create final image
- Verify before distribution
Tips for Power Users
- Automate repetitive tasks - Write scripts for common operations
- Test everything - Especially boot files and conversions
- Keep backups - Multiple backups, different locations
- Document your process - Write down what works
- Version control - Use git or similar for file management
- Verify images - Always verify before using
- Know your limits - 16MB max, understand constraints
- Test in emulators - Before using on real hardware
- Keep it organized - Good structure saves time later
- Read the docs - Even power users need reference
See Also
- Examples - More examples that might be useful
- Troubleshooting - When things go wrong
- Tool-specific documentation for detailed options
- ATR Format - Technical details
For the complete tool list, see the main documentation index.