5 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
6 // Cleanups by James L. Hammons
13 static uint8 cdrom_ram[0x100];
14 static uint16 cdrom_cmd = 0;
21 void cdrom_reset(void)
23 memset(cdrom_ram, 0x00, 0x100);
31 void cdrom_byte_write(uint32 offset, uint8 data)
34 cdrom_ram[offset] = data;
37 fprintf(log_get(),"cdrom: writing byte 0x%.2x at 0x%.8x\n",data,offset);
41 void cdrom_word_write(uint32 offset, uint16 data)
44 cdrom_ram[offset+0] = (data >> 8) & 0xFF;
45 cdrom_ram[offset+1] = data & 0xFF;
52 if ((data&0xff00)==0x1500)
54 fprintf(log_get(),"cdrom: setting mode 0x%.2x\n",data&0xff);
59 uint32 offset=cdrom_ram[0x00];
61 offset|=cdrom_ram[0x01];
63 offset|=cdrom_ram[0x02];
65 offset|=cdrom_ram[0x03];
67 uint32 size=cdrom_ram[0x04];
69 offset|=cdrom_ram[0x05];
71 fprintf(log_get(),"cdrom: READ(0x%.8x, 0x%.4x) [68k pc=0x%.8x]\n",offset,size,s68000readPC());
75 fprintf(log_get(),"cdrom: unknown command 0x%.4x\n",data);
79 fprintf(log_get(),"cdrom: writing word 0x%.4x at 0x%.8x\n",data,offset);
83 uint8 cdrom_byte_read(uint32 offset)
86 fprintf(log_get(),"cdrom: reading byte from 0x%.8x\n",offset);
88 return cdrom_ram[offset & 0xFF];
91 uint16 cdrom_word_read(uint32 offset)
99 else if (offset == 0x02)
101 else if (offset == 0x0A)
103 if (cdrom_cmd == 0x7001)
109 data = (cdrom_ram[offset+0] << 8) | cdrom_ram[offset+1];
112 fprintf(log_get(),"cdrom: reading word 0x%.4x from 0x%.8x [68k pc=0x%.8x]\n",data,offset,s68000readPC());