1 #include "include/cdrom.h"
5 static uint8 cdrom_ram[0x100];
6 static uint16 cdrom_cmd=0;
8 //////////////////////////////////////////////////////////////////////////////
10 //////////////////////////////////////////////////////////////////////////////
17 //////////////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////////
30 //////////////////////////////////////////////////////////////////////////////
31 void cdrom_reset(void)
33 memset(cdrom_ram,0x00,0x100);
37 //////////////////////////////////////////////////////////////////////////////
39 //////////////////////////////////////////////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////////
50 //////////////////////////////////////////////////////////////////////////////
52 //////////////////////////////////////////////////////////////////////////////
59 //////////////////////////////////////////////////////////////////////////////
60 void cdrom_byte_write(uint32 offset, uint8 data)
63 cdrom_ram[offset]=data;
66 fprintf(log_get(),"cdrom: writing byte 0x%.2x at 0x%.8x\n",data,offset);
69 //////////////////////////////////////////////////////////////////////////////
71 //////////////////////////////////////////////////////////////////////////////
78 //////////////////////////////////////////////////////////////////////////////
79 void cdrom_word_write(uint32 offset, uint16 data)
82 cdrom_ram[offset+0]=(data>>8)&0xff;
83 cdrom_ram[offset+1]=data&0xff;
90 if ((data&0xff00)==0x1500)
92 fprintf(log_get(),"cdrom: setting mode 0x%.2x\n",data&0xff);
97 uint32 offset=cdrom_ram[0x00];
99 offset|=cdrom_ram[0x01];
101 offset|=cdrom_ram[0x02];
103 offset|=cdrom_ram[0x03];
105 uint32 size=cdrom_ram[0x04];
107 offset|=cdrom_ram[0x05];
109 fprintf(log_get(),"cdrom: READ(0x%.8x, 0x%.4x) [68k pc=0x%.8x]\n",offset,size,s68000readPC());
113 fprintf(log_get(),"cdrom: unknown command 0x%.4x\n",data);
117 fprintf(log_get(),"cdrom: writing word 0x%.4x at 0x%.8x\n",data,offset);
120 //////////////////////////////////////////////////////////////////////////////
122 //////////////////////////////////////////////////////////////////////////////
129 //////////////////////////////////////////////////////////////////////////////
130 uint8 cdrom_byte_read(uint32 offset)
134 fprintf(log_get(),"cdrom: reading byte from 0x%.8x\n",offset);
136 return(cdrom_ram[offset]);
138 //////////////////////////////////////////////////////////////////////////////
140 //////////////////////////////////////////////////////////////////////////////
147 //////////////////////////////////////////////////////////////////////////////
148 uint16 cdrom_word_read(uint32 offset)
162 if (cdrom_cmd==0x7001)
169 data=cdrom_ram[offset+0];
171 data|=cdrom_ram[offset+1];
174 fprintf(log_get(),"cdrom: reading word 0x%.4x from 0x%.8x [68k pc=0x%.8x]\n",data,offset,s68000readPC());