04 June 2016, 17:41 | #1 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
Cd32 audio read routines using hardware
Hi
I ve got everything i need to read files from cd but psygore cd loader lacks audio play. I suppose it is mych simpler but still i dont have a clue how to do it. |
07 June 2016, 22:25 | #2 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 477
|
You could open cd.device and choose cmd cd_playtrack? Or do you want to _read_ audiotracks?
|
07 June 2016, 22:56 | #3 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
|
07 June 2016, 23:01 | #4 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 477
|
Ah, ok. I am not allowed to post cd.device in src. Sorry.
|
07 June 2016, 23:14 | #5 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
I can get info from cd.device src myself. Good idea.
|
08 June 2016, 07:28 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
CD play uses same command as data read. Data read has bit 7 set in command byte offset 7, playback has bit cleared.
Send the command, send unpause, playback starts. Nothing else is needed, no DMA, no buffers. Use of PIO mode to send and read status may be even easier than using DMA to send/receive commands, also keeps CD playback from stepping on data loader's toes. (I can try writing simple example later this week, this is also interesting never used PIO test case..). Command is something like: x4 MM SS FF MM SS FF 00 00 00 04 00 yy First MSF = start, second MSF = stop position, x = index count, yy = checksum) Note that CD32 does not have "play track x" command, only MSF to MSF. |
08 June 2016, 20:43 | #7 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
thanks Toni.
You mean that I have to read TOC to know where to start/stop? An example will be much appreciated. |
08 June 2016, 21:53 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
|
11 June 2016, 12:07 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Very ugly and minimal experimental CD32 CD audio "player" source attached.
- Direct Akiko hardware access - Uses PIO CD command/status send/receive mode that no one has ever used before! (as far as I know) - Real CD32 confirmed working - WinUAE 3.3.1 development version required if you want to test it in emulation. 3.3.0 or older don't support Akiko PIO mode. (http://www.winuae.net/files/b/winuae.7z) - Hardcoded to play from 00:02:00 to 01:00:00 (MSF format). Does not read TOC. - Reads and validates status packets from CD but does not do anything with them. This is needed if you want to know when CD play ends or if some error happened. - Stores status packets in 64k circular buffer, useful for testing what real hardware returns when trying to send invalid commands or bad parameters. - Toggles CD led every 2 seconds. Just because I wanted some extra - Press mouse to exit. TODO: TOC and status packet handling. No guarantees if I feel interested enough.. EDIT: CD play status handling will be done soon.. (Detect when play command endpos has been reached) Last edited by Toni Wilen; 11 June 2016 at 20:57. |
11 June 2016, 18:09 | #10 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
Thanks Toni! I guess I could read CD TOC using Psygore "read sector" command and exploit it.
Now I've got a lot of work to do to assemble that and make the first game work. |
11 June 2016, 18:33 | #11 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Quote:
Reading is two step process: - Start "playing" from 00:00:00 - CD microcontroller starts sending TOC entry status packets, parse and convert them to more usable format. I'll do this, it isn't that complex. |
|
11 June 2016, 18:58 | #12 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
CD32load will soon be written by JOTD / Psygore / Toni Wilen. Thanks!
|
11 June 2016, 20:36 | #13 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
TOC reading works now in emulation. Real hardware testing and tweaking tomorrow..
|
11 June 2016, 21:00 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
I lied, I quickly transferred it and it did work immediately. (I expected lots of debugging..)
New version attached. Updates: - Reads TOC. - Uses now TOC data to select track. - Exits when play end position has been reached. EDIT: above winuae supports -cd32log and -cd32log2 (even more cd32 logging). Should help with debugging. This was previously compile time setting. Last edited by Toni Wilen; 12 June 2016 at 10:47. |
11 June 2016, 22:43 | #15 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
Great work!
Questions: - so statusout needs $10000 bytes of memory to work right? - I don't see where you tell which track to play (I basically need to play a track/stop it from playing/check if it is playing) - when does level 2 interrupt happen? |
11 June 2016, 23:19 | #16 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 477
|
should be this:
Code:
skiptoc lea cmd_unpause(pc),a0 bsr.w sendcmd moveq #2,d0 ;track number to play (1-99) |
12 June 2016, 08:27 | #17 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
No. It is just for debugging. Longest status packet is 21 bytes. (20 + checksum)
I'll update it with optional "debug" features.. Quote:
It may come immediately after enable Akiko receive interrupt if there is something buffered (someone left some data). Most commands return some status data, especially TOC read can return hundreds of bytes of data. You probably have level 2 interrupt already, just add bit #29 check from b8000004 check, if set, run "my" interrupt code (and remove the CIA access at the end!). If not, run normal level2 code. |
|
12 June 2016, 10:48 | #18 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Update attached.
- Debug option added, without it status output buffer can be very small. - Some misc changes. |
13 June 2016, 22:43 | #19 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
Thanks Toni.
just a few more questions: * bcdtens dc.b 0,10,20,30,40,50,60,70,80,90 => isn't there a bug? this is not a BCD table but rather a decimal table am I right? * you said it had never been done before, so how was it done? * AFAIR no NDOS game like RNLoader used CD audio during game, except for Lotus I so I guess RN routines must have CD play/stop commands, that plus the fact that there are 13 commands and only 3 that I have identified as useful for disk reading. I'll try to adapt that to CD32load. Could take some time, but all the logic is there so it's cool! |
14 June 2016, 08:52 | #20 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Quote:
Quote:
You also noticed it did not return static value. I did more tests and I noticed it seemed to always return last status byte from CD. That was big clue. I tried writing commands to it and then check what $28 reads, it did work! Finding out related interrupt bits was not that difficult because there was only 2 unused ones. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga audio channel split by hardware? | Amiga1992 | Hardware mods | 58 | 20 January 2013 11:12 |
Amiga audio hardware trivia | Toni Wilen | Coders. General | 12 | 23 September 2010 18:14 |
Audio hardware pron! | Paul_s | Hardware pics | 3 | 23 September 2009 17:08 |
How to read the CD32-Pad with Atmega8? | CrazyIcecap | request.Other | 14 | 27 September 2008 18:57 |
Audio difference HARDWARE/HOST | glue | support.WinUAE | 2 | 10 January 2008 07:26 |
|
|