How do you access MP3 files?
1. How to access the disk:
Usually the BIOS encapsulates disk operations (INT13h), so it's very simple for us to use.
But now it's bare metal, you have to operate the hard disk controller yourself, send control commands according to the ATA specification, and also set up the DMA chip to achieve batch data transmission.
If you find the disk too complicated and want to use Flash ROM, maybe it can be simplified, but the next problem cannot be avoided.
2. How to access files:
The disk itself can only understand sectors.
The file system is a function provided by the operating system.
You have to analyze the sectors according to the FAT file system format (or other file systems: NTFS, Ext2, Ext3...) to be able to perform file operations.
(Even if you use Flash ROM, generally still need to use the FAT file system format to store MP3 files)
Also, how do you make the speaker sound?
Before 1995, Creative Labs' Sound Blaster cards were very famous, so the sound cards under DOS at that time were compatible with it at the I/O port level. Since Windows 95 came out, because of the concept of drivers, manufacturers can freely design hardware, and there is no longer a specification at the I/O port level. Or you can use AC97, but AC97 involves a lot of content about modern chip sets (such as the PCI architecture). And AC97 was originally designed to reduce costs, and many functions need to be implemented by programming software.
When you are writing an audio playback program, timing control is very important, so you also need to program the 8253 timer chip.
This is almost writing a small operating system
人类存在的目的就是试图理解人类为何存在