X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fcd%2Fcd_sys.c;h=2c70ea2685f20b6f8a0ed77af5dc421f5d74f68f;hb=cb0316e4c526ad4c8d50e40e53c9d39044dcaaf9;hp=72d6c0eda38022db5b082f4f3c6b7437f9b0ac16;hpb=cc68a136aa179a5f32fe40208371eb9c2b0aadae;p=picodrive.git diff --git a/Pico/cd/cd_sys.c b/Pico/cd/cd_sys.c index 72d6c0e..2c70ea2 100644 --- a/Pico/cd/cd_sys.c +++ b/Pico/cd/cd_sys.c @@ -1,11 +1,12 @@ #include #include "cd_sys.h" -//#include "cd_file.h" +#include "cd_file.h" #include "../PicoInt.h" -#define cdprintf printf +#define cdprintf dprintf //#define cdprintf(x...) +#define DEBUG_CD #define TRAY_OPEN 0x0500 // TRAY OPEN CDD status #define NOCD 0x0000 // CD removed CDD status @@ -15,18 +16,6 @@ #define FAST_REV 0x10300 // FAST REVERSE track CDD status #define PLAYING 0x0100 // PLAYING audio track CDD status -/* -#include "gens.h" -#include "G_dsound.h" -#include "cdda_mp3.h" -#include "lc89510.h" -#include "Star_68k.h" -#include "Mem_M68K.h" -#include "Mem_S68K.h" -#include "save.h" -#include "misc.h" -*/ - /* int CDDA_Enable; @@ -45,8 +34,6 @@ static int CDD_Complete; static int File_Add_Delay = 0; -//_scd SCD; - #define CHECK_TRAY_OPEN \ @@ -167,7 +154,7 @@ int Track_to_LBA(int track) void Check_CD_Command(void) { - cdprintf("CHECK CD COMMAND\n"); + cdprintf("CHECK CD COMMAND"); // Check CDD @@ -182,7 +169,7 @@ void Check_CD_Command(void) if (Pico_mcd->scd.Status_CDC & 1) // CDC is reading data ... { - cdprintf("Sending a read command\n"); + cdprintf("Got a read command"); // DATA ? if (Pico_mcd->scd.TOC.Tracks[Pico_mcd->scd.Cur_Track - Pico_mcd->scd.TOC.First_Track].Type) @@ -191,9 +178,7 @@ void Check_CD_Command(void) if (File_Add_Delay == 0) { -#if 0 // TODO FILE_Read_One_LBA_CDC(); -#endif } else File_Add_Delay--; } @@ -215,9 +200,7 @@ void Check_CD_Command(void) int Init_CD_Driver(void) { -#if 0 // TODO FILE_Init(); -#endif return 0; } @@ -225,9 +208,7 @@ int Init_CD_Driver(void) void End_CD_Driver(void) { -#if 0 // TODO FILE_End(); -#endif } @@ -240,33 +221,29 @@ void Reset_CD(void) } -int Insert_CD(char *buf, char *iso_name) +int Insert_CD(char *iso_name, int is_bin) { + int ret = 0; + // memset(CD_Audio_Buffer_L, 0, 4096 * 4); // memset(CD_Audio_Buffer_R, 0, 4096 * 4); - if (iso_name == NULL) - { - CD_Present = 0; - } - else + CD_Present = 0; + + if (iso_name != NULL) { -#if 0 // TODO - Load_ISO(buf, iso_name); - CD_Present = 1; -#endif - return 0; + ret = Load_ISO(iso_name, is_bin); + if (ret == 0) + CD_Present = 1; } - return 0; + return ret; } void Stop_CD(void) { -#if 0 // TODO Unload_ISO(); -#endif CD_Present = 0; } @@ -280,7 +257,7 @@ void Change_CD(void) int Get_Status_CDD_c0(void) { - cdprintf("Status command : Cur LBA = %d\n", Pico_mcd->scd.Cur_LBA); + cdprintf("Status command : Cur LBA = %d", Pico_mcd->scd.Cur_LBA); // Clear immediat status if ((Pico_mcd->cdd.Status & 0x0F00) == 0x0200) @@ -323,7 +300,7 @@ int Get_Pos_CDD_c20(void) { _msf MSF; - cdprintf("command 200 : Cur LBA = %d\n", Pico_mcd->scd.Cur_LBA); + cdprintf("command 200 : Cur LBA = %d", Pico_mcd->scd.Cur_LBA); CHECK_TRAY_OPEN @@ -336,7 +313,7 @@ int Get_Pos_CDD_c20(void) // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD; Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD; - cdprintf("Status CDD = %.4X Status = %.4X\n", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status); + cdprintf("Status CDD = %.4X Status = %.4X", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status); LBA_to_MSF(Pico_mcd->scd.Cur_LBA, &MSF); @@ -372,7 +349,7 @@ int Get_Track_Pos_CDD_c21(void) elapsed_time = Pico_mcd->scd.Cur_LBA - Track_to_LBA(LBA_to_Track(Pico_mcd->scd.Cur_LBA)); LBA_to_MSF(elapsed_time - 150, &MSF); - cdprintf(" elapsed = %d\n", elapsed_time); + cdprintf(" elapsed = %d", elapsed_time); Pico_mcd->cdd.Minute = INT_TO_BCDW(MSF.M); Pico_mcd->cdd.Seconde = INT_TO_BCDW(MSF.S); @@ -387,7 +364,7 @@ int Get_Track_Pos_CDD_c21(void) int Get_Current_Track_CDD_c22(void) { - cdprintf("Status CDD = %.4X Status = %.4X\n", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status); + cdprintf("Status CDD = %.4X Status = %.4X", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status); CHECK_TRAY_OPEN @@ -436,7 +413,7 @@ int Get_Total_Lenght_CDD_c23(void) Pico_mcd->cdd.Ext = 0; // FIXME: remove -Pico_mcd->cdd.Seconde = 2; +//Pico_mcd->cdd.Seconde = 2; CDD_Complete = 1; @@ -462,7 +439,7 @@ int Get_First_Last_Track_CDD_c24(void) Pico_mcd->cdd.Ext = 0; // FIXME: remove -Pico_mcd->cdd.Minute = Pico_mcd->cdd.Seconde = 1; +//Pico_mcd->cdd.Minute = Pico_mcd->cdd.Seconde = 1; CDD_Complete = 1; @@ -528,7 +505,7 @@ int Play_CDD_c3(void) Pico_mcd->scd.Cur_LBA = new_lba; CDC_Update_Header(); - cdprintf("Read : Cur LBA = %d, M=%d, S=%d, F=%d\n", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F); + cdprintf("Read : Cur LBA = %d, M=%d, S=%d, F=%d", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F); if (Pico_mcd->scd.Status_CDD != PLAYING) delay += 20; @@ -546,9 +523,7 @@ int Play_CDD_c3(void) { Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO //CD_Audio_Starting = 1; -#if 0 // TODO FILE_Play_CD_LBA(); -#endif } if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02; @@ -636,7 +611,7 @@ int Resume_CDD_c7(void) { _msf MSF; LBA_to_MSF(Pico_mcd->scd.Cur_LBA, &MSF); - cdprintf("Resume read : Cur LBA = %d, M=%d, S=%d, F=%d\n", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F); + cdprintf("Resume read : Cur LBA = %d, M=%d, S=%d, F=%d", Pico_mcd->scd.Cur_LBA, MSF.M, MSF.S, MSF.F); } #endif @@ -651,9 +626,7 @@ int Resume_CDD_c7(void) { Pico_mcd->s68k_regs[0x36] &= ~0x01; // AUDIO //CD_Audio_Starting = 1; -#if 0 // TODO FILE_Play_CD_LBA(); -#endif } if (Pico_mcd->scd.Cur_Track == 100) Pico_mcd->cdd.Minute = 0x0A02; @@ -669,7 +642,7 @@ int Resume_CDD_c7(void) } -int Fast_Foward_CDD_c8(void) +int Fast_Foward_CDD_c8(void) { CHECK_TRAY_OPEN CHECK_CD_PRESENT @@ -690,7 +663,7 @@ int Fast_Foward_CDD_c8(void) } -int Fast_Rewind_CDD_c9(void) +int Fast_Rewind_CDD_c9(void) { CHECK_TRAY_OPEN CHECK_CD_PRESENT @@ -751,9 +724,7 @@ int Open_Tray_CDD_cD(void) Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read -#if 0 // TODO Unload_ISO(); -#endif CD_Present = 0; Pico_mcd->scd.Status_CDD = TRAY_OPEN;