amalgamation

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@227 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-08-25 18:06:54 +00:00
parent a4f0cc8647
commit eff55556cf
35 changed files with 607 additions and 363 deletions

View file

@ -88,7 +88,7 @@ static int write_chunk(chunk_name_e name, int len, void *data, void *file)
if (PicoStateProgressCB) PicoStateProgressCB(chunk_names[name]); \
if (!write_chunk(name, sizeof(buff), &buff, file)) return 1;
int PicoCdSaveState(void *file)
PICO_INTERNAL int PicoCdSaveState(void *file)
{
unsigned char buff[0x60];
void *ym2612_regs = YM2612GetRegs();
@ -168,7 +168,7 @@ static int g_read_offs = 0;
#define CHECKED_READ_BUFF(buff) CHECKED_READ2(sizeof(buff), &buff);
int PicoCdLoadState(void *file)
PICO_INTERNAL int PicoCdLoadState(void *file)
{
unsigned char buff[0x60];
int ver, len;

View file

@ -56,7 +56,7 @@ static void CDC_Reset(void)
}
void LC89510_Reset(void)
PICO_INTERNAL void LC89510_Reset(void)
{
CDD_Reset();
CDC_Reset();
@ -66,7 +66,7 @@ void LC89510_Reset(void)
}
void Update_CDC_TRansfer(int which)
PICO_INTERNAL void Update_CDC_TRansfer(int which)
{
unsigned int DMA_Adr, dep, length;
unsigned short *dest;
@ -178,7 +178,7 @@ void Update_CDC_TRansfer(int which)
}
unsigned short Read_CDC_Host(int is_sub)
PICO_INTERNAL_ASM unsigned short Read_CDC_Host(int is_sub)
{
int addr;
@ -230,7 +230,7 @@ unsigned short Read_CDC_Host(int is_sub)
}
void CDC_Update_Header(void)
PICO_INTERNAL void CDC_Update_Header(void)
{
if (Pico_mcd->cdc.CTRL.B.B1 & 0x01) // Sub-Header wanted ?
{
@ -253,7 +253,7 @@ void CDC_Update_Header(void)
}
unsigned char CDC_Read_Reg(void)
PICO_INTERNAL unsigned char CDC_Read_Reg(void)
{
unsigned char ret;
@ -376,7 +376,7 @@ unsigned char CDC_Read_Reg(void)
}
void CDC_Write_Reg(unsigned char Data)
PICO_INTERNAL void CDC_Write_Reg(unsigned char Data)
{
cdprintf("CDC write reg%02d = %.2X", Pico_mcd->s68k_regs[5] & 0xF, Data);
@ -494,7 +494,7 @@ static int bswapwrite(int a, unsigned short d)
return d + (d >> 8);
}
void CDD_Export_Status(void)
PICO_INTERNAL void CDD_Export_Status(void)
{
unsigned int csum;
@ -524,7 +524,7 @@ void CDD_Export_Status(void)
}
void CDD_Import_Command(void)
PICO_INTERNAL void CDD_Import_Command(void)
{
// cdprintf("CDD importing command\n");
cdprintf("in: Command=%.4X, Minute=%.4X, Second=%.4X, Frame=%.4X Checksum=%.4X",

View file

@ -115,16 +115,16 @@ typedef struct
} CDD;
void LC89510_Reset(void);
unsigned short Read_CDC_Host(int is_sub);
void Update_CDC_TRansfer(int which);
void CDC_Update_Header(void);
PICO_INTERNAL_ASM unsigned short Read_CDC_Host(int is_sub);
PICO_INTERNAL void LC89510_Reset(void);
PICO_INTERNAL void Update_CDC_TRansfer(int which);
PICO_INTERNAL void CDC_Update_Header(void);
unsigned char CDC_Read_Reg(void);
void CDC_Write_Reg(unsigned char Data);
PICO_INTERNAL unsigned char CDC_Read_Reg(void);
PICO_INTERNAL void CDC_Write_Reg(unsigned char Data);
void CDD_Export_Status(void);
void CDD_Import_Command(void);
PICO_INTERNAL void CDD_Export_Status(void);
PICO_INTERNAL void CDD_Import_Command(void);
#ifdef __cplusplus
};

View file

@ -8,16 +8,18 @@
#include "../PicoInt.h"
#include "../sound/sound.h"
#include "../sound/ym2612.h"
#include "../sound/sn76496.h"
#include "gfx_cd.h"
#include "pcm.h"
#ifndef UTYPES_DEFINED
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#define UTYPES_DEFINED
#endif
//#define __debug_io
//#define __debug_io2
@ -1454,7 +1456,7 @@ static u32 PicoCheckPcS68k(u32 pc)
#endif
void PicoMemSetupCD()
PICO_INTERNAL void PicoMemSetupCD(void)
{
dprintf("PicoMemSetupCD()");
#ifdef EMU_C68K

View file

@ -24,7 +24,7 @@ unsigned char formatted_bram[4*0x10] =
// 256K | unused | bank1 |
#ifndef _ASM_MISC_C
void wram_2M_to_1M(unsigned char *m)
PICO_INTERNAL_ASM void wram_2M_to_1M(unsigned char *m)
{
unsigned short *m1M_b0, *m1M_b1;
unsigned int i, tmp, *m2M;
@ -41,7 +41,7 @@ void wram_2M_to_1M(unsigned char *m)
}
}
void wram_1M_to_2M(unsigned char *m)
PICO_INTERNAL_ASM void wram_1M_to_2M(unsigned char *m)
{
unsigned short *m1M_b0, *m1M_b1;
unsigned int i, tmp, *m2M;

View file

@ -2,7 +2,6 @@
#include "../PicoInt.h"
#include "../sound/sound.h"
extern unsigned char formatted_bram[4*0x10];
@ -32,7 +31,7 @@ int (*PicoMCDcloseTray)(void) = NULL;
}
int PicoInitMCD(void)
PICO_INTERNAL int PicoInitMCD(void)
{
SekInitS68k();
Init_CD_Driver();
@ -41,7 +40,7 @@ int PicoInitMCD(void)
}
void PicoExitMCD(void)
PICO_INTERNAL void PicoExitMCD(void)
{
End_CD_Driver();
@ -49,7 +48,7 @@ void PicoExitMCD(void)
//dump_ram(Pico.ram, "ram.bin");
}
int PicoResetMCD(int hard)
PICO_INTERNAL int PicoResetMCD(int hard)
{
if (hard) {
int fmt_size = sizeof(formatted_bram);
@ -84,7 +83,7 @@ int PicoResetMCD(int hard)
return 0;
}
static __inline void SekRun(int cyc)
static __inline void SekRunM68k(int cyc)
{
int cyc_do;
SekCycleAim+=cyc;
@ -291,7 +290,7 @@ static int PicoFrameHintsMCD(void)
{
//dprintf("vint: @ %06x [%i|%i]", SekPc, y, SekCycleCnt);
pv->status|=0x88; // V-Int happened, go into vblank
SekRun(128); SekCycleAim-=128; // there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula)
SekRunM68k(128); SekCycleAim-=128; // there must be a gap between H and V ints, also after vblank bit set (Mazin Saga, Bram Stoker's Dracula)
/*if(Pico.m.z80Run && (PicoOpt&4)) {
z80CycleAim+=cycles_z80/2;
total_z80+=z80_run(z80CycleAim-total_z80);
@ -329,7 +328,7 @@ static int PicoFrameHintsMCD(void)
if ((PicoOpt & 0x2000) && (Pico_mcd->m.busreq&3) == 1) {
SekRunPS(cycles_68k, cycles_s68k); // "better/perfect sync"
} else {
SekRun(cycles_68k);
SekRunM68k(cycles_68k);
if ((Pico_mcd->m.busreq&3) == 1) // no busreq/no reset
SekRunS68k(cycles_s68k);
}
@ -358,7 +357,7 @@ static int PicoFrameHintsMCD(void)
}
int PicoFrameMCD(void)
PICO_INTERNAL int PicoFrameMCD(void)
{
if(!(PicoOpt&0x10))
PicoFrameStart();

View file

@ -49,12 +49,12 @@ static int SekIntAckS68k(int level)
return CYCLONE_INT_ACK_AUTOVECTOR;
}
static void SekResetAck()
static void SekResetAckS68k(void)
{
dprintf("s68k: Reset encountered @ %06x", SekPcS68k);
}
static int SekUnrecognizedOpcode()
static int SekUnrecognizedOpcodeS68k(void)
{
unsigned int pc, op;
pc = SekPcS68k;
@ -67,14 +67,14 @@ static int SekUnrecognizedOpcode()
int SekInitS68k()
PICO_INTERNAL int SekInitS68k()
{
#ifdef EMU_C68K
// CycloneInit();
memset(&PicoCpuS68k,0,sizeof(PicoCpuS68k));
PicoCpuS68k.IrqCallback=SekIntAckS68k;
PicoCpuS68k.ResetCallback=SekResetAck;
PicoCpuS68k.UnrecognizedCallback=SekUnrecognizedOpcode;
PicoCpuS68k.ResetCallback=SekResetAckS68k;
PicoCpuS68k.UnrecognizedCallback=SekUnrecognizedOpcodeS68k;
#endif
#ifdef EMU_M68K
{
@ -93,7 +93,7 @@ int SekInitS68k()
}
// Reset the 68000:
int SekResetS68k()
PICO_INTERNAL int SekResetS68k()
{
if (Pico.rom==NULL) return 1;
@ -122,7 +122,7 @@ int SekResetS68k()
return 0;
}
int SekInterruptS68k(int irq)
PICO_INTERNAL int SekInterruptS68k(int irq)
{
int irqs, real_irq = 1;
Pico_mcd->m.s68k_pend_ints |= 1 << irq;

View file

@ -50,7 +50,7 @@ void PicoCDBufferFree(void)
/* this is a try to fight slow SD access of GP2X */
void PicoCDBufferRead(void *dest, int lba)
PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba)
{
int is_bin, offs, read_len, moved = 0;
reads++;

View file

@ -8,22 +8,16 @@
***********************************************************/
#include <sys/stat.h>
#include "cd_file.h"
#include "../PicoInt.h"
#include "cd_file.h"
#define cdprintf dprintf
//#define cdprintf(x...)
#define DEBUG_CD
void FILE_End(void)
{
Unload_ISO();
}
int Load_ISO(const char *iso_name, int is_bin)
PICO_INTERNAL int Load_ISO(const char *iso_name, int is_bin)
{
int i, j, num_track, Cur_LBA, index, ret, iso_name_len;
_scd_track *Tracks = Pico_mcd->TOC.Tracks;
@ -134,7 +128,7 @@ int Load_ISO(const char *iso_name, int is_bin)
}
void Unload_ISO(void)
PICO_INTERNAL void Unload_ISO(void)
{
int i;
@ -150,10 +144,7 @@ void Unload_ISO(void)
}
void PicoCDBufferRead(void *dest, int lba);
int FILE_Read_One_LBA_CDC(void)
PICO_INTERNAL int FILE_Read_One_LBA_CDC(void)
{
// static char cp_buf[2560];
@ -281,7 +272,7 @@ int FILE_Read_One_LBA_CDC(void)
}
int FILE_Play_CD_LBA(void)
PICO_INTERNAL int FILE_Play_CD_LBA(void)
{
int index = Pico_mcd->scd.Cur_Track - 1;
Pico_mcd->m.audio_track = index;

View file

@ -12,11 +12,10 @@ extern "C" {
void FILE_End(void);
int Load_ISO(const char *iso_name, int is_bin);
void Unload_ISO(void);
int FILE_Read_One_LBA_CDC(void);
int FILE_Play_CD_LBA(void);
PICO_INTERNAL int Load_ISO(const char *iso_name, int is_bin);
PICO_INTERNAL void Unload_ISO(void);
PICO_INTERNAL int FILE_Read_One_LBA_CDC(void);
PICO_INTERNAL int FILE_Play_CD_LBA(void);
#ifdef __cplusplus

View file

@ -8,10 +8,10 @@
***********************************************************/
#include <stdio.h>
#include "cd_sys.h"
#include "cd_file.h"
#include "../PicoInt.h"
#include "cd_sys.h"
#include "cd_file.h"
#define cdprintf dprintf
//#define cdprintf(x...)
@ -68,7 +68,7 @@ static int MSF_to_LBA(_msf *MSF)
}
void LBA_to_MSF(int lba, _msf *MSF)
PICO_INTERNAL void LBA_to_MSF(int lba, _msf *MSF)
{
if (lba < -150) lba = 0;
else lba += 150;
@ -122,7 +122,7 @@ static void Track_to_MSF(int track, _msf *MSF)
}
int Track_to_LBA(int track)
PICO_INTERNAL int Track_to_LBA(int track)
{
_msf MSF;
@ -131,7 +131,7 @@ int Track_to_LBA(int track)
}
void Check_CD_Command(void)
PICO_INTERNAL void Check_CD_Command(void)
{
cdprintf("CHECK CD COMMAND");
@ -175,19 +175,19 @@ void Check_CD_Command(void)
}
int Init_CD_Driver(void)
PICO_INTERNAL int Init_CD_Driver(void)
{
return 0;
}
void End_CD_Driver(void)
PICO_INTERNAL void End_CD_Driver(void)
{
FILE_End();
Unload_ISO();
}
void Reset_CD(void)
PICO_INTERNAL void Reset_CD(void)
{
Pico_mcd->scd.Cur_Track = 0;
Pico_mcd->scd.Cur_LBA = -150;
@ -202,9 +202,6 @@ 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);
CD_Present = 0;
Pico_mcd->scd.Status_CDD = NOCD;
@ -228,14 +225,15 @@ void Stop_CD(void)
}
void Change_CD(void)
/*
PICO_INTERNAL void Change_CD(void)
{
if (Pico_mcd->scd.Status_CDD == TRAY_OPEN) Close_Tray_CDD_cC();
else Open_Tray_CDD_cD();
}
*/
int Get_Status_CDD_c0(void)
PICO_INTERNAL int Get_Status_CDD_c0(void)
{
cdprintf("Status command : Cur LBA = %d", Pico_mcd->scd.Cur_LBA);
@ -253,7 +251,7 @@ int Get_Status_CDD_c0(void)
}
int Stop_CDD_c1(void)
PICO_INTERNAL int Stop_CDD_c1(void)
{
CHECK_TRAY_OPEN
@ -276,7 +274,7 @@ int Stop_CDD_c1(void)
}
int Get_Pos_CDD_c20(void)
PICO_INTERNAL int Get_Pos_CDD_c20(void)
{
_msf MSF;
@ -308,7 +306,7 @@ int Get_Pos_CDD_c20(void)
}
int Get_Track_Pos_CDD_c21(void)
PICO_INTERNAL int Get_Track_Pos_CDD_c21(void)
{
int elapsed_time;
_msf MSF;
@ -342,7 +340,7 @@ int Get_Track_Pos_CDD_c21(void)
}
int Get_Current_Track_CDD_c22(void)
PICO_INTERNAL int Get_Current_Track_CDD_c22(void)
{
cdprintf("Status CDD = %.4X Status = %.4X", Pico_mcd->scd.Status_CDD, Pico_mcd->cdd.Status);
@ -371,7 +369,7 @@ int Get_Current_Track_CDD_c22(void)
}
int Get_Total_Lenght_CDD_c23(void)
PICO_INTERNAL int Get_Total_Lenght_CDD_c23(void)
{
CHECK_TRAY_OPEN
@ -395,7 +393,7 @@ int Get_Total_Lenght_CDD_c23(void)
}
int Get_First_Last_Track_CDD_c24(void)
PICO_INTERNAL int Get_First_Last_Track_CDD_c24(void)
{
CHECK_TRAY_OPEN
@ -418,7 +416,7 @@ int Get_First_Last_Track_CDD_c24(void)
}
int Get_Track_Adr_CDD_c25(void)
PICO_INTERNAL int Get_Track_Adr_CDD_c25(void)
{
int track_number;
@ -452,7 +450,7 @@ int Get_Track_Adr_CDD_c25(void)
}
int Play_CDD_c3(void)
PICO_INTERNAL int Play_CDD_c3(void)
{
_msf MSF;
int delay, new_lba;
@ -510,7 +508,7 @@ int Play_CDD_c3(void)
}
int Seek_CDD_c4(void)
PICO_INTERNAL int Seek_CDD_c4(void)
{
_msf MSF;
@ -548,7 +546,7 @@ int Seek_CDD_c4(void)
}
int Pause_CDD_c6(void)
PICO_INTERNAL int Pause_CDD_c6(void)
{
CHECK_TRAY_OPEN
CHECK_CD_PRESENT
@ -571,7 +569,7 @@ int Pause_CDD_c6(void)
}
int Resume_CDD_c7(void)
PICO_INTERNAL int Resume_CDD_c7(void)
{
CHECK_TRAY_OPEN
CHECK_CD_PRESENT
@ -613,7 +611,7 @@ int Resume_CDD_c7(void)
}
int Fast_Foward_CDD_c8(void)
PICO_INTERNAL int Fast_Foward_CDD_c8(void)
{
CHECK_TRAY_OPEN
CHECK_CD_PRESENT
@ -634,7 +632,7 @@ int Fast_Foward_CDD_c8(void)
}
int Fast_Rewind_CDD_c9(void)
PICO_INTERNAL int Fast_Rewind_CDD_c9(void)
{
CHECK_TRAY_OPEN
CHECK_CD_PRESENT
@ -655,7 +653,7 @@ int Fast_Rewind_CDD_c9(void)
}
int Close_Tray_CDD_cC(void)
PICO_INTERNAL int Close_Tray_CDD_cC(void)
{
CD_Present = 0;
//Clear_Sound_Buffer();
@ -681,7 +679,7 @@ int Close_Tray_CDD_cC(void)
}
int Open_Tray_CDD_cD(void)
PICO_INTERNAL int Open_Tray_CDD_cD(void)
{
CHECK_TRAY_OPEN
@ -709,7 +707,7 @@ int Open_Tray_CDD_cD(void)
}
int CDD_cA(void)
PICO_INTERNAL int CDD_cA(void)
{
CHECK_TRAY_OPEN
CHECK_CD_PRESENT
@ -730,7 +728,7 @@ int CDD_cA(void)
}
int CDD_Def(void)
PICO_INTERNAL int CDD_Def(void)
{
Pico_mcd->cdd.Status = Pico_mcd->scd.Status_CDD;

View file

@ -68,38 +68,38 @@ typedef struct {
} _scd;
void LBA_to_MSF(int lba, _msf *MSF);
int Track_to_LBA(int track);
PICO_INTERNAL void LBA_to_MSF(int lba, _msf *MSF);
PICO_INTERNAL int Track_to_LBA(int track);
// moved to Pico.h
// int Insert_CD(char *iso_name, int is_bin);
// void Stop_CD(void);
void Check_CD_Command(void);
PICO_INTERNAL void Check_CD_Command(void);
int Init_CD_Driver(void);
void End_CD_Driver(void);
int Insert_CD(char *iso_name, int is_bin);
void Stop_CD(void);
void Change_CD(void);
void Reset_CD(void);
PICO_INTERNAL int Init_CD_Driver(void);
PICO_INTERNAL void End_CD_Driver(void);
PICO_INTERNAL void Reset_CD(void);
int Get_Status_CDD_c0(void);
int Stop_CDD_c1(void);
int Get_Pos_CDD_c20(void);
int Get_Track_Pos_CDD_c21(void);
int Get_Current_Track_CDD_c22(void);
int Get_Total_Lenght_CDD_c23(void);
int Get_First_Last_Track_CDD_c24(void);
int Get_Track_Adr_CDD_c25(void);
int Play_CDD_c3(void);
int Seek_CDD_c4(void);
int Pause_CDD_c6(void);
int Resume_CDD_c7(void);
int Fast_Foward_CDD_c8(void);
int Fast_Rewind_CDD_c9(void);
int CDD_cA(void);
int Close_Tray_CDD_cC(void);
int Open_Tray_CDD_cD(void);
PICO_INTERNAL int Get_Status_CDD_c0(void);
PICO_INTERNAL int Stop_CDD_c1(void);
PICO_INTERNAL int Get_Pos_CDD_c20(void);
PICO_INTERNAL int Get_Track_Pos_CDD_c21(void);
PICO_INTERNAL int Get_Current_Track_CDD_c22(void);
PICO_INTERNAL int Get_Total_Lenght_CDD_c23(void);
PICO_INTERNAL int Get_First_Last_Track_CDD_c24(void);
PICO_INTERNAL int Get_Track_Adr_CDD_c25(void);
PICO_INTERNAL int Play_CDD_c3(void);
PICO_INTERNAL int Seek_CDD_c4(void);
PICO_INTERNAL int Pause_CDD_c6(void);
PICO_INTERNAL int Resume_CDD_c7(void);
PICO_INTERNAL int Fast_Foward_CDD_c8(void);
PICO_INTERNAL int Fast_Rewind_CDD_c9(void);
PICO_INTERNAL int CDD_cA(void);
PICO_INTERNAL int Close_Tray_CDD_cC(void);
PICO_INTERNAL int Open_Tray_CDD_cD(void);
int CDD_Def(void);
PICO_INTERNAL int CDD_Def(void);
#ifdef __cplusplus

View file

@ -7,7 +7,7 @@
#include "../PicoInt.h"
#define rot_comp Pico_mcd->rot_comp
#define _rot_comp Pico_mcd->rot_comp
static const int Table_Rot_Time[] =
{
@ -37,35 +37,35 @@ static void gfx_cd_start(void)
{
int upd_len;
// rot_comp.XD_Mul = ((rot_comp.Reg_5C & 0x1f) + 1) * 4; // unused
rot_comp.Function = (rot_comp.Reg_58 & 7) | (Pico_mcd->s68k_regs[3] & 0x18); // Jmp_Adr
// rot_comp.Buffer_Adr = (rot_comp.Reg_5E & 0xfff8) << 2; // unused?
rot_comp.YD = (rot_comp.Reg_60 >> 3) & 7;
rot_comp.Vector_Adr = (rot_comp.Reg_66 & 0xfffe) << 2;
// _rot_comp.XD_Mul = ((_rot_comp.Reg_5C & 0x1f) + 1) * 4; // unused
_rot_comp.Function = (_rot_comp.Reg_58 & 7) | (Pico_mcd->s68k_regs[3] & 0x18); // Jmp_Adr
// _rot_comp.Buffer_Adr = (_rot_comp.Reg_5E & 0xfff8) << 2; // unused?
_rot_comp.YD = (_rot_comp.Reg_60 >> 3) & 7;
_rot_comp.Vector_Adr = (_rot_comp.Reg_66 & 0xfffe) << 2;
upd_len = (rot_comp.Reg_62 >> 3) & 0x3f;
upd_len = (_rot_comp.Reg_62 >> 3) & 0x3f;
upd_len = Table_Rot_Time[upd_len];
rot_comp.Draw_Speed = rot_comp.Float_Part = upd_len;
_rot_comp.Draw_Speed = _rot_comp.Float_Part = upd_len;
rot_comp.Reg_58 |= 0x8000; // Stamp_Size, we start a new GFX operation
_rot_comp.Reg_58 |= 0x8000; // Stamp_Size, we start a new GFX operation
switch (rot_comp.Reg_58 & 6) // Scr_16?
switch (_rot_comp.Reg_58 & 6) // Scr_16?
{
case 0: // ?
rot_comp.Stamp_Map_Adr = (rot_comp.Reg_5A & 0xff80) << 2;
_rot_comp.Stamp_Map_Adr = (_rot_comp.Reg_5A & 0xff80) << 2;
break;
case 2: // .Dot_32
rot_comp.Stamp_Map_Adr = (rot_comp.Reg_5A & 0xffe0) << 2;
_rot_comp.Stamp_Map_Adr = (_rot_comp.Reg_5A & 0xffe0) << 2;
break;
case 4: // .Scr_16
rot_comp.Stamp_Map_Adr = 0x20000;
_rot_comp.Stamp_Map_Adr = 0x20000;
break;
case 6: // .Scr_16_Dot_32
rot_comp.Stamp_Map_Adr = (rot_comp.Reg_5A & 0xe000) << 2;
_rot_comp.Stamp_Map_Adr = (_rot_comp.Reg_5A & 0xe000) << 2;
break;
}
dprintf("gfx_cd_start, stamp_map_addr=%06x", rot_comp.Stamp_Map_Adr);
dprintf("gfx_cd_start, stamp_map_addr=%06x", _rot_comp.Stamp_Map_Adr);
gfx_cd_update();
}
@ -73,8 +73,8 @@ static void gfx_cd_start(void)
static void gfx_completed(void)
{
rot_comp.Reg_58 &= 0x7fff; // Stamp_Size
rot_comp.Reg_64 = 0;
_rot_comp.Reg_58 &= 0x7fff; // Stamp_Size
_rot_comp.Reg_64 = 0;
if (Pico_mcd->s68k_regs[0x33] & (1<<1))
{
dprintf("gfx_cd irq 1");
@ -89,14 +89,14 @@ static void gfx_do(unsigned int func, unsigned short *stamp_base, unsigned int H
unsigned int XD, Buffer_Adr;
int DYXS;
XD = rot_comp.Reg_60 & 7;
Buffer_Adr = ((rot_comp.Reg_5E & 0xfff8) + rot_comp.YD) << 2;
ecx = *(unsigned int *)(Pico_mcd->word_ram2M + rot_comp.Vector_Adr);
XD = _rot_comp.Reg_60 & 7;
Buffer_Adr = ((_rot_comp.Reg_5E & 0xfff8) + _rot_comp.YD) << 2;
ecx = *(unsigned int *)(Pico_mcd->word_ram2M + _rot_comp.Vector_Adr);
edx = ecx >> 16;
ecx = (ecx & 0xffff) << 8;
edx <<= 8;
DYXS = *(int *)(Pico_mcd->word_ram2M + rot_comp.Vector_Adr + 4);
rot_comp.Vector_Adr += 8;
DYXS = *(int *)(Pico_mcd->word_ram2M + _rot_comp.Vector_Adr + 4);
_rot_comp.Vector_Adr += 8;
// MAKE_IMAGE_LINE
while (H_Dot)
@ -269,12 +269,12 @@ Pixel_Out:
Next_Pixel:
ecx += (DYXS << 16) >> 16; // rot_comp.DXS;
edx += DYXS >> 16; // rot_comp.DYS;
ecx += (DYXS << 16) >> 16; // _rot_comp.DXS;
edx += DYXS >> 16; // _rot_comp.DYS;
XD++;
if (XD >= 8)
{
Buffer_Adr += ((rot_comp.Reg_5C & 0x1f) + 1) << 5;
Buffer_Adr += ((_rot_comp.Reg_5C & 0x1f) + 1) << 5;
XD = 0;
}
H_Dot--;
@ -283,17 +283,17 @@ Next_Pixel:
// nothing_to_draw:
rot_comp.YD++;
// rot_comp.V_Dot--; // will be done by caller
_rot_comp.YD++;
// _rot_comp.V_Dot--; // will be done by caller
}
void gfx_cd_update(void)
PICO_INTERNAL void gfx_cd_update(void)
{
int V_Dot = rot_comp.Reg_64 & 0xff;
int V_Dot = _rot_comp.Reg_64 & 0xff;
int jobs;
dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
dprintf("gfx_cd_update, Reg_64 = %04x", _rot_comp.Reg_64);
if (!V_Dot)
{
@ -301,22 +301,22 @@ void gfx_cd_update(void)
return;
}
jobs = rot_comp.Float_Part >> 16;
jobs = _rot_comp.Float_Part >> 16;
if (!jobs)
{
rot_comp.Float_Part += rot_comp.Draw_Speed;
_rot_comp.Float_Part += _rot_comp.Draw_Speed;
return;
}
rot_comp.Float_Part &= 0xffff;
rot_comp.Float_Part += rot_comp.Draw_Speed;
_rot_comp.Float_Part &= 0xffff;
_rot_comp.Float_Part += _rot_comp.Draw_Speed;
if (PicoOpt & 0x1000) // scale/rot enabled
{
unsigned int func = rot_comp.Function;
unsigned int H_Dot = rot_comp.Reg_62 & 0x1ff;
unsigned short *stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr);
unsigned int func = _rot_comp.Function;
unsigned int H_Dot = _rot_comp.Reg_62 & 0x1ff;
unsigned short *stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + _rot_comp.Stamp_Map_Adr);
while (jobs--)
{
@ -341,22 +341,22 @@ void gfx_cd_update(void)
V_Dot -= jobs;
}
rot_comp.Reg_64 = V_Dot;
_rot_comp.Reg_64 = V_Dot;
}
unsigned int gfx_cd_read(unsigned int a)
PICO_INTERNAL_ASM unsigned int gfx_cd_read(unsigned int a)
{
unsigned int d = 0;
switch (a) {
case 0x58: d = rot_comp.Reg_58; break;
case 0x5A: d = rot_comp.Reg_5A; break;
case 0x5C: d = rot_comp.Reg_5C; break;
case 0x5E: d = rot_comp.Reg_5E; break;
case 0x60: d = rot_comp.Reg_60; break;
case 0x62: d = rot_comp.Reg_62; break;
case 0x64: d = rot_comp.Reg_64; break;
case 0x58: d = _rot_comp.Reg_58; break;
case 0x5A: d = _rot_comp.Reg_5A; break;
case 0x5C: d = _rot_comp.Reg_5C; break;
case 0x5E: d = _rot_comp.Reg_5E; break;
case 0x60: d = _rot_comp.Reg_60; break;
case 0x62: d = _rot_comp.Reg_62; break;
case 0x64: d = _rot_comp.Reg_64; break;
case 0x66: break;
default: dprintf("gfx_cd_read FIXME: unexpected address: %02x", a); break;
}
@ -366,41 +366,41 @@ unsigned int gfx_cd_read(unsigned int a)
return d;
}
void gfx_cd_write16(unsigned int a, unsigned int d)
PICO_INTERNAL_ASM void gfx_cd_write16(unsigned int a, unsigned int d)
{
dprintf("gfx_cd_write16(%x, %04x)", a, d);
switch (a) {
case 0x58: // .Reg_Stamp_Size
rot_comp.Reg_58 = d & 7;
_rot_comp.Reg_58 = d & 7;
return;
case 0x5A: // .Reg_Stamp_Adr
rot_comp.Reg_5A = d & 0xffe0;
_rot_comp.Reg_5A = d & 0xffe0;
return;
case 0x5C: // .Reg_IM_VCell_Size
rot_comp.Reg_5C = d & 0x1f;
_rot_comp.Reg_5C = d & 0x1f;
return;
case 0x5E: // .Reg_IM_Adr
rot_comp.Reg_5E = d & 0xFFF8;
_rot_comp.Reg_5E = d & 0xFFF8;
return;
case 0x60: // .Reg_IM_Offset
rot_comp.Reg_60 = d & 0x3f;
_rot_comp.Reg_60 = d & 0x3f;
return;
case 0x62: // .Reg_IM_HDot_Size
rot_comp.Reg_62 = d & 0x1ff;
_rot_comp.Reg_62 = d & 0x1ff;
return;
case 0x64: // .Reg_IM_VDot_Size
rot_comp.Reg_64 = d & 0xff; // V_Dot, must be 32bit?
_rot_comp.Reg_64 = d & 0xff; // V_Dot, must be 32bit?
return;
case 0x66: // .Reg_Vector_Adr
rot_comp.Reg_66 = d & 0xfffe;
_rot_comp.Reg_66 = d & 0xfffe;
if (Pico_mcd->s68k_regs[3]&4) return; // can't do tanformations in 1M mode
gfx_cd_start();
return;
@ -410,9 +410,9 @@ void gfx_cd_write16(unsigned int a, unsigned int d)
}
void gfx_cd_reset(void)
PICO_INTERNAL void gfx_cd_reset(void)
{
memset(&rot_comp.Reg_58, 0, sizeof(rot_comp));
memset(&_rot_comp.Reg_58, 0, sizeof(_rot_comp));
}
@ -420,10 +420,12 @@ void gfx_cd_reset(void)
#include "cell_map.c"
#ifndef UTYPES_DEFINED
typedef unsigned short u16;
#endif
// check: Heart of the alien, jaguar xj 220
void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc)
PICO_INTERNAL void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc)
{
unsigned char *base;
unsigned int asrc, a2;

View file

@ -24,14 +24,14 @@ typedef struct
} Rot_Comp;
void gfx_cd_update(void);
PICO_INTERNAL void gfx_cd_update(void);
unsigned int gfx_cd_read(unsigned int a);
void gfx_cd_write16(unsigned int a, unsigned int d);
PICO_INTERNAL_ASM unsigned int gfx_cd_read(unsigned int a);
PICO_INTERNAL_ASM void gfx_cd_write16(unsigned int a, unsigned int d);
void gfx_cd_reset(void);
PICO_INTERNAL void gfx_cd_reset(void);
void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc);
PICO_INTERNAL void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc);
#endif // _GFX_CD_H

View file

@ -7,7 +7,7 @@
static unsigned int g_rate = 0; // 18.14 fixed point
void pcm_write(unsigned int a, unsigned int d)
PICO_INTERNAL_ASM void pcm_write(unsigned int a, unsigned int d)
{
//printf("pcm_write(%i, %02x)\n", a, d);
@ -50,7 +50,7 @@ void pcm_write(unsigned int a, unsigned int d)
}
void pcm_set_rate(int rate)
PICO_INTERNAL void pcm_set_rate(int rate)
{
float step = 31.8 * 1024.0 / (float) rate; // max <4 @ 8000Hz
step *= 256*256/4;
@ -60,9 +60,7 @@ void pcm_set_rate(int rate)
}
// TODO: make use of the fact that max_length == 3
void pcm_update(int *buffer, int length, int stereo)
PICO_INTERNAL void pcm_update(int *buffer, int length, int stereo)
{
struct pcm_chan *ch;
unsigned int step, addr;

View file

@ -1,7 +1,7 @@
#define PCM_STEP_SHIFT 11
void pcm_write(unsigned int a, unsigned int d);
void pcm_set_rate(int rate);
void pcm_update(int *buffer, int length, int stereo);
PICO_INTERNAL_ASM void pcm_write(unsigned int a, unsigned int d);
PICO_INTERNAL void pcm_set_rate(int rate);
PICO_INTERNAL void pcm_update(int *buffer, int length, int stereo);