trunk/src/emu/machine/stvcd.c
| r21103 | r21104 | |
| 1039 | 1039 | case 0x64: // put sector data |
| 1040 | 1040 | /* TODO: After Burner 2, Out Run, Fantasy Zone and Dungeon Master Nexus trips this */ |
| 1041 | 1041 | { |
| 1042 | | UINT8 sectnum = cr4 & 0xff; |
| 1043 | | UINT8 bufnum = cr3>>8; |
| 1042 | UINT32 sectnum = cr4 & 0xff; |
| 1043 | UINT32 sectofs = cr2; |
| 1044 | UINT32 bufnum = cr3>>8; |
| 1044 | 1045 | |
| 1045 | 1046 | xfertype32 = XFERTYPE32_PUTSECTOR; |
| 1046 | 1047 | |
| 1048 | /*TODO: eventual errors? */ |
| 1049 | |
| 1050 | cd_getsectoroffsetnum(bufnum, §ofs, §num); |
| 1051 | |
| 1052 | |
| 1047 | 1053 | cd_stat |= CD_STAT_TRANS; |
| 1048 | 1054 | |
| 1049 | 1055 | xferoffs = 0; |
| 1050 | 1056 | xfersect = 0; |
| 1051 | 1057 | xferdnum = 0; |
| 1052 | | xfersectpos = 0; |
| 1058 | xfersectpos = sectofs; |
| 1053 | 1059 | xfersectnum = sectnum; |
| 1054 | 1060 | transpart = &partitions[bufnum]; |
| 1061 | |
| 1062 | // allocate the blocks |
| 1063 | for (int i = xfersectpos; i < xfersectpos+xfersectnum; i++) |
| 1064 | { |
| 1065 | transpart->blocks[i] = cd_alloc_block(&transpart->bnum[i]); |
| 1066 | transpart->size += transpart->blocks[i]->size; |
| 1067 | transpart->numblks++; |
| 1068 | } |
| 1055 | 1069 | } |
| 1056 | 1070 | |
| 1057 | | hirqreg |= (CMOK|ECPY|DRDY); |
| 1071 | hirqreg |= (CMOK|ECPY|DRDY); // TODO: is ECPY ok? |
| 1058 | 1072 | cr_standard_return(cd_stat); |
| 1059 | 1073 | break; |
| 1060 | 1074 | |
| r21103 | r21104 | |
| 1700 | 1714 | } |
| 1701 | 1715 | } |
| 1702 | 1716 | |
| 1717 | void saturn_state::cd_writeLong(UINT32 addr, UINT32 data) |
| 1718 | { |
| 1719 | switch (addr & 0xffff) |
| 1720 | { |
| 1721 | case 0x8000: |
| 1722 | switch (xfertype32) |
| 1723 | { |
| 1724 | case XFERTYPE32_PUTSECTOR: |
| 1725 | // make sure we have sectors left |
| 1726 | if (xfersect < xfersectnum) |
| 1727 | { |
| 1728 | // get next longword |
| 1729 | transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 0] = (data >> 24) & 0xff; |
| 1730 | transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 1] = (data >> 16) & 0xff; |
| 1731 | transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 2] = (data >> 8) & 0xff; |
| 1732 | transpart->blocks[xfersectpos+xfersect]->data[xferoffs + 3] = (data >> 0) & 0xff; |
| 1733 | |
| 1734 | xferdnum += 4; |
| 1735 | xferoffs += 4; |
| 1736 | |
| 1737 | // did we run out of sector? |
| 1738 | if (xferoffs >= transpart->blocks[xfersectpos+xfersect]->size) |
| 1739 | { |
| 1740 | CDROM_LOG(("CD: finished xfer of block %d of %d\n", xfersect+1, xfersectnum)) |
| 1741 | |
| 1742 | xferoffs = 0; |
| 1743 | xfersect++; |
| 1744 | } |
| 1745 | } |
| 1746 | else // sectors are done |
| 1747 | { |
| 1748 | xfertype32 = XFERTYPE32_INVALID; |
| 1749 | } |
| 1750 | break; |
| 1751 | |
| 1752 | default: |
| 1753 | printf("CD: unhandled 32-bit transfer type write\n"); |
| 1754 | break; |
| 1755 | } |
| 1756 | break; |
| 1757 | |
| 1758 | default: |
| 1759 | break; |
| 1760 | } |
| 1761 | } |
| 1762 | |
| 1703 | 1763 | void saturn_state::cd_writeWord(UINT32 addr, UINT16 data) |
| 1704 | 1764 | { |
| 1705 | 1765 | switch(addr & 0xffff) |
| r21103 | r21104 | |
| 1809 | 1869 | |
| 1810 | 1870 | switch (offset) |
| 1811 | 1871 | { |
| 1872 | case 0x18000: |
| 1873 | if (mem_mask == 0xffffffff) |
| 1874 | cd_writeLong(offset, data); |
| 1875 | else |
| 1876 | printf("CD: Unknown data buffer write @ mask = %08x\n", mem_mask); |
| 1877 | break; |
| 1878 | |
| 1812 | 1879 | case 0x90008: |
| 1813 | 1880 | case 0x9000a: |
| 1814 | 1881 | case 0x9000c: |