src/mess/drivers/fmtowns.c
| r7788 | r7789 | |
| 1207 | 1207 | track = cdrom_get_track(mess_cd_get_cdrom_file(device),towns_cd.lba_current); |
| 1208 | 1208 | if(track < 2) |
| 1209 | 1209 | { // recalculate LBA |
| 1210 | | if((towns_cd.parameter[6] & 0x0f) < 2) |
| 1211 | | { |
| 1212 | | lba1 = 0; |
| 1213 | | if((towns_cd.parameter[6] & 0xf0) == 0x00) |
| 1214 | | { |
| 1215 | | lba1 |= (((towns_cd.parameter[6] + 8) & 0x0f) << 8); |
| 1216 | | lba1 |= (((towns_cd.parameter[6] + 0x80) & 0xf0) << 8); |
| 1217 | | lba1 |= ((towns_cd.parameter[7] - 1) << 16); |
| 1218 | | } |
| 1219 | | else |
| 1220 | | { |
| 1221 | | lba1 |= (((towns_cd.parameter[6] + 8) & 0x0f) << 8); |
| 1222 | | lba1 |= (((towns_cd.parameter[6] - 0x10) & 0xf0) << 8); |
| 1223 | | lba1 |= ((towns_cd.parameter[7]) << 16); |
| 1224 | | } |
| 1225 | | } |
| 1226 | | else |
| 1227 | | { |
| 1228 | | lba1 = (towns_cd.parameter[7] << 16); |
| 1229 | | lba1 |= ((towns_cd.parameter[6] - 2) << 8); |
| 1230 | | } |
| 1231 | | lba1 |= towns_cd.parameter[5]; |
| 1232 | | if((towns_cd.parameter[3] & 0x0f) < 2) |
| 1233 | | { |
| 1234 | | lba2 = 0; |
| 1235 | | if((towns_cd.parameter[3] & 0xf0) == 0x00) |
| 1236 | | { |
| 1237 | | lba2 |= (((towns_cd.parameter[3] + 8) & 0x0f) << 8); |
| 1238 | | lba2 |= (((towns_cd.parameter[3] + 0x80) & 0xf0) << 8); |
| 1239 | | lba2 |= ((towns_cd.parameter[4] - 1) << 16); |
| 1240 | | } |
| 1241 | | else |
| 1242 | | { |
| 1243 | | lba2 |= (((towns_cd.parameter[3] + 8) & 0x0f) << 8); |
| 1244 | | lba2 |= (((towns_cd.parameter[3] - 0x10) & 0xf0) << 8); |
| 1245 | | lba2 |= ((towns_cd.parameter[4]) << 16); |
| 1246 | | } |
| 1247 | | } |
| 1248 | | else |
| 1249 | | { |
| 1250 | | lba2 = (towns_cd.parameter[4] << 16); |
| 1251 | | lba2 |= ((towns_cd.parameter[3] - 2) << 8); |
| 1252 | | } |
| 1253 | | lba2 |= towns_cd.parameter[2]; |
| 1254 | | towns_cd.lba_current = msf_to_lba(lba1); |
| 1255 | | towns_cd.lba_last = msf_to_lba(lba2); |
| 1210 | towns_cd.lba_current -= 150; |
| 1211 | towns_cd.lba_last -= 150; |
| 1256 | 1212 | } |
| 1257 | 1213 | |
| 1258 | 1214 | logerror("CD: Mode 1 read from LBA next:%i last:%i track:%i\n",towns_cd.lba_current,towns_cd.lba_last,track); |
| r7788 | r7789 | |
| 1313 | 1269 | } |
| 1314 | 1270 | else |
| 1315 | 1271 | { |
| 1272 | towns_cd.status &= ~0x02; |
| 1316 | 1273 | switch(towns_cd.command & 0x9f) |
| 1317 | 1274 | { |
| 1318 | 1275 | case 0x00: // Seek |
| r7788 | r7789 | |
| 1323 | 1280 | } |
| 1324 | 1281 | logerror("CD: Command 0x00: SEEK\n"); |
| 1325 | 1282 | break; |
| 1283 | case 0x01: // unknown |
| 1284 | if(towns_cd.command & 0x20) |
| 1285 | { |
| 1286 | towns_cd.extra_status = 0; |
| 1287 | towns_cd_set_status(device->machine,0x00,0x00,0x00,0x00); |
| 1288 | } |
| 1289 | logerror("CD: Command 0x01: unknown\n"); |
| 1290 | break; |
| 1326 | 1291 | case 0x02: // Read (MODE1) |
| 1327 | 1292 | logerror("CD: Command 0x02: READ MODE1\n"); |
| 1328 | 1293 | towns_cdrom_read(device); |
| r7788 | r7789 | |
| 1342 | 1307 | towns_cd_set_status(device->machine,0x00,0x00,0x00,0x00); |
| 1343 | 1308 | break; |
| 1344 | 1309 | case 0x80: // set state |
| 1310 | logerror("CD: Command 0x80: set state\n"); |
| 1345 | 1311 | if(towns_cd.command & 0x20) |
| 1346 | 1312 | { |
| 1347 | 1313 | towns_cd.extra_status = 0; |
| r7788 | r7789 | |
| 1356 | 1322 | towns_cd_set_status(device->machine,0x00,0x01,0x00,0x00); |
| 1357 | 1323 | |
| 1358 | 1324 | } |
| 1359 | | logerror("CD: Command 0x80: set state\n"); |
| 1360 | 1325 | break; |
| 1361 | 1326 | case 0x81: // set state (CDDASET) |
| 1362 | 1327 | if(towns_cd.command & 0x20) |