trunk/src/emu/bus/coco/coco_dwsock.c
| r242066 | r242067 | |
| 24 | 24 | |
| 25 | 25 | INPUT_PORTS_START( coco_drivewire ) |
| 26 | 26 | PORT_START(DRIVEWIRE_PORT_TAG) |
| 27 | | PORT_CONFNAME( 0xffff, 65504, "Drivewire Server TCP Port") |
| 28 | | PORT_CHANGED_MEMBER(DEVICE_SELF, beckerport_device, drivewire_port_changed, NULL ) |
| 27 | PORT_CONFNAME( 0xffff, 65504, "Drivewire Server TCP Port") |
| 28 | PORT_CHANGED_MEMBER(DEVICE_SELF, beckerport_device, drivewire_port_changed, NULL ) |
| 29 | 29 | PORT_CONFSETTING( 65500, "65500" ) |
| 30 | 30 | PORT_CONFSETTING( 65501, "65501" ) |
| 31 | 31 | PORT_CONFSETTING( 65502, "65502" ) |
| r242066 | r242067 | |
| 52 | 52 | //------------------------------------------------- |
| 53 | 53 | INPUT_CHANGED_MEMBER(beckerport_device::drivewire_port_changed) |
| 54 | 54 | { |
| 55 | | this->update_port(); |
| 55 | this->update_port(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | //************************************************************************** |
| r242066 | r242067 | |
| 64 | 64 | //------------------------------------------------- |
| 65 | 65 | |
| 66 | 66 | beckerport_device::beckerport_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 67 | | : device_t(mconfig, COCO_DWSOCK, "Virtual Becker Port", tag, owner, clock, "coco_dwsock", __FILE__), |
| 68 | | m_dwconfigport(*this, DRIVEWIRE_PORT_TAG) |
| 67 | : device_t(mconfig, COCO_DWSOCK, "Virtual Becker Port", tag, owner, clock, "coco_dwsock", __FILE__), |
| 68 | m_dwconfigport(*this, DRIVEWIRE_PORT_TAG) |
| 69 | 69 | { |
| 70 | | m_pSocket = NULL; |
| 71 | | m_head = 0; |
| 72 | | m_rx_pending = 0; |
| 70 | m_pSocket = NULL; |
| 71 | m_head = 0; |
| 72 | m_rx_pending = 0; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | beckerport_device::~beckerport_device() |
| 76 | 76 | { |
| 77 | | if (m_pSocket != NULL) |
| 78 | | device_stop(); |
| 77 | if (m_pSocket != NULL) |
| 78 | device_stop(); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /*------------------------------------------------- |
| r242066 | r242067 | |
| 84 | 84 | |
| 85 | 85 | void beckerport_device::device_start(void) |
| 86 | 86 | { |
| 87 | | char chAddress[64]; |
| 87 | char chAddress[64]; |
| 88 | 88 | |
| 89 | | /* format address string for opening the port */ |
| 90 | | snprintf(chAddress, sizeof(chAddress), "socket.%s:%d", m_hostname, m_dwtcpport); |
| 89 | /* format address string for opening the port */ |
| 90 | snprintf(chAddress, sizeof(chAddress), "socket.%s:%d", m_hostname, m_dwtcpport); |
| 91 | 91 | |
| 92 | | fprintf(stderr, "Connecting to Drivewire server on %s:%d... ", m_hostname, m_dwtcpport); |
| 92 | fprintf(stderr, "Connecting to Drivewire server on %s:%d... ", m_hostname, m_dwtcpport); |
| 93 | 93 | |
| 94 | | UINT64 filesize; // unused |
| 95 | | file_error filerr = osd_open(chAddress, 0, &m_pSocket, &filesize); |
| 96 | | if (filerr != FILERR_NONE) |
| 97 | | { |
| 98 | | fprintf(stderr, "Error: osd_open returned error %i!\n", (int) filerr); |
| 99 | | return; |
| 100 | | } |
| 94 | UINT64 filesize; // unused |
| 95 | file_error filerr = osd_open(chAddress, 0, &m_pSocket, &filesize); |
| 96 | if (filerr != FILERR_NONE) |
| 97 | { |
| 98 | fprintf(stderr, "Error: osd_open returned error %i!\n", (int) filerr); |
| 99 | return; |
| 100 | } |
| 101 | 101 | |
| 102 | | fprintf(stderr, "Connected!\n"); |
| 102 | fprintf(stderr, "Connected!\n"); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /*------------------------------------------------- |
| r242066 | r242067 | |
| 108 | 108 | |
| 109 | 109 | void beckerport_device::device_stop(void) |
| 110 | 110 | { |
| 111 | | if (m_pSocket != NULL) |
| 112 | | { |
| 113 | | printf("Closing connection to Drivewire server\n"); |
| 114 | | osd_close(m_pSocket); |
| 115 | | m_pSocket = NULL; |
| 116 | | } |
| 111 | if (m_pSocket != NULL) |
| 112 | { |
| 113 | printf("Closing connection to Drivewire server\n"); |
| 114 | osd_close(m_pSocket); |
| 115 | m_pSocket = NULL; |
| 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /*------------------------------------------------- |
| r242066 | r242067 | |
| 132 | 132 | |
| 133 | 133 | READ8_MEMBER(beckerport_device::read) |
| 134 | 134 | { |
| 135 | | unsigned char data = 0x5a; |
| 135 | unsigned char data = 0x5a; |
| 136 | 136 | |
| 137 | | if (m_pSocket == NULL) |
| 138 | | return data; |
| 137 | if (m_pSocket == NULL) |
| 138 | return data; |
| 139 | 139 | |
| 140 | | switch (offset) |
| 141 | | { |
| 142 | | case DWS_STATUS: |
| 143 | | if (!m_rx_pending) |
| 144 | | { |
| 145 | | /* Try to read from dws */ |
| 146 | | file_error filerr = osd_read(m_pSocket, m_buf, 0, sizeof(m_buf), &m_rx_pending); |
| 147 | | if (filerr != FILERR_NONE && filerr != FILERR_FAILURE) // FILERR_FAILURE means no data available, so don't throw error message |
| 148 | | fprintf(stderr, "coco_dwsock.c: beckerport_device::read() socket read operation failed with file_error %i\n", filerr); |
| 149 | | else |
| 150 | | m_head = 0; |
| 151 | | } |
| 152 | | //printf("beckerport_device: status read. %i bytes remaining.\n", m_rx_pending); |
| 153 | | data = (m_rx_pending > 0) ? 2 : 0; |
| 154 | | break; |
| 155 | | case DWS_DATA: |
| 156 | | if (!m_rx_pending) { |
| 157 | | fprintf(stderr, "coco_dwsock.c: beckerport_device::read() buffer underrun\n"); |
| 158 | | break; |
| 159 | | } |
| 160 | | data = m_buf[m_head++]; |
| 161 | | m_rx_pending--; |
| 162 | | //printf("beckerport_device: data read 1 byte (0x%02x). %i bytes remaining.\n", data&0xff, m_rx_pending); |
| 163 | | break; |
| 164 | | default: |
| 165 | | fprintf(stderr, "%s: read from bad offset %d\n", __FILE__, offset); |
| 166 | | } |
| 140 | switch (offset) |
| 141 | { |
| 142 | case DWS_STATUS: |
| 143 | if (!m_rx_pending) |
| 144 | { |
| 145 | /* Try to read from dws */ |
| 146 | file_error filerr = osd_read(m_pSocket, m_buf, 0, sizeof(m_buf), &m_rx_pending); |
| 147 | if (filerr != FILERR_NONE && filerr != FILERR_FAILURE) // FILERR_FAILURE means no data available, so don't throw error message |
| 148 | fprintf(stderr, "coco_dwsock.c: beckerport_device::read() socket read operation failed with file_error %i\n", filerr); |
| 149 | else |
| 150 | m_head = 0; |
| 151 | } |
| 152 | //printf("beckerport_device: status read. %i bytes remaining.\n", m_rx_pending); |
| 153 | data = (m_rx_pending > 0) ? 2 : 0; |
| 154 | break; |
| 155 | case DWS_DATA: |
| 156 | if (!m_rx_pending) { |
| 157 | fprintf(stderr, "coco_dwsock.c: beckerport_device::read() buffer underrun\n"); |
| 158 | break; |
| 159 | } |
| 160 | data = m_buf[m_head++]; |
| 161 | m_rx_pending--; |
| 162 | //printf("beckerport_device: data read 1 byte (0x%02x). %i bytes remaining.\n", data&0xff, m_rx_pending); |
| 163 | break; |
| 164 | default: |
| 165 | fprintf(stderr, "%s: read from bad offset %d\n", __FILE__, offset); |
| 166 | } |
| 167 | 167 | |
| 168 | | return (int)data; |
| 168 | return (int)data; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /*------------------------------------------------- |
| r242066 | r242067 | |
| 174 | 174 | |
| 175 | 175 | WRITE8_MEMBER(beckerport_device::write) |
| 176 | 176 | { |
| 177 | | char d = (char)data; |
| 178 | | file_error filerr; |
| 177 | char d = (char)data; |
| 178 | file_error filerr; |
| 179 | 179 | |
| 180 | | if (m_pSocket == NULL) |
| 181 | | return; |
| 180 | if (m_pSocket == NULL) |
| 181 | return; |
| 182 | 182 | |
| 183 | | switch (offset) |
| 184 | | { |
| 185 | | case DWS_STATUS: |
| 186 | | //printf("beckerport_write: error: write (0x%02x) to status register\n", d); |
| 187 | | break; |
| 188 | | case DWS_DATA: |
| 189 | | filerr = osd_write(m_pSocket, &d, 0, 1, NULL); |
| 190 | | if (filerr != FILERR_NONE) |
| 191 | | fprintf(stderr, "coco_dwsock.c: beckerport_device::write() socket write operation failed with file_error %i\n", filerr); |
| 192 | | //printf("beckerport_write: data write one byte (0x%02x)\n", d & 0xff); |
| 193 | | break; |
| 194 | | default: |
| 195 | | fprintf(stderr, "%s: write to bad offset %d\n", __FILE__, offset); |
| 196 | | } |
| 183 | switch (offset) |
| 184 | { |
| 185 | case DWS_STATUS: |
| 186 | //printf("beckerport_write: error: write (0x%02x) to status register\n", d); |
| 187 | break; |
| 188 | case DWS_DATA: |
| 189 | filerr = osd_write(m_pSocket, &d, 0, 1, NULL); |
| 190 | if (filerr != FILERR_NONE) |
| 191 | fprintf(stderr, "coco_dwsock.c: beckerport_device::write() socket write operation failed with file_error %i\n", filerr); |
| 192 | //printf("beckerport_write: data write one byte (0x%02x)\n", d & 0xff); |
| 193 | break; |
| 194 | default: |
| 195 | fprintf(stderr, "%s: write to bad offset %d\n", __FILE__, offset); |
| 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /*------------------------------------------------- |
| r242066 | r242067 | |
| 202 | 202 | |
| 203 | 203 | void beckerport_device::update_port(void) |
| 204 | 204 | { |
| 205 | | device_stop(); |
| 206 | | m_dwtcpport = m_dwconfigport->read_safe(65504); |
| 207 | | device_start(); |
| 205 | device_stop(); |
| 206 | m_dwtcpport = m_dwconfigport->read_safe(65504); |
| 207 | device_start(); |
| 208 | 208 | } |
| 209 | | |
trunk/src/lib/winpcap/Packet32.h
| r242066 | r242067 | |
| 12 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | 14 | * documentation and/or other materials provided with the distribution. |
| 15 | | * 3. Neither the name of the Politecnico di Torino, CACE Technologies |
| 16 | | * nor the names of its contributors may be used to endorse or promote |
| 17 | | * products derived from this software without specific prior written |
| 15 | * 3. Neither the name of the Politecnico di Torino, CACE Technologies |
| 16 | * nor the names of its contributors may be used to endorse or promote |
| 17 | * products derived from this software without specific prior written |
| 18 | 18 | * permission. |
| 19 | 19 | * |
| 20 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| r242066 | r242067 | |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | /** @ingroup packetapi |
| 35 | | * @{ |
| 35 | * @{ |
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | 38 | /** @defgroup packet32h Packet.dll definitions and data structures |
| r242066 | r242067 | |
| 70 | 70 | |
| 71 | 71 | /// Alignment macro. Defines the alignment size. |
| 72 | 72 | #define Packet_ALIGNMENT sizeof(int) |
| 73 | | /// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. |
| 73 | /// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. |
| 74 | 74 | #define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) |
| 75 | 75 | |
| 76 | | #define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 77 | | #define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 78 | | #define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 79 | | #define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 80 | | #define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 81 | | #define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 76 | #define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 77 | #define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 78 | #define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 79 | #define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 80 | #define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 81 | #define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent |
| 82 | 82 | |
| 83 | 83 | // Loopback behaviour definitions |
| 84 | | #define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver |
| 85 | | #define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver |
| 84 | #define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver |
| 85 | #define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver |
| 86 | 86 | |
| 87 | 87 | /*! |
| 88 | 88 | \brief Network type structure. |
| r242066 | r242067 | |
| 91 | 91 | */ |
| 92 | 92 | typedef struct NetType |
| 93 | 93 | { |
| 94 | | UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) |
| 95 | | ULONGLONG LinkSpeed; ///< The speed of the network in bits per second |
| 94 | UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) |
| 95 | ULONGLONG LinkSpeed; ///< The speed of the network in bits per second |
| 96 | 96 | }NetType; |
| 97 | 97 | |
| 98 | 98 | |
| r242066 | r242067 | |
| 103 | 103 | /*! |
| 104 | 104 | \brief A BPF pseudo-assembly program. |
| 105 | 105 | |
| 106 | | The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. |
| 106 | The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. |
| 107 | 107 | */ |
| 108 | | struct bpf_program |
| 108 | struct bpf_program |
| 109 | 109 | { |
| 110 | | UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. |
| 111 | | struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. |
| 110 | UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. |
| 111 | struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | 114 | /*! |
| r242066 | r242067 | |
| 116 | 116 | |
| 117 | 117 | bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. |
| 118 | 118 | */ |
| 119 | | struct bpf_insn |
| 119 | struct bpf_insn |
| 120 | 120 | { |
| 121 | | USHORT code; ///< Instruction type and addressing mode. |
| 122 | | UCHAR jt; ///< Jump if true |
| 123 | | UCHAR jf; ///< Jump if false |
| 124 | | int k; ///< Generic field used for various purposes. |
| 121 | USHORT code; ///< Instruction type and addressing mode. |
| 122 | UCHAR jt; ///< Jump if true |
| 123 | UCHAR jf; ///< Jump if false |
| 124 | int k; ///< Generic field used for various purposes. |
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | 127 | /*! |
| r242066 | r242067 | |
| 129 | 129 | |
| 130 | 130 | It is used by packet.dll to return statistics about a capture session. |
| 131 | 131 | */ |
| 132 | | struct bpf_stat |
| 132 | struct bpf_stat |
| 133 | 133 | { |
| 134 | | UINT bs_recv; ///< Number of packets that the driver received from the network adapter |
| 135 | | ///< from the beginning of the current capture. This value includes the packets |
| 134 | UINT bs_recv; ///< Number of packets that the driver received from the network adapter |
| 135 | ///< from the beginning of the current capture. This value includes the packets |
| 136 | 136 | ///< lost by the driver. |
| 137 | | UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. |
| 138 | | ///< Basically, a packet is lost when the the buffer of the driver is full. |
| 137 | UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. |
| 138 | ///< Basically, a packet is lost when the the buffer of the driver is full. |
| 139 | 139 | ///< In this situation the packet cannot be stored and the driver rejects it. |
| 140 | | UINT ps_ifdrop; ///< drops by interface. XXX not yet supported |
| 141 | | UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and |
| 140 | UINT ps_ifdrop; ///< drops by interface. XXX not yet supported |
| 141 | UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and |
| 142 | 142 | ///< thus reach the application. |
| 143 | 143 | }; |
| 144 | 144 | |
| r242066 | r242067 | |
| 147 | 147 | |
| 148 | 148 | This structure defines the header associated with every packet delivered to the application. |
| 149 | 149 | */ |
| 150 | | struct bpf_hdr |
| 150 | struct bpf_hdr |
| 151 | 151 | { |
| 152 | | struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. |
| 152 | struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. |
| 153 | 153 | ///< It is stored in a TimeVal structure. |
| 154 | | UINT bh_caplen; ///< Length of captured portion. The captured portion <b>can be different</b> |
| 154 | UINT bh_caplen; ///< Length of captured portion. The captured portion <b>can be different</b> |
| 155 | 155 | ///< from the original packet, because it is possible (with a proper filter) |
| 156 | 156 | ///< to instruct the driver to capture only a portion of the packets. |
| 157 | | UINT bh_datalen; ///< Original length of packet |
| 158 | | USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, |
| 157 | UINT bh_datalen; ///< Original length of packet |
| 158 | USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, |
| 159 | 159 | ///< a padding could be added between the end of this structure and the packet |
| 160 | | ///< data for performance reasons. This filed can be used to retrieve the actual data |
| 160 | ///< data for performance reasons. This filed can be used to retrieve the actual data |
| 161 | 161 | ///< of the packet. |
| 162 | 162 | }; |
| 163 | 163 | |
| r242066 | r242067 | |
| 169 | 169 | packet in a dump file. This makes straightforward sending WinPcap dump files to the network. |
| 170 | 170 | */ |
| 171 | 171 | struct dump_bpf_hdr{ |
| 172 | | struct timeval ts; ///< Time stamp of the packet |
| 173 | | UINT caplen; ///< Length of captured portion. The captured portion can smaller than the |
| 174 | | ///< the original packet, because it is possible (with a proper filter) to |
| 175 | | ///< instruct the driver to capture only a portion of the packets. |
| 176 | | UINT len; ///< Length of the original packet (off wire). |
| 172 | struct timeval ts; ///< Time stamp of the packet |
| 173 | UINT caplen; ///< Length of captured portion. The captured portion can smaller than the |
| 174 | ///< the original packet, because it is possible (with a proper filter) to |
| 175 | ///< instruct the driver to capture only a portion of the packets. |
| 176 | UINT len; ///< Length of the original packet (off wire). |
| 177 | 177 | }; |
| 178 | 178 | |
| 179 | 179 | |
| r242066 | r242067 | |
| 181 | 181 | |
| 182 | 182 | struct bpf_stat; |
| 183 | 183 | |
| 184 | | #define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices |
| 185 | | #define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links |
| 184 | #define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices |
| 185 | #define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links |
| 186 | 186 | #define NMAX_PACKET 65535 |
| 187 | 187 | |
| 188 | 188 | /*! |
| 189 | 189 | \brief Addresses of a network adapter. |
| 190 | 190 | |
| 191 | | This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with |
| 191 | This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with |
| 192 | 192 | an adapter. |
| 193 | 193 | */ |
| 194 | 194 | typedef struct npf_if_addr { |
| 195 | | struct sockaddr_storage IPAddress; ///< IP address. |
| 196 | | struct sockaddr_storage SubnetMask; ///< Netmask for that address. |
| 197 | | struct sockaddr_storage Broadcast; ///< Broadcast address. |
| 195 | struct sockaddr_storage IPAddress; ///< IP address. |
| 196 | struct sockaddr_storage SubnetMask; ///< Netmask for that address. |
| 197 | struct sockaddr_storage Broadcast; ///< Broadcast address. |
| 198 | 198 | }npf_if_addr; |
| 199 | 199 | |
| 200 | 200 | |
| 201 | | #define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. |
| 202 | | #define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. |
| 203 | | #define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. |
| 204 | | #define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. |
| 201 | #define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. |
| 202 | #define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. |
| 203 | #define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. |
| 204 | #define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. |
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API |
| 208 | 208 | typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API |
| 209 | 209 | |
| 210 | | #define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter |
| 211 | | #define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET |
| 212 | | #define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card |
| 213 | | #define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file |
| 214 | | #define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. |
| 215 | | #define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card |
| 216 | | #define INFO_FLAG_NPFIM_DEVICE 32 |
| 210 | #define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter |
| 211 | #define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET |
| 212 | #define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card |
| 213 | #define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file |
| 214 | #define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. |
| 215 | #define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card |
| 216 | #define INFO_FLAG_NPFIM_DEVICE 32 |
| 217 | 217 | |
| 218 | 218 | /*! |
| 219 | 219 | \brief Describes an opened network adapter. |
| r242066 | r242067 | |
| 221 | 221 | This structure is the most important for the functioning of packet.dll, but the great part of its fields |
| 222 | 222 | should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters |
| 223 | 223 | */ |
| 224 | | typedef struct _ADAPTER { |
| 225 | | HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. |
| 224 | typedef struct _ADAPTER { |
| 225 | HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. |
| 226 | 226 | CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. |
| 227 | | int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated |
| 227 | int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated |
| 228 | 228 | ///< on the wire. |
| 229 | | HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. |
| 229 | HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. |
| 230 | 230 | ///< It can be passed to standard Win32 functions (like WaitForSingleObject |
| 231 | | ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some |
| 232 | | ///< data. It is particularly useful in GUI applications that need to wait |
| 231 | ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some |
| 232 | ///< data. It is particularly useful in GUI applications that need to wait |
| 233 | 233 | ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() |
| 234 | 234 | ///< function can be used to define the minimum amount of data in the kernel buffer |
| 235 | | ///< that will cause the event to be signalled. |
| 236 | | |
| 237 | | UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and |
| 235 | ///< that will cause the event to be signalled. |
| 236 | |
| 237 | UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and |
| 238 | 238 | ///< ReadEvent will be signaled, also if no packets were captured |
| 239 | 239 | CHAR Name[ADAPTER_NAME_LENGTH]; |
| 240 | 240 | PWAN_ADAPTER pWanAdapter; |
| 241 | | UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. |
| 241 | UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. |
| 242 | 242 | |
| 243 | 243 | #ifdef HAVE_AIRPCAP_API |
| 244 | | PAirpcapHandle AirpcapAd; |
| 244 | PAirpcapHandle AirpcapAd; |
| 245 | 245 | #endif // HAVE_AIRPCAP_API |
| 246 | 246 | |
| 247 | 247 | #ifdef HAVE_NPFIM_API |
| r242066 | r242067 | |
| 249 | 249 | #endif // HAVE_NPFIM_API |
| 250 | 250 | |
| 251 | 251 | #ifdef HAVE_DAG_API |
| 252 | | dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter |
| 253 | | PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card |
| 254 | | struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure |
| 255 | | unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry |
| 256 | | DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). |
| 252 | dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter |
| 253 | PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card |
| 254 | struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure |
| 255 | unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry |
| 256 | DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). |
| 257 | 257 | #endif // HAVE_DAG_API |
| 258 | 258 | } ADAPTER, *LPADAPTER; |
| 259 | 259 | |
| r242066 | r242067 | |
| 262 | 262 | |
| 263 | 263 | This structure defines the header associated with every packet delivered to the application. |
| 264 | 264 | */ |
| 265 | | typedef struct _PACKET { |
| 266 | | HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. |
| 267 | | OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. |
| 268 | | PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for |
| 265 | typedef struct _PACKET { |
| 266 | HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. |
| 267 | OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. |
| 268 | PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for |
| 269 | 269 | ///< details about the organization of the data in this buffer |
| 270 | | UINT Length; ///< Length of the buffer |
| 271 | | DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data |
| 270 | UINT Length; ///< Length of the buffer |
| 271 | DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data |
| 272 | 272 | ///< received by the last call to PacketReceivePacket() |
| 273 | | BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. |
| 273 | BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. |
| 274 | 274 | } PACKET, *LPPACKET; |
| 275 | 275 | |
| 276 | 276 | /*! |
| 277 | 277 | \brief Structure containing an OID request. |
| 278 | 278 | |
| 279 | | It is used by the PacketRequest() function to send an OID to the interface card driver. |
| 280 | | It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, |
| 279 | It is used by the PacketRequest() function to send an OID to the interface card driver. |
| 280 | It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, |
| 281 | 281 | the list of the multicast groups defined on it, and so on. |
| 282 | 282 | */ |
| 283 | 283 | struct _PACKET_OID_DATA { |
| 284 | | ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h |
| 284 | ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h |
| 285 | 285 | ///< for a complete list of valid codes. |
| 286 | | ULONG Length; ///< Length of the data field |
| 287 | | UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received |
| 286 | ULONG Length; ///< Length of the data field |
| 287 | UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received |
| 288 | 288 | ///< from the adapter. |
| 289 | | }; |
| 289 | }; |
| 290 | 290 | typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; |
| 291 | 291 | |
| 292 | 292 | #ifdef __cplusplus |
| r242066 | r242067 | |
| 299 | 299 | |
| 300 | 300 | /* |
| 301 | 301 | BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName, |
| 302 | | CHAR *Value, |
| 303 | | UINT *pValueLen, |
| 304 | | CHAR *DefaultVal); |
| 302 | CHAR *Value, |
| 303 | UINT *pValueLen, |
| 304 | CHAR *DefaultVal); |
| 305 | 305 | |
| 306 | 306 | BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName, |
| 307 | | WCHAR *Value, |
| 308 | | UINT *pValueLen, |
| 309 | | WCHAR *DefaultVal); |
| 307 | WCHAR *Value, |
| 308 | UINT *pValueLen, |
| 309 | WCHAR *DefaultVal); |
| 310 | 310 | */ |
| 311 | | |
| 311 | |
| 312 | 312 | //--------------------------------------------------------------------------- |
| 313 | 313 | // EXPORTED FUNCTIONS |
| 314 | 314 | //--------------------------------------------------------------------------- |
| r242066 | r242067 | |
| 350 | 350 | // |
| 351 | 351 | // Used by PacketStartOemEx |
| 352 | 352 | // |
| 353 | | #define PACKET_START_OEM_NO_NETMON 0x00000001 |
| 353 | #define PACKET_START_OEM_NO_NETMON 0x00000001 |
| 354 | 354 | |
| 355 | 355 | #ifdef __cplusplus |
| 356 | 356 | } |
| 357 | | #endif |
| 357 | #endif |
| 358 | 358 | |
| 359 | 359 | #endif //__PACKET32 |
trunk/src/lib/winpcap/ip6_misc.h
| r242066 | r242067 | |
| 1 | 1 | /* |
| 2 | 2 | * Copyright (c) 1993, 1994, 1997 |
| 3 | | * The Regents of the University of California. All rights reserved. |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | 6 | * modification, are permitted provided that: (1) source code distributions |
| r242066 | r242067 | |
| 30 | 30 | #include <ws2tcpip.h> |
| 31 | 31 | |
| 32 | 32 | #ifndef __MINGW32__ |
| 33 | | #define IN_MULTICAST(a) IN_CLASSD(a) |
| 33 | #define IN_MULTICAST(a) IN_CLASSD(a) |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | | #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) |
| 36 | #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) |
| 37 | 37 | |
| 38 | | #define IN_LOOPBACKNET 127 |
| 38 | #define IN_LOOPBACKNET 127 |
| 39 | 39 | |
| 40 | 40 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) |
| 41 | 41 | /* IPv6 address */ |
| 42 | 42 | struct in6_addr |
| 43 | | { |
| 44 | | union |
| 45 | | { |
| 46 | | u_int8_t u6_addr8[16]; |
| 47 | | u_int16_t u6_addr16[8]; |
| 48 | | u_int32_t u6_addr32[4]; |
| 49 | | } in6_u; |
| 50 | | #define s6_addr in6_u.u6_addr8 |
| 51 | | #define s6_addr16 in6_u.u6_addr16 |
| 52 | | #define s6_addr32 in6_u.u6_addr32 |
| 53 | | #define s6_addr64 in6_u.u6_addr64 |
| 54 | | }; |
| 43 | { |
| 44 | union |
| 45 | { |
| 46 | u_int8_t u6_addr8[16]; |
| 47 | u_int16_t u6_addr16[8]; |
| 48 | u_int32_t u6_addr32[4]; |
| 49 | } in6_u; |
| 50 | #define s6_addr in6_u.u6_addr8 |
| 51 | #define s6_addr16 in6_u.u6_addr16 |
| 52 | #define s6_addr32 in6_u.u6_addr32 |
| 53 | #define s6_addr64 in6_u.u6_addr64 |
| 54 | }; |
| 55 | 55 | |
| 56 | 56 | #define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } |
| 57 | 57 | #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } |
| r242066 | r242067 | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | #if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)) |
| 62 | | typedef unsigned short sa_family_t; |
| 62 | typedef unsigned short sa_family_t; |
| 63 | 63 | #endif |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) |
| 67 | 67 | |
| 68 | | #define __SOCKADDR_COMMON(sa_prefix) \ |
| 69 | | sa_family_t sa_prefix##family |
| 68 | #define __SOCKADDR_COMMON(sa_prefix) \ |
| 69 | sa_family_t sa_prefix##family |
| 70 | 70 | |
| 71 | 71 | /* Ditto, for IPv6. */ |
| 72 | 72 | struct sockaddr_in6 |
| 73 | | { |
| 74 | | __SOCKADDR_COMMON (sin6_); |
| 75 | | u_int16_t sin6_port; /* Transport layer port # */ |
| 76 | | u_int32_t sin6_flowinfo; /* IPv6 flow information */ |
| 77 | | struct in6_addr sin6_addr; /* IPv6 address */ |
| 78 | | }; |
| 73 | { |
| 74 | __SOCKADDR_COMMON (sin6_); |
| 75 | u_int16_t sin6_port; /* Transport layer port # */ |
| 76 | u_int32_t sin6_flowinfo; /* IPv6 flow information */ |
| 77 | struct in6_addr sin6_addr; /* IPv6 address */ |
| 78 | }; |
| 79 | 79 | |
| 80 | 80 | #define IN6_IS_ADDR_V4MAPPED(a) \ |
| 81 | 81 | ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ |
| 82 | | (((u_int32_t *) (a))[2] == htonl (0xffff))) |
| 82 | (((u_int32_t *) (a))[2] == htonl (0xffff))) |
| 83 | 83 | |
| 84 | 84 | #define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) |
| 85 | 85 | |
| r242066 | r242067 | |
| 88 | 88 | |
| 89 | 89 | #define IN6_IS_ADDR_LOOPBACK(a) \ |
| 90 | 90 | (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ |
| 91 | | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) |
| 91 | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) |
| 92 | 92 | #endif /* __MINGW32__ */ |
| 93 | 93 | |
| 94 | 94 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc |
| r242066 | r242067 | |
| 104 | 104 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] |
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | | * IPV6 extension headers |
| 107 | * IPV6 extension headers |
| 108 | 108 | */ |
| 109 | | #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ |
| 110 | | #define IPPROTO_IPV6 41 /* IPv6 header. */ |
| 111 | | #define IPPROTO_ROUTING 43 /* IPv6 routing header */ |
| 112 | | #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ |
| 113 | | #define IPPROTO_ESP 50 /* encapsulating security payload */ |
| 114 | | #define IPPROTO_AH 51 /* authentication header */ |
| 115 | | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ |
| 116 | | #define IPPROTO_NONE 59 /* IPv6 no next header */ |
| 117 | | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ |
| 118 | | #define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ |
| 109 | #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ |
| 110 | #define IPPROTO_IPV6 41 /* IPv6 header. */ |
| 111 | #define IPPROTO_ROUTING 43 /* IPv6 routing header */ |
| 112 | #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ |
| 113 | #define IPPROTO_ESP 50 /* encapsulating security payload */ |
| 114 | #define IPPROTO_AH 51 /* authentication header */ |
| 115 | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ |
| 116 | #define IPPROTO_NONE 59 /* IPv6 no next header */ |
| 117 | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ |
| 118 | #define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ |
| 119 | 119 | |
| 120 | | #define IPV6_RTHDR_TYPE_0 0 |
| 120 | #define IPV6_RTHDR_TYPE_0 0 |
| 121 | 121 | |
| 122 | 122 | /* Option types and related macros */ |
| 123 | | #define IP6OPT_PAD1 0x00 /* 00 0 00000 */ |
| 124 | | #define IP6OPT_PADN 0x01 /* 00 0 00001 */ |
| 125 | | #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ |
| 126 | | #define IP6OPT_JUMBO_LEN 6 |
| 127 | | #define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ |
| 123 | #define IP6OPT_PAD1 0x00 /* 00 0 00000 */ |
| 124 | #define IP6OPT_PADN 0x01 /* 00 0 00001 */ |
| 125 | #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ |
| 126 | #define IP6OPT_JUMBO_LEN 6 |
| 127 | #define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ |
| 128 | 128 | |
| 129 | | #define IP6OPT_RTALERT_LEN 4 |
| 130 | | #define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ |
| 131 | | #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ |
| 132 | | #define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ |
| 133 | | #define IP6OPT_MINLEN 2 |
| 129 | #define IP6OPT_RTALERT_LEN 4 |
| 130 | #define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ |
| 131 | #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ |
| 132 | #define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ |
| 133 | #define IP6OPT_MINLEN 2 |
| 134 | 134 | |
| 135 | | #define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ |
| 136 | | #define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ |
| 137 | | #define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ |
| 138 | | #define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ |
| 139 | | #define IP6OPT_EID 0x8a /* 10 0 01010 */ |
| 135 | #define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ |
| 136 | #define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ |
| 137 | #define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ |
| 138 | #define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ |
| 139 | #define IP6OPT_EID 0x8a /* 10 0 01010 */ |
| 140 | 140 | |
| 141 | | #define IP6OPT_TYPE(o) ((o) & 0xC0) |
| 142 | | #define IP6OPT_TYPE_SKIP 0x00 |
| 143 | | #define IP6OPT_TYPE_DISCARD 0x40 |
| 144 | | #define IP6OPT_TYPE_FORCEICMP 0x80 |
| 145 | | #define IP6OPT_TYPE_ICMP 0xC0 |
| 141 | #define IP6OPT_TYPE(o) ((o) & 0xC0) |
| 142 | #define IP6OPT_TYPE_SKIP 0x00 |
| 143 | #define IP6OPT_TYPE_DISCARD 0x40 |
| 144 | #define IP6OPT_TYPE_FORCEICMP 0x80 |
| 145 | #define IP6OPT_TYPE_ICMP 0xC0 |
| 146 | 146 | |
| 147 | | #define IP6OPT_MUTABLE 0x20 |
| 147 | #define IP6OPT_MUTABLE 0x20 |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) |
| 151 | 151 | #ifndef EAI_ADDRFAMILY |
| 152 | 152 | struct addrinfo { |
| 153 | | int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ |
| 154 | | int ai_family; /* PF_xxx */ |
| 155 | | int ai_socktype; /* SOCK_xxx */ |
| 156 | | int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ |
| 157 | | size_t ai_addrlen; /* length of ai_addr */ |
| 158 | | char *ai_canonname; /* canonical name for hostname */ |
| 159 | | struct sockaddr *ai_addr; /* binary address */ |
| 160 | | struct addrinfo *ai_next; /* next structure in linked list */ |
| 153 | int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ |
| 154 | int ai_family; /* PF_xxx */ |
| 155 | int ai_socktype; /* SOCK_xxx */ |
| 156 | int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ |
| 157 | size_t ai_addrlen; /* length of ai_addr */ |
| 158 | char *ai_canonname; /* canonical name for hostname */ |
| 159 | struct sockaddr *ai_addr; /* binary address */ |
| 160 | struct addrinfo *ai_next; /* next structure in linked list */ |
| 161 | 161 | }; |
| 162 | 162 | #endif |
| 163 | 163 | #endif /* __MINGW32__ */ |
trunk/src/lib/winpcap/pcap/bpf.h
| r242066 | r242067 | |
| 1 | 1 | /*- |
| 2 | 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 |
| 3 | | * The Regents of the University of California. All rights reserved. |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * This code is derived from the Stanford/CMU enet packet filter, |
| 6 | 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed |
| 7 | | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence |
| 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence |
| 8 | 8 | * Berkeley Laboratory. |
| 9 | 9 | * |
| 10 | 10 | * Redistribution and use in source and binary forms, with or without |
| r242066 | r242067 | |
| 64 | 64 | typedef long bpf_int32; |
| 65 | 65 | typedef unsigned long bpf_u_int32; |
| 66 | 66 | #else |
| 67 | | typedef int bpf_int32; |
| 68 | | typedef u_int bpf_u_int32; |
| 67 | typedef int bpf_int32; |
| 68 | typedef u_int bpf_u_int32; |
| 69 | 69 | #endif |
| 70 | 70 | |
| 71 | 71 | /* |
| 72 | | * Alignment macros. BPF_WORDALIGN rounds up to the next |
| 73 | | * even multiple of BPF_ALIGNMENT. |
| 72 | * Alignment macros. BPF_WORDALIGN rounds up to the next |
| 73 | * even multiple of BPF_ALIGNMENT. |
| 74 | 74 | */ |
| 75 | 75 | #ifndef __NetBSD__ |
| 76 | 76 | #define BPF_ALIGNMENT sizeof(bpf_int32) |
| r242066 | r242067 | |
| 89 | 89 | u_int bf_len; |
| 90 | 90 | struct bpf_insn *bf_insns; |
| 91 | 91 | }; |
| 92 | | |
| 92 | |
| 93 | 93 | /* |
| 94 | | * Struct return by BIOCVERSION. This represents the version number of |
| 94 | * Struct return by BIOCVERSION. This represents the version number of |
| 95 | 95 | * the filter language described by the instruction encodings below. |
| 96 | 96 | * bpf understands a program iff kernel_major == filter_major && |
| 97 | 97 | * kernel_minor >= filter_minor, that is, if the value returned by the |
| r242066 | r242067 | |
| 125 | 125 | * These are the types that are the same on all platforms, and that |
| 126 | 126 | * have been defined by <net/bpf.h> for ages. |
| 127 | 127 | */ |
| 128 | | #define DLT_NULL 0 /* BSD loopback encapsulation */ |
| 129 | | #define DLT_EN10MB 1 /* Ethernet (10Mb) */ |
| 130 | | #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ |
| 131 | | #define DLT_AX25 3 /* Amateur Radio AX.25 */ |
| 132 | | #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ |
| 133 | | #define DLT_CHAOS 5 /* Chaos */ |
| 134 | | #define DLT_IEEE802 6 /* 802.5 Token Ring */ |
| 135 | | #define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ |
| 136 | | #define DLT_SLIP 8 /* Serial Line IP */ |
| 137 | | #define DLT_PPP 9 /* Point-to-point Protocol */ |
| 138 | | #define DLT_FDDI 10 /* FDDI */ |
| 128 | #define DLT_NULL 0 /* BSD loopback encapsulation */ |
| 129 | #define DLT_EN10MB 1 /* Ethernet (10Mb) */ |
| 130 | #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ |
| 131 | #define DLT_AX25 3 /* Amateur Radio AX.25 */ |
| 132 | #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ |
| 133 | #define DLT_CHAOS 5 /* Chaos */ |
| 134 | #define DLT_IEEE802 6 /* 802.5 Token Ring */ |
| 135 | #define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ |
| 136 | #define DLT_SLIP 8 /* Serial Line IP */ |
| 137 | #define DLT_PPP 9 /* Point-to-point Protocol */ |
| 138 | #define DLT_FDDI 10 /* FDDI */ |
| 139 | 139 | |
| 140 | 140 | /* |
| 141 | 141 | * These are types that are different on some platforms, and that |
| r242066 | r242067 | |
| 146 | 146 | * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, |
| 147 | 147 | * but I don't know what the right #define is for BSD/OS. |
| 148 | 148 | */ |
| 149 | | #define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ |
| 149 | #define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ |
| 150 | 150 | |
| 151 | 151 | #ifdef __OpenBSD__ |
| 152 | | #define DLT_RAW 14 /* raw IP */ |
| 152 | #define DLT_RAW 14 /* raw IP */ |
| 153 | 153 | #else |
| 154 | | #define DLT_RAW 12 /* raw IP */ |
| 154 | #define DLT_RAW 12 /* raw IP */ |
| 155 | 155 | #endif |
| 156 | 156 | |
| 157 | 157 | /* |
| r242066 | r242067 | |
| 162 | 162 | */ |
| 163 | 163 | #if defined(__NetBSD__) || defined(__FreeBSD__) |
| 164 | 164 | #ifndef DLT_SLIP_BSDOS |
| 165 | | #define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ |
| 166 | | #define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ |
| 165 | #define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ |
| 166 | #define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ |
| 167 | 167 | #endif |
| 168 | 168 | #else |
| 169 | | #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ |
| 170 | | #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ |
| 169 | #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ |
| 170 | #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ |
| 171 | 171 | #endif |
| 172 | 172 | |
| 173 | 173 | /* |
| r242066 | r242067 | |
| 176 | 176 | * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. |
| 177 | 177 | */ |
| 178 | 178 | |
| 179 | | #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ |
| 179 | #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ |
| 180 | 180 | |
| 181 | 181 | /* |
| 182 | 182 | * Apparently Redback uses this for its SmartEdge 400/800. I hope |
| 183 | 183 | * nobody else decided to use it, too. |
| 184 | 184 | */ |
| 185 | | #define DLT_REDBACK_SMARTEDGE 32 |
| 185 | #define DLT_REDBACK_SMARTEDGE 32 |
| 186 | 186 | |
| 187 | 187 | /* |
| 188 | 188 | * These values are defined by NetBSD; other platforms should refrain from |
| 189 | 189 | * using them for other purposes, so that NetBSD savefiles with link |
| 190 | 190 | * types of 50 or 51 can be read as this type on all platforms. |
| 191 | 191 | */ |
| 192 | | #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ |
| 193 | | #define DLT_PPP_ETHER 51 /* PPP over Ethernet */ |
| 192 | #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ |
| 193 | #define DLT_PPP_ETHER 51 /* PPP over Ethernet */ |
| 194 | 194 | |
| 195 | 195 | /* |
| 196 | 196 | * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses |
| r242066 | r242067 | |
| 199 | 199 | * Ethernet type, and 36 bytes that appear to be 0 in at least one capture |
| 200 | 200 | * I've seen. |
| 201 | 201 | */ |
| 202 | | #define DLT_SYMANTEC_FIREWALL 99 |
| 202 | #define DLT_SYMANTEC_FIREWALL 99 |
| 203 | 203 | |
| 204 | 204 | /* |
| 205 | 205 | * Values between 100 and 103 are used in capture file headers as |
| r242066 | r242067 | |
| 221 | 221 | * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, |
| 222 | 222 | * for source compatibility with programs written for libpcap 0.5. |
| 223 | 223 | */ |
| 224 | | #define DLT_C_HDLC 104 /* Cisco HDLC */ |
| 225 | | #define DLT_CHDLC DLT_C_HDLC |
| 224 | #define DLT_C_HDLC 104 /* Cisco HDLC */ |
| 225 | #define DLT_CHDLC DLT_C_HDLC |
| 226 | 226 | |
| 227 | | #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ |
| 227 | #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ |
| 228 | 228 | |
| 229 | 229 | /* |
| 230 | 230 | * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, |
| r242066 | r242067 | |
| 239 | 239 | * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header |
| 240 | 240 | * (DLCI, etc.). |
| 241 | 241 | */ |
| 242 | | #define DLT_FRELAY 107 |
| 242 | #define DLT_FRELAY 107 |
| 243 | 243 | |
| 244 | 244 | /* |
| 245 | 245 | * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except |
| r242066 | r242067 | |
| 249 | 249 | * we don't use 12 for it in OSes other than OpenBSD. |
| 250 | 250 | */ |
| 251 | 251 | #ifdef __OpenBSD__ |
| 252 | | #define DLT_LOOP 12 |
| 252 | #define DLT_LOOP 12 |
| 253 | 253 | #else |
| 254 | | #define DLT_LOOP 108 |
| 254 | #define DLT_LOOP 108 |
| 255 | 255 | #endif |
| 256 | 256 | |
| 257 | 257 | /* |
| r242066 | r242067 | |
| 260 | 260 | * than OpenBSD. |
| 261 | 261 | */ |
| 262 | 262 | #ifdef __OpenBSD__ |
| 263 | | #define DLT_ENC 13 |
| 263 | #define DLT_ENC 13 |
| 264 | 264 | #else |
| 265 | | #define DLT_ENC 109 |
| 265 | #define DLT_ENC 109 |
| 266 | 266 | #endif |
| 267 | 267 | |
| 268 | 268 | /* |
| r242066 | r242067 | |
| 275 | 275 | /* |
| 276 | 276 | * This is for Linux cooked sockets. |
| 277 | 277 | */ |
| 278 | | #define DLT_LINUX_SLL 113 |
| 278 | #define DLT_LINUX_SLL 113 |
| 279 | 279 | |
| 280 | 280 | /* |
| 281 | 281 | * Apple LocalTalk hardware. |
| 282 | 282 | */ |
| 283 | | #define DLT_LTALK 114 |
| 283 | #define DLT_LTALK 114 |
| 284 | 284 | |
| 285 | 285 | /* |
| 286 | 286 | * Acorn Econet. |
| 287 | 287 | */ |
| 288 | | #define DLT_ECONET 115 |
| 288 | #define DLT_ECONET 115 |
| 289 | 289 | |
| 290 | 290 | /* |
| 291 | 291 | * Reserved for use with OpenBSD ipfilter. |
| 292 | 292 | */ |
| 293 | | #define DLT_IPFILTER 116 |
| 293 | #define DLT_IPFILTER 116 |
| 294 | 294 | |
| 295 | 295 | /* |
| 296 | 296 | * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 |
| r242066 | r242067 | |
| 299 | 299 | * XXX: is there a conflict with DLT_PFSYNC 18 as well? |
| 300 | 300 | */ |
| 301 | 301 | #ifdef __OpenBSD__ |
| 302 | | #define DLT_OLD_PFLOG 17 |
| 303 | | #define DLT_PFSYNC 18 |
| 302 | #define DLT_OLD_PFLOG 17 |
| 303 | #define DLT_PFSYNC 18 |
| 304 | 304 | #endif |
| 305 | | #define DLT_PFLOG 117 |
| 305 | #define DLT_PFLOG 117 |
| 306 | 306 | |
| 307 | 307 | /* |
| 308 | 308 | * Registered for Cisco-internal use. |
| 309 | 309 | */ |
| 310 | | #define DLT_CISCO_IOS 118 |
| 310 | #define DLT_CISCO_IOS 118 |
| 311 | 311 | |
| 312 | 312 | /* |
| 313 | 313 | * For 802.11 cards using the Prism II chips, with a link-layer |
| 314 | 314 | * header including Prism monitor mode information plus an 802.11 |
| 315 | 315 | * header. |
| 316 | 316 | */ |
| 317 | | #define DLT_PRISM_HEADER 119 |
| 317 | #define DLT_PRISM_HEADER 119 |
| 318 | 318 | |
| 319 | 319 | /* |
| 320 | 320 | * Reserved for Aironet 802.11 cards, with an Aironet link-layer header |
| 321 | 321 | * (see Doug Ambrisko's FreeBSD patches). |
| 322 | 322 | */ |
| 323 | | #define DLT_AIRONET_HEADER 120 |
| 323 | #define DLT_AIRONET_HEADER 120 |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | 326 | * Reserved for Siemens HiPath HDLC. |
| 327 | 327 | */ |
| 328 | | #define DLT_HHDLC 121 |
| 328 | #define DLT_HHDLC 121 |
| 329 | 329 | |
| 330 | 330 | /* |
| 331 | 331 | * This is for RFC 2625 IP-over-Fibre Channel. |
| r242066 | r242067 | |
| 335 | 335 | * where the link-layer header starts with an RFC 2625 Network_Header |
| 336 | 336 | * field. |
| 337 | 337 | */ |
| 338 | | #define DLT_IP_OVER_FC 122 |
| 338 | #define DLT_IP_OVER_FC 122 |
| 339 | 339 | |
| 340 | 340 | /* |
| 341 | 341 | * This is for Full Frontal ATM on Solaris with SunATM, with a |
| r242066 | r242067 | |
| 351 | 351 | * and the like don't have to infer the presence or absence of a |
| 352 | 352 | * pseudo-header and the form of the pseudo-header. |
| 353 | 353 | */ |
| 354 | | #define DLT_SUNATM 123 /* Solaris+SunATM */ |
| 354 | #define DLT_SUNATM 123 /* Solaris+SunATM */ |
| 355 | 355 | |
| 356 | | /* |
| 356 | /* |
| 357 | 357 | * Reserved as per request from Kent Dahlgren <kent@praesum.com> |
| 358 | 358 | * for private use. |
| 359 | 359 | */ |
| r242066 | r242067 | |
| 366 | 366 | * including radio information, used by some recent BSD drivers as |
| 367 | 367 | * well as the madwifi Atheros driver for Linux. |
| 368 | 368 | */ |
| 369 | | #define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ |
| 369 | #define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ |
| 370 | 370 | |
| 371 | 371 | /* |
| 372 | 372 | * Reserved for the TZSP encapsulation, as per request from |
| r242066 | r242067 | |
| 389 | 389 | * |
| 390 | 390 | * We therefore have to have separate DLT_ values for them. |
| 391 | 391 | */ |
| 392 | | #define DLT_ARCNET_LINUX 129 /* ARCNET */ |
| 392 | #define DLT_ARCNET_LINUX 129 /* ARCNET */ |
| 393 | 393 | |
| 394 | 394 | /* |
| 395 | 395 | * Juniper-private data link types, as per request from |
| r242066 | r242067 | |
| 411 | 411 | * <dieter@apple.com>. The header that's presented is an Ethernet-like |
| 412 | 412 | * header: |
| 413 | 413 | * |
| 414 | | * #define FIREWIRE_EUI64_LEN 8 |
| 415 | | * struct firewire_header { |
| 416 | | * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; |
| 417 | | * u_char firewire_shost[FIREWIRE_EUI64_LEN]; |
| 418 | | * u_short firewire_type; |
| 419 | | * }; |
| 414 | * #define FIREWIRE_EUI64_LEN 8 |
| 415 | * struct firewire_header { |
| 416 | * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; |
| 417 | * u_char firewire_shost[FIREWIRE_EUI64_LEN]; |
| 418 | * u_short firewire_type; |
| 419 | * }; |
| 420 | 420 | * |
| 421 | 421 | * with "firewire_type" being an Ethernet type value, rather than, |
| 422 | 422 | * for example, raw GASP frames being handed up. |
| 423 | 423 | */ |
| 424 | | #define DLT_APPLE_IP_OVER_IEEE1394 138 |
| 424 | #define DLT_APPLE_IP_OVER_IEEE1394 138 |
| 425 | 425 | |
| 426 | 426 | /* |
| 427 | 427 | * Various SS7 encapsulations, as per a request from Jeff Morriss |
| 428 | 428 | * <jeff.morriss[AT]ulticom.com> and subsequent discussions. |
| 429 | 429 | */ |
| 430 | | #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ |
| 431 | | #define DLT_MTP2 140 /* MTP2, without pseudo-header */ |
| 432 | | #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ |
| 433 | | #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ |
| 430 | #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ |
| 431 | #define DLT_MTP2 140 /* MTP2, without pseudo-header */ |
| 432 | #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ |
| 433 | #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ |
| 434 | 434 | |
| 435 | 435 | /* |
| 436 | 436 | * DOCSIS MAC frames. |
| 437 | 437 | */ |
| 438 | | #define DLT_DOCSIS 143 |
| 438 | #define DLT_DOCSIS 143 |
| 439 | 439 | |
| 440 | 440 | /* |
| 441 | 441 | * Linux-IrDA packets. Protocol defined at http://www.irda.org. |
| r242066 | r242067 | |
| 452 | 452 | * issue and define a real DLT_IRDA... |
| 453 | 453 | * Jean II |
| 454 | 454 | */ |
| 455 | | #define DLT_LINUX_IRDA 144 |
| 455 | #define DLT_LINUX_IRDA 144 |
| 456 | 456 | |
| 457 | 457 | /* |
| 458 | 458 | * Reserved for IBM SP switch and IBM Next Federation switch. |
| 459 | 459 | */ |
| 460 | | #define DLT_IBM_SP 145 |
| 461 | | #define DLT_IBM_SN 146 |
| 460 | #define DLT_IBM_SP 145 |
| 461 | #define DLT_IBM_SN 146 |
| 462 | 462 | |
| 463 | 463 | /* |
| 464 | 464 | * Reserved for private use. If you have some link-layer header type |
| r242066 | r242067 | |
| 485 | 485 | * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, |
| 486 | 486 | * as per the comment above, and use the type you're given. |
| 487 | 487 | */ |
| 488 | | #define DLT_USER0 147 |
| 489 | | #define DLT_USER1 148 |
| 490 | | #define DLT_USER2 149 |
| 491 | | #define DLT_USER3 150 |
| 492 | | #define DLT_USER4 151 |
| 493 | | #define DLT_USER5 152 |
| 494 | | #define DLT_USER6 153 |
| 495 | | #define DLT_USER7 154 |
| 496 | | #define DLT_USER8 155 |
| 497 | | #define DLT_USER9 156 |
| 498 | | #define DLT_USER10 157 |
| 499 | | #define DLT_USER11 158 |
| 500 | | #define DLT_USER12 159 |
| 501 | | #define DLT_USER13 160 |
| 502 | | #define DLT_USER14 161 |
| 503 | | #define DLT_USER15 162 |
| 488 | #define DLT_USER0 147 |
| 489 | #define DLT_USER1 148 |
| 490 | #define DLT_USER2 149 |
| 491 | #define DLT_USER3 150 |
| 492 | #define DLT_USER4 151 |
| 493 | #define DLT_USER5 152 |
| 494 | #define DLT_USER6 153 |
| 495 | #define DLT_USER7 154 |
| 496 | #define DLT_USER8 155 |
| 497 | #define DLT_USER9 156 |
| 498 | #define DLT_USER10 157 |
| 499 | #define DLT_USER11 158 |
| 500 | #define DLT_USER12 159 |
| 501 | #define DLT_USER13 160 |
| 502 | #define DLT_USER14 161 |
| 503 | #define DLT_USER15 162 |
| 504 | 504 | |
| 505 | 505 | /* |
| 506 | 506 | * For future use with 802.11 captures - defined by AbsoluteValue |
| 507 | 507 | * Systems to store a number of bits of link-layer information |
| 508 | 508 | * including radio information: |
| 509 | 509 | * |
| 510 | | * http://www.shaftnet.org/~pizza/software/capturefrm.txt |
| 510 | * http://www.shaftnet.org/~pizza/software/capturefrm.txt |
| 511 | 511 | * |
| 512 | 512 | * but it might be used by some non-AVS drivers now or in the |
| 513 | 513 | * future. |
| 514 | 514 | */ |
| 515 | | #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ |
| 515 | #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ |
| 516 | 516 | |
| 517 | 517 | /* |
| 518 | 518 | * Juniper-private data link type, as per request from |
| r242066 | r242067 | |
| 525 | 525 | /* |
| 526 | 526 | * Reserved for BACnet MS/TP. |
| 527 | 527 | */ |
| 528 | | #define DLT_BACNET_MS_TP 165 |
| 528 | #define DLT_BACNET_MS_TP 165 |
| 529 | 529 | |
| 530 | 530 | /* |
| 531 | 531 | * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. |
| r242066 | r242067 | |
| 541 | 541 | * The first byte of the PPP header (0xff03) is modified to accomodate |
| 542 | 542 | * the direction - 0x00 = IN, 0x01 = OUT. |
| 543 | 543 | */ |
| 544 | | #define DLT_PPP_PPPD 166 |
| 544 | #define DLT_PPP_PPPD 166 |
| 545 | 545 | |
| 546 | 546 | /* |
| 547 | 547 | * Names for backwards compatibility with older versions of some PPP |
| 548 | 548 | * software; new software should use DLT_PPP_PPPD. |
| 549 | 549 | */ |
| 550 | | #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD |
| 551 | | #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD |
| 550 | #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD |
| 551 | #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD |
| 552 | 552 | |
| 553 | 553 | /* |
| 554 | 554 | * Juniper-private data link type, as per request from |
| r242066 | r242067 | |
| 559 | 559 | #define DLT_JUNIPER_PPPOE 167 |
| 560 | 560 | #define DLT_JUNIPER_PPPOE_ATM 168 |
| 561 | 561 | |
| 562 | | #define DLT_GPRS_LLC 169 /* GPRS LLC */ |
| 563 | | #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ |
| 564 | | #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ |
| 562 | #define DLT_GPRS_LLC 169 /* GPRS LLC */ |
| 563 | #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ |
| 564 | #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ |
| 565 | 565 | |
| 566 | 566 | /* |
| 567 | 567 | * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line |
| 568 | 568 | * monitoring equipment. |
| 569 | 569 | */ |
| 570 | | #define DLT_GCOM_T1E1 172 |
| 571 | | #define DLT_GCOM_SERIAL 173 |
| 570 | #define DLT_GCOM_T1E1 172 |
| 571 | #define DLT_GCOM_SERIAL 173 |
| 572 | 572 | |
| 573 | 573 | /* |
| 574 | 574 | * Juniper-private data link type, as per request from |
| r242066 | r242067 | |
| 583 | 583 | * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of |
| 584 | 584 | * the link-layer header. |
| 585 | 585 | */ |
| 586 | | #define DLT_ERF_ETH 175 /* Ethernet */ |
| 587 | | #define DLT_ERF_POS 176 /* Packet-over-SONET */ |
| 586 | #define DLT_ERF_ETH 175 /* Ethernet */ |
| 587 | #define DLT_ERF_POS 176 /* Packet-over-SONET */ |
| 588 | 588 | |
| 589 | 589 | /* |
| 590 | 590 | * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD |
| r242066 | r242067 | |
| 592 | 592 | * includes additional information before the LAPD header, so it's |
| 593 | 593 | * not necessarily a generic LAPD header. |
| 594 | 594 | */ |
| 595 | | #define DLT_LINUX_LAPD 177 |
| 595 | #define DLT_LINUX_LAPD 177 |
| 596 | 596 | |
| 597 | 597 | /* |
| 598 | 598 | * Juniper-private data link type, as per request from |
| 599 | | * Hannes Gredler <hannes@juniper.net>. |
| 599 | * Hannes Gredler <hannes@juniper.net>. |
| 600 | 600 | * The DLT_ are used for prepending meta-information |
| 601 | 601 | * like interface index, interface name |
| 602 | 602 | * before standard Ethernet, PPP, Frelay & C-HDLC Frames |
| r242066 | r242067 | |
| 613 | 613 | |
| 614 | 614 | /* |
| 615 | 615 | * Juniper-private data link type, as per request from |
| 616 | | * Hannes Gredler <hannes@juniper.net>. |
| 616 | * Hannes Gredler <hannes@juniper.net>. |
| 617 | 617 | * The DLT_ is used for internal communication with a |
| 618 | 618 | * voice Adapter Card (PIC) |
| 619 | 619 | */ |
| r242066 | r242067 | |
| 639 | 639 | * USB packets, beginning with a USB setup header; requested by |
| 640 | 640 | * Paolo Abeni <paolo.abeni@email.it>. |
| 641 | 641 | */ |
| 642 | | #define DLT_USB 186 |
| 642 | #define DLT_USB 186 |
| 643 | 643 | |
| 644 | 644 | /* |
| 645 | 645 | * Bluetooth HCI UART transport layer (part H:4); requested by |
| 646 | 646 | * Paolo Abeni. |
| 647 | 647 | */ |
| 648 | | #define DLT_BLUETOOTH_HCI_H4 187 |
| 648 | #define DLT_BLUETOOTH_HCI_H4 187 |
| 649 | 649 | |
| 650 | 650 | /* |
| 651 | 651 | * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz |
| 652 | 652 | * <cruz_petagay@bah.com>. |
| 653 | 653 | */ |
| 654 | | #define DLT_IEEE802_16_MAC_CPS 188 |
| 654 | #define DLT_IEEE802_16_MAC_CPS 188 |
| 655 | 655 | |
| 656 | 656 | /* |
| 657 | 657 | * USB packets, beginning with a Linux USB header; requested by |
| 658 | 658 | * Paolo Abeni <paolo.abeni@email.it>. |
| 659 | 659 | */ |
| 660 | | #define DLT_USB_LINUX 189 |
| 660 | #define DLT_USB_LINUX 189 |
| 661 | 661 | |
| 662 | 662 | /* |
| 663 | 663 | * Controller Area Network (CAN) v. 2.0B packets. |
| r242066 | r242067 | |
| 672 | 672 | * IEEE 802.15.4, with address fields padded, as is done by Linux |
| 673 | 673 | * drivers; requested by Juergen Schimmer. |
| 674 | 674 | */ |
| 675 | | #define DLT_IEEE802_15_4_LINUX 191 |
| 675 | #define DLT_IEEE802_15_4_LINUX 191 |
| 676 | 676 | |
| 677 | 677 | /* |
| 678 | 678 | * Per Packet Information encapsulated packets. |
| 679 | 679 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. |
| 680 | 680 | */ |
| 681 | | #define DLT_PPI 192 |
| 681 | #define DLT_PPI 192 |
| 682 | 682 | |
| 683 | 683 | /* |
| 684 | 684 | * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; |
| 685 | 685 | * requested by Charles Clancy. |
| 686 | 686 | */ |
| 687 | | #define DLT_IEEE802_16_MAC_CPS_RADIO 193 |
| 687 | #define DLT_IEEE802_16_MAC_CPS_RADIO 193 |
| 688 | 688 | |
| 689 | 689 | /* |
| 690 | 690 | * Juniper-private data link type, as per request from |
| 691 | | * Hannes Gredler <hannes@juniper.net>. |
| 691 | * Hannes Gredler <hannes@juniper.net>. |
| 692 | 692 | * The DLT_ is used for internal communication with a |
| 693 | 693 | * integrated service module (ISM). |
| 694 | 694 | */ |
| r242066 | r242067 | |
| 698 | 698 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no |
| 699 | 699 | * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. |
| 700 | 700 | */ |
| 701 | | #define DLT_IEEE802_15_4 195 |
| 701 | #define DLT_IEEE802_15_4 195 |
| 702 | 702 | |
| 703 | 703 | /* |
| 704 | 704 | * Various link-layer types, with a pseudo-header, for SITA |
| 705 | 705 | * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). |
| 706 | 706 | */ |
| 707 | | #define DLT_SITA 196 |
| 707 | #define DLT_SITA 196 |
| 708 | 708 | |
| 709 | 709 | /* |
| 710 | 710 | * Various link-layer types, with a pseudo-header, for Endace DAG cards; |
| 711 | 711 | * encapsulates Endace ERF records. Requested by Stephen Donnelly |
| 712 | 712 | * <stephen@endace.com>. |
| 713 | 713 | */ |
| 714 | | #define DLT_ERF 197 |
| 714 | #define DLT_ERF 197 |
| 715 | 715 | |
| 716 | 716 | /* |
| 717 | 717 | * Special header prepended to Ethernet packets when capturing from a |
| 718 | 718 | * u10 Networks board. Requested by Phil Mulholland |
| 719 | 719 | * <phil@u10networks.com>. |
| 720 | 720 | */ |
| 721 | | #define DLT_RAIF1 198 |
| 721 | #define DLT_RAIF1 198 |
| 722 | 722 | |
| 723 | 723 | /* |
| 724 | 724 | * IPMB packet for IPMI, beginning with the I2C slave address, followed |
| 725 | 725 | * by the netFn and LUN, etc.. Requested by Chanthy Toeung |
| 726 | 726 | * <chanthy.toeung@ca.kontron.com>. |
| 727 | 727 | */ |
| 728 | | #define DLT_IPMB 199 |
| 728 | #define DLT_IPMB 199 |
| 729 | 729 | |
| 730 | 730 | /* |
| 731 | 731 | * Juniper-private data link type, as per request from |
| 732 | | * Hannes Gredler <hannes@juniper.net>. |
| 732 | * Hannes Gredler <hannes@juniper.net>. |
| 733 | 733 | * The DLT_ is used for capturing data on a secure tunnel interface. |
| 734 | 734 | */ |
| 735 | 735 | #define DLT_JUNIPER_ST 200 |
| r242066 | r242067 | |
| 738 | 738 | * Bluetooth HCI UART transport layer (part H:4), with pseudo-header |
| 739 | 739 | * that includes direction information; requested by Paolo Abeni. |
| 740 | 740 | */ |
| 741 | | #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 |
| 741 | #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 |
| 742 | 742 | |
| 743 | 743 | /* |
| 744 | 744 | * AX.25 packet with a 1-byte KISS header; see |
| 745 | 745 | * |
| 746 | | * http://www.ax25.net/kiss.htm |
| 746 | * http://www.ax25.net/kiss.htm |
| 747 | 747 | * |
| 748 | 748 | * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. |
| 749 | 749 | */ |
| 750 | | #define DLT_AX25_KISS 202 |
| 750 | #define DLT_AX25_KISS 202 |
| 751 | 751 | |
| 752 | 752 | /* |
| 753 | 753 | * LAPD packets from an ISDN channel, starting with the address field, |
| 754 | 754 | * with no pseudo-header. |
| 755 | 755 | * Requested by Varuna De Silva <varunax@gmail.com>. |
| 756 | 756 | */ |
| 757 | | #define DLT_LAPD 203 |
| 757 | #define DLT_LAPD 203 |
| 758 | 758 | |
| 759 | 759 | /* |
| 760 | 760 | * Variants of various link-layer headers, with a one-byte direction |
| r242066 | r242067 | |
| 762 | 762 | * non-zero (any non-zero value) means "sent by this host" - as per |
| 763 | 763 | * Will Barker <w.barker@zen.co.uk>. |
| 764 | 764 | */ |
| 765 | | #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ |
| 766 | | #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ |
| 767 | | #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ |
| 768 | | #define DLT_LAPB_WITH_DIR 207 /* LAPB */ |
| 765 | #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ |
| 766 | #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ |
| 767 | #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ |
| 768 | #define DLT_LAPB_WITH_DIR 207 /* LAPB */ |
| 769 | 769 | |
| 770 | 770 | /* |
| 771 | 771 | * 208 is reserved for an as-yet-unspecified proprietary link-layer |
| r242066 | r242067 | |
| 776 | 776 | * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman |
| 777 | 777 | * <avn@pigeonpoint.com>. |
| 778 | 778 | */ |
| 779 | | #define DLT_IPMB_LINUX 209 |
| 779 | #define DLT_IPMB_LINUX 209 |
| 780 | 780 | |
| 781 | 781 | /* |
| 782 | 782 | * FlexRay automotive bus - http://www.flexray.com/ - as requested |
| 783 | 783 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. |
| 784 | 784 | */ |
| 785 | | #define DLT_FLEXRAY 210 |
| 785 | #define DLT_FLEXRAY 210 |
| 786 | 786 | |
| 787 | 787 | /* |
| 788 | 788 | * Media Oriented Systems Transport (MOST) bus for multimedia |
| 789 | 789 | * transport - http://www.mostcooperation.com/ - as requested |
| 790 | 790 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. |
| 791 | 791 | */ |
| 792 | | #define DLT_MOST 211 |
| 792 | #define DLT_MOST 211 |
| 793 | 793 | |
| 794 | 794 | /* |
| 795 | 795 | * Local Interconnect Network (LIN) bus for vehicle networks - |
| 796 | 796 | * http://www.lin-subbus.org/ - as requested by Hannes Kaelber |
| 797 | 797 | * <hannes.kaelber@x2e.de>. |
| 798 | 798 | */ |
| 799 | | #define DLT_LIN 212 |
| 799 | #define DLT_LIN 212 |
| 800 | 800 | |
| 801 | 801 | /* |
| 802 | 802 | * X2E-private data link type used for serial line capture, |
| 803 | 803 | * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. |
| 804 | 804 | */ |
| 805 | | #define DLT_X2E_SERIAL 213 |
| 805 | #define DLT_X2E_SERIAL 213 |
| 806 | 806 | |
| 807 | 807 | /* |
| 808 | 808 | * X2E-private data link type used for the Xoraya data logger |
| 809 | 809 | * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. |
| 810 | 810 | */ |
| 811 | | #define DLT_X2E_XORAYA 214 |
| 811 | #define DLT_X2E_XORAYA 214 |
| 812 | 812 | |
| 813 | 813 | /* |
| 814 | 814 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no |
| r242066 | r242067 | |
| 819 | 819 | * |
| 820 | 820 | * Requested by Max Filippov <jcmvbkbc@gmail.com>. |
| 821 | 821 | */ |
| 822 | | #define DLT_IEEE802_15_4_NONASK_PHY 215 |
| 822 | #define DLT_IEEE802_15_4_NONASK_PHY 215 |
| 823 | 823 | |
| 824 | 824 | |
| 825 | 825 | /* |
| r242066 | r242067 | |
| 827 | 827 | * a member of that class. A class value of 0 indicates a regular |
| 828 | 828 | * DLT_/LINKTYPE_ value. |
| 829 | 829 | */ |
| 830 | | #define DLT_CLASS(x) ((x) & 0x03ff0000) |
| 830 | #define DLT_CLASS(x) ((x) & 0x03ff0000) |
| 831 | 831 | |
| 832 | 832 | /* |
| 833 | 833 | * NetBSD-specific generic "raw" link type. The class value indicates |
| r242066 | r242067 | |
| 836 | 836 | * do not assume that they correspond to AF_ values for your operating |
| 837 | 837 | * system. |
| 838 | 838 | */ |
| 839 | | #define DLT_CLASS_NETBSD_RAWAF 0x02240000 |
| 840 | | #define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) |
| 841 | | #define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) |
| 842 | | #define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) |
| 839 | #define DLT_CLASS_NETBSD_RAWAF 0x02240000 |
| 840 | #define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) |
| 841 | #define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) |
| 842 | #define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) |
| 843 | 843 | |
| 844 | 844 | |
| 845 | 845 | /* |
| r242066 | r242067 | |
| 847 | 847 | */ |
| 848 | 848 | /* instruction classes */ |
| 849 | 849 | #define BPF_CLASS(code) ((code) & 0x07) |
| 850 | | #define BPF_LD 0x00 |
| 851 | | #define BPF_LDX 0x01 |
| 852 | | #define BPF_ST 0x02 |
| 853 | | #define BPF_STX 0x03 |
| 854 | | #define BPF_ALU 0x04 |
| 855 | | #define BPF_JMP 0x05 |
| 856 | | #define BPF_RET 0x06 |
| 857 | | #define BPF_MISC 0x07 |
| 850 | #define BPF_LD 0x00 |
| 851 | #define BPF_LDX 0x01 |
| 852 | #define BPF_ST 0x02 |
| 853 | #define BPF_STX 0x03 |
| 854 | #define BPF_ALU 0x04 |
| 855 | #define BPF_JMP 0x05 |
| 856 | #define BPF_RET 0x06 |
| 857 | #define BPF_MISC 0x07 |
| 858 | 858 | |
| 859 | 859 | /* ld/ldx fields */ |
| 860 | | #define BPF_SIZE(code) ((code) & 0x18) |
| 861 | | #define BPF_W 0x00 |
| 862 | | #define BPF_H 0x08 |
| 863 | | #define BPF_B 0x10 |
| 864 | | #define BPF_MODE(code) ((code) & 0xe0) |
| 865 | | #define BPF_IMM 0x00 |
| 866 | | #define BPF_ABS 0x20 |
| 867 | | #define BPF_IND 0x40 |
| 868 | | #define BPF_MEM 0x60 |
| 869 | | #define BPF_LEN 0x80 |
| 870 | | #define BPF_MSH 0xa0 |
| 860 | #define BPF_SIZE(code) ((code) & 0x18) |
| 861 | #define BPF_W 0x00 |
| 862 | #define BPF_H 0x08 |
| 863 | #define BPF_B 0x10 |
| 864 | #define BPF_MODE(code) ((code) & 0xe0) |
| 865 | #define BPF_IMM 0x00 |
| 866 | #define BPF_ABS 0x20 |
| 867 | #define BPF_IND 0x40 |
| 868 | #define BPF_MEM 0x60 |
| 869 | #define BPF_LEN 0x80 |
| 870 | #define BPF_MSH 0xa0 |
| 871 | 871 | |
| 872 | 872 | /* alu/jmp fields */ |
| 873 | | #define BPF_OP(code) ((code) & 0xf0) |
| 874 | | #define BPF_ADD 0x00 |
| 875 | | #define BPF_SUB 0x10 |
| 876 | | #define BPF_MUL 0x20 |
| 877 | | #define BPF_DIV 0x30 |
| 878 | | #define BPF_OR 0x40 |
| 879 | | #define BPF_AND 0x50 |
| 880 | | #define BPF_LSH 0x60 |
| 881 | | #define BPF_RSH 0x70 |
| 882 | | #define BPF_NEG 0x80 |
| 883 | | #define BPF_JA 0x00 |
| 884 | | #define BPF_JEQ 0x10 |
| 885 | | #define BPF_JGT 0x20 |
| 886 | | #define BPF_JGE 0x30 |
| 887 | | #define BPF_JSET 0x40 |
| 888 | | #define BPF_SRC(code) ((code) & 0x08) |
| 889 | | #define BPF_K 0x00 |
| 890 | | #define BPF_X 0x08 |
| 873 | #define BPF_OP(code) ((code) & 0xf0) |
| 874 | #define BPF_ADD 0x00 |
| 875 | #define BPF_SUB 0x10 |
| 876 | #define BPF_MUL 0x20 |
| 877 | #define BPF_DIV 0x30 |
| 878 | #define BPF_OR 0x40 |
| 879 | #define BPF_AND 0x50 |
| 880 | #define BPF_LSH 0x60 |
| 881 | #define BPF_RSH 0x70 |
| 882 | #define BPF_NEG 0x80 |
| 883 | #define BPF_JA 0x00 |
| 884 | #define BPF_JEQ 0x10 |
| 885 | #define BPF_JGT 0x20 |
| 886 | #define BPF_JGE 0x30 |
| 887 | #define BPF_JSET 0x40 |
| 888 | #define BPF_SRC(code) ((code) & 0x08) |
| 889 | #define BPF_K 0x00 |
| 890 | #define BPF_X 0x08 |
| 891 | 891 | |
| 892 | 892 | /* ret - BPF_K and BPF_X also apply */ |
| 893 | | #define BPF_RVAL(code) ((code) & 0x18) |
| 894 | | #define BPF_A 0x10 |
| 893 | #define BPF_RVAL(code) ((code) & 0x18) |
| 894 | #define BPF_A 0x10 |
| 895 | 895 | |
| 896 | 896 | /* misc */ |
| 897 | 897 | #define BPF_MISCOP(code) ((code) & 0xf8) |
| 898 | | #define BPF_TAX 0x00 |
| 899 | | #define BPF_TXA 0x80 |
| 898 | #define BPF_TAX 0x00 |
| 899 | #define BPF_TXA 0x80 |
| 900 | 900 | |
| 901 | 901 | /* |
| 902 | 902 | * The instruction data structure. |
| 903 | 903 | */ |
| 904 | 904 | struct bpf_insn { |
| 905 | | u_short code; |
| 906 | | u_char jt; |
| 907 | | u_char jf; |
| 905 | u_short code; |
| 906 | u_char jt; |
| 907 | u_char jf; |
| 908 | 908 | bpf_u_int32 k; |
| 909 | 909 | }; |
| 910 | 910 | |
trunk/src/lib/winpcap/pcap/pcap.h
| r242066 | r242067 | |
| 1 | 1 | /* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (c) 1993, 1994, 1995, 1996, 1997 |
| 4 | | * The Regents of the University of California. All rights reserved. |
| 4 | * The Regents of the University of California. All rights reserved. |
| 5 | 5 | * |
| 6 | 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | 7 | * modification, are permitted provided that the following conditions |
| r242066 | r242067 | |
| 13 | 13 | * documentation and/or other materials provided with the distribution. |
| 14 | 14 | * 3. All advertising materials mentioning features or use of this software |
| 15 | 15 | * must display the following acknowledgement: |
| 16 | | * This product includes software developed by the Computer Systems |
| 17 | | * Engineering Group at Lawrence Berkeley Laboratory. |
| 16 | * This product includes software developed by the Computer Systems |
| 17 | * Engineering Group at Lawrence Berkeley Laboratory. |
| 18 | 18 | * 4. Neither the name of the University nor of the Laboratory may be used |
| 19 | 19 | * to endorse or promote products derived from this software without |
| 20 | 20 | * specific prior written permission. |
| r242066 | r242067 | |
| 38 | 38 | #define lib_pcap_pcap_h |
| 39 | 39 | |
| 40 | 40 | #if defined(WIN32) |
| 41 | | #include <pcap-stdinc.h> |
| 41 | #include <pcap-stdinc.h> |
| 42 | 42 | #elif defined(MSDOS) |
| 43 | | #include <sys/types.h> |
| 44 | | #include <sys/socket.h> /* u_int, u_char etc. */ |
| 43 | #include <sys/types.h> |
| 44 | #include <sys/socket.h> /* u_int, u_char etc. */ |
| 45 | 45 | #else /* UN*X */ |
| 46 | | #include <sys/types.h> |
| 47 | | #include <sys/time.h> |
| 46 | #include <sys/types.h> |
| 47 | #include <sys/time.h> |
| 48 | 48 | #endif /* WIN32/MSDOS/UN*X */ |
| 49 | 49 | |
| 50 | 50 | #ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H |
| r242066 | r242067 | |
| 80 | 80 | * predates the bpf typedefs for 64-bit support. |
| 81 | 81 | */ |
| 82 | 82 | #if BPF_RELEASE - 0 < 199406 |
| 83 | | typedef int bpf_int32; |
| 84 | | typedef u_int bpf_u_int32; |
| 83 | typedef int bpf_int32; |
| 84 | typedef u_int bpf_u_int32; |
| 85 | 85 | #endif |
| 86 | 86 | |
| 87 | 87 | typedef struct pcap pcap_t; |
| r242066 | r242067 | |
| 105 | 105 | * |
| 106 | 106 | * Instead: |
| 107 | 107 | * |
| 108 | | * introduce a new structure for the new format, if the layout |
| 109 | | * of the structure changed; |
| 108 | * introduce a new structure for the new format, if the layout |
| 109 | * of the structure changed; |
| 110 | 110 | * |
| 111 | | * send mail to "tcpdump-workers@lists.tcpdump.org", requesting |
| 112 | | * a new magic number for your new capture file format, and, when |
| 113 | | * you get the new magic number, put it in "savefile.c"; |
| 111 | * send mail to "tcpdump-workers@lists.tcpdump.org", requesting |
| 112 | * a new magic number for your new capture file format, and, when |
| 113 | * you get the new magic number, put it in "savefile.c"; |
| 114 | 114 | * |
| 115 | | * use that magic number for save files with the changed file |
| 116 | | * header; |
| 115 | * use that magic number for save files with the changed file |
| 116 | * header; |
| 117 | 117 | * |
| 118 | | * make the code in "savefile.c" capable of reading files with |
| 119 | | * the old file header as well as files with the new file header |
| 120 | | * (using the magic number to determine the header format). |
| 118 | * make the code in "savefile.c" capable of reading files with |
| 119 | * the old file header as well as files with the new file header |
| 120 | * (using the magic number to determine the header format). |
| 121 | 121 | * |
| 122 | 122 | * Then supply the changes as a patch at |
| 123 | 123 | * |
| 124 | | * http://sourceforge.net/projects/libpcap/ |
| 124 | * http://sourceforge.net/projects/libpcap/ |
| 125 | 125 | * |
| 126 | 126 | * so that future versions of libpcap and programs that use it (such as |
| 127 | 127 | * tcpdump) will be able to read your new capture file format. |
| r242066 | r242067 | |
| 130 | 130 | bpf_u_int32 magic; |
| 131 | 131 | u_short version_major; |
| 132 | 132 | u_short version_minor; |
| 133 | | bpf_int32 thiszone; /* gmt to local correction */ |
| 134 | | bpf_u_int32 sigfigs; /* accuracy of timestamps */ |
| 135 | | bpf_u_int32 snaplen; /* max length saved portion of each pkt */ |
| 136 | | bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ |
| 133 | bpf_int32 thiszone; /* gmt to local correction */ |
| 134 | bpf_u_int32 sigfigs; /* accuracy of timestamps */ |
| 135 | bpf_u_int32 snaplen; /* max length saved portion of each pkt */ |
| 136 | bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ |
| 137 | 137 | }; |
| 138 | 138 | |
| 139 | 139 | /* |
| 140 | 140 | * Macros for the value returned by pcap_datalink_ext(). |
| 141 | | * |
| 141 | * |
| 142 | 142 | * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro |
| 143 | 143 | * gives the FCS length of packets in the capture. |
| 144 | 144 | */ |
| 145 | | #define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) |
| 146 | | #define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) |
| 147 | | #define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) |
| 145 | #define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) |
| 146 | #define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) |
| 147 | #define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) |
| 148 | 148 | |
| 149 | 149 | typedef enum { |
| 150 | | PCAP_D_INOUT = 0, |
| 151 | | PCAP_D_IN, |
| 152 | | PCAP_D_OUT |
| 150 | PCAP_D_INOUT = 0, |
| 151 | PCAP_D_IN, |
| 152 | PCAP_D_OUT |
| 153 | 153 | } pcap_direction_t; |
| 154 | 154 | |
| 155 | 155 | /* |
| r242066 | r242067 | |
| 165 | 165 | * that's not what the underlying packet capture mechanism supplies. |
| 166 | 166 | */ |
| 167 | 167 | struct pcap_pkthdr { |
| 168 | | struct timeval ts; /* time stamp */ |
| 169 | | bpf_u_int32 caplen; /* length of portion present */ |
| 170 | | bpf_u_int32 len; /* length this packet (off wire) */ |
| 168 | struct timeval ts; /* time stamp */ |
| 169 | bpf_u_int32 caplen; /* length of portion present */ |
| 170 | bpf_u_int32 len; /* length this packet (off wire) */ |
| 171 | 171 | }; |
| 172 | 172 | |
| 173 | 173 | /* |
| 174 | 174 | * As returned by the pcap_stats() |
| 175 | 175 | */ |
| 176 | 176 | struct pcap_stat { |
| 177 | | u_int ps_recv; /* number of packets received */ |
| 178 | | u_int ps_drop; /* number of packets dropped */ |
| 179 | | u_int ps_ifdrop; /* drops by interface XXX not yet supported */ |
| 177 | u_int ps_recv; /* number of packets received */ |
| 178 | u_int ps_drop; /* number of packets dropped */ |
| 179 | u_int ps_ifdrop; /* drops by interface XXX not yet supported */ |
| 180 | 180 | #ifdef HAVE_REMOTE |
| 181 | | u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ |
| 182 | | u_int ps_sent; /* number of packets sent by the server on the network */ |
| 183 | | u_int ps_netdrop; /* number of packets lost on the network */ |
| 181 | u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ |
| 182 | u_int ps_sent; /* number of packets sent by the server on the network */ |
| 183 | u_int ps_netdrop; /* number of packets lost on the network */ |
| 184 | 184 | #endif /* HAVE_REMOTE */ |
| 185 | 185 | }; |
| 186 | 186 | |
| r242066 | r242067 | |
| 189 | 189 | * As returned by the pcap_stats_ex() |
| 190 | 190 | */ |
| 191 | 191 | struct pcap_stat_ex { |
| 192 | | u_long rx_packets; /* total packets received */ |
| 193 | | u_long tx_packets; /* total packets transmitted */ |
| 194 | | u_long rx_bytes; /* total bytes received */ |
| 195 | | u_long tx_bytes; /* total bytes transmitted */ |
| 196 | | u_long rx_errors; /* bad packets received */ |
| 197 | | u_long tx_errors; /* packet transmit problems */ |
| 198 | | u_long rx_dropped; /* no space in Rx buffers */ |
| 199 | | u_long tx_dropped; /* no space available for Tx */ |
| 200 | | u_long multicast; /* multicast packets received */ |
| 201 | | u_long collisions; |
| 192 | u_long rx_packets; /* total packets received */ |
| 193 | u_long tx_packets; /* total packets transmitted */ |
| 194 | u_long rx_bytes; /* total bytes received */ |
| 195 | u_long tx_bytes; /* total bytes transmitted */ |
| 196 | u_long rx_errors; /* bad packets received */ |
| 197 | u_long tx_errors; /* packet transmit problems */ |
| 198 | u_long rx_dropped; /* no space in Rx buffers */ |
| 199 | u_long tx_dropped; /* no space available for Tx */ |
| 200 | u_long multicast; /* multicast packets received */ |
| 201 | u_long collisions; |
| 202 | 202 | |
| 203 | | /* detailed rx_errors: */ |
| 204 | | u_long rx_length_errors; |
| 205 | | u_long rx_over_errors; /* receiver ring buff overflow */ |
| 206 | | u_long rx_crc_errors; /* recv'd pkt with crc error */ |
| 207 | | u_long rx_frame_errors; /* recv'd frame alignment error */ |
| 208 | | u_long rx_fifo_errors; /* recv'r fifo overrun */ |
| 209 | | u_long rx_missed_errors; /* recv'r missed packet */ |
| 203 | /* detailed rx_errors: */ |
| 204 | u_long rx_length_errors; |
| 205 | u_long rx_over_errors; /* receiver ring buff overflow */ |
| 206 | u_long rx_crc_errors; /* recv'd pkt with crc error */ |
| 207 | u_long rx_frame_errors; /* recv'd frame alignment error */ |
| 208 | u_long rx_fifo_errors; /* recv'r fifo overrun */ |
| 209 | u_long rx_missed_errors; /* recv'r missed packet */ |
| 210 | 210 | |
| 211 | | /* detailed tx_errors */ |
| 212 | | u_long tx_aborted_errors; |
| 213 | | u_long tx_carrier_errors; |
| 214 | | u_long tx_fifo_errors; |
| 215 | | u_long tx_heartbeat_errors; |
| 216 | | u_long tx_window_errors; |
| 217 | | }; |
| 211 | /* detailed tx_errors */ |
| 212 | u_long tx_aborted_errors; |
| 213 | u_long tx_carrier_errors; |
| 214 | u_long tx_fifo_errors; |
| 215 | u_long tx_heartbeat_errors; |
| 216 | u_long tx_window_errors; |
| 217 | }; |
| 218 | 218 | #endif |
| 219 | 219 | |
| 220 | 220 | /* |
| r242066 | r242067 | |
| 222 | 222 | */ |
| 223 | 223 | struct pcap_if { |
| 224 | 224 | struct pcap_if *next; |
| 225 | | char *name; /* name to hand to "pcap_open_live()" */ |
| 226 | | char *description; /* textual description of interface, or NULL */ |
| 225 | char *name; /* name to hand to "pcap_open_live()" */ |
| 226 | char *description; /* textual description of interface, or NULL */ |
| 227 | 227 | struct pcap_addr *addresses; |
| 228 | | bpf_u_int32 flags; /* PCAP_IF_ interface flags */ |
| 228 | bpf_u_int32 flags; /* PCAP_IF_ interface flags */ |
| 229 | 229 | }; |
| 230 | 230 | |
| 231 | | #define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ |
| 231 | #define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ |
| 232 | 232 | |
| 233 | 233 | /* |
| 234 | 234 | * Representation of an interface address. |
| 235 | 235 | */ |
| 236 | 236 | struct pcap_addr { |
| 237 | 237 | struct pcap_addr *next; |
| 238 | | struct sockaddr *addr; /* address */ |
| 239 | | struct sockaddr *netmask; /* netmask for that address */ |
| 240 | | struct sockaddr *broadaddr; /* broadcast address for that address */ |
| 241 | | struct sockaddr *dstaddr; /* P2P destination address for that address */ |
| 238 | struct sockaddr *addr; /* address */ |
| 239 | struct sockaddr *netmask; /* netmask for that address */ |
| 240 | struct sockaddr *broadaddr; /* broadcast address for that address */ |
| 241 | struct sockaddr *dstaddr; /* P2P destination address for that address */ |
| 242 | 242 | }; |
| 243 | 243 | |
| 244 | 244 | typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, |
| 245 | | const u_char *); |
| 245 | const u_char *); |
| 246 | 246 | |
| 247 | 247 | /* |
| 248 | 248 | * Error codes for the pcap API. |
| r242066 | r242067 | |
| 250 | 250 | * failure of a call that returns these codes by checking for a |
| 251 | 251 | * negative value. |
| 252 | 252 | */ |
| 253 | | #define PCAP_ERROR -1 /* generic error code */ |
| 254 | | #define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ |
| 255 | | #define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */ |
| 256 | | #define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */ |
| 257 | | #define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */ |
| 258 | | #define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */ |
| 259 | | #define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ |
| 260 | | #define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ |
| 261 | | #define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ |
| 253 | #define PCAP_ERROR -1 /* generic error code */ |
| 254 | #define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ |
| 255 | #define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */ |
| 256 | #define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */ |
| 257 | #define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */ |
| 258 | #define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */ |
| 259 | #define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ |
| 260 | #define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ |
| 261 | #define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ |
| 262 | 262 | |
| 263 | 263 | /* |
| 264 | 264 | * Warning codes for the pcap API. |
| 265 | 265 | * These will all be positive and non-zero, so they won't look like |
| 266 | 266 | * errors. |
| 267 | 267 | */ |
| 268 | | #define PCAP_WARNING 1 /* generic warning code */ |
| 269 | | #define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ |
| 268 | #define PCAP_WARNING 1 /* generic warning code */ |
| 269 | #define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ |
| 270 | 270 | |
| 271 | | char *pcap_lookupdev(char *); |
| 272 | | int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); |
| 271 | char *pcap_lookupdev(char *); |
| 272 | int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); |
| 273 | 273 | |
| 274 | | pcap_t *pcap_create(const char *, char *); |
| 275 | | int pcap_set_snaplen(pcap_t *, int); |
| 276 | | int pcap_set_promisc(pcap_t *, int); |
| 277 | | int pcap_can_set_rfmon(pcap_t *); |
| 278 | | int pcap_set_rfmon(pcap_t *, int); |
| 279 | | int pcap_set_timeout(pcap_t *, int); |
| 280 | | int pcap_set_buffer_size(pcap_t *, int); |
| 281 | | int pcap_activate(pcap_t *); |
| 274 | pcap_t *pcap_create(const char *, char *); |
| 275 | int pcap_set_snaplen(pcap_t *, int); |
| 276 | int pcap_set_promisc(pcap_t *, int); |
| 277 | int pcap_can_set_rfmon(pcap_t *); |
| 278 | int pcap_set_rfmon(pcap_t *, int); |
| 279 | int pcap_set_timeout(pcap_t *, int); |
| 280 | int pcap_set_buffer_size(pcap_t *, int); |
| 281 | int pcap_activate(pcap_t *); |
| 282 | 282 | |
| 283 | | pcap_t *pcap_open_live(const char *, int, int, int, char *); |
| 284 | | pcap_t *pcap_open_dead(int, int); |
| 285 | | pcap_t *pcap_open_offline(const char *, char *); |
| 283 | pcap_t *pcap_open_live(const char *, int, int, int, char *); |
| 284 | pcap_t *pcap_open_dead(int, int); |
| 285 | pcap_t *pcap_open_offline(const char *, char *); |
| 286 | 286 | #if defined(WIN32) |
| 287 | 287 | pcap_t *pcap_hopen_offline(intptr_t, char *); |
| 288 | 288 | #if !defined(LIBPCAP_EXPORTS) |
| r242066 | r242067 | |
| 292 | 292 | static pcap_t *pcap_fopen_offline(FILE *, char *); |
| 293 | 293 | #endif |
| 294 | 294 | #else /*WIN32*/ |
| 295 | | pcap_t *pcap_fopen_offline(FILE *, char *); |
| 295 | pcap_t *pcap_fopen_offline(FILE *, char *); |
| 296 | 296 | #endif /*WIN32*/ |
| 297 | 297 | |
| 298 | | void pcap_close(pcap_t *); |
| 299 | | int pcap_loop(pcap_t *, int, pcap_handler, u_char *); |
| 300 | | int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); |
| 298 | void pcap_close(pcap_t *); |
| 299 | int pcap_loop(pcap_t *, int, pcap_handler, u_char *); |
| 300 | int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); |
| 301 | 301 | const u_char* |
| 302 | 302 | pcap_next(pcap_t *, struct pcap_pkthdr *); |
| 303 | | int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); |
| 304 | | void pcap_breakloop(pcap_t *); |
| 305 | | int pcap_stats(pcap_t *, struct pcap_stat *); |
| 306 | | int pcap_setfilter(pcap_t *, struct bpf_program *); |
| 307 | | int pcap_setdirection(pcap_t *, pcap_direction_t); |
| 308 | | int pcap_getnonblock(pcap_t *, char *); |
| 309 | | int pcap_setnonblock(pcap_t *, int, char *); |
| 310 | | int pcap_inject(pcap_t *, const void *, size_t); |
| 311 | | int pcap_sendpacket(pcap_t *, const u_char *, int); |
| 303 | int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); |
| 304 | void pcap_breakloop(pcap_t *); |
| 305 | int pcap_stats(pcap_t *, struct pcap_stat *); |
| 306 | int pcap_setfilter(pcap_t *, struct bpf_program *); |
| 307 | int pcap_setdirection(pcap_t *, pcap_direction_t); |
| 308 | int pcap_getnonblock(pcap_t *, char *); |
| 309 | int pcap_setnonblock(pcap_t *, int, char *); |
| 310 | int pcap_inject(pcap_t *, const void *, size_t); |
| 311 | int pcap_sendpacket(pcap_t *, const u_char *, int); |
| 312 | 312 | const char *pcap_statustostr(int); |
| 313 | 313 | const char *pcap_strerror(int); |
| 314 | | char *pcap_geterr(pcap_t *); |
| 315 | | void pcap_perror(pcap_t *, char *); |
| 316 | | int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, |
| 317 | | bpf_u_int32); |
| 318 | | int pcap_compile_nopcap(int, int, struct bpf_program *, |
| 319 | | const char *, int, bpf_u_int32); |
| 320 | | void pcap_freecode(struct bpf_program *); |
| 321 | | int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *, |
| 322 | | const u_char *); |
| 323 | | int pcap_datalink(pcap_t *); |
| 324 | | int pcap_datalink_ext(pcap_t *); |
| 325 | | int pcap_list_datalinks(pcap_t *, int **); |
| 326 | | int pcap_set_datalink(pcap_t *, int); |
| 327 | | void pcap_free_datalinks(int *); |
| 328 | | int pcap_datalink_name_to_val(const char *); |
| 314 | char *pcap_geterr(pcap_t *); |
| 315 | void pcap_perror(pcap_t *, char *); |
| 316 | int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, |
| 317 | bpf_u_int32); |
| 318 | int pcap_compile_nopcap(int, int, struct bpf_program *, |
| 319 | const char *, int, bpf_u_int32); |
| 320 | void pcap_freecode(struct bpf_program *); |
| 321 | int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *, |
| 322 | const u_char *); |
| 323 | int pcap_datalink(pcap_t *); |
| 324 | int pcap_datalink_ext(pcap_t *); |
| 325 | int pcap_list_datalinks(pcap_t *, int **); |
| 326 | int pcap_set_datalink(pcap_t *, int); |
| 327 | void pcap_free_datalinks(int *); |
| 328 | int pcap_datalink_name_to_val(const char *); |
| 329 | 329 | const char *pcap_datalink_val_to_name(int); |
| 330 | 330 | const char *pcap_datalink_val_to_description(int); |
| 331 | | int pcap_snapshot(pcap_t *); |
| 332 | | int pcap_is_swapped(pcap_t *); |
| 333 | | int pcap_major_version(pcap_t *); |
| 334 | | int pcap_minor_version(pcap_t *); |
| 331 | int pcap_snapshot(pcap_t *); |
| 332 | int pcap_is_swapped(pcap_t *); |
| 333 | int pcap_major_version(pcap_t *); |
| 334 | int pcap_minor_version(pcap_t *); |
| 335 | 335 | |
| 336 | 336 | /* XXX */ |
| 337 | | FILE *pcap_file(pcap_t *); |
| 338 | | int pcap_fileno(pcap_t *); |
| 337 | FILE *pcap_file(pcap_t *); |
| 338 | int pcap_fileno(pcap_t *); |
| 339 | 339 | |
| 340 | 340 | pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); |
| 341 | 341 | pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); |
| 342 | | FILE *pcap_dump_file(pcap_dumper_t *); |
| 343 | | long pcap_dump_ftell(pcap_dumper_t *); |
| 344 | | int pcap_dump_flush(pcap_dumper_t *); |
| 345 | | void pcap_dump_close(pcap_dumper_t *); |
| 346 | | void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); |
| 342 | FILE *pcap_dump_file(pcap_dumper_t *); |
| 343 | long pcap_dump_ftell(pcap_dumper_t *); |
| 344 | int pcap_dump_flush(pcap_dumper_t *); |
| 345 | void pcap_dump_close(pcap_dumper_t *); |
| 346 | void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); |
| 347 | 347 | |
| 348 | | int pcap_findalldevs(pcap_if_t **, char *); |
| 349 | | void pcap_freealldevs(pcap_if_t *); |
| 348 | int pcap_findalldevs(pcap_if_t **, char *); |
| 349 | void pcap_freealldevs(pcap_if_t *); |
| 350 | 350 | |
| 351 | 351 | const char *pcap_lib_version(void); |
| 352 | 352 | |
| 353 | 353 | /* XXX this guy lives in the bpf tree */ |
| 354 | | u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); |
| 355 | | int bpf_validate(const struct bpf_insn *f, int len); |
| 356 | | char *bpf_image(const struct bpf_insn *, int); |
| 357 | | void bpf_dump(const struct bpf_program *, int); |
| 354 | u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); |
| 355 | int bpf_validate(const struct bpf_insn *f, int len); |
| 356 | char *bpf_image(const struct bpf_insn *, int); |
| 357 | void bpf_dump(const struct bpf_program *, int); |
| 358 | 358 | |
| 359 | 359 | #if defined(WIN32) |
| 360 | 360 | |
| r242066 | r242067 | |
| 391 | 391 | * UN*X definitions |
| 392 | 392 | */ |
| 393 | 393 | |
| 394 | | int pcap_get_selectable_fd(pcap_t *); |
| 394 | int pcap_get_selectable_fd(pcap_t *); |
| 395 | 395 | |
| 396 | 396 | #endif /* WIN32/MSDOS/UN*X */ |
| 397 | 397 | |
| 398 | 398 | #ifdef HAVE_REMOTE |
| 399 | 399 | /* Includes most of the public stuff that is needed for the remote capture */ |
| 400 | 400 | #include <remote-ext.h> |
| 401 | | #endif /* HAVE_REMOTE */ |
| 401 | #endif /* HAVE_REMOTE */ |
| 402 | 402 | |
| 403 | 403 | #ifdef __cplusplus |
| 404 | 404 | } |
trunk/src/lib/winpcap/remote-ext.h
| r242066 | r242067 | |
| 2 | 2 | * Copyright (c) 2002 - 2003 |
| 3 | 3 | * NetGroup, Politecnico di Torino (Italy) |
| 4 | 4 | * All rights reserved. |
| 5 | | * |
| 6 | | * Redistribution and use in source and binary forms, with or without |
| 7 | | * modification, are permitted provided that the following conditions |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | 8 | * are met: |
| 9 | | * |
| 10 | | * 1. Redistributions of source code must retain the above copyright |
| 9 | * |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | | * notice, this list of conditions and the following disclaimer in the |
| 14 | | * documentation and/or other materials provided with the distribution. |
| 15 | | * 3. Neither the name of the Politecnico di Torino nor the names of its |
| 16 | | * contributors may be used to endorse or promote products derived from |
| 17 | | * this software without specific prior written permission. |
| 18 | | * |
| 19 | | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the Politecnico di Torino nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | | * |
| 30 | * |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | 33 | |
| r242066 | r242067 | |
| 49 | 49 | #endif |
| 50 | 50 | |
| 51 | 51 | /*! |
| 52 | | \file remote-ext.h |
| 52 | \file remote-ext.h |
| 53 | 53 | |
| 54 | | The goal of this file it to include most of the new definitions that should be |
| 55 | | placed into the pcap.h file. |
| 54 | The goal of this file it to include most of the new definitions that should be |
| 55 | placed into the pcap.h file. |
| 56 | 56 | |
| 57 | | It includes all new definitions (structures and functions like pcap_open(). |
| 58 | | Some of the functions are not really a remote feature, but, right now, |
| 59 | | they are placed here. |
| 57 | It includes all new definitions (structures and functions like pcap_open(). |
| 58 | Some of the functions are not really a remote feature, but, right now, |
| 59 | they are placed here. |
| 60 | 60 | */ |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // All this stuff is public |
| 65 | 65 | /*! \addtogroup remote_struct |
| 66 | | \{ |
| 66 | \{ |
| 67 | 67 | */ |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /*! |
| 73 | | \brief Defines the maximum buffer size in which address, port, interface names are kept. |
| 73 | \brief Defines the maximum buffer size in which address, port, interface names are kept. |
| 74 | 74 | |
| 75 | | In case the adapter name or such is larger than this value, it is truncated. |
| 76 | | This is not used by the user; however it must be aware that an hostname / interface |
| 77 | | name longer than this value will be truncated. |
| 75 | In case the adapter name or such is larger than this value, it is truncated. |
| 76 | This is not used by the user; however it must be aware that an hostname / interface |
| 77 | name longer than this value will be truncated. |
| 78 | 78 | */ |
| 79 | 79 | #define PCAP_BUF_SIZE 1024 |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | /*! \addtogroup remote_source_ID |
| 83 | | \{ |
| 83 | \{ |
| 84 | 84 | */ |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | /*! |
| 88 | | \brief Internal representation of the type of source in use (file, |
| 89 | | remote/local interface). |
| 88 | \brief Internal representation of the type of source in use (file, |
| 89 | remote/local interface). |
| 90 | 90 | |
| 91 | | This indicates a file, i.e. the user want to open a capture from a local file. |
| 91 | This indicates a file, i.e. the user want to open a capture from a local file. |
| 92 | 92 | */ |
| 93 | 93 | #define PCAP_SRC_FILE 2 |
| 94 | 94 | /*! |
| 95 | | \brief Internal representation of the type of source in use (file, |
| 96 | | remote/local interface). |
| 95 | \brief Internal representation of the type of source in use (file, |
| 96 | remote/local interface). |
| 97 | 97 | |
| 98 | | This indicates a local interface, i.e. the user want to open a capture from |
| 99 | | a local interface. This does not involve the RPCAP protocol. |
| 98 | This indicates a local interface, i.e. the user want to open a capture from |
| 99 | a local interface. This does not involve the RPCAP protocol. |
| 100 | 100 | */ |
| 101 | 101 | #define PCAP_SRC_IFLOCAL 3 |
| 102 | 102 | /*! |
| 103 | | \brief Internal representation of the type of source in use (file, |
| 104 | | remote/local interface). |
| 103 | \brief Internal representation of the type of source in use (file, |
| 104 | remote/local interface). |
| 105 | 105 | |
| 106 | | This indicates a remote interface, i.e. the user want to open a capture from |
| 107 | | an interface on a remote host. This does involve the RPCAP protocol. |
| 106 | This indicates a remote interface, i.e. the user want to open a capture from |
| 107 | an interface on a remote host. This does involve the RPCAP protocol. |
| 108 | 108 | */ |
| 109 | 109 | #define PCAP_SRC_IFREMOTE 4 |
| 110 | 110 | |
| 111 | 111 | /*! |
| 112 | | \} |
| 112 | \} |
| 113 | 113 | */ |
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /*! \addtogroup remote_source_string |
| 118 | 118 | |
| 119 | | The formats allowed by the pcap_open() are the following: |
| 120 | | - file://path_and_filename [opens a local file] |
| 121 | | - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] |
| 122 | | - rpcap://host/devicename [opens the selected device available on a remote host] |
| 123 | | - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] |
| 124 | | - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged] |
| 125 | | - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged] |
| 119 | The formats allowed by the pcap_open() are the following: |
| 120 | - file://path_and_filename [opens a local file] |
| 121 | - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] |
| 122 | - rpcap://host/devicename [opens the selected device available on a remote host] |
| 123 | - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] |
| 124 | - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged] |
| 125 | - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged] |
| 126 | 126 | |
| 127 | | The formats allowed by the pcap_findalldevs_ex() are the following: |
| 128 | | - file://folder/ [lists all the files in the given folder] |
| 129 | | - rpcap:// [lists all local adapters] |
| 130 | | - rpcap://host:port/ [lists the devices available on a remote host] |
| 127 | The formats allowed by the pcap_findalldevs_ex() are the following: |
| 128 | - file://folder/ [lists all the files in the given folder] |
| 129 | - rpcap:// [lists all local adapters] |
| 130 | - rpcap://host:port/ [lists the devices available on a remote host] |
| 131 | 131 | |
| 132 | | Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since |
| 133 | | IPv6 is fully supported, these are the allowed formats: |
| 132 | Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since |
| 133 | IPv6 is fully supported, these are the allowed formats: |
| 134 | 134 | |
| 135 | | - host (literal): e.g. host.foo.bar |
| 136 | | - host (numeric IPv4): e.g. 10.11.12.13 |
| 137 | | - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] |
| 138 | | - host (numeric IPv6): e.g. [1:2:3::4] |
| 139 | | - port: can be either numeric (e.g. '80') or literal (e.g. 'http') |
| 135 | - host (literal): e.g. host.foo.bar |
| 136 | - host (numeric IPv4): e.g. 10.11.12.13 |
| 137 | - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] |
| 138 | - host (numeric IPv6): e.g. [1:2:3::4] |
| 139 | - port: can be either numeric (e.g. '80') or literal (e.g. 'http') |
| 140 | 140 | |
| 141 | | Here you find some allowed examples: |
| 142 | | - rpcap://host.foo.bar/devicename [everything literal, no port number] |
| 143 | | - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] |
| 144 | | - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] |
| 145 | | - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] |
| 146 | | - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] |
| 147 | | - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] |
| 148 | | - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] |
| 149 | | - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] |
| 150 | | |
| 151 | | \{ |
| 141 | Here you find some allowed examples: |
| 142 | - rpcap://host.foo.bar/devicename [everything literal, no port number] |
| 143 | - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] |
| 144 | - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] |
| 145 | - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] |
| 146 | - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] |
| 147 | - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] |
| 148 | - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] |
| 149 | - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] |
| 150 | |
| 151 | \{ |
| 152 | 152 | */ |
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | /*! |
| 156 | | \brief String that will be used to determine the type of source in use (file, |
| 157 | | remote/local interface). |
| 156 | \brief String that will be used to determine the type of source in use (file, |
| 157 | remote/local interface). |
| 158 | 158 | |
| 159 | | This string will be prepended to the interface name in order to create a string |
| 160 | | that contains all the information required to open the source. |
| 159 | This string will be prepended to the interface name in order to create a string |
| 160 | that contains all the information required to open the source. |
| 161 | 161 | |
| 162 | | This string indicates that the user wants to open a capture from a local file. |
| 162 | This string indicates that the user wants to open a capture from a local file. |
| 163 | 163 | */ |
| 164 | 164 | #define PCAP_SRC_FILE_STRING "file://" |
| 165 | 165 | /*! |
| 166 | | \brief String that will be used to determine the type of source in use (file, |
| 167 | | remote/local interface). |
| 166 | \brief String that will be used to determine the type of source in use (file, |
| 167 | remote/local interface). |
| 168 | 168 | |
| 169 | | This string will be prepended to the interface name in order to create a string |
| 170 | | that contains all the information required to open the source. |
| 169 | This string will be prepended to the interface name in order to create a string |
| 170 | that contains all the information required to open the source. |
| 171 | 171 | |
| 172 | | This string indicates that the user wants to open a capture from a network interface. |
| 173 | | This string does not necessarily involve the use of the RPCAP protocol. If the |
| 174 | | interface required resides on the local host, the RPCAP protocol is not involved |
| 175 | | and the local functions are used. |
| 172 | This string indicates that the user wants to open a capture from a network interface. |
| 173 | This string does not necessarily involve the use of the RPCAP protocol. If the |
| 174 | interface required resides on the local host, the RPCAP protocol is not involved |
| 175 | and the local functions are used. |
| 176 | 176 | */ |
| 177 | 177 | #define PCAP_SRC_IF_STRING "rpcap://" |
| 178 | 178 | |
| 179 | 179 | /*! |
| 180 | | \} |
| 180 | \} |
| 181 | 181 | */ |
| 182 | 182 | |
| 183 | 183 | |
| r242066 | r242067 | |
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | /*! |
| 188 | | \addtogroup remote_open_flags |
| 189 | | \{ |
| 188 | \addtogroup remote_open_flags |
| 189 | \{ |
| 190 | 190 | */ |
| 191 | 191 | |
| 192 | 192 | /*! |
| 193 | | \brief Defines if the adapter has to go in promiscuous mode. |
| 193 | \brief Defines if the adapter has to go in promiscuous mode. |
| 194 | 194 | |
| 195 | | It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. |
| 196 | | Note that even if this parameter is false, the interface could well be in promiscuous |
| 197 | | mode for some other reason (for example because another capture process with |
| 198 | | promiscuous mode enabled is currently using that interface). |
| 199 | | On on Linux systems with 2.2 or later kernels (that have the "any" device), this |
| 200 | | flag does not work on the "any" device; if an argument of "any" is supplied, |
| 201 | | the 'promisc' flag is ignored. |
| 195 | It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. |
| 196 | Note that even if this parameter is false, the interface could well be in promiscuous |
| 197 | mode for some other reason (for example because another capture process with |
| 198 | promiscuous mode enabled is currently using that interface). |
| 199 | On on Linux systems with 2.2 or later kernels (that have the "any" device), this |
| 200 | flag does not work on the "any" device; if an argument of "any" is supplied, |
| 201 | the 'promisc' flag is ignored. |
| 202 | 202 | */ |
| 203 | | #define PCAP_OPENFLAG_PROMISCUOUS 1 |
| 203 | #define PCAP_OPENFLAG_PROMISCUOUS 1 |
| 204 | 204 | |
| 205 | 205 | /*! |
| 206 | | \brief Defines if the data trasfer (in case of a remote |
| 207 | | capture) has to be done with UDP protocol. |
| 206 | \brief Defines if the data trasfer (in case of a remote |
| 207 | capture) has to be done with UDP protocol. |
| 208 | 208 | |
| 209 | | If it is '1' if you want a UDP data connection, '0' if you want |
| 210 | | a TCP data connection; control connection is always TCP-based. |
| 211 | | A UDP connection is much lighter, but it does not guarantee that all |
| 212 | | the captured packets arrive to the client workstation. Moreover, |
| 213 | | it could be harmful in case of network congestion. |
| 214 | | This flag is meaningless if the source is not a remote interface. |
| 215 | | In that case, it is simply ignored. |
| 209 | If it is '1' if you want a UDP data connection, '0' if you want |
| 210 | a TCP data connection; control connection is always TCP-based. |
| 211 | A UDP connection is much lighter, but it does not guarantee that all |
| 212 | the captured packets arrive to the client workstation. Moreover, |
| 213 | it could be harmful in case of network congestion. |
| 214 | This flag is meaningless if the source is not a remote interface. |
| 215 | In that case, it is simply ignored. |
| 216 | 216 | */ |
| 217 | | #define PCAP_OPENFLAG_DATATX_UDP 2 |
| 217 | #define PCAP_OPENFLAG_DATATX_UDP 2 |
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | /*! |
| 221 | | \brief Defines if the remote probe will capture its own generated traffic. |
| 221 | \brief Defines if the remote probe will capture its own generated traffic. |
| 222 | 222 | |
| 223 | | In case the remote probe uses the same interface to capture traffic and to send |
| 224 | | data back to the caller, the captured traffic includes the RPCAP traffic as well. |
| 225 | | If this flag is turned on, the RPCAP traffic is excluded from the capture, so that |
| 226 | | the trace returned back to the collector is does not include this traffic. |
| 223 | In case the remote probe uses the same interface to capture traffic and to send |
| 224 | data back to the caller, the captured traffic includes the RPCAP traffic as well. |
| 225 | If this flag is turned on, the RPCAP traffic is excluded from the capture, so that |
| 226 | the trace returned back to the collector is does not include this traffic. |
| 227 | 227 | */ |
| 228 | | #define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 |
| 228 | #define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 |
| 229 | 229 | |
| 230 | 230 | /*! |
| 231 | | \brief Defines if the local adapter will capture its own generated traffic. |
| 231 | \brief Defines if the local adapter will capture its own generated traffic. |
| 232 | 232 | |
| 233 | | This flag tells the underlying capture driver to drop the packets that were sent by itself. |
| 234 | | This is usefult when building applications like bridges, that should ignore the traffic |
| 235 | | they just sent. |
| 233 | This flag tells the underlying capture driver to drop the packets that were sent by itself. |
| 234 | This is usefult when building applications like bridges, that should ignore the traffic |
| 235 | they just sent. |
| 236 | 236 | */ |
| 237 | | #define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8 |
| 237 | #define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8 |
| 238 | 238 | |
| 239 | 239 | /*! |
| 240 | | \brief This flag configures the adapter for maximum responsiveness. |
| 240 | \brief This flag configures the adapter for maximum responsiveness. |
| 241 | 241 | |
| 242 | | In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before |
| 243 | | copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, |
| 244 | | i.e. better performance, which is good for applications like sniffers. If the user sets the |
| 245 | | PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application |
| 246 | | is ready to receive them. This is suggested for real time applications (like, for example, a bridge) |
| 247 | | that need the best responsiveness.*/ |
| 248 | | #define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16 |
| 242 | In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before |
| 243 | copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, |
| 244 | i.e. better performance, which is good for applications like sniffers. If the user sets the |
| 245 | PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application |
| 246 | is ready to receive them. This is suggested for real time applications (like, for example, a bridge) |
| 247 | that need the best responsiveness.*/ |
| 248 | #define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16 |
| 249 | 249 | |
| 250 | 250 | /*! |
| 251 | | \} |
| 251 | \} |
| 252 | 252 | */ |
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | /*! |
| 256 | | \addtogroup remote_samp_methods |
| 257 | | \{ |
| 256 | \addtogroup remote_samp_methods |
| 257 | \{ |
| 258 | 258 | */ |
| 259 | 259 | |
| 260 | 260 | /*! |
| 261 | | \brief No sampling has to be done on the current capture. |
| 261 | \brief No sampling has to be done on the current capture. |
| 262 | 262 | |
| 263 | | In this case, no sampling algorithms are applied to the current capture. |
| 263 | In this case, no sampling algorithms are applied to the current capture. |
| 264 | 264 | */ |
| 265 | | #define PCAP_SAMP_NOSAMP 0 |
| 265 | #define PCAP_SAMP_NOSAMP 0 |
| 266 | 266 | |
| 267 | 267 | /*! |
| 268 | | \brief It defines that only 1 out of N packets must be returned to the user. |
| 268 | \brief It defines that only 1 out of N packets must be returned to the user. |
| 269 | 269 | |
| 270 | | In this case, the 'value' field of the 'pcap_samp' structure indicates the |
| 271 | | number of packets (minus 1) that must be discarded before one packet got accepted. |
| 272 | | In other words, if 'value = 10', the first packet is returned to the caller, while |
| 273 | | the following 9 are discarded. |
| 270 | In this case, the 'value' field of the 'pcap_samp' structure indicates the |
| 271 | number of packets (minus 1) that must be discarded before one packet got accepted. |
| 272 | In other words, if 'value = 10', the first packet is returned to the caller, while |
| 273 | the following 9 are discarded. |
| 274 | 274 | */ |
| 275 | | #define PCAP_SAMP_1_EVERY_N 1 |
| 275 | #define PCAP_SAMP_1_EVERY_N 1 |
| 276 | 276 | |
| 277 | 277 | /*! |
| 278 | | \brief It defines that we have to return 1 packet every N milliseconds. |
| 278 | \brief It defines that we have to return 1 packet every N milliseconds. |
| 279 | 279 | |
| 280 | | In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting |
| 281 | | time' in milliseconds before one packet got accepted. |
| 282 | | In other words, if 'value = 10', the first packet is returned to the caller; the next |
| 283 | | returned one will be the first packet that arrives when 10ms have elapsed. |
| 280 | In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting |
| 281 | time' in milliseconds before one packet got accepted. |
| 282 | In other words, if 'value = 10', the first packet is returned to the caller; the next |
| 283 | returned one will be the first packet that arrives when 10ms have elapsed. |
| 284 | 284 | */ |
| 285 | 285 | #define PCAP_SAMP_FIRST_AFTER_N_MS 2 |
| 286 | 286 | |
| 287 | 287 | /*! |
| 288 | | \} |
| 288 | \} |
| 289 | 289 | */ |
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /*! |
| 293 | | \addtogroup remote_auth_methods |
| 294 | | \{ |
| 293 | \addtogroup remote_auth_methods |
| 294 | \{ |
| 295 | 295 | */ |
| 296 | 296 | |
| 297 | 297 | /*! |
| 298 | | \brief It defines the NULL authentication. |
| 298 | \brief It defines the NULL authentication. |
| 299 | 299 | |
| 300 | | This value has to be used within the 'type' member of the pcap_rmtauth structure. |
| 301 | | The 'NULL' authentication has to be equal to 'zero', so that old applications |
| 302 | | can just put every field of struct pcap_rmtauth to zero, and it does work. |
| 300 | This value has to be used within the 'type' member of the pcap_rmtauth structure. |
| 301 | The 'NULL' authentication has to be equal to 'zero', so that old applications |
| 302 | can just put every field of struct pcap_rmtauth to zero, and it does work. |
| 303 | 303 | */ |
| 304 | 304 | #define RPCAP_RMTAUTH_NULL 0 |
| 305 | 305 | /*! |
| 306 | | \brief It defines the username/password authentication. |
| 306 | \brief It defines the username/password authentication. |
| 307 | 307 | |
| 308 | | With this type of authentication, the RPCAP protocol will use the username/ |
| 309 | | password provided to authenticate the user on the remote machine. If the |
| 310 | | authentication is successful (and the user has the right to open network devices) |
| 311 | | the RPCAP connection will continue; otherwise it will be dropped. |
| 308 | With this type of authentication, the RPCAP protocol will use the username/ |
| 309 | password provided to authenticate the user on the remote machine. If the |
| 310 | authentication is successful (and the user has the right to open network devices) |
| 311 | the RPCAP connection will continue; otherwise it will be dropped. |
| 312 | 312 | |
| 313 | | This value has to be used within the 'type' member of the pcap_rmtauth structure. |
| 313 | This value has to be used within the 'type' member of the pcap_rmtauth structure. |
| 314 | 314 | */ |
| 315 | 315 | #define RPCAP_RMTAUTH_PWD 1 |
| 316 | 316 | |
| 317 | 317 | /*! |
| 318 | | \} |
| 318 | \} |
| 319 | 319 | */ |
| 320 | 320 | |
| 321 | 321 | |
| r242066 | r242067 | |
| 323 | 323 | |
| 324 | 324 | /*! |
| 325 | 325 | |
| 326 | | \brief This structure keeps the information needed to autheticate |
| 327 | | the user on a remote machine. |
| 328 | | |
| 329 | | The remote machine can either grant or refuse the access according |
| 330 | | to the information provided. |
| 331 | | In case the NULL authentication is required, both 'username' and |
| 332 | | 'password' can be NULL pointers. |
| 333 | | |
| 334 | | This structure is meaningless if the source is not a remote interface; |
| 335 | | in that case, the functions which requires such a structure can accept |
| 336 | | a NULL pointer as well. |
| 326 | \brief This structure keeps the information needed to autheticate |
| 327 | the user on a remote machine. |
| 328 | |
| 329 | The remote machine can either grant or refuse the access according |
| 330 | to the information provided. |
| 331 | In case the NULL authentication is required, both 'username' and |
| 332 | 'password' can be NULL pointers. |
| 333 | |
| 334 | This structure is meaningless if the source is not a remote interface; |
| 335 | in that case, the functions which requires such a structure can accept |
| 336 | a NULL pointer as well. |
| 337 | 337 | */ |
| 338 | 338 | struct pcap_rmtauth |
| 339 | 339 | { |
| 340 | 340 | /*! |
| 341 | | \brief Type of the authentication required. |
| 341 | \brief Type of the authentication required. |
| 342 | 342 | |
| 343 | | In order to provide maximum flexibility, we can support different types |
| 344 | | of authentication based on the value of this 'type' variable. The currently |
| 345 | | supported authentication methods are defined into the |
| 346 | | \link remote_auth_methods Remote Authentication Methods Section\endlink. |
| 343 | In order to provide maximum flexibility, we can support different types |
| 344 | of authentication based on the value of this 'type' variable. The currently |
| 345 | supported authentication methods are defined into the |
| 346 | \link remote_auth_methods Remote Authentication Methods Section\endlink. |
| 347 | 347 | |
| 348 | 348 | */ |
| 349 | 349 | int type; |
| 350 | 350 | /*! |
| 351 | | \brief Zero-terminated string containing the username that has to be |
| 352 | | used on the remote machine for authentication. |
| 353 | | |
| 354 | | This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication |
| 355 | | and it can be NULL. |
| 351 | \brief Zero-terminated string containing the username that has to be |
| 352 | used on the remote machine for authentication. |
| 353 | |
| 354 | This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication |
| 355 | and it can be NULL. |
| 356 | 356 | */ |
| 357 | 357 | char *username; |
| 358 | 358 | /*! |
| 359 | | \brief Zero-terminated string containing the password that has to be |
| 360 | | used on the remote machine for authentication. |
| 361 | | |
| 362 | | This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication |
| 363 | | and it can be NULL. |
| 359 | \brief Zero-terminated string containing the password that has to be |
| 360 | used on the remote machine for authentication. |
| 361 | |
| 362 | This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication |
| 363 | and it can be NULL. |
| 364 | 364 | */ |
| 365 | 365 | char *password; |
| 366 | 366 | }; |
| 367 | 367 | |
| 368 | 368 | |
| 369 | 369 | /*! |
| 370 | | \brief This structure defines the information related to sampling. |
| 370 | \brief This structure defines the information related to sampling. |
| 371 | 371 | |
| 372 | | In case the sampling is requested, the capturing device should read |
| 373 | | only a subset of the packets coming from the source. The returned packets depend |
| 374 | | on the sampling parameters. |
| 372 | In case the sampling is requested, the capturing device should read |
| 373 | only a subset of the packets coming from the source. The returned packets depend |
| 374 | on the sampling parameters. |
| 375 | 375 | |
| 376 | | \warning The sampling process is applied <strong>after</strong> the filtering process. |
| 377 | | In other words, packets are filtered first, then the sampling process selects a |
| 378 | | subset of the 'filtered' packets and it returns them to the caller. |
| 376 | \warning The sampling process is applied <strong>after</strong> the filtering process. |
| 377 | In other words, packets are filtered first, then the sampling process selects a |
| 378 | subset of the 'filtered' packets and it returns them to the caller. |
| 379 | 379 | */ |
| 380 | 380 | struct pcap_samp |
| 381 | 381 | { |
| 382 | 382 | /*! |
| 383 | | Method used for sampling. Currently, the supported methods are listed in the |
| 384 | | \link remote_samp_methods Sampling Methods Section\endlink. |
| 383 | Method used for sampling. Currently, the supported methods are listed in the |
| 384 | \link remote_samp_methods Sampling Methods Section\endlink. |
| 385 | 385 | */ |
| 386 | 386 | int method; |
| 387 | 387 | |
| 388 | 388 | /*! |
| 389 | | This value depends on the sampling method defined. For its meaning, please check |
| 390 | | at the \link remote_samp_methods Sampling Methods Section\endlink. |
| 389 | This value depends on the sampling method defined. For its meaning, please check |
| 390 | at the \link remote_samp_methods Sampling Methods Section\endlink. |
| 391 | 391 | */ |
| 392 | 392 | int value; |
| 393 | 393 | }; |
| r242066 | r242067 | |
| 400 | 400 | |
| 401 | 401 | |
| 402 | 402 | /*! |
| 403 | | \} |
| 403 | \} |
| 404 | 404 | */ // end of public documentation |
| 405 | 405 | |
| 406 | 406 | |
| r242066 | r242067 | |
| 410 | 410 | |
| 411 | 411 | /** \name New WinPcap functions |
| 412 | 412 | |
| 413 | | This section lists the new functions that are able to help considerably in writing |
| 414 | | WinPcap programs because of their easiness of use. |
| 413 | This section lists the new functions that are able to help considerably in writing |
| 414 | WinPcap programs because of their easiness of use. |
| 415 | 415 | */ |
| 416 | 416 | //\{ |
| 417 | 417 | pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf); |
| r242066 | r242067 | |
| 427 | 427 | |
| 428 | 428 | /** \name Remote Capture functions |
| 429 | 429 | */ |
| 430 | | //\{ |
| 430 | //\{ |
| 431 | 431 | SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf); |
| 432 | 432 | int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf); |
| 433 | 433 | int pcap_remoteact_close(const char *host, char *errbuf); |
| r242066 | r242067 | |
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | #endif |
| 444 | | |
trunk/src/mame/drivers/alpha68k.c
| r242066 | r242067 | |
| 1876 | 1876 | // AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE_LEGACY("adpcm", saiyugoub1_adpcm_control_w) |
| 1877 | 1877 | ADDRESS_MAP_END |
| 1878 | 1878 | |
| 1879 | | // Pixel clock, assuming that it can't be 4 MHz because 4 MHz / 15,20 KHz = 263 HTOTAL (VERY unlikely). |
| 1879 | // Pixel clock, assuming that it can't be 4 MHz because 4 MHz / 15,20 KHz = 263 HTOTAL (VERY unlikely). |
| 1880 | 1880 | #define ALPHA68K_PIXEL_CLOCK XTAL_24MHz/4 |
| 1881 | 1881 | #define ALPHA68K_HTOTAL 394 |
| 1882 | 1882 | #define ALPHA68K_HBEND 0 |
| r242066 | r242067 | |
| 1909 | 1909 | |
| 1910 | 1910 | /* video hardware */ |
| 1911 | 1911 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1912 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 1913 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1914 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 1915 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 1912 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 1913 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1914 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 1915 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 1916 | 1916 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 1917 | 1917 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_sstingry) |
| 1918 | 1918 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 1958 | 1958 | |
| 1959 | 1959 | /* video hardware */ |
| 1960 | 1960 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1961 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 1962 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1963 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 1964 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 1961 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 1962 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1963 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 1964 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 1965 | 1965 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 1966 | 1966 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros) |
| 1967 | 1967 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2006 | 2006 | |
| 2007 | 2007 | /* video hardware */ |
| 2008 | 2008 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2009 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2010 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2011 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2012 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2009 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2010 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2011 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2012 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2013 | 2013 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2014 | 2014 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros) |
| 2015 | 2015 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2043 | 2043 | |
| 2044 | 2044 | /* video hardware */ |
| 2045 | 2045 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2046 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2047 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2048 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2049 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2046 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2047 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2048 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2049 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2050 | 2050 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2051 | 2051 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I) |
| 2052 | 2052 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2088 | 2088 | |
| 2089 | 2089 | /* video hardware */ |
| 2090 | 2090 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2091 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2092 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2093 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2094 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2091 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2092 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2093 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2094 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2095 | 2095 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2096 | 2096 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II) |
| 2097 | 2097 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2141 | 2141 | |
| 2142 | 2142 | /* video hardware */ |
| 2143 | 2143 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2144 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2145 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2146 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2147 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2144 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2145 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2146 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2147 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2148 | 2148 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2149 | 2149 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II) |
| 2150 | 2150 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2187 | 2187 | |
| 2188 | 2188 | /* video hardware */ |
| 2189 | 2189 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2190 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2191 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2192 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2193 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2190 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2191 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2192 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2193 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2194 | 2194 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2195 | 2195 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V) |
| 2196 | 2196 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2233 | 2233 | |
| 2234 | 2234 | /* video hardware */ |
| 2235 | 2235 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2236 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2237 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2238 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2239 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2236 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2237 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2238 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2239 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2240 | 2240 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2241 | 2241 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V_sb) |
| 2242 | 2242 | MCFG_SCREEN_PALETTE("palette") |
| r242066 | r242067 | |
| 2278 | 2278 | |
| 2279 | 2279 | /* video hardware */ |
| 2280 | 2280 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2281 | | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2282 | | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2283 | | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2284 | | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2281 | // MCFG_SCREEN_REFRESH_RATE(60) |
| 2282 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 2283 | // MCFG_SCREEN_SIZE(32*8, 32*8) |
| 2284 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 2285 | 2285 | MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART) |
| 2286 | 2286 | MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I) |
| 2287 | 2287 | MCFG_SCREEN_PALETTE("palette") |
trunk/src/mame/drivers/gts80b.c
| r242066 | r242067 | |
| 252 | 252 | INPUT_PORTS_END |
| 253 | 253 | |
| 254 | 254 | static const UINT16 patterns[] = { |
| 255 | | /* 0x00-0x07 */ 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 256 | | /* 0x08-0x0f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 257 | | /* 0x10-0x17 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 258 | | /* 0x18-0x1f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 259 | | /* 0x20-0x27 */ 0x0000, 0x0309, 0x0220, 0x2A4E, 0x2A6D, 0x6E65, 0x135D, 0x0400, |
| 260 | | /* 0x28-0x2f */ 0x1400, 0x4100, 0x7F40, 0x2A40, 0x0000, 0x0840, 0x0000, 0x4400, |
| 261 | | /* 0x30-0x37 */ 0x003f, 0x2200, 0x085B, 0x084f, 0x0866, 0x086D, 0x087D, 0x0007, |
| 262 | | /* 0x38-0x3f */ 0x087F, 0x086F, 0x0009, 0x4001, 0x4408, 0x0848, 0x1108, 0x2803, |
| 263 | | /* 0x40-0x47 */ 0x205F, 0x0877, 0x2A0F, 0x0039, 0x220F, 0x0079, 0x0071, 0x083D, |
| 264 | | /* 0x48-0x4f */ 0x0876, 0x2209, 0x001E, 0x1470, 0x0038, 0x0536, 0x1136, 0x003f, |
| 265 | | /* 0x50-0x57 */ 0x0873, 0x103F, 0x1873, 0x086D, 0x2201, 0x003E, 0x4430, 0x5036, |
| 266 | | /* 0x58-0x5f */ 0x5500, 0x2500, 0x4409, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 267 | | /* 0x60-0x67 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 268 | | /* 0x68-0x6f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 269 | | /* 0x70-0x77 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 270 | | /* 0x78-0x7f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 255 | /* 0x00-0x07 */ 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 256 | /* 0x08-0x0f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 257 | /* 0x10-0x17 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 258 | /* 0x18-0x1f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 259 | /* 0x20-0x27 */ 0x0000, 0x0309, 0x0220, 0x2A4E, 0x2A6D, 0x6E65, 0x135D, 0x0400, |
| 260 | /* 0x28-0x2f */ 0x1400, 0x4100, 0x7F40, 0x2A40, 0x0000, 0x0840, 0x0000, 0x4400, |
| 261 | /* 0x30-0x37 */ 0x003f, 0x2200, 0x085B, 0x084f, 0x0866, 0x086D, 0x087D, 0x0007, |
| 262 | /* 0x38-0x3f */ 0x087F, 0x086F, 0x0009, 0x4001, 0x4408, 0x0848, 0x1108, 0x2803, |
| 263 | /* 0x40-0x47 */ 0x205F, 0x0877, 0x2A0F, 0x0039, 0x220F, 0x0079, 0x0071, 0x083D, |
| 264 | /* 0x48-0x4f */ 0x0876, 0x2209, 0x001E, 0x1470, 0x0038, 0x0536, 0x1136, 0x003f, |
| 265 | /* 0x50-0x57 */ 0x0873, 0x103F, 0x1873, 0x086D, 0x2201, 0x003E, 0x4430, 0x5036, |
| 266 | /* 0x58-0x5f */ 0x5500, 0x2500, 0x4409, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 267 | /* 0x60-0x67 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 268 | /* 0x68-0x6f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 269 | /* 0x70-0x77 */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 270 | /* 0x78-0x7f */ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, |
| 271 | 271 | }; |
| 272 | 272 | |
| 273 | 273 | READ8_MEMBER( gts80b_state::port1a_r ) |
| r242066 | r242067 | |
| 410 | 410 | MACHINE_CONFIG_END |
| 411 | 411 | |
| 412 | 412 | //static MACHINE_CONFIG_DERIVED( gts80b_ss, gts80b ) |
| 413 | | // MCFG_GOTTLIEB_SOUND_R1_ADD("r1sound") |
| 414 | | // //MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX("r1sound") // votrax crashes |
| 415 | | // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 413 | // MCFG_GOTTLIEB_SOUND_R1_ADD("r1sound") |
| 414 | // //MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX("r1sound") // votrax crashes |
| 415 | // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 416 | 416 | //MACHINE_CONFIG_END |
| 417 | 417 | |
| 418 | 418 | static MACHINE_CONFIG_DERIVED( gts80b_s1, gts80b ) |
trunk/src/mame/drivers/harddriv.c
| r242066 | r242067 | |
| 342 | 342 | |
| 343 | 343 | harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 344 | 344 | : device_t(mconfig, HARDDRIV_DEVICE, "Hard Drivin' PCB Family", tag, owner, clock, "harddriv_pcb", __FILE__), |
| 345 | | /* device_video_interface(mconfig, *this, false), */ |
| 345 | /* device_video_interface(mconfig, *this, false), */ |
| 346 | 346 | m_maincpu(*this, "maincpu"), |
| 347 | 347 | m_gsp(*this, "gsp"), |
| 348 | 348 | m_msp(*this, "msp"), |
| r242066 | r242067 | |
| 433 | 433 | m_ds3xdsp_sdata(0), |
| 434 | 434 | m_ds3xdsp_internal_timer(*this, "ds3xdsp_timer"), |
| 435 | 435 | m_adc_control(0), |
| 436 | | m_adc8_select(0), |
| 437 | | m_adc8_data(0), |
| 438 | | m_adc12_select(0), |
| 439 | | m_adc12_byte(0), |
| 440 | | m_adc12_data(0), |
| 441 | | m_hdc68k_last_wheel(0), |
| 442 | | m_hdc68k_last_port1(0), |
| 443 | | m_hdc68k_wheel_edge(0), |
| 444 | | m_hdc68k_shifter_state(0), |
| 445 | | m_st68k_sloop_bank(0), |
| 446 | | m_st68k_last_alt_sloop_offset(0), |
| 447 | | m_next_msp_sync(0), |
| 436 | m_adc8_select(0), |
| 437 | m_adc8_data(0), |
| 438 | m_adc12_select(0), |
| 439 | m_adc12_byte(0), |
| 440 | m_adc12_data(0), |
| 441 | m_hdc68k_last_wheel(0), |
| 442 | m_hdc68k_last_port1(0), |
| 443 | m_hdc68k_wheel_edge(0), |
| 444 | m_hdc68k_shifter_state(0), |
| 445 | m_st68k_sloop_bank(0), |
| 446 | m_st68k_last_alt_sloop_offset(0), |
| 447 | m_next_msp_sync(0), |
| 448 | 448 | m_soundflag(0), |
| 449 | | m_mainflag(0), |
| 450 | | m_sounddata(0), |
| 451 | | m_maindata(0), |
| 452 | | m_dacmute(0), |
| 453 | | m_cramen(0), |
| 454 | | m_irq68k(0), |
| 455 | | m_sound_rom_offs(0), |
| 456 | | m_rombase(0), |
| 457 | | m_romsize(0), |
| 458 | | m_last_bio_cycles(0), |
| 459 | | m_vram_mask(0), |
| 460 | | m_shiftreg_enable(0), |
| 461 | | m_gsp_shiftreg_source(0), |
| 449 | m_mainflag(0), |
| 450 | m_sounddata(0), |
| 451 | m_maindata(0), |
| 452 | m_dacmute(0), |
| 453 | m_cramen(0), |
| 454 | m_irq68k(0), |
| 455 | m_sound_rom_offs(0), |
| 456 | m_rombase(0), |
| 457 | m_romsize(0), |
| 458 | m_last_bio_cycles(0), |
| 459 | m_vram_mask(0), |
| 460 | m_shiftreg_enable(0), |
| 461 | m_gsp_shiftreg_source(0), |
| 462 | 462 | m_gfx_finescroll(0), |
| 463 | 463 | m_gfx_palettebank(0), |
| 464 | 464 | m_dac(*this, "dac"), |
| r242066 | r242067 | |
| 526 | 526 | |
| 527 | 527 | WRITE16_MEMBER( harddriv_state::watchdog_reset16_w ) |
| 528 | 528 | { |
| 529 | | |
| 530 | 529 | } |
| 531 | 530 | |
| 532 | 531 | static ADDRESS_MAP_START( driver_68k_map, AS_PROGRAM, 16, harddriv_state ) |
| r242066 | r242067 | |
| 876 | 875 | |
| 877 | 876 | PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ |
| 878 | 877 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 879 | | |
| 878 | |
| 880 | 879 | INPUT_PORTS_END |
| 881 | 880 | |
| 882 | 881 | |
| r242066 | r242067 | |
| 964 | 963 | |
| 965 | 964 | static INPUT_PORTS_START( racedriv_pan ) |
| 966 | 965 | PORT_INCLUDE( racedriv ) |
| 967 | | |
| 966 | |
| 968 | 967 | PORT_START("leftpcb:IN0") /* 600000 */ |
| 969 | 968 | PORT_DIPNAME( 0x01, 0x01, "Diagnostic jumper (Left)" ) |
| 970 | 969 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| r242066 | r242067 | |
| 1509 | 1508 | /* Driver board with MSP (used by Hard Drivin' cockpit) */ |
| 1510 | 1509 | static MACHINE_CONFIG_FRAGMENT( driver_msp ) |
| 1511 | 1510 | |
| 1512 | | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1511 | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1513 | 1512 | |
| 1514 | 1513 | /* basic machine hardware */ |
| 1515 | 1514 | MCFG_CPU_ADD("msp", TMS34010, XTAL_50MHz) |
| r242066 | r242067 | |
| 1526 | 1525 | /* Multisync board without MSP (used by STUN Runner, Steel Talons, Race Drivin' compact) */ |
| 1527 | 1526 | static MACHINE_CONFIG_FRAGMENT( multisync_nomsp ) |
| 1528 | 1527 | |
| 1529 | | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1528 | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1530 | 1529 | |
| 1531 | 1530 | /* basic machine hardware */ |
| 1532 | 1531 | MCFG_CPU_MODIFY("maincpu") |
| r242066 | r242067 | |
| 1547 | 1546 | /* Multisync board with MSP (used by Hard Drivin' compact) */ |
| 1548 | 1547 | static MACHINE_CONFIG_FRAGMENT( multisync_msp ) |
| 1549 | 1548 | |
| 1550 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1549 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1551 | 1550 | |
| 1552 | 1551 | /* basic machine hardware */ |
| 1553 | 1552 | MCFG_CPU_ADD("msp", TMS34010, XTAL_50MHz) |
| r242066 | r242067 | |
| 1564 | 1563 | /* Multisync II board (used by Hard Drivin's Airborne) */ |
| 1565 | 1564 | static MACHINE_CONFIG_FRAGMENT( multisync2 ) |
| 1566 | 1565 | |
| 1567 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1566 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1568 | 1567 | |
| 1569 | 1568 | /* basic machine hardware */ |
| 1570 | 1569 | MCFG_CPU_MODIFY("maincpu") |
| r242066 | r242067 | |
| 1697 | 1696 | *************************************/ |
| 1698 | 1697 | |
| 1699 | 1698 | static MACHINE_CONFIG_FRAGMENT( harddriv ) |
| 1700 | | MCFG_FRAGMENT_ADD( driver_msp ) |
| 1699 | MCFG_FRAGMENT_ADD( driver_msp ) |
| 1701 | 1700 | /* basic machine hardware */ /* original driver board with MSP */ |
| 1702 | 1701 | MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ |
| 1703 | 1702 | MCFG_FRAGMENT_ADD( driversnd ) /* driver sound board */ |
| 1704 | 1703 | MACHINE_CONFIG_END |
| 1705 | 1704 | |
| 1706 | 1705 | static MACHINE_CONFIG_FRAGMENT( harddrivc ) |
| 1707 | | MCFG_FRAGMENT_ADD( multisync_msp ) |
| 1706 | MCFG_FRAGMENT_ADD( multisync_msp ) |
| 1708 | 1707 | |
| 1709 | 1708 | /* basic machine hardware */ /* multisync board with MSP */ |
| 1710 | 1709 | MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ |
| r242066 | r242067 | |
| 1712 | 1711 | MACHINE_CONFIG_END |
| 1713 | 1712 | |
| 1714 | 1713 | static MACHINE_CONFIG_FRAGMENT( racedriv ) |
| 1715 | | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1714 | MCFG_FRAGMENT_ADD( driver_nomsp ) |
| 1716 | 1715 | |
| 1717 | 1716 | /* basic machine hardware */ /* original driver board without MSP */ |
| 1718 | 1717 | MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ |
| r242066 | r242067 | |
| 1722 | 1721 | |
| 1723 | 1722 | static MACHINE_CONFIG_FRAGMENT( racedrivc ) |
| 1724 | 1723 | |
| 1725 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1724 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1726 | 1725 | |
| 1727 | 1726 | /* basic machine hardware */ /* multisync board without MSP */ |
| 1728 | 1727 | MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ |
| r242066 | r242067 | |
| 1733 | 1732 | |
| 1734 | 1733 | static MACHINE_CONFIG_FRAGMENT( racedrivc_panorama_side ) |
| 1735 | 1734 | |
| 1736 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1735 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1737 | 1736 | |
| 1738 | 1737 | /* basic machine hardware */ /* multisync board without MSP */ |
| 1739 | 1738 | MCFG_FRAGMENT_ADD( adsp ) /* ADSP board */ |
| 1740 | | // MCFG_FRAGMENT_ADD( dsk ) /* DSK board */ |
| 1741 | | // MCFG_FRAGMENT_ADD( driversnd ) /* driver sound board */ |
| 1739 | // MCFG_FRAGMENT_ADD( dsk ) /* DSK board */ |
| 1740 | // MCFG_FRAGMENT_ADD( driversnd ) /* driver sound board */ |
| 1742 | 1741 | MACHINE_CONFIG_END |
| 1743 | 1742 | |
| 1744 | 1743 | WRITE_LINE_MEMBER(harddriv_state::sound_int_write_line) |
| r242066 | r242067 | |
| 1750 | 1749 | |
| 1751 | 1750 | static MACHINE_CONFIG_FRAGMENT( stunrun ) |
| 1752 | 1751 | |
| 1753 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1752 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1754 | 1753 | |
| 1755 | 1754 | /* basic machine hardware */ /* multisync board without MSP */ |
| 1756 | 1755 | MCFG_CPU_MODIFY("gsp") |
| r242066 | r242067 | |
| 1770 | 1769 | MACHINE_CONFIG_END |
| 1771 | 1770 | |
| 1772 | 1771 | static MACHINE_CONFIG_FRAGMENT( steeltal ) |
| 1773 | | MCFG_FRAGMENT_ADD( multisync_msp ) |
| 1772 | MCFG_FRAGMENT_ADD( multisync_msp ) |
| 1774 | 1773 | |
| 1775 | 1774 | /* basic machine hardware */ /* multisync board with MSP */ |
| 1776 | 1775 | MCFG_FRAGMENT_ADD( ds3 ) /* DS III board */ |
| r242066 | r242067 | |
| 1793 | 1792 | |
| 1794 | 1793 | static MACHINE_CONFIG_FRAGMENT( strtdriv ) |
| 1795 | 1794 | |
| 1796 | | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1795 | MCFG_FRAGMENT_ADD( multisync_nomsp ) |
| 1797 | 1796 | |
| 1798 | 1797 | /* basic machine hardware */ /* multisync board */ |
| 1799 | 1798 | MCFG_FRAGMENT_ADD( ds3 ) /* DS III board */ |
| r242066 | r242067 | |
| 1805 | 1804 | |
| 1806 | 1805 | static MACHINE_CONFIG_FRAGMENT( hdrivair ) |
| 1807 | 1806 | |
| 1808 | | MCFG_FRAGMENT_ADD( multisync2 ) |
| 1807 | MCFG_FRAGMENT_ADD( multisync2 ) |
| 1809 | 1808 | |
| 1810 | 1809 | /* basic machine hardware */ /* multisync II board */ |
| 1811 | 1810 | MCFG_FRAGMENT_ADD( ds3 ) /* DS IV board */ |
| r242066 | r242067 | |
| 1833 | 1832 | /* Compact */ |
| 1834 | 1833 | |
| 1835 | 1834 | void harddrivc_board_device_state::device_start() |
| 1836 | | { |
| 1835 | { |
| 1837 | 1836 | init_harddrivc(); |
| 1838 | 1837 | harddriv_state::device_start(); |
| 1839 | 1838 | } |
| r242066 | r242067 | |
| 2090 | 2089 | MCFG_DEVICE_ADD("leftpcb", RACEDRIVC_PANORAMA_SIDE_BOARD_DEVICE, 0) |
| 2091 | 2090 | MCFG_DEVICE_ADD("rightpcb", RACEDRIVC_PANORAMA_SIDE_BOARD_DEVICE, 0) |
| 2092 | 2091 | |
| 2093 | | // MCFG_QUANTUM_TIME(attotime::from_hz(100000)) |
| 2092 | // MCFG_QUANTUM_TIME(attotime::from_hz(100000)) |
| 2094 | 2093 | MCFG_DEVICE_MODIFY("mainpcb:duartn68681") |
| 2095 | 2094 | MCFG_MC68681_A_TX_CALLBACK(WRITELINE(racedriv_board_device_state,tx_a )) |
| 2096 | 2095 | |
| 2097 | | MCFG_TIMER_DRIVER_ADD_PERIODIC("hack_timer", harddriv_new_state, hack_timer, attotime::from_hz(60)) |
| 2098 | | // MCFG_QUANTUM_TIME(attotime::from_hz(60000)) |
| 2096 | MCFG_TIMER_DRIVER_ADD_PERIODIC("hack_timer", harddriv_new_state, hack_timer, attotime::from_hz(60)) |
| 2097 | // MCFG_QUANTUM_TIME(attotime::from_hz(60000)) |
| 2099 | 2098 | MACHINE_CONFIG_END |
| 2100 | 2099 | |
| 2101 | 2100 | // this is an ugly hack, otherwise MAME's core can't seem to handle partial updates if you have multiple screens with different update frequencies. |
| r242066 | r242067 | |
| 2155 | 2154 | ROM_LOAD( "harddriv.200e", 0x000000, 0x000800, CRC(aed020f7) SHA1(494fc2eb74b4924c07f18bef5e69efd5476deec2) ) |
| 2156 | 2155 | |
| 2157 | 2156 | ROM_REGION( 0x800, "mainpcb:210e", 0 ) |
| 2158 | | ROM_LOAD( "harddriv.210e", 0x000000, 0x000800, CRC(4a91835b) SHA1(96f0087ba7e577748758a2fbe61225048862bb65) ) |
| 2157 | ROM_LOAD( "harddriv.210e", 0x000000, 0x000800, CRC(4a91835b) SHA1(96f0087ba7e577748758a2fbe61225048862bb65) ) |
| 2159 | 2158 | ROM_END |
| 2160 | 2159 | |
| 2161 | 2160 | |
| r242066 | r242067 | |
| 4204 | 4203 | |
| 4205 | 4204 | ROM_REGION( 0x800, "mainpcb:210e", 0 ) |
| 4206 | 4205 | ROM_LOAD( "racedriv.210e", 0x000000, 0x000800, CRC(3d7c732e) SHA1(e7de81d4a54327514fdd339e93c888c63a344d2c) ) |
| 4207 | | |
| 4206 | |
| 4208 | 4207 | /* Left PCB ( Multisync PCB (A046901) )*/ |
| 4209 | 4208 | ROM_REGION( 0x200000, "leftpcb:maincpu", 0 ) /* 2MB for 68000 code */ |
| 4210 | 4209 | ROM_LOAD16_BYTE( "088-2002.bin", 0x000000, 0x010000, CRC(77724070) SHA1(5862f30f7e2ab9c0beb06cf5599bcb1ff97f3a47) ) |
| r242066 | r242067 | |
| 4233 | 4232 | ROM_LOAD16_BYTE( "088-1022.bin", 0x40001, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) ) |
| 4234 | 4233 | |
| 4235 | 4234 | ROM_REGION( 0x800, "leftpcb:200e", 0 ) // set to display left monitor, controls not calibrated with valid values (don't think they need to be) |
| 4236 | | ROM_LOAD( "leftpcb_200e", 0x000000, 0x000800, CRC(a618d02e) SHA1(cc1068fe4f6ec9a26b6e8fdbe05f4364a64559c1) ) |
| 4235 | ROM_LOAD( "leftpcb_200e", 0x000000, 0x000800, CRC(a618d02e) SHA1(cc1068fe4f6ec9a26b6e8fdbe05f4364a64559c1) ) |
| 4237 | 4236 | ROM_REGION( 0x800, "leftpcb:210e", 0 ) |
| 4238 | 4237 | ROM_LOAD( "leftpcb_210e", 0x000000, 0x000800, CRC(108ea834) SHA1(d7aec78287647dc52f92143cdb6d7765de0b4e39) ) |
| 4239 | 4238 | |
| r242066 | r242067 | |
| 4265 | 4264 | ROM_LOAD16_BYTE( "088-1022.bin", 0x40001, 0x10000, CRC(4f1e1c5d) SHA1(3e72813129cae9e9bf084bfb1b747aa46b92591e) ) |
| 4266 | 4265 | |
| 4267 | 4266 | ROM_REGION( 0x800, "rightpcb:200e", 0 ) // set to display right monitor, controls not calibrated with valid values (don't think they need to be) |
| 4268 | | ROM_LOAD( "rightpcb_200e", 0x000000, 0x000800, CRC(6f1b7094) SHA1(6194a5b99aebe43f02c8d267290207b32c5bdbbd) ) |
| 4267 | ROM_LOAD( "rightpcb_200e", 0x000000, 0x000800, CRC(6f1b7094) SHA1(6194a5b99aebe43f02c8d267290207b32c5bdbbd) ) |
| 4269 | 4268 | ROM_REGION( 0x800, "rightpcb:210e", 0 ) |
| 4270 | 4269 | ROM_LOAD( "rightpcb_210e", 0x000000, 0x000800, CRC(108ea834) SHA1(d7aec78287647dc52f92143cdb6d7765de0b4e39) ) |
| 4271 | 4270 | ROM_END |
| r242066 | r242067 | |
| 5078 | 5077 | m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(gsp_protection, gsp_protection + 0x0f, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); |
| 5079 | 5078 | |
| 5080 | 5079 | /* set up gsp speedup handler (todo, work these out) */ |
| 5081 | | // m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); |
| 5082 | | // m_gsp->space(AS_PROGRAM).install_read_handler(0xfff76f60, 0xfff76f6f, read16_delegate(FUNC(harddriv_state::rdgsp_speedup1_r), this)); |
| 5083 | | // m_gsp_speedup_pc = 0xfff43a00; |
| 5080 | // m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); |
| 5081 | // m_gsp->space(AS_PROGRAM).install_read_handler(0xfff76f60, 0xfff76f6f, read16_delegate(FUNC(harddriv_state::rdgsp_speedup1_r), this)); |
| 5082 | // m_gsp_speedup_pc = 0xfff43a00; |
| 5084 | 5083 | |
| 5085 | 5084 | /* set up adsp speedup handlers */ |
| 5086 | 5085 | m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); |
| r242066 | r242067 | |
| 5301 | 5300 | |
| 5302 | 5301 | GAME( 1993, hdrivair, 0, hdrivair_machine, hdrivair, driver_device, 0, ROT0, "Atari Games", "Hard Drivin's Airborne (prototype)", GAME_IMPERFECT_SOUND ) |
| 5303 | 5302 | GAME( 1993, hdrivairp, hdrivair, hdrivairp_machine, hdrivair, driver_device, 0,ROT0, "Atari Games", "Hard Drivin's Airborne (prototype, early rev)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 5304 | | |
| 5305 | | |
trunk/src/mame/drivers/segaufo.c
| r242066 | r242067 | |
| 8 | 8 | 1st gen |
| 9 | 9 | * ? |
| 10 | 10 | - # UFO Catcher (1985) |
| 11 | | |
| 11 | |
| 12 | 12 | 2nd gen: |
| 13 | 13 | * ? |
| 14 | 14 | - # UFO Catcher DX (1987) |
| r242066 | r242067 | |
| 21 | 21 | - UFO Catcher Mini (1991) (1P) |
| 22 | 22 | - # UFO Catcher Sega Sonic (1991) |
| 23 | 23 | - # School Kids (1993) |
| 24 | | |
| 24 | |
| 25 | 25 | 4th gen - EX brd |
| 26 | 26 | * Z80, 2 Sega 315-5296(I/O), 315-5338A, YM3438, NEC uPD71054C, optional NEC uPD7759C |
| 27 | 27 | - # Dream Palace (1992) |
| r242066 | r242067 | |
| 32 | 32 | - UFO Catcher 800 (1998) (1P) |
| 33 | 33 | - # Baby UFO (1998) |
| 34 | 34 | - # Prize Sensor (1998) |
| 35 | | |
| 35 | |
| 36 | 36 | More games were released after 2000, assumed to be on more modern hardware. |
| 37 | 37 | |
| 38 | 38 | TODO: |
| r242066 | r242067 | |
| 57 | 57 | |
| 58 | 58 | /* simulation parameters */ |
| 59 | 59 | // x/y/z cabinet dimensions per player (motor range) |
| 60 | | #define CABINET_WIDTH 400 |
| 60 | #define CABINET_WIDTH 400 |
| 61 | 61 | #define CABINET_DEPTH 400 |
| 62 | 62 | #define CABINET_HEIGHT 300 |
| 63 | 63 | |
| r242066 | r242067 | |
| 85 | 85 | required_device<sega_315_5296_device> m_io1; |
| 86 | 86 | required_device<sega_315_5296_device> m_io2; |
| 87 | 87 | optional_device<upd7759_device> m_upd; |
| 88 | | |
| 88 | |
| 89 | 89 | struct Player |
| 90 | 90 | { |
| 91 | 91 | struct Motor |
| r242066 | r242067 | |
| 96 | 96 | float speed; |
| 97 | 97 | } motor[4]; |
| 98 | 98 | } m_player[2]; |
| 99 | | |
| 99 | |
| 100 | 100 | UINT8 m_stepper; |
| 101 | | |
| 101 | |
| 102 | 102 | void motor_tick(int p, int m); |
| 103 | 103 | |
| 104 | 104 | DECLARE_WRITE_LINE_MEMBER(pit_out0); |
| r242066 | r242067 | |
| 121 | 121 | DECLARE_WRITE8_MEMBER(ex_ufo800_lamps_w); |
| 122 | 122 | DECLARE_READ8_MEMBER(ex_upd_busy_r); |
| 123 | 123 | DECLARE_WRITE8_MEMBER(ex_upd_start_w); |
| 124 | | |
| 124 | |
| 125 | 125 | virtual void machine_reset(); |
| 126 | 126 | virtual void machine_start(); |
| 127 | 127 | TIMER_DEVICE_CALLBACK_MEMBER(simulate_xyz); |
| r242066 | r242067 | |
| 135 | 135 | float delta = m_player[p].motor[m].speed; |
| 136 | 136 | if (m_player[p].motor[m].direction) |
| 137 | 137 | delta = -delta; |
| 138 | | |
| 138 | |
| 139 | 139 | if (m_player[p].motor[m].running) |
| 140 | 140 | m_player[p].motor[m].position += delta; |
| 141 | | |
| 141 | |
| 142 | 142 | if (m_player[p].motor[m].position < 0) |
| 143 | 143 | m_player[p].motor[m].position = 0; |
| 144 | 144 | if (m_player[p].motor[m].position > 1) |
| r242066 | r242067 | |
| 163 | 163 | for (int p = 0; p < 2; p++) |
| 164 | 164 | for (int m = 0; m < 4; m++) |
| 165 | 165 | output_set_indexed_value("counter", p*4 + m, (UINT8)(m_player[p].motor[m].position * 100)); |
| 166 | | |
| 166 | |
| 167 | 167 | #if 0 |
| 168 | 168 | char msg1[0x100] = {0}; |
| 169 | 169 | char msg2[0x100] = {0}; |
| r242066 | r242067 | |
| 226 | 226 | // d6: crane open sensor (reflective sticker on the stepper motor rotation disc) |
| 227 | 227 | if (m_player[p].motor[3].position >= 0.97) |
| 228 | 228 | ret ^= 0x40; |
| 229 | | |
| 229 | |
| 230 | 230 | // d7: prize sensor (mirror?) |
| 231 | 231 | ret |= (ioport(p ? "IN2" : "IN1")->read() & 0x80); |
| 232 | 232 | |
| r242066 | r242067 | |
| 249 | 249 | // d0-d3: p1, d4-d7: p2 |
| 250 | 250 | UINT8 cur = data >> (p*4) & 0xf; |
| 251 | 251 | UINT8 prev = m_stepper >> (p*4) & 0xf; |
| 252 | | |
| 252 | |
| 253 | 253 | for (int i = 0; i < 4; i++) |
| 254 | 254 | { |
| 255 | 255 | if (sequence[i] == prev && sequence[(i+1) & 3] == cur) |
| 256 | 256 | { |
| 257 | 257 | m_player[p].motor[3].running = 1; |
| 258 | 258 | motor_tick(p, 3); |
| 259 | | |
| 259 | |
| 260 | 260 | // change direction after each quarter rotate |
| 261 | 261 | if (m_player[p].motor[3].position <= 0 || m_player[p].motor[3].position >= 1) |
| 262 | 262 | m_player[p].motor[3].direction ^= 1; |
| 263 | | |
| 263 | |
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | | |
| 268 | |
| 269 | 269 | m_stepper = data; |
| 270 | 270 | } |
| 271 | 271 | |
| r242066 | r242067 | |
| 281 | 281 | { |
| 282 | 282 | static const UINT8 lut_7448[0x10] = |
| 283 | 283 | { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 }; |
| 284 | | |
| 284 | |
| 285 | 285 | // d0-d3: cpanel digit |
| 286 | 286 | // other bits: ? |
| 287 | 287 | output_set_digit_value(offset & 1, lut_7448[data & 0xf]); |
| r242066 | r242067 | |
| 290 | 290 | WRITE8_MEMBER(ufo_state::crane_xyz_w) |
| 291 | 291 | { |
| 292 | 292 | int p = offset & 1; |
| 293 | | |
| 293 | |
| 294 | 294 | // d0: x/z axis (0:x, 1:z + halt x/y) |
| 295 | 295 | // d1: x/z direction |
| 296 | 296 | // d2: y direction |
| r242066 | r242067 | |
| 315 | 315 | // 10 = red, green |
| 316 | 316 | output_set_lamp_value(10, data & 3); |
| 317 | 317 | output_set_lamp_value(11, data >> 2 & 3); |
| 318 | | |
| 318 | |
| 319 | 319 | // d4,d5: ? |
| 320 | 320 | // d6,d7: coincounters |
| 321 | 321 | coin_counter_w(machine(), 0, data & 0x40); // 100 Y |
| r242066 | r242067 | |
| 346 | 346 | ret ^= (m_player[p].motor[m].position >= 1) << shift; |
| 347 | 347 | ret ^= (m_player[p].motor[m].position <= 0) << (shift+1); |
| 348 | 348 | } |
| 349 | | |
| 349 | |
| 350 | 350 | return ret; |
| 351 | 351 | } |
| 352 | 352 | |
| r242066 | r242067 | |
| 354 | 354 | { |
| 355 | 355 | // d0-d3: p1, d4-d7: p2 |
| 356 | 356 | UINT8 ret = 0xff; |
| 357 | | |
| 357 | |
| 358 | 358 | for (int p = 0; p < 2; p++) |
| 359 | 359 | { |
| 360 | 360 | // d0: crane open sensor |
| 361 | 361 | if (m_player[p].motor[3].position >= 0.97) |
| 362 | 362 | ret ^= (1 << (p*4)); |
| 363 | | |
| 363 | |
| 364 | 364 | // d1: coincounter is plugged in (ufo800 gives error 14 otherwise) |
| 365 | 365 | // d2,d3: ? |
| 366 | 366 | } |
| 367 | | |
| 367 | |
| 368 | 368 | return ret; |
| 369 | 369 | } |
| 370 | 370 | |
| r242066 | r242067 | |
| 382 | 382 | // d0,d1,d4,d5: p1/p2 button lamps |
| 383 | 383 | for (int i = 0; i < 4; i++) |
| 384 | 384 | output_set_lamp_value(i, ~data >> ((i&1) + (i&2) * 2) & 1); |
| 385 | | |
| 385 | |
| 386 | 386 | // d2,d3,d6,d7: p1/p2 coincounters |
| 387 | 387 | for (int i = 0; i < 4; i++) |
| 388 | 388 | coin_counter_w(machine(), i, data >> (2 + (i&1) + (i&2) * 2) & 1); |
| r242066 | r242067 | |
| 391 | 391 | WRITE8_MEMBER(ufo_state::ex_crane_xyz_w) |
| 392 | 392 | { |
| 393 | 393 | int p = offset & 1; |
| 394 | | |
| 394 | |
| 395 | 395 | // more straightforward setup than on UFO board hardware |
| 396 | 396 | // d0: move left |
| 397 | 397 | // d1: move right |
| r242066 | r242067 | |
| 464 | 464 | AM_RANGE(0x60, 0x60) AM_WRITE(ex_upd_start_w) AM_READNOP |
| 465 | 465 | AM_RANGE(0x61, 0x61) AM_READ(ex_upd_busy_r) |
| 466 | 466 | AM_RANGE(0x64, 0x65) AM_WRITE(ex_ufo21_lamps_w) AM_READNOP |
| 467 | | // AM_RANGE(0x68, 0x68) AM_WRITENOP // ? |
| 467 | // AM_RANGE(0x68, 0x68) AM_WRITENOP // ? |
| 468 | 468 | AM_IMPORT_FROM( ufo_portmap ) |
| 469 | 469 | ADDRESS_MAP_END |
| 470 | 470 | |
| 471 | 471 | static ADDRESS_MAP_START( ex_ufo800_portmap, AS_IO, 8, ufo_state ) |
| 472 | | // AM_RANGE(0x60, 0x67) AM_NOP // unused? |
| 473 | | // AM_RANGE(0x68, 0x68) AM_WRITENOP // ? |
| 472 | // AM_RANGE(0x60, 0x67) AM_NOP // unused? |
| 473 | // AM_RANGE(0x68, 0x68) AM_WRITENOP // ? |
| 474 | 474 | AM_IMPORT_FROM( ufo_portmap ) |
| 475 | 475 | ADDRESS_MAP_END |
| 476 | 476 | |
| r242066 | r242067 | |
| 723 | 723 | // init/zerofill/register for savestates |
| 724 | 724 | static const float motor_speeds[4] = |
| 725 | 725 | { 1.0f/CABINET_WIDTH, 1.0f/CABINET_DEPTH, 1.0f/CABINET_HEIGHT, 1.0f/CRANE_SIZE }; |
| 726 | | |
| 726 | |
| 727 | 727 | for (int m = 0; m < 4; m++) |
| 728 | 728 | { |
| 729 | 729 | for (int p = 0; p < 2; p++) |
| r242066 | r242067 | |
| 742 | 742 | save_item(NAME(m_player[1].motor[m].direction), m); |
| 743 | 743 | save_item(NAME(m_player[1].motor[m].position), m); |
| 744 | 744 | } |
| 745 | | |
| 745 | |
| 746 | 746 | m_stepper = 0; |
| 747 | 747 | save_item(NAME(m_stepper)); |
| 748 | 748 | } |
| r242066 | r242067 | |
| 761 | 761 | |
| 762 | 762 | MCFG_TIMER_DRIVER_ADD_PERIODIC("motor_timer", ufo_state, simulate_xyz, attotime::from_hz(MOTOR_SPEED)) |
| 763 | 763 | MCFG_TIMER_DRIVER_ADD_PERIODIC("update_timer", ufo_state, update_info, attotime::from_hz(60)) |
| 764 | | |
| 764 | |
| 765 | 765 | MCFG_DEVICE_ADD("io1", SEGA_315_5296, XTAL_16MHz) |
| 766 | 766 | // all ports set to input |
| 767 | 767 | MCFG_315_5296_IN_PORTA_CB(READ8(ufo_state, crane_limits_r)) |
trunk/src/mame/drivers/videopin.c
| r242066 | r242067 | |
| 235 | 235 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 236 | 236 | |
| 237 | 237 | PORT_START("DSW") /* IN1 */ |
| 238 | | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:8,7") |
| 238 | PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:8,7") |
| 239 | 239 | PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) ) |
| 240 | 240 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_1C ) ) |
| 241 | 241 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) |
| 242 | 242 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 243 | | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("DSW:6,5") |
| 243 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("DSW:6,5") |
| 244 | 244 | PORT_DIPSETTING( 0x00, DEF_STR( English ) ) |
| 245 | 245 | PORT_DIPSETTING( 0x10, DEF_STR( German ) ) |
| 246 | 246 | PORT_DIPSETTING( 0x20, DEF_STR( French ) ) |
| 247 | 247 | PORT_DIPSETTING( 0x30, DEF_STR( Spanish ) ) |
| 248 | | PORT_DIPNAME( 0x08, 0x08, "Balls" ) PORT_DIPLOCATION("DSW:4") |
| 248 | PORT_DIPNAME( 0x08, 0x08, "Balls" ) PORT_DIPLOCATION("DSW:4") |
| 249 | 249 | PORT_DIPSETTING( 0x08, "3" ) |
| 250 | 250 | PORT_DIPSETTING( 0x00, "5" ) |
| 251 | | PORT_DIPNAME( 0x04, 0x00, "Replay" ) PORT_DIPLOCATION("DSW:3") |
| 251 | PORT_DIPNAME( 0x04, 0x00, "Replay" ) PORT_DIPLOCATION("DSW:3") |
| 252 | 252 | PORT_DIPSETTING( 0x04, "Off (award 80000 points instead)" ) |
| 253 | 253 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 254 | | PORT_DIPNAME( 0x02, 0x00, "Extra Ball" ) PORT_DIPLOCATION("DSW:2") |
| 254 | PORT_DIPNAME( 0x02, 0x00, "Extra Ball" ) PORT_DIPLOCATION("DSW:2") |
| 255 | 255 | PORT_DIPSETTING( 0x02, "Off (award 50000 points instead)" ) |
| 256 | 256 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 257 | | PORT_DIPNAME( 0x01, 0x01, "Replay Level" ) PORT_DIPLOCATION("DSW:1") |
| 257 | PORT_DIPNAME( 0x01, 0x01, "Replay Level" ) PORT_DIPLOCATION("DSW:1") |
| 258 | 258 | PORT_DIPSETTING( 0x00, "180000 (3 balls) / 300000 (5 balls)" ) |
| 259 | 259 | PORT_DIPSETTING( 0x01, "210000 (3 balls) / 350000 (5 balls)" ) |
| 260 | 260 | |
| r242066 | r242067 | |
| 275 | 275 | static INPUT_PORTS_START( solarwar ) |
| 276 | 276 | PORT_INCLUDE( videopin ) |
| 277 | 277 | PORT_MODIFY("DSW") |
| 278 | | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:8,7") |
| 278 | PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW:8,7") |
| 279 | 279 | PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) ) |
| 280 | 280 | PORT_DIPSETTING( 0x80, DEF_STR( 1C_1C ) ) |
| 281 | 281 | PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) |
| 282 | 282 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 283 | 283 | PORT_DIPUNKNOWN_DIPLOC( 0x30, 0x30, "DSW:6,5" ) |
| 284 | | PORT_DIPNAME( 0x01, 0x01, "Replay Level" ) PORT_DIPLOCATION("DSW:1") |
| 284 | PORT_DIPNAME( 0x01, 0x01, "Replay Level" ) PORT_DIPLOCATION("DSW:1") |
| 285 | 285 | PORT_DIPSETTING( 0x00, "180000 (3 balls) / 300000 (5 balls)" ) |
| 286 | 286 | PORT_DIPSETTING( 0x01, "300000 (3 balls) / 500000 (5 balls)" ) |
| 287 | 287 | INPUT_PORTS_END |
| r242066 | r242067 | |
| 410 | 410 | |
| 411 | 411 | ROM_START( solarwar ) |
| 412 | 412 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 413 | | ROM_LOAD_NIB_LOW ( "36159-01.e0", 0x2000, 0x0400, CRC(0db9f0fc) SHA1(191429a25b43727694f75c0ae9cbff705fbc4d77) ) |
| 414 | | ROM_LOAD_NIB_HIGH( "36154-01.k0", 0x2000, 0x0400, CRC(64629efc) SHA1(4da3870c35e693ed334502ea17ae023a0073ff85) ) |
| 415 | | ROM_LOAD_NIB_LOW ( "36160-01.d0", 0x2400, 0x0400, CRC(63a25dee) SHA1(cff0f1c4d381eb99a30f2fe09ff6f42ca994a19f) ) |
| 416 | | ROM_LOAD_NIB_HIGH( "36155-01.j0", 0x2400, 0x0400, CRC(5fa64f47) SHA1(64e37380be0df761ba81c516592fef87bba30b91) ) |
| 417 | | ROM_LOAD_NIB_LOW ( "36167-01.h1", 0x2800, 0x0400, CRC(5a85bca8) SHA1(7af9895c2e567d569ed60305fa1245081e346fc1) ) |
| 418 | | ROM_LOAD_NIB_HIGH( "36166-01.h1", 0x2800, 0x0400, CRC(6ce095a6) SHA1(e3bb534487d3cd0cecccff47c0742de8f951b46c) ) |
| 419 | | ROM_LOAD_NIB_LOW ( "36161-01.c0", 0x2c00, 0x0400, CRC(a9e2e08f) SHA1(5539a86d4fb69735182762e21cf3cc26d16eff80) ) |
| 420 | | ROM_LOAD_NIB_HIGH( "36157-01.h0", 0x2c00, 0x0400, CRC(30b6eb18) SHA1(ae819dd97c6a7e26981731e7706cbfa3699b6a0b) ) |
| 421 | | ROM_LOAD_NIB_LOW ( "36169-01.e1", 0x3000, 0x0400, CRC(f702127c) SHA1(7fb83c616671e4ea9697282a04662ec035d5d8ed) ) |
| 422 | | ROM_LOAD_NIB_HIGH( "36164-01.k1", 0x3000, 0x0400, CRC(3dcded96) SHA1(eacdf017b08a7c3305fd79430fbbf07292d0cfa0) ) |
| 423 | | ROM_LOAD_NIB_LOW ( "36163-02.a0", 0x3400, 0x0400, CRC(3e176619) SHA1(9b6a9a5fa02b1d87bdaa43fad8971ff3317b132d) ) |
| 424 | | ROM_LOAD_NIB_HIGH( "36156-02.h0", 0x3400, 0x0400, CRC(e51363fb) SHA1(c01b263dfd6d448a18ff855a93aa4e48afc6d725) ) |
| 425 | | ROM_LOAD_NIB_LOW ( "36168-01.f1", 0x3800, 0x0400, CRC(5ccbcf7e) SHA1(10f8932265abe6e62e9f243c653d7fad770a2ff5) ) |
| 426 | | ROM_LOAD_NIB_HIGH( "36165-01.j1", 0x3800, 0x0400, CRC(e2ee4f7d) SHA1(be2f602a5bcfe404509ac8d6914a03213573b0a6) ) |
| 427 | | ROM_LOAD_NIB_LOW ( "36162-02.b0", 0x3c00, 0x0400, CRC(cec1baaa) SHA1(15c130b01a7b8b9aa07e01f7c84c4c26494f39d8) ) |
| 413 | ROM_LOAD_NIB_LOW ( "36159-01.e0", 0x2000, 0x0400, CRC(0db9f0fc) SHA1(191429a25b43727694f75c0ae9cbff705fbc4d77) ) |
| 414 | ROM_LOAD_NIB_HIGH( "36154-01.k0", 0x2000, 0x0400, CRC(64629efc) SHA1(4da3870c35e693ed334502ea17ae023a0073ff85) ) |
| 415 | ROM_LOAD_NIB_LOW ( "36160-01.d0", 0x2400, 0x0400, CRC(63a25dee) SHA1(cff0f1c4d381eb99a30f2fe09ff6f42ca994a19f) ) |
| 416 | ROM_LOAD_NIB_HIGH( "36155-01.j0", 0x2400, 0x0400, CRC(5fa64f47) SHA1(64e37380be0df761ba81c516592fef87bba30b91) ) |
| 417 | ROM_LOAD_NIB_LOW ( "36167-01.h1", 0x2800, 0x0400, CRC(5a85bca8) SHA1(7af9895c2e567d569ed60305fa1245081e346fc1) ) |
| 418 | ROM_LOAD_NIB_HIGH( "36166-01.h1", 0x2800, 0x0400, CRC(6ce095a6) SHA1(e3bb534487d3cd0cecccff47c0742de8f951b46c) ) |
| 419 | ROM_LOAD_NIB_LOW ( "36161-01.c0", 0x2c00, 0x0400, CRC(a9e2e08f) SHA1(5539a86d4fb69735182762e21cf3cc26d16eff80) ) |
| 420 | ROM_LOAD_NIB_HIGH( "36157-01.h0", 0x2c00, 0x0400, CRC(30b6eb18) SHA1(ae819dd97c6a7e26981731e7706cbfa3699b6a0b) ) |
| 421 | ROM_LOAD_NIB_LOW ( "36169-01.e1", 0x3000, 0x0400, CRC(f702127c) SHA1(7fb83c616671e4ea9697282a04662ec035d5d8ed) ) |
| 422 | ROM_LOAD_NIB_HIGH( "36164-01.k1", 0x3000, 0x0400, CRC(3dcded96) SHA1(eacdf017b08a7c3305fd79430fbbf07292d0cfa0) ) |
| 423 | ROM_LOAD_NIB_LOW ( "36163-02.a0", 0x3400, 0x0400, CRC(3e176619) SHA1(9b6a9a5fa02b1d87bdaa43fad8971ff3317b132d) ) |
| 424 | ROM_LOAD_NIB_HIGH( "36156-02.h0", 0x3400, 0x0400, CRC(e51363fb) SHA1(c01b263dfd6d448a18ff855a93aa4e48afc6d725) ) |
| 425 | ROM_LOAD_NIB_LOW ( "36168-01.f1", 0x3800, 0x0400, CRC(5ccbcf7e) SHA1(10f8932265abe6e62e9f243c653d7fad770a2ff5) ) |
| 426 | ROM_LOAD_NIB_HIGH( "36165-01.j1", 0x3800, 0x0400, CRC(e2ee4f7d) SHA1(be2f602a5bcfe404509ac8d6914a03213573b0a6) ) |
| 427 | ROM_LOAD_NIB_LOW ( "36162-02.b0", 0x3c00, 0x0400, CRC(cec1baaa) SHA1(15c130b01a7b8b9aa07e01f7c84c4c26494f39d8) ) |
| 428 | 428 | ROM_RELOAD( 0xfc00, 0x0400 ) |
| 429 | | ROM_LOAD_NIB_HIGH( "36158-02.f0", 0x3c00, 0x0400, CRC(2606b87e) SHA1(ea72e36837eccf29cd5c82fe9a6a018a1a94730c) ) |
| 429 | ROM_LOAD_NIB_HIGH( "36158-02.f0", 0x3c00, 0x0400, CRC(2606b87e) SHA1(ea72e36837eccf29cd5c82fe9a6a018a1a94730c) ) |
| 430 | 430 | ROM_RELOAD( 0xfc00, 0x0400 ) |
| 431 | 431 | |
| 432 | 432 | ROM_REGION( 0x0200, "gfx1", 0 ) /* tiles */ |
trunk/src/mame/mame.lst
| r242066 | r242067 | |
| 104 | 104 | mspacmanbgd // bootleg |
| 105 | 105 | mspacmanbcc // bootleg |
| 106 | 106 | mspacmanblt // bootleg |
| 107 | | clubpacm // Miky |
| 107 | clubpacm // Miky |
| 108 | 108 | woodpeck // (c) 1981 Amenip (Palcom Queen River) |
| 109 | 109 | woodpeca // (c) 1981 Amenip Nova Games Ltd. |
| 110 | 110 | mspacmab // bootleg |
| r242066 | r242067 | |
| 442 | 442 | bigkong // bootleg |
| 443 | 443 | monkeyd // bootleg |
| 444 | 444 | dking // Crazy Kong Bootleg |
| 445 | | ckongdks // Spanish Crazy Kong bootleg |
| 445 | ckongdks // Spanish Crazy Kong bootleg |
| 446 | 446 | ckongpt2 // (c) 1981 Falcon |
| 447 | 447 | ckongpt2a // (c) 1981 Falcon |
| 448 | 448 | ckongpt2j // (c) 1981 Falcon |
| r242066 | r242067 | |
| 710 | 710 | nextfase // bootleg |
| 711 | 711 | phoenixs // bootleg (Sonic) |
| 712 | 712 | avefenix // bootleg (Video Game) |
| 713 | | avefenixrf // bootleg (Recreativos Franco) |
| 713 | avefenixrf // bootleg (Recreativos Franco) |
| 714 | 714 | pleiads // (c) 1981 Tehkan |
| 715 | 715 | pleiadsb2 // bootleg |
| 716 | 716 | pleiadbl // bootleg |
| r242066 | r242067 | |
| 1478 | 1478 | gunchamp // (c) 1980 Model Racing |
| 1479 | 1479 | gunchamps // (c) 1980 Model Racing (sshot.c) |
| 1480 | 1480 | spaceatt // (c) 1978 Video Games GMBH |
| 1481 | | galmonst // (c) Laguna S.A. |
| 1481 | galmonst // (c) Laguna S.A. |
| 1482 | 1482 | spaceat2 // (c) 1980 Zenitone-Microsec Ltd |
| 1483 | 1483 | spacecom // bootleg |
| 1484 | 1484 | sinvzen // Zenitone-Microsec Ltd |
| r242066 | r242067 | |
| 1650 | 1650 | tron2 // (c) 1982 |
| 1651 | 1651 | tron3 // (c) 1982 |
| 1652 | 1652 | tron4 // (c) 1982 |
| 1653 | | tronger // (c) 1982 |
| 1653 | tronger // (c) 1982 |
| 1654 | 1654 | kroozr // (c) 1982 |
| 1655 | 1655 | domino // (c) 1982 |
| 1656 | 1656 | wacko // (c) 1982 |
| r242066 | r242067 | |
| 1800 | 1800 | youjyudn // (c) 1986 (Japan) |
| 1801 | 1801 | |
| 1802 | 1802 | vigilant // (c) 1988 (World) |
| 1803 | | vigilantb // (c) 1988 (World) |
| 1803 | vigilantb // (c) 1988 (World) |
| 1804 | 1804 | vigilant1 // (c) 1988 (World) |
| 1805 | 1805 | vigilantu // (c) 1988 (US) |
| 1806 | 1806 | vigilantu2 // (c) 1988 (US) |
| r242066 | r242067 | |
| 2089 | 2089 | kicknrunu // A87 (c) 1986 Taito Corporation |
| 2090 | 2090 | mexico86 // bootleg (Micro Research) |
| 2091 | 2091 | darius // A96 (c) 1986 Taito Corporation Japan (World) |
| 2092 | | dariusu // A96 (c) 1986 Taito America Corporation (US) |
| 2092 | dariusu // A96 (c) 1986 Taito America Corporation (US) |
| 2093 | 2093 | dariusj // A96 (c) 1986 Taito Corporation (Japan) |
| 2094 | 2094 | dariuso // A96 (c) 1986 Taito Corporation (Japan) |
| 2095 | 2095 | dariuse // A96 (c) 1986 Taito Corporation (Japan) |
| r242066 | r242067 | |
| 2280 | 2280 | cubybop // ??? no copyright message |
| 2281 | 2281 | plgirls // (c) 1992 Hot-B. |
| 2282 | 2282 | plgirls2 // (c) 1993 Hot-B. |
| 2283 | | plgirls2b // |
| 2283 | plgirls2b // |
| 2284 | 2284 | lagirl // plgirls bootleg? |
| 2285 | 2285 | |
| 2286 | 2286 | // Taito H-System games |
| r242066 | r242067 | |
| 2853 | 2853 | tjumpman // (c) 1999 Namco |
| 2854 | 2854 | |
| 2855 | 2855 | mushisam // (c) 2004 Cave (AMI license) - 2004/10/12.MASTER VER. |
| 2856 | | mushisama // (c) 2004 Cave (AMI license) - 2004/10/12 MASTER VER. |
| 2856 | mushisama // (c) 2004 Cave (AMI license) - 2004/10/12 MASTER VER. |
| 2857 | 2857 | mushisamb // (c) 2004 Cave (AMI license) - 2004/10/12 MASTER VER |
| 2858 | 2858 | espgal2 // (c) 2005 Cave (AMI license) - 2005/11/14 MASTER VER |
| 2859 | 2859 | ibara // (c) 2005 Cave (AMI license) - 2005/03/22 MASTER VER.. |
| r242066 | r242067 | |
| 3029 | 3029 | bionicc1 // 3/1987 (c) 1987 (US) |
| 3030 | 3030 | bionicc2 // 3/1987 (c) 1987 (US) |
| 3031 | 3031 | topsecrt // 3/1987 (c) 1987 (Japan) |
| 3032 | | supduck // (c) Comad |
| 3032 | supduck // (c) Comad |
| 3033 | 3033 | 1943 // 6/1987 (c) 1987 (Euro) |
| 3034 | 3034 | 1943u // 6/1987 (c) 1987 (US) Rev C |
| 3035 | 3035 | 1943j // 6/1987 (c) 1987 (Japan) Rev B |
| r242066 | r242067 | |
| 3220 | 3220 | sf2mdt // bootleg |
| 3221 | 3221 | sf2mdta // bootleg |
| 3222 | 3222 | sf2mdtb // bootleg |
| 3223 | | sf2b // bootleg |
| 3223 | sf2b // bootleg |
| 3224 | 3224 | cworld2j // 11/06/1992 (c) 1992 (Japan) |
| 3225 | 3225 | varth // 14/07/1992 (c) 1992 (World) |
| 3226 | 3226 | varthr1 // 12/06/1992 (c) 1992 (World) |
| r242066 | r242067 | |
| 4587 | 4587 | dduxj // (c) 1989 (FD1094, decrypted) |
| 4588 | 4588 | ddux1 // (c) 1989 (8751) |
| 4589 | 4589 | dunkshot // (c) 1986 (FD1094, decrypted) |
| 4590 | | dunkshoto // (c) 1986 (FD1094, decrypted) |
| 4590 | dunkshoto // (c) 1986 (FD1094, decrypted) |
| 4591 | 4591 | eswat // (c) 1989 (FD1094, decrypted) |
| 4592 | 4592 | eswatu // (c) 1989 (FD1094, decrypted) |
| 4593 | 4593 | eswatj // (c) 1989 (FD1094, decrypted) |
| r242066 | r242067 | |
| 5262 | 5262 | aladmdb // MegaDrive-based hack |
| 5263 | 5263 | mk3mdb // MegaDrive-based hack |
| 5264 | 5264 | srmdb // MegaDrive-based hack |
| 5265 | | sonic2mb // MegaDrive-based hack |
| 5265 | sonic2mb // MegaDrive-based hack |
| 5266 | 5266 | |
| 5267 | 5267 | // Sega Naomi-based (Dreamcast) systems |
| 5268 | 5268 | naomi // 1998.?? Naomi BIOS |
| r242066 | r242067 | |
| 5842 | 5842 | gekitsui // (c) 1985 Data East Corporation (Japan) |
| 5843 | 5843 | tryout // (c) 1985 Data East Corporation (Japan) |
| 5844 | 5844 | firetrap // (c) 1986 Data East USA (US) |
| 5845 | | firetrapa // (c) 1986 Data East USA (US) |
| 5845 | firetrapa // (c) 1986 Data East USA (US) |
| 5846 | 5846 | firetrapj // (c) 1986 Wood Place Inc. (Japan) |
| 5847 | 5847 | firetrapbl // bootleg |
| 5848 | 5848 | metlclsh // (c) 1985 Data East |
| r242066 | r242067 | |
| 6457 | 6457 | tmntua // GX963 (c) 1989 (US) |
| 6458 | 6458 | tmht // GX963 (c) 1989 (UK) |
| 6459 | 6459 | tmhta // GX963 (c) 1989 (UK) |
| 6460 | | tmhtb // GX963 (c) 1989 (UK?) |
| 6460 | tmhtb // GX963 (c) 1989 (UK?) |
| 6461 | 6461 | tmntj // GX963 (c) 1990 (Japan) |
| 6462 | 6462 | tmht2p // GX963 (c) 1989 (UK) |
| 6463 | 6463 | tmht2pa // GX963 (c) 1989 (UK) |
| r242066 | r242067 | |
| 6861 | 6861 | // Smokey Joe // 030926 1978/07 [6502] |
| 6862 | 6862 | sbrkout3 // 033442-033452 1978/09 [6502] |
| 6863 | 6863 | sbrkout // 033453-033455 1978/09 [6502] |
| 6864 | | sbrkoutc // unrealeased proto |
| 6864 | sbrkoutc // unrealeased proto |
| 6865 | 6865 | atarifb // 033xxx 1978/10 [6502] |
| 6866 | 6866 | atarifb1 // 033xxx 1978/10 [6502] |
| 6867 | 6867 | orbit // 033689-033702 1978/11 [6800] |
| r242066 | r242067 | |
| 7929 | 7929 | ninjakd2a // UPL-????? (c) 1987 |
| 7930 | 7930 | ninjakd2b // UPL-????? (c) 1987 |
| 7931 | 7931 | rdaction // UPL-87003?(c) 1987 + World Games license |
| 7932 | | jt104 // hack? |
| 7932 | jt104 // hack? |
| 7933 | 7933 | mnight // UPL-????? (c) 1987 distributed by Kawakus |
| 7934 | 7934 | arkarea // UPL-87007 (c) 1988 (Arcade TV Game List - P.67, Right, 2 from top) |
| 7935 | 7935 | robokid // UPL-88013 (c) 1988 |
| r242066 | r242067 | |
| 8322 | 8322 | sbagman // (c) 1984 |
| 8323 | 8323 | sbagmans // (c) 1984 + Stern license |
| 8324 | 8324 | botanic // (c) 1983 |
| 8325 | | botanicf // (c) 1984 |
| 8325 | botanicf // (c) 1984 |
| 8326 | 8326 | squaitsa // (c) 1985 |
| 8327 | 8327 | tankbust // (c) 1985 |
| 8328 | 8328 | |
| r242066 | r242067 | |
| 8375 | 8375 | goodejana // (c) 1991 Seibu/Tecmo |
| 8376 | 8376 | |
| 8377 | 8377 | raiden2 // (c) 1993 Seibu Kaihatsu + Fabtek license |
| 8378 | | raiden2sw // (c) 1993 Seibu Kaihats |
| 8378 | raiden2sw // (c) 1993 Seibu Kaihats |
| 8379 | 8379 | raiden2u // (c) 1993 Seibu Kaihatsu + Fabtek license |
| 8380 | 8380 | raiden2hk // (c) 1993 Seibu Kaihatsu + Metrotainment license |
| 8381 | 8381 | raiden2j // (c) 1993 Seibu Kaihatsu |
| r242066 | r242067 | |
| 8721 | 8721 | baryona // (c) 1997 SemiCom |
| 8722 | 8722 | dreamwld // (c) 2000 SemiCom |
| 8723 | 8723 | rolcrush // (c) 1999 Trust |
| 8724 | | cutefght // (c) 1998 SemiCom |
| 8724 | cutefght // (c) 1998 SemiCom |
| 8725 | 8725 | |
| 8726 | 8726 | // SH2 board |
| 8727 | 8727 | s1945ii // (c) 1997 |
| r242066 | r242067 | |
| 8836 | 8836 | // SH-4 hardware |
| 8837 | 8837 | atvtrack // (c) 2002 - Ref 020419 |
| 8838 | 8838 | atvtracka // (c) 2002 - Ref 020419 |
| 8839 | | smashdrv // (c) 2000 |
| 8839 | smashdrv // (c) 2000 |
| 8840 | 8840 | |
| 8841 | 8841 | /* |
| 8842 | 8842 | Remaining Gaelco Games: |
| r242066 | r242067 | |
| 9317 | 9317 | musicbal // (c) 1987 |
| 9318 | 9318 | sauro // (c) 1987 |
| 9319 | 9319 | saurop // (c) 1987 |
| 9320 | | saurorr // (c) 1987 |
| 9320 | saurorr // (c) 1987 |
| 9321 | 9321 | trckydoc // (c) 1987 |
| 9322 | 9322 | trckydoca // (c) 1987 |
| 9323 | 9323 | |
| r242066 | r242067 | |
| 9588 | 9588 | jongtei // "532" Mahjong Jong-Tei (C) 1999 Dynax |
| 9589 | 9589 | seljan2 // "557" 1996 Dynax / Face |
| 9590 | 9590 | realbrk // "600" Billiard Academy Real Break 1998 (Europe) |
| 9591 | | realbrko // "600" Billiard Academy Real Break 1998 (Europe) |
| 9591 | realbrko // "600" Billiard Academy Real Break 1998 (Europe) |
| 9592 | 9592 | realbrkk // "600" Billiard Academy Real Break 1998 (Korea) |
| 9593 | 9593 | janshinp // "700j" 1996 Dynax / Sigma |
| 9594 | 9594 | dtoyoken // "700d" 1996 Dynax / Sigma |
| r242066 | r242067 | |
| 9749 | 9749 | dw2v100x // |
| 9750 | 9750 | drgw2c // |
| 9751 | 9751 | drgw2j // |
| 9752 | | drgw2hk // |
| 9752 | drgw2hk // |
| 9753 | 9753 | drgw3 // (c) 1998 Dragon World 3 |
| 9754 | 9754 | drgw3105 // |
| 9755 | 9755 | drgw3100 // |
| r242066 | r242067 | |
| 9850 | 9850 | // IGS PGM2 Platform |
| 9851 | 9851 | orleg2 // (c) 2007 |
| 9852 | 9852 | orleg2o // |
| 9853 | | orleg2oa // |
| 9853 | orleg2oa // |
| 9854 | 9854 | kov2nl // (c) 2008 |
| 9855 | 9855 | kov2nlo // |
| 9856 | | kov2nloa // |
| 9856 | kov2nloa // |
| 9857 | 9857 | ddpdojh // |
| 9858 | 9858 | kov3 // |
| 9859 | 9859 | |
| r242066 | r242067 | |
| 31864 | 31864 | cocoloco // 198?, Petaco S.A. |
| 31865 | 31865 | |
| 31866 | 31866 | alinvade |
| 31867 | | |
trunk/src/mess/drivers/apple2.c
| r242066 | r242067 | |
| 2 | 2 | // copyright-holders:R. Belmont |
| 3 | 3 | /*************************************************************************** |
| 4 | 4 | |
| 5 | | apple2.c - Apple II/II Plus and clones |
| 5 | apple2.c - Apple II/II Plus and clones |
| 6 | 6 | |
| 7 | | Next generation driver written in September/October 2014 by R. Belmont. |
| 8 | | Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont |
| 9 | | Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. |
| 10 | | |
| 11 | | II: original base model. RAM sizes of 4, 8, 12, 16, 20, 24, 32, 36, and 48 KB possible. |
| 7 | Next generation driver written in September/October 2014 by R. Belmont. |
| 8 | Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont |
| 9 | Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. |
| 10 | |
| 11 | II: original base model. RAM sizes of 4, 8, 12, 16, 20, 24, 32, 36, and 48 KB possible. |
| 12 | 12 | 8K of ROM at $E000-$FFFF, empty sockets for $D000-$D7FF and $D800-$DFFF. |
| 13 | 13 | Programmer's Aid #1 was sold by Apple for $D000-$D7FF, some third-party ROMs |
| 14 | 14 | were also available. |
| r242066 | r242067 | |
| 19 | 19 | |
| 20 | 20 | ROM contains original non-autostart Monitor and Integer BASIC; apparently |
| 21 | 21 | Autostart + Integer is also possible. |
| 22 | | |
| 23 | | II Plus: RAM options reduced to 16/32/48 KB. |
| 22 | |
| 23 | II Plus: RAM options reduced to 16/32/48 KB. |
| 24 | 24 | ROM expanded to 12KB from $D000-$FFFF containing Applesoft BASIC and |
| 25 | 25 | the Autostart Monitor. Applesoft is a licensed version of Microsoft's |
| 26 | 26 | 6502 BASIC as also found in Commodore and many other computers. |
| 27 | | |
| 28 | | |
| 27 | |
| 28 | |
| 29 | 29 | Users of both models often connected the SHIFT key to the paddle #2 button |
| 30 | 30 | (mapped to $C063) in order to inform properly written software that characters |
| 31 | 31 | were to be intended upper/lower case. |
| 32 | | |
| 32 | |
| 33 | 33 | Both models commonly included a RAM "language card" in slot 0 which added 16K |
| 34 | 34 | of RAM which could be banked into the $D000-$FFFF space to replace the ROMs. |
| 35 | 35 | This allowed running Applesoft on a II and Integer BASIC on a II Plus. |
| 36 | 36 | A II Plus with this card installed is often called a "64K Apple II"; this is |
| 37 | 37 | the base configuration required to run ProDOS and some larger games. |
| 38 | | |
| 39 | | ************************************************************************/ |
| 40 | | |
| 38 | |
| 39 | ************************************************************************/ |
| 40 | |
| 41 | 41 | #include "emu.h" |
| 42 | 42 | #include "machine/bankdev.h" |
| 43 | 43 | #include "machine/ram.h" |
| r242066 | r242067 | |
| 212 | 212 | { |
| 213 | 213 | // assume no cards are pulling /INH |
| 214 | 214 | m_inh_slot = -1; |
| 215 | | |
| 215 | |
| 216 | 216 | // scan the slots to figure out which card(s) are INHibiting stuff |
| 217 | 217 | for (int i = 0; i <= 7; i++) |
| 218 | 218 | { |
| r242066 | r242067 | |
| 226 | 226 | { |
| 227 | 227 | if (m_inh_bank != 1) |
| 228 | 228 | { |
| 229 | | m_upperbank->set_bank(1); |
| 229 | m_upperbank->set_bank(1); |
| 230 | 230 | m_inh_bank = 1; |
| 231 | 231 | } |
| 232 | 232 | } |
| r242066 | r242067 | |
| 234 | 234 | { |
| 235 | 235 | if (m_inh_bank != 0) |
| 236 | 236 | { |
| 237 | | m_upperbank->set_bank(0); |
| 237 | m_upperbank->set_bank(0); |
| 238 | 238 | m_inh_bank = 0; |
| 239 | 239 | } |
| 240 | 240 | } |
| r242066 | r242067 | |
| 248 | 248 | // if no slots are inhibiting, make sure ROM is fully switched in |
| 249 | 249 | if ((m_inh_slot == -1) && (m_inh_bank != 0)) |
| 250 | 250 | { |
| 251 | | m_upperbank->set_bank(0); |
| 251 | m_upperbank->set_bank(0); |
| 252 | 252 | m_inh_bank = 0; |
| 253 | 253 | } |
| 254 | 254 | } |
| r242066 | r242067 | |
| 315 | 315 | m_anykeydown = false; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | | /*************************************************************************** |
| 318 | /*************************************************************************** |
| 319 | 319 | VIDEO |
| 320 | 320 | ***************************************************************************/ |
| 321 | 321 | |
| r242066 | r242067 | |
| 332 | 332 | m_video->m_sysconfig = m_sysconfig->read(); |
| 333 | 333 | |
| 334 | 334 | // check reset |
| 335 | | if (m_resetdip) // if reset DIP is present, use it |
| 335 | if (m_resetdip) // if reset DIP is present, use it |
| 336 | 336 | { |
| 337 | 337 | if (m_resetdip->read() & 1) |
| 338 | | { // CTRL-RESET |
| 338 | { // CTRL-RESET |
| 339 | 339 | if ((m_kbspecial->read() & 0x88) == 0x88) |
| 340 | 340 | { |
| 341 | 341 | m_maincpu->reset(); |
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | | else // plain RESET |
| 344 | else // plain RESET |
| 345 | 345 | { |
| 346 | 346 | if (m_kbspecial->read() & 0x80) |
| 347 | 347 | { |
| r242066 | r242067 | |
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | | else // no DIP, so always plain RESET |
| 352 | else // no DIP, so always plain RESET |
| 353 | 353 | { |
| 354 | 354 | if (m_kbspecial->read() & 0x80) |
| 355 | 355 | { |
| r242066 | r242067 | |
| 383 | 383 | m_video->hgr_update(screen, bitmap, cliprect, 0, 191); |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | | else // lo-res |
| 387 | | { |
| 386 | else // lo-res |
| 387 | { |
| 388 | 388 | if (m_video->m_mix) |
| 389 | 389 | { |
| 390 | 390 | m_video->lores_update(screen, bitmap, cliprect, 0, 159); |
| r242066 | r242067 | |
| 404 | 404 | return 0; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | | /*************************************************************************** |
| 407 | /*************************************************************************** |
| 408 | 408 | I/O |
| 409 | 409 | ***************************************************************************/ |
| 410 | 410 | // most softswitches don't care about read vs write, so handle them here |
| r242066 | r242067 | |
| 440 | 440 | m_video->m_mix = true; break; |
| 441 | 441 | |
| 442 | 442 | case 0x54: // set page 1 |
| 443 | | m_page2 = false; |
| 443 | m_page2 = false; |
| 444 | 444 | m_video->m_page2 = false; |
| 445 | 445 | break; |
| 446 | 446 | |
| 447 | 447 | case 0x55: // set page 2 |
| 448 | | m_page2 = true; |
| 448 | m_page2 = true; |
| 449 | 449 | m_video->m_page2 = true; |
| 450 | 450 | break; |
| 451 | 451 | |
| r242066 | r242067 | |
| 479 | 479 | case 0x5f: // AN3 on |
| 480 | 480 | m_an3 = true; break; |
| 481 | 481 | |
| 482 | | case 0x68: // IIgs STATE register, which ProDOS touches |
| 482 | case 0x68: // IIgs STATE register, which ProDOS touches |
| 483 | 483 | break; |
| 484 | 484 | |
| 485 | 485 | case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: |
| r242066 | r242067 | |
| 510 | 510 | case 0x68: |
| 511 | 511 | return m_cassette->input() > 0.0 ? 0x80 : 0; |
| 512 | 512 | |
| 513 | | case 0x61: // button 0 |
| 513 | case 0x61: // button 0 |
| 514 | 514 | case 0x69: |
| 515 | 515 | return (m_joybuttons->read() & 0x10) ? 0x80 : 0; |
| 516 | 516 | |
| 517 | | case 0x62: // button 1 |
| 517 | case 0x62: // button 1 |
| 518 | 518 | case 0x6a: |
| 519 | 519 | return (m_joybuttons->read() & 0x20) ? 0x80 : 0; |
| 520 | 520 | |
| 521 | | case 0x63: // button 2 |
| 521 | case 0x63: // button 2 |
| 522 | 522 | case 0x6b: |
| 523 | 523 | // check if SHIFT key mod configured |
| 524 | 524 | if (m_sysconfig->read() & 0x04) |
| r242066 | r242067 | |
| 527 | 527 | } |
| 528 | 528 | return (m_joybuttons->read() & 0x40) ? 0x80 : 0; |
| 529 | 529 | |
| 530 | | case 0x64: // joy 1 X axis |
| 530 | case 0x64: // joy 1 X axis |
| 531 | 531 | case 0x6c: |
| 532 | 532 | return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; |
| 533 | 533 | |
| 534 | | case 0x65: // joy 1 Y axis |
| 534 | case 0x65: // joy 1 Y axis |
| 535 | 535 | case 0x6d: |
| 536 | 536 | return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; |
| 537 | 537 | |
| r242066 | r242067 | |
| 666 | 666 | { |
| 667 | 667 | if (m_inh_slot != -1) |
| 668 | 668 | { |
| 669 | | return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); |
| 669 | return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | | assert(0); // hitting inh_r with invalid m_inh_slot should not be possible |
| 672 | assert(0); // hitting inh_r with invalid m_inh_slot should not be possible |
| 673 | 673 | return read_floatingbus(); |
| 674 | 674 | } |
| 675 | 675 | |
| r242066 | r242067 | |
| 942 | 942 | if (m_transchar != 0) |
| 943 | 943 | { |
| 944 | 944 | m_strobe = 0x80; |
| 945 | | // printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); |
| 945 | // printf("new char = %04x (%02x)\n", m_lastchar&0x3f, m_transchar); |
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | 948 | } |
| r242066 | r242067 | |
| 1021 | 1021 | PORT_CONFSETTING(0x02, "Green") |
| 1022 | 1022 | PORT_CONFSETTING(0x03, "Amber") |
| 1023 | 1023 | |
| 1024 | | PORT_CONFNAME(0x04, 0x04, "Shift key mod") // default to installed |
| 1024 | PORT_CONFNAME(0x04, 0x04, "Shift key mod") // default to installed |
| 1025 | 1025 | PORT_CONFSETTING(0x00, "Not present") |
| 1026 | 1026 | PORT_CONFSETTING(0x04, "Installed") |
| 1027 | 1027 | INPUT_PORTS_END |
| r242066 | r242067 | |
| 1053 | 1053 | PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 1054 | 1054 | PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 1055 | 1055 | PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 1056 | | PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 1056 | PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 1057 | 1057 | PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') |
| 1058 | 1058 | PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') |
| 1059 | 1059 | |
| r242066 | r242067 | |
| 1186 | 1186 | |
| 1187 | 1187 | static SLOT_INTERFACE_START(apple2_slot0_cards) |
| 1188 | 1188 | SLOT_INTERFACE("lang", A2BUS_RAMCARD16K) /* Apple II RAM Language Card */ |
| 1189 | | SLOT_INTERFACE("ssram", A2BUS_RAMCARD128K) /* Saturn Systems 128K extended language card */ |
| 1189 | SLOT_INTERFACE("ssram", A2BUS_RAMCARD128K) /* Saturn Systems 128K extended language card */ |
| 1190 | 1190 | SLOT_INTERFACE_END |
| 1191 | 1191 | |
| 1192 | 1192 | static SLOT_INTERFACE_START(apple2_cards) |
| r242066 | r242067 | |
| 1277 | 1277 | MCFG_AY3600_SHIFT_CB(READLINE(napple2_state, ay3600_shift_r)) |
| 1278 | 1278 | MCFG_AY3600_CONTROL_CB(READLINE(napple2_state, ay3600_control_r)) |
| 1279 | 1279 | MCFG_AY3600_DATA_READY_CB(WRITELINE(napple2_state, ay3600_data_ready_w)) |
| 1280 | | MCFG_AY3600_AKO_CB(WRITELINE(napple2_state, ay3600_ako_w)) |
| 1280 | MCFG_AY3600_AKO_CB(WRITELINE(napple2_state, ay3600_ako_w)) |
| 1281 | 1281 | |
| 1282 | 1282 | /* repeat timer. 15 Hz from page 90 of "The Apple II Circuit Description */ |
| 1283 | 1283 | MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", napple2_state, ay3600_repeat, attotime::from_hz(15)) |
trunk/src/mess/drivers/apple2e.c
| r242066 | r242067 | |
| 4 | 4 | |
| 5 | 5 | apple2e.c - Apple IIe/IIc/IIc Plus and clones |
| 6 | 6 | |
| 7 | | Next generation driver written in September/October 2014 by R. Belmont. |
| 8 | | Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont |
| 9 | | Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. |
| 10 | | |
| 11 | | |
| 12 | | IIe: base of this driver. 64K RAM, slot 0 language card emulation without the double-read requirement, |
| 7 | Next generation driver written in September/October 2014 by R. Belmont. |
| 8 | Thanks to the original Apple II series driver's authors: Mike Balfour, Nathan Woods, and R. Belmont |
| 9 | Special thanks to the Apple II Documentation Project/Antoine Vignau and Peter Ferrie. |
| 10 | |
| 11 | |
| 12 | IIe: base of this driver. 64K RAM, slot 0 language card emulation without the double-read requirement, |
| 13 | 13 | lowercase and SHIFT key on button 2, Open and Solid Apple buttons on joy buttons 0 and 1, |
| 14 | 14 | auxiliary slot, built-in 80 column support if extra RAM added. |
| 15 | | |
| 16 | | Physical slot 0 was eliminated thanks to the built-in language card. |
| 17 | | |
| 18 | | Most of the write-only softswitches gained readback locations, necessary to make interrupt-driven |
| 19 | | software possible. |
| 20 | | |
| 21 | | Base 80-column card: 1K RAM, allows 80 columns and double-lo-res, |
| 22 | | no double-hi-res. |
| 23 | | |
| 24 | | Extended 80-column card: 64K RAM (including a second language card), |
| 25 | | allows 80 columns, double-lo-res, and double-hi-res. |
| 26 | | |
| 27 | | Revision A motherboards (very rare) don't support double-hi-res; it's unclear |
| 28 | | if double-lo-res works or not. We emulate the much more common Rev B or later |
| 29 | | board. |
| 30 | | |
| 31 | | IIe enhanced: 65C02 CPU with more instructions, MouseText in the character generator. |
| 32 | | |
| 33 | | IIe platinum: Like enhanced but with added numeric keypad and extended 80-column card |
| 34 | | included in the box. Keypad CLEAR generates ESC by default, one hardware mod |
| 35 | | made it generate CTRL-X instead. (new keyboard encoder ROM?) |
| 36 | | |
| 37 | | NOTE: On real IIe and IIe enhanced h/w, pressing SHIFT and paddle button 2 will |
| 38 | | short out the power supply and cause a safety shutdown. (We don't emulate |
| 39 | | this "feature", and it was relatively rare in real life as Apple joysticks only |
| 40 | | had buttons 0 and 1 normally). |
| 41 | | |
| 42 | | IIc: IIe enhanced shrunken into a pizzabox with a Disk II compatible |
| 43 | | half-height drive included in the case. |
| 44 | | |
| 45 | | No slots, but included functionality equivalent to the following slots |
| 46 | | on the motherboard: |
| 15 | |
| 16 | Physical slot 0 was eliminated thanks to the built-in language card. |
| 17 | |
| 18 | Most of the write-only softswitches gained readback locations, necessary to make interrupt-driven |
| 19 | software possible. |
| 20 | |
| 21 | Base 80-column card: 1K RAM, allows 80 columns and double-lo-res, |
| 22 | no double-hi-res. |
| 23 | |
| 24 | Extended 80-column card: 64K RAM (including a second language card), |
| 25 | allows 80 columns, double-lo-res, and double-hi-res. |
| 26 | |
| 27 | Revision A motherboards (very rare) don't support double-hi-res; it's unclear |
| 28 | if double-lo-res works or not. We emulate the much more common Rev B or later |
| 29 | board. |
| 30 | |
| 31 | IIe enhanced: 65C02 CPU with more instructions, MouseText in the character generator. |
| 32 | |
| 33 | IIe platinum: Like enhanced but with added numeric keypad and extended 80-column card |
| 34 | included in the box. Keypad CLEAR generates ESC by default, one hardware mod |
| 35 | made it generate CTRL-X instead. (new keyboard encoder ROM?) |
| 36 | |
| 37 | NOTE: On real IIe and IIe enhanced h/w, pressing SHIFT and paddle button 2 will |
| 38 | short out the power supply and cause a safety shutdown. (We don't emulate |
| 39 | this "feature", and it was relatively rare in real life as Apple joysticks only |
| 40 | had buttons 0 and 1 normally). |
| 41 | |
| 42 | IIc: IIe enhanced shrunken into a pizzabox with a Disk II compatible |
| 43 | half-height drive included in the case. |
| 44 | |
| 45 | No slots, but included functionality equivalent to the following slots |
| 46 | on the motherboard: |
| 47 | 47 | - 2 Super Serial Cards (modem and printer ports) |
| 48 | 48 | - extended 80 column card / 128K RAM |
| 49 | 49 | - Disk II IWM controller |
| 50 | 50 | - Apple II Mouse card (firmware entry points are compatible, |
| 51 | 51 | but the hardware implementation omits the 68705 and is quite different!) |
| 52 | | |
| 52 | |
| 53 | 53 | Has a 40/80 column switch and a QWERTY/DVORAK switch. |
| 54 | | |
| 55 | | IIc (UniDisk 3.5): IIc with ROM doubled to 32K and the ROMSWITCH register |
| 56 | | added to page between the original 16K ROM and the new added 16K. The |
| 57 | | extra firmware space was dedicated to implementing the Protocol Converter, |
| 58 | | later renamed "SmartPort", which communicates with "smart" packet devices |
| 59 | | over the IWM bus. |
| 60 | | |
| 61 | | Partial AppleTalk code also exists in this ROM but it doesn't work and |
| 62 | | was not completed. |
| 63 | | |
| 64 | | IIc (Original Memory Expansion): |
| 65 | | Removes AppleTalk and adds support for a memory expansion card with up |
| 66 | | to 1 MB; this is identical both in hardware and firmware to the "Slinky" |
| 67 | | memory expansion card for the Apple IIe (a2bus/a2memexp.c). |
| 68 | 54 | |
| 69 | | IIc (Revised Memory Expansion, Rev. 3): |
| 70 | | Fixes several nasty bugs in the Original Memory Expansion version. Not |
| 71 | | currently dumped. |
| 72 | | |
| 73 | | IIc (Rev 4): |
| 74 | | Fixes memory size detection for memory cards with less than 1MB. Fixes |
| 75 | | several screen hole errors introduced in Rev 3, and fixes Terminal Mode |
| 76 | | wherein the firmware can be put into a built-in terminal mode for simple |
| 77 | | tests with a modem. |
| 78 | | |
| 79 | | IIc Plus: |
| 80 | | Like IIc with memory expansion, but with licensed built-in Zip Chip which |
| 81 | | runs the 65C02 at 4 MHz turbo speed with a small cache RAM. |
| 55 | IIc (UniDisk 3.5): IIc with ROM doubled to 32K and the ROMSWITCH register |
| 56 | added to page between the original 16K ROM and the new added 16K. The |
| 57 | extra firmware space was dedicated to implementing the Protocol Converter, |
| 58 | later renamed "SmartPort", which communicates with "smart" packet devices |
| 59 | over the IWM bus. |
| 82 | 60 | |
| 83 | | The machine has an internal "Apple 3.5" drive plus a custom gate array |
| 84 | | which emulates the functionality of the UniDisk 3.5's on-board 65C02. |
| 85 | | This gets around the fact that 1 MHz isn't sufficient to handle direct |
| 86 | | Woz-style control of a double-density 3.5" drive. |
| 61 | Partial AppleTalk code also exists in this ROM but it doesn't work and |
| 62 | was not completed. |
| 87 | 63 | |
| 88 | | External drive port allows IIgs-style daisy-chaining. |
| 64 | IIc (Original Memory Expansion): |
| 65 | Removes AppleTalk and adds support for a memory expansion card with up |
| 66 | to 1 MB; this is identical both in hardware and firmware to the "Slinky" |
| 67 | memory expansion card for the Apple IIe (a2bus/a2memexp.c). |
| 89 | 68 | |
| 69 | IIc (Revised Memory Expansion, Rev. 3): |
| 70 | Fixes several nasty bugs in the Original Memory Expansion version. Not |
| 71 | currently dumped. |
| 72 | |
| 73 | IIc (Rev 4): |
| 74 | Fixes memory size detection for memory cards with less than 1MB. Fixes |
| 75 | several screen hole errors introduced in Rev 3, and fixes Terminal Mode |
| 76 | wherein the firmware can be put into a built-in terminal mode for simple |
| 77 | tests with a modem. |
| 78 | |
| 79 | IIc Plus: |
| 80 | Like IIc with memory expansion, but with licensed built-in Zip Chip which |
| 81 | runs the 65C02 at 4 MHz turbo speed with a small cache RAM. |
| 82 | |
| 83 | The machine has an internal "Apple 3.5" drive plus a custom gate array |
| 84 | which emulates the functionality of the UniDisk 3.5's on-board 65C02. |
| 85 | This gets around the fact that 1 MHz isn't sufficient to handle direct |
| 86 | Woz-style control of a double-density 3.5" drive. |
| 87 | |
| 88 | External drive port allows IIgs-style daisy-chaining. |
| 89 | |
| 90 | 90 | ---------------------------------- |
| 91 | 91 | |
| 92 | 92 | TK3000 keyboard matrix |
| r242066 | r242067 | |
| 163 | 163 | #define A2_AUXSLOT_TAG "auxbus" |
| 164 | 164 | #define A2_VIDEO_TAG "a2video" |
| 165 | 165 | |
| 166 | | #define A2_0000_TAG "r00bank" |
| 167 | | #define A2_0200_TAG "r02bank" |
| 168 | | #define A2_0400_TAG "r04bank" |
| 169 | | #define A2_0800_TAG "r08bank" |
| 170 | | #define A2_2000_TAG "r20bank" |
| 171 | | #define A2_4000_TAG "r40bank" |
| 172 | | #define A2_C100_TAG "c1bank" |
| 173 | | #define A2_C300_TAG "c3bank" |
| 174 | | #define A2_C400_TAG "c4bank" |
| 175 | | #define A2_C800_TAG "c8bank" |
| 166 | #define A2_0000_TAG "r00bank" |
| 167 | #define A2_0200_TAG "r02bank" |
| 168 | #define A2_0400_TAG "r04bank" |
| 169 | #define A2_0800_TAG "r08bank" |
| 170 | #define A2_2000_TAG "r20bank" |
| 171 | #define A2_4000_TAG "r40bank" |
| 172 | #define A2_C100_TAG "c1bank" |
| 173 | #define A2_C300_TAG "c3bank" |
| 174 | #define A2_C400_TAG "c4bank" |
| 175 | #define A2_C800_TAG "c8bank" |
| 176 | 176 | #define A2_LCBANK_TAG "lcbank" |
| 177 | 177 | |
| 178 | 178 | #define MOUSE_BUTTON_TAG "mse_button" |
| 179 | 179 | #define MOUSE_XAXIS_TAG "mse_x" |
| 180 | 180 | #define MOUSE_YAXIS_TAG "mse_y" |
| 181 | 181 | |
| 182 | | #define CNXX_UNCLAIMED -1 |
| 183 | | #define CNXX_INTROM -2 |
| 182 | #define CNXX_UNCLAIMED -1 |
| 183 | #define CNXX_INTROM -2 |
| 184 | 184 | |
| 185 | 185 | #define IRQ_SLOT 0 |
| 186 | | #define IRQ_VBL 1 |
| 186 | #define IRQ_VBL 1 |
| 187 | 187 | #define IRQ_MOUSEXY 2 |
| 188 | 188 | |
| 189 | 189 | class apple2e_state : public driver_device |
| r242066 | r242067 | |
| 430 | 430 | { |
| 431 | 431 | // assume no cards are pulling /INH |
| 432 | 432 | m_inh_slot = -1; |
| 433 | | |
| 433 | |
| 434 | 434 | // scan the slots to figure out which card(s) are INHibiting stuff |
| 435 | 435 | for (int i = 0; i <= 7; i++) |
| 436 | 436 | { |
| r242066 | r242067 | |
| 444 | 444 | { |
| 445 | 445 | if (m_inh_bank != 1) |
| 446 | 446 | { |
| 447 | | m_upperbank->set_bank(1); |
| 447 | m_upperbank->set_bank(1); |
| 448 | 448 | m_inh_bank = 1; |
| 449 | 449 | } |
| 450 | 450 | } |
| r242066 | r242067 | |
| 452 | 452 | { |
| 453 | 453 | if (m_inh_bank != 0) |
| 454 | 454 | { |
| 455 | | m_upperbank->set_bank(0); |
| 455 | m_upperbank->set_bank(0); |
| 456 | 456 | m_inh_bank = 0; |
| 457 | 457 | } |
| 458 | 458 | } |
| r242066 | r242067 | |
| 466 | 466 | // if no slots are inhibiting, make sure ROM is fully switched in |
| 467 | 467 | if ((m_inh_slot == -1) && (m_inh_bank != 0)) |
| 468 | 468 | { |
| 469 | | m_upperbank->set_bank(0); |
| 469 | m_upperbank->set_bank(0); |
| 470 | 470 | m_inh_bank = 0; |
| 471 | 471 | } |
| 472 | 472 | } |
| r242066 | r242067 | |
| 485 | 485 | { |
| 486 | 486 | if (m_exp_liveptr <= m_exp_addrmask) |
| 487 | 487 | { |
| 488 | | retval = m_exp_ram[m_exp_liveptr]; |
| 488 | retval = m_exp_ram[m_exp_liveptr]; |
| 489 | 489 | } |
| 490 | 490 | else |
| 491 | 491 | { |
| r242066 | r242067 | |
| 569 | 569 | m_cassette_out = 0; |
| 570 | 570 | if (m_cassette) |
| 571 | 571 | { |
| 572 | | m_cassette->output(-1.0f); |
| 572 | m_cassette->output(-1.0f); |
| 573 | 573 | } |
| 574 | 574 | m_upperbank->set_bank(0); |
| 575 | 575 | m_lcbank->set_bank(0); |
| r242066 | r242067 | |
| 587 | 587 | m_exp_addrmask = m_ram_size - (128*1024) - 1; |
| 588 | 588 | m_exp_ram = m_ram_ptr + (128*1024); |
| 589 | 589 | } |
| 590 | | else // no expansion |
| 590 | else // no expansion |
| 591 | 591 | { |
| 592 | 592 | m_exp_addrmask = 0; |
| 593 | 593 | m_exp_ram = NULL; |
| r242066 | r242067 | |
| 612 | 612 | m_aux_ptr = m_auxslotdevice->get_vram_ptr(); |
| 613 | 613 | m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); |
| 614 | 614 | } |
| 615 | | else // IIc has 128K right on the motherboard |
| 615 | else // IIc has 128K right on the motherboard |
| 616 | 616 | { |
| 617 | 617 | m_auxslotdevice = NULL; |
| 618 | 618 | |
| 619 | 619 | if (m_ram_size >= (128*1024)) |
| 620 | 620 | { |
| 621 | | m_aux_ptr = &m_ram_ptr[0x10000]; |
| 621 | m_aux_ptr = &m_ram_ptr[0x10000]; |
| 622 | 622 | m_aux_bank_ptr = m_aux_ptr; |
| 623 | 623 | } |
| 624 | 624 | } |
| r242066 | r242067 | |
| 749 | 749 | |
| 750 | 750 | if (m_irqmask) |
| 751 | 751 | { |
| 752 | | m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 752 | m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); |
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| r242066 | r242067 | |
| 760 | 760 | |
| 761 | 761 | if (!m_irqmask) |
| 762 | 762 | { |
| 763 | | m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 763 | m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | | /*************************************************************************** |
| 767 | /*************************************************************************** |
| 768 | 768 | VIDEO |
| 769 | 769 | ***************************************************************************/ |
| 770 | 770 | |
| r242066 | r242067 | |
| 779 | 779 | |
| 780 | 780 | if (m_isiic) |
| 781 | 781 | { |
| 782 | | update_iic_mouse(); |
| 782 | update_iic_mouse(); |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if (scanline == 192) |
| r242066 | r242067 | |
| 828 | 828 | { |
| 829 | 829 | if (m_video->m_dhires) |
| 830 | 830 | { |
| 831 | | m_video->dhgr_update(screen, bitmap, cliprect, 0, 159); |
| 831 | m_video->dhgr_update(screen, bitmap, cliprect, 0, 159); |
| 832 | 832 | } |
| 833 | 833 | else |
| 834 | 834 | { |
| 835 | | m_video->hgr_update(screen, bitmap, cliprect, 0, 159); |
| 835 | m_video->hgr_update(screen, bitmap, cliprect, 0, 159); |
| 836 | 836 | } |
| 837 | 837 | m_video->text_update(screen, bitmap, cliprect, 160, 191); |
| 838 | 838 | } |
| r242066 | r242067 | |
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | | else // lo-res |
| 852 | | { |
| 851 | else // lo-res |
| 852 | { |
| 853 | 853 | if (m_video->m_mix) |
| 854 | 854 | { |
| 855 | 855 | if (m_video->m_dhires) |
| r242066 | r242067 | |
| 867 | 867 | { |
| 868 | 868 | if (m_video->m_dhires) |
| 869 | 869 | { |
| 870 | | m_video->dlores_update(screen, bitmap, cliprect, 0, 191); |
| 870 | m_video->dlores_update(screen, bitmap, cliprect, 0, 191); |
| 871 | 871 | } |
| 872 | 872 | else |
| 873 | 873 | { |
| 874 | | m_video->lores_update(screen, bitmap, cliprect, 0, 191); |
| 874 | m_video->lores_update(screen, bitmap, cliprect, 0, 191); |
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | } |
| r242066 | r242067 | |
| 886 | 886 | return 0; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | | /*************************************************************************** |
| 889 | /*************************************************************************** |
| 890 | 890 | I/O |
| 891 | 891 | ***************************************************************************/ |
| 892 | 892 | void apple2e_state::auxbank_update() |
| r242066 | r242067 | |
| 954 | 954 | m_c100bank->set_bank(cxswitch); |
| 955 | 955 | m_c400bank->set_bank(cxswitch); |
| 956 | 956 | |
| 957 | | // printf("intcxrom %d cnxx_slot %d isiic %d romswitch %d\n", m_intcxrom, m_cnxx_slot, m_isiic, m_romswitch); |
| 957 | // printf("intcxrom %d cnxx_slot %d isiic %d romswitch %d\n", m_intcxrom, m_cnxx_slot, m_isiic, m_romswitch); |
| 958 | 958 | if ((m_intcxrom) || (m_cnxx_slot < 0) || (m_isiic)) |
| 959 | 959 | { |
| 960 | 960 | if (m_romswitch) |
| 961 | 961 | { |
| 962 | | m_c800bank->set_bank(2); |
| 962 | m_c800bank->set_bank(2); |
| 963 | 963 | } |
| 964 | 964 | else |
| 965 | 965 | { |
| 966 | | m_c800bank->set_bank(1); |
| 966 | m_c800bank->set_bank(1); |
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | else |
| r242066 | r242067 | |
| 975 | 975 | { |
| 976 | 976 | if (m_romswitch) |
| 977 | 977 | { |
| 978 | | m_c300bank->set_bank(2); |
| 978 | m_c300bank->set_bank(2); |
| 979 | 979 | } |
| 980 | 980 | else |
| 981 | 981 | { |
| 982 | | m_c300bank->set_bank(1); |
| 982 | m_c300bank->set_bank(1); |
| 983 | 983 | } |
| 984 | 984 | } |
| 985 | 985 | else |
| 986 | 986 | { |
| 987 | | m_c300bank->set_bank(0); |
| 987 | m_c300bank->set_bank(0); |
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | 990 | |
| r242066 | r242067 | |
| 1018 | 1018 | { |
| 1019 | 1019 | if (m_lcram) |
| 1020 | 1020 | { |
| 1021 | | m_lcbank->set_bank(1); |
| 1021 | m_lcbank->set_bank(1); |
| 1022 | 1022 | } |
| 1023 | 1023 | else |
| 1024 | 1024 | { |
| 1025 | 1025 | if (m_romswitch) |
| 1026 | 1026 | { |
| 1027 | | m_lcbank->set_bank(2); |
| 1027 | m_lcbank->set_bank(2); |
| 1028 | 1028 | } |
| 1029 | 1029 | else |
| 1030 | 1030 | { |
| 1031 | | m_lcbank->set_bank(0); |
| 1031 | m_lcbank->set_bank(0); |
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | #if 0 |
| 1037 | | printf("LC: new state %c%c dxxx=%04x altzp=%d\n", |
| 1038 | | m_lcram ? 'R' : 'x', |
| 1039 | | m_lcwriteenable ? 'W' : 'x', |
| 1040 | | m_lcram2 ? 0x1000 : 0x0000, |
| 1041 | | m_altzp); |
| 1037 | printf("LC: new state %c%c dxxx=%04x altzp=%d\n", |
| 1038 | m_lcram ? 'R' : 'x', |
| 1039 | m_lcwriteenable ? 'W' : 'x', |
| 1040 | m_lcram2 ? 0x1000 : 0x0000, |
| 1041 | m_altzp); |
| 1042 | 1042 | #endif |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| r242066 | r242067 | |
| 1055 | 1055 | { |
| 1056 | 1056 | switch (offset) |
| 1057 | 1057 | { |
| 1058 | | case 0x58: // DisXY |
| 1058 | case 0x58: // DisXY |
| 1059 | 1059 | m_xy = false; break; |
| 1060 | 1060 | |
| 1061 | | case 0x59: // EnbXY |
| 1061 | case 0x59: // EnbXY |
| 1062 | 1062 | m_xy = true; break; |
| 1063 | 1063 | |
| 1064 | | case 0x5a: // DisVBL |
| 1064 | case 0x5a: // DisVBL |
| 1065 | 1065 | m_vblmask = false; break; |
| 1066 | 1066 | |
| 1067 | | case 0x5b: // EnVBL |
| 1067 | case 0x5b: // EnVBL |
| 1068 | 1068 | m_vblmask = true; break; |
| 1069 | 1069 | |
| 1070 | | case 0x5c: // RisX0Edge |
| 1070 | case 0x5c: // RisX0Edge |
| 1071 | 1071 | m_x0edge = false; break; |
| 1072 | 1072 | |
| 1073 | | case 0x5d: // FalX0Edge |
| 1073 | case 0x5d: // FalX0Edge |
| 1074 | 1074 | m_x0edge = true; break; |
| 1075 | 1075 | |
| 1076 | | case 0x5e: // RisY0Edge |
| 1076 | case 0x5e: // RisY0Edge |
| 1077 | 1077 | if (!m_ioudis) |
| 1078 | 1078 | { |
| 1079 | | m_y0edge = false; |
| 1079 | m_y0edge = false; |
| 1080 | 1080 | } |
| 1081 | 1081 | break; |
| 1082 | 1082 | |
| 1083 | | case 0x5f: // FalY0Edge |
| 1083 | case 0x5f: // FalY0Edge |
| 1084 | 1084 | if (!m_ioudis) |
| 1085 | 1085 | { |
| 1086 | | m_y0edge = true; |
| 1086 | m_y0edge = true; |
| 1087 | 1087 | } |
| 1088 | 1088 | break; |
| 1089 | 1089 | } |
| r242066 | r242067 | |
| 1091 | 1091 | |
| 1092 | 1092 | if (m_ioudis) |
| 1093 | 1093 | { |
| 1094 | | switch (offset) |
| 1094 | switch (offset) |
| 1095 | 1095 | { |
| 1096 | | case 0x5e: // SETDHIRES |
| 1097 | | m_video->m_dhires = true; |
| 1096 | case 0x5e: // SETDHIRES |
| 1097 | m_video->m_dhires = true; |
| 1098 | 1098 | break; |
| 1099 | 1099 | |
| 1100 | | case 0x5f: // CLRDHIRES |
| 1101 | | m_video->m_dhires = false; |
| 1100 | case 0x5f: // CLRDHIRES |
| 1101 | m_video->m_dhires = false; |
| 1102 | 1102 | break; |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| r242066 | r242067 | |
| 1111 | 1111 | case 0x20: |
| 1112 | 1112 | if (m_cassette) |
| 1113 | 1113 | { |
| 1114 | | m_cassette_state ^= 1; |
| 1114 | m_cassette_state ^= 1; |
| 1115 | 1115 | m_cassette->output(m_cassette_state ? 1.0f : -1.0f); |
| 1116 | 1116 | } |
| 1117 | 1117 | break; |
| r242066 | r242067 | |
| 1127 | 1127 | { |
| 1128 | 1128 | if (m_romswitch) |
| 1129 | 1129 | { |
| 1130 | | m_lcbank->set_bank(2); |
| 1130 | m_lcbank->set_bank(2); |
| 1131 | 1131 | } |
| 1132 | 1132 | else |
| 1133 | 1133 | { |
| 1134 | | m_lcbank->set_bank(0); |
| 1134 | m_lcbank->set_bank(0); |
| 1135 | 1135 | } |
| 1136 | 1136 | } |
| 1137 | 1137 | } |
| r242066 | r242067 | |
| 1142 | 1142 | m_speaker->level_w(m_speaker_state); |
| 1143 | 1143 | break; |
| 1144 | 1144 | |
| 1145 | | case 0x48: // (IIc only) clear mouse X/Y interrupt flags |
| 1145 | case 0x48: // (IIc only) clear mouse X/Y interrupt flags |
| 1146 | 1146 | m_xirq = m_yirq = false; |
| 1147 | 1147 | lower_irq(IRQ_MOUSEXY); |
| 1148 | 1148 | break; |
| r242066 | r242067 | |
| 1160 | 1160 | m_video->m_mix = true; break; |
| 1161 | 1161 | |
| 1162 | 1162 | case 0x54: // set page 1 |
| 1163 | | m_page2 = false; |
| 1163 | m_page2 = false; |
| 1164 | 1164 | m_video->m_page2 = false; |
| 1165 | 1165 | auxbank_update(); |
| 1166 | 1166 | break; |
| 1167 | 1167 | |
| 1168 | 1168 | case 0x55: // set page 2 |
| 1169 | | m_page2 = true; |
| 1169 | m_page2 = true; |
| 1170 | 1170 | m_video->m_page2 = true; |
| 1171 | 1171 | auxbank_update(); |
| 1172 | 1172 | break; |
| 1173 | 1173 | |
| 1174 | 1174 | case 0x56: // select lo-res |
| 1175 | | m_video->m_hires = false; |
| 1175 | m_video->m_hires = false; |
| 1176 | 1176 | auxbank_update(); |
| 1177 | 1177 | break; |
| 1178 | 1178 | |
| 1179 | 1179 | case 0x57: // select hi-res |
| 1180 | | m_video->m_hires = true; |
| 1180 | m_video->m_hires = true; |
| 1181 | 1181 | auxbank_update(); |
| 1182 | 1182 | break; |
| 1183 | 1183 | |
| r242066 | r242067 | |
| 1205 | 1205 | case 0x5f: // AN3 on |
| 1206 | 1206 | m_an3 = true; break; |
| 1207 | 1207 | |
| 1208 | | case 0x68: // IIgs STATE register, which ProDOS touches |
| 1208 | case 0x68: // IIgs STATE register, which ProDOS touches |
| 1209 | 1209 | break; |
| 1210 | 1210 | |
| 1211 | | // trigger joypad read |
| 1211 | // trigger joypad read |
| 1212 | 1212 | case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: |
| 1213 | 1213 | case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: |
| 1214 | 1214 | if (is_iic) |
| r242066 | r242067 | |
| 1238 | 1238 | case 0x00: // keyboard latch |
| 1239 | 1239 | return m_transchar | m_strobe; |
| 1240 | 1240 | |
| 1241 | | case 0x02: // RAMRDOFF |
| 1241 | case 0x02: // RAMRDOFF |
| 1242 | 1242 | m_ramrd = false; |
| 1243 | 1243 | auxbank_update(); |
| 1244 | 1244 | break; |
| 1245 | 1245 | |
| 1246 | | case 0x03: // RAMRDON |
| 1246 | case 0x03: // RAMRDON |
| 1247 | 1247 | m_ramrd = true; |
| 1248 | 1248 | auxbank_update(); |
| 1249 | 1249 | break; |
| 1250 | 1250 | |
| 1251 | | case 0x04: // RAMWRTOFF |
| 1251 | case 0x04: // RAMWRTOFF |
| 1252 | 1252 | m_ramwrt = false; |
| 1253 | 1253 | auxbank_update(); |
| 1254 | 1254 | break; |
| 1255 | 1255 | |
| 1256 | | case 0x05: // RAMWRTON |
| 1256 | case 0x05: // RAMWRTON |
| 1257 | 1257 | m_ramwrt = true; |
| 1258 | 1258 | auxbank_update(); |
| 1259 | 1259 | break; |
| r242066 | r242067 | |
| 1265 | 1265 | return rv; |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | | case 0x11: // read LCRAM2 (LC Dxxx bank) |
| 1268 | case 0x11: // read LCRAM2 (LC Dxxx bank) |
| 1269 | 1269 | return m_lcram2 ? 0x80 : 0x00; |
| 1270 | 1270 | |
| 1271 | | case 0x12: // read LCRAM (is LC readable?) |
| 1271 | case 0x12: // read LCRAM (is LC readable?) |
| 1272 | 1272 | return m_lcram ? 0x80 : 0x00; |
| 1273 | 1273 | |
| 1274 | | case 0x13: // read RAMRD |
| 1274 | case 0x13: // read RAMRD |
| 1275 | 1275 | return m_ramrd ? 0x80 : 0x00; |
| 1276 | 1276 | |
| 1277 | | case 0x14: // read RAMWRT |
| 1277 | case 0x14: // read RAMWRT |
| 1278 | 1278 | return m_ramwrt ? 0x80 : 0x00; |
| 1279 | 1279 | |
| 1280 | | case 0x15: // read INTCXROM |
| 1280 | case 0x15: // read INTCXROM |
| 1281 | 1281 | return m_intcxrom ? 0x80 : 0x00; |
| 1282 | 1282 | |
| 1283 | | case 0x16: // read ALTZP |
| 1283 | case 0x16: // read ALTZP |
| 1284 | 1284 | return m_altzp ? 0x80 : 0x00; |
| 1285 | 1285 | |
| 1286 | | case 0x17: // read SLOTC3ROM |
| 1286 | case 0x17: // read SLOTC3ROM |
| 1287 | 1287 | return m_slotc3rom ? 0x80 : 0x00; |
| 1288 | 1288 | |
| 1289 | | case 0x18: // read 80STORE |
| 1289 | case 0x18: // read 80STORE |
| 1290 | 1290 | return m_80store ? 0x80 : 0x00; |
| 1291 | 1291 | |
| 1292 | | case 0x19: // read VBLBAR |
| 1292 | case 0x19: // read VBLBAR |
| 1293 | 1293 | return space.machine().first_screen()->vblank() ? 0x00 : 0x80; |
| 1294 | 1294 | |
| 1295 | | case 0x1a: // read TEXT |
| 1295 | case 0x1a: // read TEXT |
| 1296 | 1296 | return m_video->m_graphics ? 0x00 : 0x80; |
| 1297 | 1297 | |
| 1298 | | case 0x1b: // read MIXED |
| 1298 | case 0x1b: // read MIXED |
| 1299 | 1299 | return m_video->m_mix ? 0x80 : 0x00; |
| 1300 | 1300 | |
| 1301 | | case 0x1c: // read PAGE2 |
| 1301 | case 0x1c: // read PAGE2 |
| 1302 | 1302 | return m_page2 ? 0x80 : 0x00; |
| 1303 | 1303 | |
| 1304 | | case 0x1d: // read HIRES |
| 1304 | case 0x1d: // read HIRES |
| 1305 | 1305 | return m_video->m_hires ? 0x80 : 0x00; |
| 1306 | 1306 | |
| 1307 | | case 0x1e: // read ALTCHARSET |
| 1307 | case 0x1e: // read ALTCHARSET |
| 1308 | 1308 | return m_video->m_altcharset ? 0x80 : 0x00; |
| 1309 | 1309 | |
| 1310 | | case 0x1f: // read 80COL |
| 1310 | case 0x1f: // read 80COL |
| 1311 | 1311 | return m_video->m_80col ? 0x80 : 0x00; |
| 1312 | 1312 | |
| 1313 | 1313 | case 0x60: // cassette in |
| 1314 | 1314 | case 0x68: |
| 1315 | 1315 | if (m_cassette) |
| 1316 | 1316 | { |
| 1317 | | return m_cassette->input() > 0.0 ? 0x80 : 0; |
| 1317 | return m_cassette->input() > 0.0 ? 0x80 : 0; |
| 1318 | 1318 | } |
| 1319 | 1319 | return 0; |
| 1320 | 1320 | |
| 1321 | | case 0x61: // button 0 or Open Apple |
| 1321 | case 0x61: // button 0 or Open Apple |
| 1322 | 1322 | case 0x69: |
| 1323 | 1323 | return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; |
| 1324 | 1324 | |
| 1325 | | case 0x62: // button 1 or Solid Apple |
| 1325 | case 0x62: // button 1 or Solid Apple |
| 1326 | 1326 | case 0x6a: |
| 1327 | 1327 | return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; |
| 1328 | 1328 | |
| 1329 | | case 0x63: // button 2 or SHIFT key |
| 1329 | case 0x63: // button 2 or SHIFT key |
| 1330 | 1330 | case 0x6b: |
| 1331 | 1331 | return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0; |
| 1332 | 1332 | |
| 1333 | | case 0x64: // joy 1 X axis |
| 1333 | case 0x64: // joy 1 X axis |
| 1334 | 1334 | case 0x6c: |
| 1335 | 1335 | return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; |
| 1336 | 1336 | |
| 1337 | | case 0x65: // joy 1 Y axis |
| 1337 | case 0x65: // joy 1 Y axis |
| 1338 | 1338 | case 0x6d: |
| 1339 | 1339 | return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; |
| 1340 | 1340 | |
| r242066 | r242067 | |
| 1346 | 1346 | case 0x6f: |
| 1347 | 1347 | return (space.machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0; |
| 1348 | 1348 | |
| 1349 | | case 0x7e: // read IOUDIS |
| 1349 | case 0x7e: // read IOUDIS |
| 1350 | 1350 | return m_ioudis ? 0x80 : 0x00; |
| 1351 | 1351 | |
| 1352 | | case 0x7f: // read DHIRES |
| 1352 | case 0x7f: // read DHIRES |
| 1353 | 1353 | return m_video->m_dhires ? 0x00 : 0x80; |
| 1354 | 1354 | |
| 1355 | 1355 | default: |
| r242066 | r242067 | |
| 1366 | 1366 | |
| 1367 | 1367 | switch (offset) |
| 1368 | 1368 | { |
| 1369 | | case 0x00: // 80STOREOFF |
| 1369 | case 0x00: // 80STOREOFF |
| 1370 | 1370 | m_80store = false; |
| 1371 | 1371 | auxbank_update(); |
| 1372 | 1372 | break; |
| 1373 | 1373 | |
| 1374 | | case 0x01: // 80STOREON |
| 1374 | case 0x01: // 80STOREON |
| 1375 | 1375 | m_80store = true; |
| 1376 | 1376 | auxbank_update(); |
| 1377 | 1377 | break; |
| 1378 | 1378 | |
| 1379 | | case 0x02: // RAMRDOFF |
| 1379 | case 0x02: // RAMRDOFF |
| 1380 | 1380 | m_ramrd = false; |
| 1381 | 1381 | auxbank_update(); |
| 1382 | 1382 | break; |
| 1383 | 1383 | |
| 1384 | | case 0x03: // RAMRDON |
| 1384 | case 0x03: // RAMRDON |
| 1385 | 1385 | m_ramrd = true; |
| 1386 | 1386 | auxbank_update(); |
| 1387 | 1387 | break; |
| 1388 | 1388 | |
| 1389 | | case 0x04: // RAMWRTOFF |
| 1389 | case 0x04: // RAMWRTOFF |
| 1390 | 1390 | m_ramwrt = false; |
| 1391 | 1391 | auxbank_update(); |
| 1392 | 1392 | break; |
| 1393 | 1393 | |
| 1394 | | case 0x05: // RAMWRTON |
| 1394 | case 0x05: // RAMWRTON |
| 1395 | 1395 | m_ramwrt = true; |
| 1396 | 1396 | auxbank_update(); |
| 1397 | 1397 | break; |
| 1398 | 1398 | |
| 1399 | | case 0x06: // INTCXROMOFF |
| 1399 | case 0x06: // INTCXROMOFF |
| 1400 | 1400 | m_intcxrom = false; |
| 1401 | 1401 | update_slotrom_banks(); |
| 1402 | 1402 | break; |
| 1403 | 1403 | |
| 1404 | | case 0x07: // INTCXROMON |
| 1404 | case 0x07: // INTCXROMON |
| 1405 | 1405 | m_intcxrom = true; |
| 1406 | 1406 | update_slotrom_banks(); |
| 1407 | 1407 | break; |
| 1408 | 1408 | |
| 1409 | | case 0x08: // ALTZPOFF |
| 1409 | case 0x08: // ALTZPOFF |
| 1410 | 1410 | m_altzp = false; |
| 1411 | 1411 | auxbank_update(); |
| 1412 | 1412 | break; |
| 1413 | 1413 | |
| 1414 | | case 0x09: // ALTZPON |
| 1414 | case 0x09: // ALTZPON |
| 1415 | 1415 | m_altzp = true; |
| 1416 | 1416 | auxbank_update(); |
| 1417 | 1417 | break; |
| 1418 | 1418 | |
| 1419 | | case 0x0a: // SETINTC3ROM |
| 1419 | case 0x0a: // SETINTC3ROM |
| 1420 | 1420 | m_slotc3rom = false; |
| 1421 | 1421 | update_slotrom_banks(); |
| 1422 | 1422 | break; |
| 1423 | 1423 | |
| 1424 | | case 0x0b: // SETSLOTC3ROM |
| 1424 | case 0x0b: // SETSLOTC3ROM |
| 1425 | 1425 | m_slotc3rom = true; |
| 1426 | 1426 | update_slotrom_banks(); |
| 1427 | 1427 | break; |
| 1428 | 1428 | |
| 1429 | | case 0x0c: // 80COLOFF |
| 1429 | case 0x0c: // 80COLOFF |
| 1430 | 1430 | m_video->m_80col = false; |
| 1431 | 1431 | break; |
| 1432 | 1432 | |
| 1433 | | case 0x0d: // 80COLON |
| 1433 | case 0x0d: // 80COLON |
| 1434 | 1434 | m_video->m_80col = true; |
| 1435 | 1435 | break; |
| 1436 | 1436 | |
| 1437 | | case 0x0e: // ALTCHARSETOFF |
| 1437 | case 0x0e: // ALTCHARSETOFF |
| 1438 | 1438 | m_video->m_altcharset = false; |
| 1439 | 1439 | break; |
| 1440 | 1440 | |
| 1441 | | case 0x0f: // ALTCHARSETON |
| 1441 | case 0x0f: // ALTCHARSETON |
| 1442 | 1442 | m_video->m_altcharset = true; |
| 1443 | 1443 | break; |
| 1444 | 1444 | |
| r242066 | r242067 | |
| 1446 | 1446 | m_strobe = 0; |
| 1447 | 1447 | break; |
| 1448 | 1448 | |
| 1449 | | case 0x20: // cassette output |
| 1449 | case 0x20: // cassette output |
| 1450 | 1450 | if (m_cassette) |
| 1451 | 1451 | { |
| 1452 | | m_cassette_out ^= 1; |
| 1452 | m_cassette_out ^= 1; |
| 1453 | 1453 | m_cassette->output(m_cassette_out ? 1.0f : -1.0f); |
| 1454 | 1454 | } |
| 1455 | 1455 | break; |
| r242066 | r242067 | |
| 1463 | 1463 | // card may have banked auxram; get a new bank pointer |
| 1464 | 1464 | m_aux_bank_ptr = m_auxslotdevice->get_auxbank_ptr(); |
| 1465 | 1465 | } |
| 1466 | | do_io(space, offset, false); // make sure it also side-effect resets the paddles as documented |
| 1466 | do_io(space, offset, false); // make sure it also side-effect resets the paddles as documented |
| 1467 | 1467 | break; |
| 1468 | 1468 | |
| 1469 | | case 0x7e: // SETIOUDIS |
| 1469 | case 0x7e: // SETIOUDIS |
| 1470 | 1470 | m_ioudis = true; break; |
| 1471 | 1471 | |
| 1472 | | case 0x7f: // CLRIOUDIS |
| 1472 | case 0x7f: // CLRIOUDIS |
| 1473 | 1473 | m_ioudis = false; break; |
| 1474 | 1474 | |
| 1475 | 1475 | default: |
| r242066 | r242067 | |
| 1487 | 1487 | case 0x00: // keyboard latch |
| 1488 | 1488 | return m_transchar | m_strobe; |
| 1489 | 1489 | |
| 1490 | | case 0x02: // RAMRDOFF |
| 1490 | case 0x02: // RAMRDOFF |
| 1491 | 1491 | m_ramrd = false; |
| 1492 | 1492 | auxbank_update(); |
| 1493 | 1493 | break; |
| 1494 | 1494 | |
| 1495 | | case 0x03: // RAMRDON |
| 1495 | case 0x03: // RAMRDON |
| 1496 | 1496 | m_ramrd = true; |
| 1497 | 1497 | auxbank_update(); |
| 1498 | 1498 | break; |
| 1499 | 1499 | |
| 1500 | | case 0x04: // RAMWRTOFF |
| 1500 | case 0x04: // RAMWRTOFF |
| 1501 | 1501 | m_ramwrt = false; |
| 1502 | 1502 | auxbank_update(); |
| 1503 | 1503 | break; |
| 1504 | 1504 | |
| 1505 | | case 0x05: // RAMWRTON |
| 1505 | case 0x05: // RAMWRTON |
| 1506 | 1506 | m_ramwrt = true; |
| 1507 | 1507 | auxbank_update(); |
| 1508 | 1508 | break; |
| 1509 | 1509 | |
| 1510 | | case 0x10: // read any key down, reset keyboard strobe |
| 1510 | case 0x10: // read any key down, reset keyboard strobe |
| 1511 | 1511 | { |
| 1512 | 1512 | UINT8 rv = m_transchar | m_anykeydown; |
| 1513 | 1513 | m_strobe = 0; |
| 1514 | 1514 | return rv; |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | | case 0x11: // read LCRAM2 (LC Dxxx bank) |
| 1517 | case 0x11: // read LCRAM2 (LC Dxxx bank) |
| 1518 | 1518 | return m_lcram2 ? 0x80 : 0x00; |
| 1519 | | break; |
| 1519 | break; |
| 1520 | 1520 | |
| 1521 | | case 0x12: // read LCRAM (is LC readable?) |
| 1521 | case 0x12: // read LCRAM (is LC readable?) |
| 1522 | 1522 | return m_lcram ? 0x80 : 0x00; |
| 1523 | 1523 | break; |
| 1524 | 1524 | |
| 1525 | | case 0x13: // read RAMRD |
| 1525 | case 0x13: // read RAMRD |
| 1526 | 1526 | return m_ramrd ? 0x80 : 0x00; |
| 1527 | 1527 | |
| 1528 | | case 0x14: // read RAMWRT |
| 1528 | case 0x14: // read RAMWRT |
| 1529 | 1529 | return m_ramwrt ? 0x80 : 0x00; |
| 1530 | 1530 | |
| 1531 | | case 0x15: // read & reset mouse X0 interrupt flag |
| 1531 | case 0x15: // read & reset mouse X0 interrupt flag |
| 1532 | 1532 | lower_irq(IRQ_MOUSEXY); |
| 1533 | 1533 | return m_xirq ? 0x80 : 0x00; |
| 1534 | 1534 | |
| 1535 | | case 0x16: // read ALTZP |
| 1535 | case 0x16: // read ALTZP |
| 1536 | 1536 | return m_altzp ? 0x80 : 0x00; |
| 1537 | 1537 | |
| 1538 | | case 0x17: // read & reset mouse Y0 interrupt flag |
| 1538 | case 0x17: // read & reset mouse Y0 interrupt flag |
| 1539 | 1539 | lower_irq(IRQ_MOUSEXY); |
| 1540 | 1540 | return m_yirq ? 0x80 : 0x00; |
| 1541 | 1541 | |
| 1542 | | case 0x18: // read 80STORE |
| 1542 | case 0x18: // read 80STORE |
| 1543 | 1543 | return m_80store ? 0x80 : 0x00; |
| 1544 | 1544 | |
| 1545 | | case 0x19: // read VBL |
| 1545 | case 0x19: // read VBL |
| 1546 | 1546 | return m_vbl ? 0x80 : 0x00; |
| 1547 | 1547 | |
| 1548 | | case 0x1a: // read TEXT |
| 1548 | case 0x1a: // read TEXT |
| 1549 | 1549 | return m_video->m_graphics ? 0x00 : 0x80; |
| 1550 | 1550 | |
| 1551 | | case 0x1b: // read MIXED |
| 1551 | case 0x1b: // read MIXED |
| 1552 | 1552 | return m_video->m_mix ? 0x80 : 0x00; |
| 1553 | 1553 | |
| 1554 | | case 0x1c: // read PAGE2 |
| 1554 | case 0x1c: // read PAGE2 |
| 1555 | 1555 | return m_page2 ? 0x80 : 0x00; |
| 1556 | 1556 | |
| 1557 | | case 0x1d: // read HIRES |
| 1557 | case 0x1d: // read HIRES |
| 1558 | 1558 | return m_video->m_hires ? 0x80 : 0x00; |
| 1559 | 1559 | |
| 1560 | | case 0x1e: // read ALTCHARSET |
| 1560 | case 0x1e: // read ALTCHARSET |
| 1561 | 1561 | return m_video->m_altcharset ? 0x80 : 0x00; |
| 1562 | 1562 | |
| 1563 | | case 0x1f: // read 80COL |
| 1563 | case 0x1f: // read 80COL |
| 1564 | 1564 | return m_video->m_80col ? 0x80 : 0x00; |
| 1565 | 1565 | |
| 1566 | | case 0x40: // read XYMask (IIc only) |
| 1566 | case 0x40: // read XYMask (IIc only) |
| 1567 | 1567 | return m_xy ? 0x80 : 0x00; |
| 1568 | 1568 | |
| 1569 | | case 0x41: // read VBL mask (IIc only) |
| 1569 | case 0x41: // read VBL mask (IIc only) |
| 1570 | 1570 | return m_vblmask ? 0x80 : 0x00; |
| 1571 | 1571 | |
| 1572 | | case 0x42: // read X0Edge (IIc only) |
| 1572 | case 0x42: // read X0Edge (IIc only) |
| 1573 | 1573 | return m_x0edge ? 0x80 : 0x00; |
| 1574 | 1574 | |
| 1575 | | case 0x43: // read Y0Edge (IIc only) |
| 1575 | case 0x43: // read Y0Edge (IIc only) |
| 1576 | 1576 | return m_y0edge ? 0x80 : 0x00; |
| 1577 | 1577 | |
| 1578 | 1578 | case 0x60: // 40/80 column switch (IIc only) |
| 1579 | 1579 | return (m_sysconfig->read() & 0x04) ? 0x80 : 0; |
| 1580 | 1580 | |
| 1581 | | case 0x61: // button 0 or Open Apple or mouse button 1 |
| 1581 | case 0x61: // button 0 or Open Apple or mouse button 1 |
| 1582 | 1582 | case 0x69: |
| 1583 | 1583 | return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0; |
| 1584 | 1584 | |
| 1585 | | case 0x62: // button 1 or Solid Apple |
| 1585 | case 0x62: // button 1 or Solid Apple |
| 1586 | 1586 | case 0x6a: |
| 1587 | 1587 | return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0; |
| 1588 | 1588 | |
| 1589 | | case 0x63: // mouse button 2 (no other function on IIc) |
| 1589 | case 0x63: // mouse button 2 (no other function on IIc) |
| 1590 | 1590 | case 0x6b: |
| 1591 | 1591 | return m_mouseb->read() ? 0 : 0x80; |
| 1592 | 1592 | |
| 1593 | | case 0x64: // joy 1 X axis |
| 1593 | case 0x64: // joy 1 X axis |
| 1594 | 1594 | case 0x6c: |
| 1595 | 1595 | return (space.machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0; |
| 1596 | 1596 | |
| 1597 | | case 0x65: // joy 1 Y axis |
| 1597 | case 0x65: // joy 1 Y axis |
| 1598 | 1598 | case 0x6d: |
| 1599 | 1599 | return (space.machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0; |
| 1600 | 1600 | |
| r242066 | r242067 | |
| 1606 | 1606 | case 0x6f: |
| 1607 | 1607 | return m_y1 ? 0x80 : 0; |
| 1608 | 1608 | |
| 1609 | | case 0x7e: // read IOUDIS |
| 1609 | case 0x7e: // read IOUDIS |
| 1610 | 1610 | m_vbl = false; |
| 1611 | 1611 | lower_irq(IRQ_VBL); |
| 1612 | 1612 | return m_ioudis ? 0x80 : 0x00; |
| 1613 | 1613 | |
| 1614 | | case 0x7f: // read DHIRES |
| 1614 | case 0x7f: // read DHIRES |
| 1615 | 1615 | return m_video->m_dhires ? 0x00 : 0x80; |
| 1616 | 1616 | |
| 1617 | 1617 | default: |
| r242066 | r242067 | |
| 1628 | 1628 | |
| 1629 | 1629 | switch (offset) |
| 1630 | 1630 | { |
| 1631 | | case 0x00: // 80STOREOFF |
| 1631 | case 0x00: // 80STOREOFF |
| 1632 | 1632 | m_80store = false; |
| 1633 | 1633 | auxbank_update(); |
| 1634 | 1634 | break; |
| 1635 | 1635 | |
| 1636 | | case 0x01: // 80STOREON |
| 1636 | case 0x01: // 80STOREON |
| 1637 | 1637 | m_80store = true; |
| 1638 | 1638 | auxbank_update(); |
| 1639 | 1639 | break; |
| 1640 | 1640 | |
| 1641 | | case 0x02: // RAMRDOFF |
| 1641 | case 0x02: // RAMRDOFF |
| 1642 | 1642 | m_ramrd = false; |
| 1643 | 1643 | auxbank_update(); |
| 1644 | 1644 | break; |
| 1645 | 1645 | |
| 1646 | | case 0x03: // RAMRDON |
| 1646 | case 0x03: // RAMRDON |
| 1647 | 1647 | m_ramrd = true; |
| 1648 | 1648 | auxbank_update(); |
| 1649 | 1649 | break; |
| 1650 | 1650 | |
| 1651 | | case 0x04: // RAMWRTOFF |
| 1651 | case 0x04: // RAMWRTOFF |
| 1652 | 1652 | m_ramwrt = false; |
| 1653 | 1653 | auxbank_update(); |
| 1654 | 1654 | break; |
| 1655 | 1655 | |
| 1656 | | case 0x05: // RAMWRTON |
| 1656 | case 0x05: // RAMWRTON |
| 1657 | 1657 | m_ramwrt = true; |
| 1658 | 1658 | auxbank_update(); |
| 1659 | 1659 | break; |
| 1660 | 1660 | |
| 1661 | | case 0x06: // INTCXROMOFF |
| 1661 | case 0x06: // INTCXROMOFF |
| 1662 | 1662 | m_intcxrom = false; |
| 1663 | 1663 | update_slotrom_banks(); |
| 1664 | 1664 | break; |
| 1665 | 1665 | |
| 1666 | | case 0x07: // INTCXROMON |
| 1666 | case 0x07: // INTCXROMON |
| 1667 | 1667 | m_intcxrom = true; |
| 1668 | 1668 | update_slotrom_banks(); |
| 1669 | 1669 | break; |
| 1670 | 1670 | |
| 1671 | | case 0x08: // ALTZPOFF |
| 1671 | case 0x08: // ALTZPOFF |
| 1672 | 1672 | m_altzp = false; |
| 1673 | 1673 | auxbank_update(); |
| 1674 | 1674 | break; |
| 1675 | 1675 | |
| 1676 | | case 0x09: // ALTZPON |
| 1676 | case 0x09: // ALTZPON |
| 1677 | 1677 | m_altzp = true; |
| 1678 | 1678 | auxbank_update(); |
| 1679 | 1679 | break; |
| 1680 | 1680 | |
| 1681 | | case 0x0a: // SETINTC3ROM |
| 1681 | case 0x0a: // SETINTC3ROM |
| 1682 | 1682 | m_slotc3rom = false; |
| 1683 | 1683 | update_slotrom_banks(); |
| 1684 | 1684 | break; |
| 1685 | 1685 | |
| 1686 | | case 0x0b: // SETSLOTC3ROM |
| 1686 | case 0x0b: // SETSLOTC3ROM |
| 1687 | 1687 | m_slotc3rom = true; |
| 1688 | 1688 | update_slotrom_banks(); |
| 1689 | 1689 | break; |
| 1690 | 1690 | |
| 1691 | | case 0x0c: // 80COLOFF |
| 1691 | case 0x0c: // 80COLOFF |
| 1692 | 1692 | m_video->m_80col = false; |
| 1693 | 1693 | break; |
| 1694 | 1694 | |
| 1695 | | case 0x0d: // 80COLON |
| 1695 | case 0x0d: // 80COLON |
| 1696 | 1696 | m_video->m_80col = true; |
| 1697 | 1697 | break; |
| 1698 | 1698 | |
| 1699 | | case 0x0e: // ALTCHARSETOFF |
| 1699 | case 0x0e: // ALTCHARSETOFF |
| 1700 | 1700 | m_video->m_altcharset = false; |
| 1701 | 1701 | break; |
| 1702 | 1702 | |
| 1703 | | case 0x0f: // ALTCHARSETON |
| 1703 | case 0x0f: // ALTCHARSETON |
| 1704 | 1704 | m_video->m_altcharset = true; |
| 1705 | 1705 | break; |
| 1706 | 1706 | |
| r242066 | r242067 | |
| 1714 | 1714 | lower_irq(IRQ_VBL); |
| 1715 | 1715 | break; |
| 1716 | 1716 | |
| 1717 | | case 0x7e: // SETIOUDIS |
| 1718 | | m_ioudis = true; |
| 1717 | case 0x7e: // SETIOUDIS |
| 1718 | m_ioudis = true; |
| 1719 | 1719 | break; |
| 1720 | 1720 | |
| 1721 | | case 0x7f: // CLRIOUDIS |
| 1722 | | m_ioudis = false; |
| 1721 | case 0x7f: // CLRIOUDIS |
| 1722 | m_ioudis = false; |
| 1723 | 1723 | break; |
| 1724 | 1724 | |
| 1725 | 1725 | default: |
| r242066 | r242067 | |
| 1835 | 1835 | } |
| 1836 | 1836 | else |
| 1837 | 1837 | { |
| 1838 | | if (m_slotdevice[slot] != NULL) |
| 1838 | if (m_slotdevice[slot] != NULL) |
| 1839 | 1839 | { |
| 1840 | 1840 | return m_slotdevice[slot]->read_c0nx(space, offset % 0x10); |
| 1841 | 1841 | } |
| r242066 | r242067 | |
| 1867 | 1867 | |
| 1868 | 1868 | UINT8 apple2e_state::read_slot_rom(address_space &space, int slotbias, int offset) |
| 1869 | 1869 | { |
| 1870 | | int slotnum = ((offset>>8) & 0xf) + slotbias; |
| 1870 | int slotnum = ((offset>>8) & 0xf) + slotbias; |
| 1871 | 1871 | |
| 1872 | 1872 | if (m_slotdevice[slotnum] != NULL) |
| 1873 | 1873 | { |
| r242066 | r242067 | |
| 1970 | 1970 | { |
| 1971 | 1971 | if (m_inh_slot != -1) |
| 1972 | 1972 | { |
| 1973 | | return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); |
| 1973 | return m_slotdevice[m_inh_slot]->read_inh_rom(space, offset + 0xd000); |
| 1974 | 1974 | } |
| 1975 | 1975 | |
| 1976 | | assert(0); // hitting inh_r with invalid m_inh_slot should not be possible |
| 1976 | assert(0); // hitting inh_r with invalid m_inh_slot should not be possible |
| 1977 | 1977 | return read_floatingbus(); |
| 1978 | 1978 | } |
| 1979 | 1979 | |
| r242066 | r242067 | |
| 1989 | 1989 | { |
| 1990 | 1990 | if (m_altzp) |
| 1991 | 1991 | { |
| 1992 | | if (m_aux_bank_ptr) |
| 1993 | | { |
| 1994 | | if (offset < 0x1000) |
| 1992 | if (m_aux_bank_ptr) |
| 1993 | { |
| 1994 | if (offset < 0x1000) |
| 1995 | 1995 | { |
| 1996 | 1996 | if (m_lcram2) |
| 1997 | 1997 | { |
| r242066 | r242067 | |
| 2004 | 2004 | } |
| 2005 | 2005 | |
| 2006 | 2006 | return m_aux_bank_ptr[(offset & 0x1fff) + 0xe000]; |
| 2007 | | } |
| 2008 | | else |
| 2009 | | { |
| 2010 | | return read_floatingbus(); |
| 2011 | 2007 | } |
| 2008 | else |
| 2009 | { |
| 2010 | return read_floatingbus(); |
| 2011 | } |
| 2012 | 2012 | } |
| 2013 | 2013 | else |
| 2014 | 2014 | { |
| 2015 | | if (offset < 0x1000) |
| 2015 | if (offset < 0x1000) |
| 2016 | 2016 | { |
| 2017 | 2017 | if (m_lcram2) |
| 2018 | 2018 | { |
| r242066 | r242067 | |
| 2038 | 2038 | if (m_altzp) |
| 2039 | 2039 | { |
| 2040 | 2040 | if (m_aux_bank_ptr) |
| 2041 | | { |
| 2042 | | if (offset < 0x1000) |
| 2041 | { |
| 2042 | if (offset < 0x1000) |
| 2043 | 2043 | { |
| 2044 | 2044 | if (m_lcram2) |
| 2045 | 2045 | { |
| r242066 | r242067 | |
| 2057 | 2057 | } |
| 2058 | 2058 | else |
| 2059 | 2059 | { |
| 2060 | | if (offset < 0x1000) |
| 2060 | if (offset < 0x1000) |
| 2061 | 2061 | { |
| 2062 | 2062 | if (m_lcram2) |
| 2063 | 2063 | { |
| r242066 | r242067 | |
| 2295 | 2295 | AM_RANGE(0x2000, 0x3fff) AM_DEVICE(A2_2000_TAG, address_map_bank_device, amap8) |
| 2296 | 2296 | AM_RANGE(0x4000, 0xbfff) AM_DEVICE(A2_4000_TAG, address_map_bank_device, amap8) |
| 2297 | 2297 | AM_RANGE(0xc000, 0xc07f) AM_READWRITE(c000_r, c000_w) |
| 2298 | | // AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) |
| 2299 | | // AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) |
| 2298 | // AM_RANGE(0xc098, 0xc09b) AM_DEVREADWRITE(IIC_ACIA1_TAG, mos6551_device, read, write) |
| 2299 | // AM_RANGE(0xc0a8, 0xc0ab) AM_DEVREADWRITE(IIC_ACIA2_TAG, mos6551_device, read, write) |
| 2300 | 2300 | AM_RANGE(0xc0d0, 0xc0d3) AM_READWRITE(memexp_r, memexp_w) |
| 2301 | 2301 | AM_RANGE(0xc0e0, 0xc0ef) AM_DEVREADWRITE(LASER128_UDC_TAG, applefdc_base_device, read, write) |
| 2302 | 2302 | AM_RANGE(0xc080, 0xc0ff) AM_READWRITE(c080_r, c080_w) |
| r242066 | r242067 | |
| 2309 | 2309 | |
| 2310 | 2310 | static ADDRESS_MAP_START( r0000bank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2311 | 2311 | AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0000_r, ram0000_w) |
| 2312 | | AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0000_r, auxram0000_w) |
| 2312 | AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0000_r, auxram0000_w) |
| 2313 | 2313 | ADDRESS_MAP_END |
| 2314 | 2314 | |
| 2315 | 2315 | static ADDRESS_MAP_START( r0200bank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2316 | | AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0200_r, ram0200_w) // wr 0 rd 0 |
| 2316 | AM_RANGE(0x0000, 0x01ff) AM_READWRITE(ram0200_r, ram0200_w) // wr 0 rd 0 |
| 2317 | 2317 | AM_RANGE(0x0200, 0x03ff) AM_READWRITE(auxram0200_r, ram0200_w) // wr 0 rd 1 |
| 2318 | 2318 | AM_RANGE(0x0400, 0x05ff) AM_READWRITE(ram0200_r, auxram0200_w) // wr 1 rd 0 |
| 2319 | 2319 | AM_RANGE(0x0600, 0x07ff) AM_READWRITE(auxram0200_r, auxram0200_w) // wr 1 rd 1 |
| 2320 | 2320 | ADDRESS_MAP_END |
| 2321 | 2321 | |
| 2322 | 2322 | static ADDRESS_MAP_START( r0400bank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2323 | | AM_RANGE(0x0000, 0x03ff) AM_READWRITE(ram0400_r, ram0400_w) // wr 0 rd 0 |
| 2324 | | AM_RANGE(0x0400, 0x07ff) AM_READWRITE(auxram0400_r, ram0400_w) // wr 0 rd 1 |
| 2325 | | AM_RANGE(0x0800, 0x0bff) AM_READWRITE(ram0400_r, auxram0400_w) // wr 1 rd 0 |
| 2323 | AM_RANGE(0x0000, 0x03ff) AM_READWRITE(ram0400_r, ram0400_w) // wr 0 rd 0 |
| 2324 | AM_RANGE(0x0400, 0x07ff) AM_READWRITE(auxram0400_r, ram0400_w) // wr 0 rd 1 |
| 2325 | AM_RANGE(0x0800, 0x0bff) AM_READWRITE(ram0400_r, auxram0400_w) // wr 1 rd 0 |
| 2326 | 2326 | AM_RANGE(0x0c00, 0x0fff) AM_READWRITE(auxram0400_r, auxram0400_w) // wr 1 rd 1 |
| 2327 | 2327 | ADDRESS_MAP_END |
| 2328 | 2328 | |
| r242066 | r242067 | |
| 2330 | 2330 | AM_RANGE(0x0000, 0x17ff) AM_READWRITE(ram0800_r, ram0800_w) |
| 2331 | 2331 | AM_RANGE(0x2000, 0x37ff) AM_READWRITE(auxram0800_r, ram0800_w) |
| 2332 | 2332 | AM_RANGE(0x4000, 0x57ff) AM_READWRITE(ram0800_r, auxram0800_w) |
| 2333 | | AM_RANGE(0x6000, 0x77ff) AM_READWRITE(auxram0800_r, auxram0800_w) |
| 2333 | AM_RANGE(0x6000, 0x77ff) AM_READWRITE(auxram0800_r, auxram0800_w) |
| 2334 | 2334 | ADDRESS_MAP_END |
| 2335 | 2335 | |
| 2336 | 2336 | static ADDRESS_MAP_START( r2000bank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2337 | 2337 | AM_RANGE(0x0000, 0x1fff) AM_READWRITE(ram2000_r, ram2000_w) |
| 2338 | 2338 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(auxram2000_r, ram2000_w) |
| 2339 | 2339 | AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ram2000_r, auxram2000_w) |
| 2340 | | AM_RANGE(0x6000, 0x7fff) AM_READWRITE(auxram2000_r, auxram2000_w) |
| 2340 | AM_RANGE(0x6000, 0x7fff) AM_READWRITE(auxram2000_r, auxram2000_w) |
| 2341 | 2341 | ADDRESS_MAP_END |
| 2342 | 2342 | |
| 2343 | 2343 | static ADDRESS_MAP_START( r4000bank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2344 | 2344 | AM_RANGE(0x00000, 0x07fff) AM_READWRITE(ram4000_r, ram4000_w) |
| 2345 | 2345 | AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(auxram4000_r, ram4000_w) |
| 2346 | 2346 | AM_RANGE(0x10000, 0x17fff) AM_READWRITE(ram4000_r, auxram4000_w) |
| 2347 | | AM_RANGE(0x18000, 0x1ffff) AM_READWRITE(auxram4000_r, auxram4000_w) |
| 2347 | AM_RANGE(0x18000, 0x1ffff) AM_READWRITE(auxram4000_r, auxram4000_w) |
| 2348 | 2348 | ADDRESS_MAP_END |
| 2349 | 2349 | |
| 2350 | 2350 | static ADDRESS_MAP_START( c100bank_map, AS_PROGRAM, 8, apple2e_state ) |
| r242066 | r242067 | |
| 2372 | 2372 | ADDRESS_MAP_END |
| 2373 | 2373 | |
| 2374 | 2374 | static ADDRESS_MAP_START( inhbank_map, AS_PROGRAM, 8, apple2e_state ) |
| 2375 | | AM_RANGE(0x0000, 0x2fff) AM_DEVICE(A2_LCBANK_TAG, address_map_bank_device, amap8) |
| 2375 | AM_RANGE(0x0000, 0x2fff) AM_DEVICE(A2_LCBANK_TAG, address_map_bank_device, amap8) |
| 2376 | 2376 | AM_RANGE(0x3000, 0x5fff) AM_READWRITE(inh_r, inh_w) |
| 2377 | 2377 | ADDRESS_MAP_END |
| 2378 | 2378 | |
| r242066 | r242067 | |
| 2424 | 2424 | trans |= (m_kbspecial->read() & 0x01) ? 0x0000 : 0x0200; // caps lock is bit 9 (active low) |
| 2425 | 2425 | |
| 2426 | 2426 | if (m_isiic) |
| 2427 | | { |
| 2427 | { |
| 2428 | 2428 | if (m_sysconfig->read() & 0x08) |
| 2429 | 2429 | { |
| 2430 | | trans += 0x400; // go to DVORAK half of the ROM |
| 2430 | trans += 0x400; // go to DVORAK half of the ROM |
| 2431 | 2431 | } |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| r242066 | r242067 | |
| 2459 | 2459 | } |
| 2460 | 2460 | else |
| 2461 | 2461 | { |
| 2462 | | m_strobe = 0x80; |
| 2462 | m_strobe = 0x80; |
| 2463 | 2463 | } |
| 2464 | 2464 | } |
| 2465 | 2465 | } |
| r242066 | r242067 | |
| 3169 | 3169 | MCFG_AY3600_SHIFT_CB(READLINE(apple2e_state, ay3600_shift_r)) |
| 3170 | 3170 | MCFG_AY3600_CONTROL_CB(READLINE(apple2e_state, ay3600_control_r)) |
| 3171 | 3171 | MCFG_AY3600_DATA_READY_CB(WRITELINE(apple2e_state, ay3600_data_ready_w)) |
| 3172 | | MCFG_AY3600_AKO_CB(WRITELINE(apple2e_state, ay3600_ako_w)) |
| 3172 | MCFG_AY3600_AKO_CB(WRITELINE(apple2e_state, ay3600_ako_w)) |
| 3173 | 3173 | |
| 3174 | 3174 | /* repeat timer. 15 Hz from page 7-15 of "Understanding the Apple IIe" */ |
| 3175 | 3175 | MCFG_TIMER_DRIVER_ADD_PERIODIC("repttmr", apple2e_state, ay3600_repeat, attotime::from_hz(15)) |
| r242066 | r242067 | |
| 3215 | 3215 | MCFG_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ |
| 3216 | 3216 | MCFG_CPU_PROGRAM_MAP(apple2e_map) |
| 3217 | 3217 | |
| 3218 | | // MCFG_CPU_ADD("subcpu", Z80, 1021800) // schematics are illegible on where the clock comes from, but it *seems* to be the same as the 65C02 clock |
| 3219 | | // MCFG_CPU_PROGRAM_MAP(tk3000_kbd_map) |
| 3218 | // MCFG_CPU_ADD("subcpu", Z80, 1021800) // schematics are illegible on where the clock comes from, but it *seems* to be the same as the 65C02 clock |
| 3219 | // MCFG_CPU_PROGRAM_MAP(tk3000_kbd_map) |
| 3220 | 3220 | MACHINE_CONFIG_END |
| 3221 | 3221 | |
| 3222 | 3222 | static MACHINE_CONFIG_DERIVED( apple2ep, apple2e ) |
| r242066 | r242067 | |
| 3597 | 3597 | COMP( 1986, apple2c3, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (Original Memory Expansion)", GAME_SUPPORTS_SAVE ) |
| 3598 | 3598 | COMP( 1986, apple2c4, apple2c, 0, apple2c_mem, apple2c, driver_device, 0, "Apple Computer", "Apple //c (rev 4)", GAME_SUPPORTS_SAVE ) |
| 3599 | 3599 | COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, driver_device, 0, "Apple Computer", "Apple //c Plus", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) |
| 3600 | | |
trunk/src/mess/machine/ms7004.c
| r242066 | r242067 | |
| 87 | 87 | // INPUT_PORTS( ms7004 ) |
| 88 | 88 | //------------------------------------------------- |
| 89 | 89 | /* |
| 90 | | bit sig XSn ВРn |
| 91 | | --- --- --- --- |
| 92 | | 0 8 16 15 |
| 93 | | 1 9 15 14 |
| 94 | | 2 10 14 13 |
| 95 | | 3 11 13 12 |
| 96 | | 4 12 19 16 |
| 97 | | 5 13 12 11 |
| 98 | | 6 14 11 10 |
| 99 | | 7 15 10 9 |
| 100 | | 8 16 9 8 |
| 101 | | 9 17 8 7 |
| 102 | | 10 18 7 6 |
| 103 | | 11 19 6 5 |
| 104 | | 12 20 3 1 |
| 105 | | 13 21 1 2 |
| 106 | | 14 22 4 3 |
| 107 | | 15 23 5 4 |
| 90 | bit sig XSn ????n |
| 91 | --- --- --- --- |
| 92 | 0 8 16 15 |
| 93 | 1 9 15 14 |
| 94 | 2 10 14 13 |
| 95 | 3 11 13 12 |
| 96 | 4 12 19 16 |
| 97 | 5 13 12 11 |
| 98 | 6 14 11 10 |
| 99 | 7 15 10 9 |
| 100 | 8 16 9 8 |
| 101 | 9 17 8 7 |
| 102 | 10 18 7 6 |
| 103 | 11 19 6 5 |
| 104 | 12 20 3 1 |
| 105 | 13 21 1 2 |
| 106 | 14 22 4 3 |
| 107 | 15 23 5 4 |
| 108 | 108 | |
| 109 | | 0xc9 KEY_LANGLE_RANGLE 'резервная клавиша' |
| 110 | | 0xbc KEY_DELETE ЗБ |
| 111 | | 0xbd KEY_RETURN ВК |
| 112 | | 0xbf KEY_TILDE '; +' |
| 113 | | 0xc4 - 'Ъ' |
| 114 | | 0xca - '/ ?' |
| 115 | | 0xed KEY_PERIOD 'Ю @' |
| 116 | | 0xf1 - '_' |
| 109 | 0xc9 KEY_LANGLE_RANGLE '?????????????????? ??????????????' |
| 110 | 0xbc KEY_DELETE ???? |
| 111 | 0xbd KEY_RETURN ???? |
| 112 | 0xbf KEY_TILDE '; +' |
| 113 | 0xc4 - '??' |
| 114 | 0xca - '/ ?' |
| 115 | 0xed KEY_PERIOD '?? @' |
| 116 | 0xf1 - '_' |
| 117 | 117 | <...> |
| 118 | 118 | |
| 119 | | 0x56 KEY_F1 СТОП КАДР |
| 120 | | 0x57 KEY_F2 ПЕЧАТЬ КАДРА |
| 121 | | 0x58 KEY_F3 ПАУЗА |
| 122 | | 0x59 KEY_F4 УСТ РЕЖИМА |
| 123 | | 0x5a KEY_F5 Ф5 |
| 119 | 0x56 KEY_F1 ???????? ???????? |
| 120 | 0x57 KEY_F2 ???????????? ?????????? |
| 121 | 0x58 KEY_F3 ?????????? |
| 122 | 0x59 KEY_F4 ?????? ???????????? |
| 123 | 0x5a KEY_F5 ??5 |
| 124 | 124 | |
| 125 | | 0x64 KEY_F6 ПРЕРЫВ |
| 126 | | 0x65 KEY_F7 ПРОДОЛЖ |
| 127 | | 0x66 KEY_F8 ОТМЕН |
| 128 | | 0x67 KEY_F9 ОСНОВН КАДР |
| 129 | | 0x69 KEY_F10 ВЫХОД |
| 125 | 0x64 KEY_F6 ???????????? |
| 126 | 0x65 KEY_F7 ?????????????? |
| 127 | 0x66 KEY_F8 ?????????? |
| 128 | 0x67 KEY_F9 ???????????? ???????? |
| 129 | 0x69 KEY_F10 ?????????? |
| 130 | 130 | |
| 131 | | 0x71 KEY_F11 Ф11 (АР2) |
| 132 | | 0x72 KEY_F12 Ф12 (ВШ) |
| 133 | | 0x73 KEY_F13 Ф13 (ПС) |
| 134 | | 0x74 KEY_F14 ДОП ВАРИАНТ |
| 131 | 0x71 KEY_F11 ??11 (????2) |
| 132 | 0x72 KEY_F12 ??12 (????) |
| 133 | 0x73 KEY_F13 ??13 (????) |
| 134 | 0x74 KEY_F14 ?????? ?????????????? |
| 135 | 135 | |
| 136 | | 0x7c KEY_HELP ПМ |
| 137 | | 0x7d KEY_MENU ИСП |
| 136 | 0x7c KEY_HELP ???? |
| 137 | 0x7d KEY_MENU ?????? |
| 138 | 138 | |
| 139 | | 0x80 KEY_F17 Ф17 |
| 140 | | 0x81 KEY_F18 Ф18 |
| 141 | | 0x82 KEY_F19 Ф19 |
| 142 | | 0x83 KEY_F20 Ф20 |
| 139 | 0x80 KEY_F17 ??17 |
| 140 | 0x81 KEY_F18 ??18 |
| 141 | 0x82 KEY_F19 ??19 |
| 142 | 0x83 KEY_F20 ??20 |
| 143 | 143 | |
| 144 | | 0xb0 KEY_LOCK ФКС |
| 145 | | 0xae KEY_SHIFT ВР |
| 146 | | 0xaf KEY_CTRL СУ |
| 144 | 0xb0 KEY_LOCK ?????? |
| 145 | 0xae KEY_SHIFT ???? |
| 146 | 0xaf KEY_CTRL ???? |
| 147 | 147 | |
| 148 | | 0xb1 KEY_META КМП |
| 149 | | 0xb2 - РУС/ЛАТ |
| 148 | 0xb1 KEY_META ?????? |
| 149 | 0xb2 - ??????/?????? |
| 150 | 150 | |
| 151 | | 0x8a KEY_FIND НТ |
| 152 | | 0x8b KEY_INSERT_HERE ВСТ |
| 153 | | 0x8c KEY_REMOVE УДАЛ |
| 154 | | 0x8d KEY_SELECT ВЫБР |
| 155 | | 0x8e KEY_PREV_SCREEN ПРЕД КАДР |
| 156 | | 0x8f KEY_NEXT_SCREEN СЛЕД КАДР |
| 151 | 0x8a KEY_FIND ???? |
| 152 | 0x8b KEY_INSERT_HERE ?????? |
| 153 | 0x8c KEY_REMOVE ???????? |
| 154 | 0x8d KEY_SELECT ???????? |
| 155 | 0x8e KEY_PREV_SCREEN ???????? ???????? |
| 156 | 0x8f KEY_NEXT_SCREEN ???????? ???????? |
| 157 | 157 | |
| 158 | 158 | nothing sends '@' or '`' |
| 159 | 159 | |
| 160 | | `/~ sends ^/~ |
| 161 | | 2/@ sends 2/" |
| 162 | | 6/^ sends 6/& |
| 163 | | 7/& sends 7/' |
| 164 | | 8/ * sends 8/( |
| 165 | | 9/( sends 9/) |
| 166 | | 0/) sends 0/0 |
| 167 | | -/_ sends _/_ |
| 168 | | +/= sends -/= |
| 169 | | ;/: sends ;/+ |
| 170 | | '/" sends :/ * |
| 160 | `/~ sends ^/~ |
| 161 | 2/@ sends 2/" |
| 162 | 6/^ sends 6/& |
| 163 | 7/& sends 7/' |
| 164 | 8/ * sends 8/( |
| 165 | 9/( sends 9/) |
| 166 | 0/) sends 0/0 |
| 167 | -/_ sends _/_ |
| 168 | +/= sends -/= |
| 169 | ;/: sends ;/+ |
| 170 | '/" sends :/ * |
| 171 | 171 | |
| 172 | | F10 sends ^C |
| 173 | | F11 sends ESC |
| 174 | | F12 sends ^H |
| 172 | F10 sends ^C |
| 173 | F11 sends ESC |
| 174 | F12 sends ^H |
| 175 | 175 | */ |
| 176 | 176 | INPUT_PORTS_START( ms7004 ) |
| 177 | | PORT_START("KBD12") // vertical row 1 |
| 177 | PORT_START("KBD12") // vertical row 1 |
| 178 | 178 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Print Screen (F2)") PORT_CODE(KEYCODE_F2) |
| 179 | 179 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Hold Screen (F1)") PORT_CODE(KEYCODE_F1) |
| 180 | 180 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '{' / '|' |
| r242066 | r242067 | |
| 184 | 184 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) // what |
| 185 | 185 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LShift") PORT_CODE(KEYCODE_LSHIFT) |
| 186 | 186 | |
| 187 | | PORT_START("KBD13") // vertical row 2 |
| 187 | PORT_START("KBD13") // vertical row 2 |
| 188 | 188 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Setup (F3)") PORT_CODE(KEYCODE_F3) |
| 189 | 189 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Data / Talk (F4)") PORT_CODE(KEYCODE_F4) |
| 190 | 190 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| r242066 | r242067 | |
| 194 | 194 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_ESC) |
| 195 | 195 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT) |
| 196 | 196 | |
| 197 | | PORT_START("KBD14") // vertical row 3 |
| 197 | PORT_START("KBD14") // vertical row 3 |
| 198 | 198 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break (F5)") PORT_CODE(KEYCODE_F5) |
| 199 | 199 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 200 | 200 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| r242066 | r242067 | |
| 204 | 204 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 205 | 205 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 206 | 206 | |
| 207 | | PORT_START("KBD15") // vertical row 4 |
| 207 | PORT_START("KBD15") // vertical row 4 |
| 208 | 208 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 209 | 209 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 210 | 210 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| r242066 | r242067 | |
| 214 | 214 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 215 | 215 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 216 | 216 | |
| 217 | | PORT_START("KBD11") // vertical row 5 |
| 217 | PORT_START("KBD11") // vertical row 5 |
| 218 | 218 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Interrupt (F6)") PORT_CODE(KEYCODE_F6) |
| 219 | 219 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 220 | 220 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| r242066 | r242067 | |
| 224 | 224 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 225 | 225 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 226 | 226 | |
| 227 | | PORT_START("KBD10") // vertical row 6 |
| 227 | PORT_START("KBD10") // vertical row 6 |
| 228 | 228 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Resume (F7)") PORT_CODE(KEYCODE_F7) |
| 229 | 229 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 230 | 230 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| r242066 | r242067 | |
| 234 | 234 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 235 | 235 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 236 | 236 | |
| 237 | | PORT_START("KBD9") // vertical row 7 |
| 237 | PORT_START("KBD9") // vertical row 7 |
| 238 | 238 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cancel (F8)") PORT_CODE(KEYCODE_F8) |
| 239 | 239 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Main Screen (F9)") PORT_CODE(KEYCODE_F9) |
| 240 | 240 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| r242066 | r242067 | |
| 244 | 244 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 245 | 245 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| 246 | 246 | |
| 247 | | PORT_START("KBD8") // vertical row 8 |
| 247 | PORT_START("KBD8") // vertical row 8 |
| 248 | 248 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Exit (F10)") PORT_CODE(KEYCODE_F10) |
| 249 | 249 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 250 | 250 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| r242066 | r242067 | |
| 254 | 254 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) // '@' |
| 255 | 255 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 256 | 256 | |
| 257 | | PORT_START("KBD7") // vertical row 9 |
| 257 | PORT_START("KBD7") // vertical row 9 |
| 258 | 258 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 259 | 259 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC (F11)") PORT_CODE(KEYCODE_F11) |
| 260 | 260 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| r242066 | r242067 | |
| 264 | 264 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 265 | 265 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) |
| 266 | 266 | |
| 267 | | PORT_START("KBD6") // vertical row 10 |
| 267 | PORT_START("KBD6") // vertical row 10 |
| 268 | 268 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS (F12)") PORT_CODE(KEYCODE_F12) |
| 269 | 269 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LF (F13)") PORT_CODE(KEYCODE_PRTSCR) |
| 270 | 270 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // '}' |
| 271 | 271 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 272 | 272 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) // ':' |
| 273 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // 'ъ' |
| 273 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) // '??' |
| 274 | 274 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 275 | 275 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) |
| 276 | 276 | |
| 277 | | PORT_START("KBD5") // vertical row 11 |
| 277 | PORT_START("KBD5") // vertical row 11 |
| 278 | 278 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Additional Options (F14)") PORT_CODE(KEYCODE_PAUSE) |
| 279 | 279 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 280 | 280 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete <X") PORT_CODE(KEYCODE_BACKSPACE) |
| 281 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // ??? |
| 281 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) // ??? |
| 282 | 282 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) |
| 283 | 283 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 284 | 284 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RShift") PORT_CODE(KEYCODE_RSHIFT) |
| 285 | 285 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 286 | 286 | |
| 287 | | PORT_START("KBD3") // vertical row 12 |
| 287 | PORT_START("KBD3") // vertical row 12 |
| 288 | 288 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help (F15)") PORT_CODE(KEYCODE_RALT) |
| 289 | 289 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert Here") PORT_CODE(KEYCODE_HOME) |
| 290 | 290 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Find") PORT_CODE(KEYCODE_INSERT) |
| r242066 | r242067 | |
| 294 | 294 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 295 | 295 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 296 | 296 | |
| 297 | | PORT_START("KBD2") // vertical row 13 |
| 297 | PORT_START("KBD2") // vertical row 13 |
| 298 | 298 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 299 | 299 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Remove") PORT_CODE(KEYCODE_PGUP) |
| 300 | 300 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Next [v]") PORT_CODE(KEYCODE_PGDN) |
| r242066 | r242067 | |
| 304 | 304 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 305 | 305 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 306 | 306 | |
| 307 | | PORT_START("KBD1") // vertical row 14 |
| 307 | PORT_START("KBD1") // vertical row 14 |
| 308 | 308 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Do (F16)") PORT_CODE(KEYCODE_RCONTROL) |
| 309 | 309 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 310 | 310 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF1") PORT_CODE(KEYCODE_NUMLOCK) |
| r242066 | r242067 | |
| 314 | 314 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 2") PORT_CODE(KEYCODE_2_PAD) |
| 315 | 315 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) |
| 316 | 316 | |
| 317 | | PORT_START("KBD0") // vertical row 15 |
| 317 | PORT_START("KBD0") // vertical row 15 |
| 318 | 318 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F17") |
| 319 | 319 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F18") |
| 320 | 320 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF2") PORT_CODE(KEYCODE_SLASH_PAD) |
| r242066 | r242067 | |
| 324 | 324 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) |
| 325 | 325 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD) |
| 326 | 326 | |
| 327 | | PORT_START("KBD4") // vertical row 16 |
| 327 | PORT_START("KBD4") // vertical row 16 |
| 328 | 328 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F19") |
| 329 | 329 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20") |
| 330 | 330 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_MINUS_PAD) |
| r242066 | r242067 | |
| 355 | 355 | |
| 356 | 356 | ms7004_device::ms7004_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 357 | 357 | : device_t(mconfig, MS7004, "MS7004 keyboard", tag, owner, clock, "ms7004", __FILE__), |
| 358 | | // device_serial_interface(mconfig, *this), |
| 358 | // device_serial_interface(mconfig, *this), |
| 359 | 359 | m_maincpu(*this, MS7004_CPU_TAG), |
| 360 | 360 | m_speaker(*this, MS7004_SPK_TAG), |
| 361 | 361 | m_i8243(*this, "i8243"), |
| r242066 | r242067 | |
| 458 | 458 | |
| 459 | 459 | DBG_LOG(2,0,( "%s: 8243 port %d data %02xH\n", |
| 460 | 460 | tag(), offset + 4, data)); |
| 461 | | |
| 461 | |
| 462 | 462 | if (data) { |
| 463 | 463 | switch(offset << 4 | data) { |
| 464 | 464 | case 0x01: sense = m_kbd0->read(); break; |
trunk/src/mess/machine/wswan.c
| r242066 | r242067 | |
| 155 | 155 | save_item(NAME(m_internal_eeprom)); |
| 156 | 156 | save_item(NAME(m_bios_disabled)); |
| 157 | 157 | save_item(NAME(m_rotate)); |
| 158 | | |
| 158 | |
| 159 | 159 | save_item(NAME(m_sound_dma.source)); |
| 160 | 160 | save_item(NAME(m_sound_dma.size)); |
| 161 | 161 | save_item(NAME(m_sound_dma.enable)); |
| 162 | | |
| 162 | |
| 163 | 163 | if (m_cart->exists()) |
| 164 | 164 | m_cart->save_nvram(); |
| 165 | 165 | } |
| r242066 | r242067 | |
| 168 | 168 | { |
| 169 | 169 | m_ws_bios_bank = auto_alloc_array(machine(), UINT8, 0x10000); |
| 170 | 170 | memcpy(m_ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40); |
| 171 | | |
| 171 | |
| 172 | 172 | register_save(); |
| 173 | | |
| 173 | |
| 174 | 174 | machine().device<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); |
| 175 | | |
| 175 | |
| 176 | 176 | if (m_cart->exists()) |
| 177 | 177 | { |
| 178 | 178 | // ROM |
| 179 | 179 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x20000, 0x2ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom20),(ws_cart_slot_device*)m_cart)); |
| 180 | 180 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x30000, 0x3ffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom30),(ws_cart_slot_device*)m_cart)); |
| 181 | 181 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x40000, 0xeffff, read8_delegate(FUNC(ws_cart_slot_device::read_rom40),(ws_cart_slot_device*)m_cart)); |
| 182 | | |
| 182 | |
| 183 | 183 | // SRAM |
| 184 | 184 | if (m_cart->get_type() == WS_SRAM) |
| 185 | 185 | { |
| r242066 | r242067 | |
| 204 | 204 | void wswan_state::machine_reset() |
| 205 | 205 | { |
| 206 | 206 | m_bios_disabled = 0; |
| 207 | | |
| 207 | |
| 208 | 208 | if (m_cart->exists()) |
| 209 | 209 | m_rotate = m_cart->get_is_rotated(); |
| 210 | 210 | else |
| 211 | 211 | m_rotate = 0; |
| 212 | | |
| 212 | |
| 213 | 213 | /* Intialize ports */ |
| 214 | 214 | memcpy(m_ws_portram, ws_portram_init, 256); |
| 215 | | |
| 215 | |
| 216 | 216 | render_target *target = machine().render().first_target(); |
| 217 | 217 | target->set_view(m_rotate); |
| 218 | | |
| 218 | |
| 219 | 219 | /* Initialize sound DMA */ |
| 220 | 220 | memset(&m_sound_dma, 0, sizeof(m_sound_dma)); |
| 221 | 221 | } |
| r242066 | r242067 | |
| 231 | 231 | READ8_MEMBER( wswan_state::port_r ) |
| 232 | 232 | { |
| 233 | 233 | UINT8 value = m_ws_portram[offset]; |
| 234 | | |
| 234 | |
| 235 | 235 | if (offset != 2) |
| 236 | 236 | logerror("PC=%X: port read %02X\n", m_maincpu->pc(), offset); |
| 237 | | |
| 237 | |
| 238 | 238 | if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) |
| 239 | 239 | return m_vdp->reg_r(space, offset); |
| 240 | | |
| 240 | |
| 241 | 241 | switch (offset) |
| 242 | 242 | { |
| 243 | 243 | case 0x4a: // Sound DMA source address (low) |
| r242066 | r242067 | |
| 288 | 288 | value = m_cart->read_io(space, offset & 0x0f); |
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | | |
| 291 | |
| 292 | 292 | return value; |
| 293 | 293 | } |
| 294 | 294 | |
| r242066 | r242067 | |
| 297 | 297 | address_space &mem = m_maincpu->space(AS_PROGRAM); |
| 298 | 298 | UINT8 input; |
| 299 | 299 | logerror("PC=%X: port write %02X <- %02X\n", m_maincpu->pc(), offset, data); |
| 300 | | |
| 300 | |
| 301 | 301 | if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) |
| 302 | 302 | { |
| 303 | 303 | m_vdp->reg_w(space, offset, data); |
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | | |
| 306 | |
| 307 | 307 | switch (offset) |
| 308 | 308 | { |
| 309 | 309 | case 0x40: /* DMA source address (low) |
| 310 | | Bit 0-7 - DMA source address bit 0-7 |
| 311 | | */ |
| 310 | Bit 0-7 - DMA source address bit 0-7 |
| 311 | */ |
| 312 | 312 | case 0x41: /* DMA source address (high) |
| 313 | | Bit 0-7 - DMA source address bit 8-15 |
| 314 | | */ |
| 313 | Bit 0-7 - DMA source address bit 8-15 |
| 314 | */ |
| 315 | 315 | case 0x42: /* DMA source bank |
| 316 | | Bit 0-7 - DMA source bank number |
| 317 | | */ |
| 316 | Bit 0-7 - DMA source bank number |
| 317 | */ |
| 318 | 318 | case 0x43: /* DMA destination bank |
| 319 | | Bit 0-7 - DMA destination bank number |
| 320 | | */ |
| 319 | Bit 0-7 - DMA destination bank number |
| 320 | */ |
| 321 | 321 | case 0x44: /* DMA destination address (low) |
| 322 | | Bit 0-7 - DMA destination address bit 0-7 |
| 323 | | */ |
| 322 | Bit 0-7 - DMA destination address bit 0-7 |
| 323 | */ |
| 324 | 324 | case 0x45: /* DMA destination address (high) |
| 325 | | Bit 0-7 - DMA destination address bit 8-15 |
| 326 | | */ |
| 325 | Bit 0-7 - DMA destination address bit 8-15 |
| 326 | */ |
| 327 | 327 | case 0x46: /* Size of copied data (low) |
| 328 | | Bit 0-7 - DMA size bit 0-7 |
| 329 | | */ |
| 328 | Bit 0-7 - DMA size bit 0-7 |
| 329 | */ |
| 330 | 330 | case 0x47: /* Size of copied data (high) |
| 331 | | Bit 0-7 - DMA size bit 8-15 |
| 332 | | */ |
| 331 | Bit 0-7 - DMA size bit 8-15 |
| 332 | */ |
| 333 | 333 | break; |
| 334 | 334 | case 0x48: /* DMA control |
| 335 | | Bit 0-6 - Unknown |
| 336 | | Bit 7 - DMA stop/start |
| 337 | | */ |
| 335 | Bit 0-6 - Unknown |
| 336 | Bit 7 - DMA stop/start |
| 337 | */ |
| 338 | 338 | if (data & 0x80) |
| 339 | 339 | { |
| 340 | 340 | UINT32 src, dst; |
| 341 | 341 | UINT16 length; |
| 342 | | |
| 342 | |
| 343 | 343 | src = m_ws_portram[0x40] + (m_ws_portram[0x41] << 8) + (m_ws_portram[0x42] << 16); |
| 344 | 344 | dst = m_ws_portram[0x44] + (m_ws_portram[0x45] << 8) + (m_ws_portram[0x43] << 16); |
| 345 | 345 | length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8); |
| r242066 | r242067 | |
| 362 | 362 | } |
| 363 | 363 | break; |
| 364 | 364 | case 0x4a: /* Sound DMA source address (low) |
| 365 | | Bit 0-7 - Sound DMA source address bit 0-7 |
| 366 | | */ |
| 365 | Bit 0-7 - Sound DMA source address bit 0-7 |
| 366 | */ |
| 367 | 367 | m_sound_dma.source = (m_sound_dma.source & 0x0fff00) | data; |
| 368 | 368 | break; |
| 369 | 369 | case 0x4b: /* Sound DMA source address (high) |
| 370 | | Bit 0-7 - Sound DMA source address bit 8-15 |
| 371 | | */ |
| 370 | Bit 0-7 - Sound DMA source address bit 8-15 |
| 371 | */ |
| 372 | 372 | m_sound_dma.source = (m_sound_dma.source & 0x0f00ff) | (data << 8); |
| 373 | 373 | break; |
| 374 | 374 | case 0x4c: /* Sound DMA source memory segment |
| 375 | | Bit 0-3 - Sound DMA source address segment |
| 376 | | Bit 4-7 - Unknown |
| 377 | | */ |
| 375 | Bit 0-3 - Sound DMA source address segment |
| 376 | Bit 4-7 - Unknown |
| 377 | */ |
| 378 | 378 | m_sound_dma.source = (m_sound_dma.source & 0xffff) | ((data & 0x0f) << 16); |
| 379 | 379 | break; |
| 380 | 380 | case 0x4d: /* Unknown */ |
| 381 | 381 | break; |
| 382 | 382 | case 0x4e: /* Sound DMA transfer size (low) |
| 383 | | Bit 0-7 - Sound DMA transfer size bit 0-7 |
| 384 | | */ |
| 383 | Bit 0-7 - Sound DMA transfer size bit 0-7 |
| 384 | */ |
| 385 | 385 | m_sound_dma.size = (m_sound_dma.size & 0xff00) | data; |
| 386 | 386 | break; |
| 387 | 387 | case 0x4f: /* Sound DMA transfer size (high) |
| 388 | | Bit 0-7 - Sound DMA transfer size bit 8-15 |
| 389 | | */ |
| 388 | Bit 0-7 - Sound DMA transfer size bit 8-15 |
| 389 | */ |
| 390 | 390 | m_sound_dma.size = (m_sound_dma.size & 0xff) | (data << 8); |
| 391 | 391 | break; |
| 392 | 392 | case 0x50: /* Unknown */ |
| 393 | 393 | case 0x51: /* Unknown */ |
| 394 | 394 | break; |
| 395 | 395 | case 0x52: /* Sound DMA start/stop |
| 396 | | Bit 0-6 - Unknown |
| 397 | | Bit 7 - Sound DMA stop/start |
| 398 | | */ |
| 396 | Bit 0-6 - Unknown |
| 397 | Bit 7 - Sound DMA stop/start |
| 398 | */ |
| 399 | 399 | m_sound_dma.enable = data; |
| 400 | 400 | break; |
| 401 | 401 | case 0x60: |
| 402 | 402 | m_vdp->reg_w(space, offset, data); |
| 403 | 403 | break; |
| 404 | 404 | case 0x80: /* Audio 1 freq (lo) |
| 405 | | Bit 0-7 - Audio channel 1 frequency bit 0-7 |
| 406 | | */ |
| 405 | Bit 0-7 - Audio channel 1 frequency bit 0-7 |
| 406 | */ |
| 407 | 407 | case 0x81: /* Audio 1 freq (hi) |
| 408 | | Bit 0-7 - Audio channel 1 frequency bit 8-15 |
| 409 | | */ |
| 408 | Bit 0-7 - Audio channel 1 frequency bit 8-15 |
| 409 | */ |
| 410 | 410 | case 0x82: /* Audio 2 freq (lo) |
| 411 | | Bit 0-7 - Audio channel 2 frequency bit 0-7 |
| 412 | | */ |
| 411 | Bit 0-7 - Audio channel 2 frequency bit 0-7 |
| 412 | */ |
| 413 | 413 | case 0x83: /* Audio 2 freq (hi) |
| 414 | | Bit 0-7 - Audio channel 2 frequency bit 8-15 |
| 415 | | */ |
| 414 | Bit 0-7 - Audio channel 2 frequency bit 8-15 |
| 415 | */ |
| 416 | 416 | case 0x84: /* Audio 3 freq (lo) |
| 417 | | Bit 0-7 - Audio channel 3 frequency bit 0-7 |
| 418 | | */ |
| 417 | Bit 0-7 - Audio channel 3 frequency bit 0-7 |
| 418 | */ |
| 419 | 419 | case 0x85: /* Audio 3 freq (hi) |
| 420 | | Bit 0-7 - Audio channel 3 frequency bit 8-15 |
| 421 | | */ |
| 420 | Bit 0-7 - Audio channel 3 frequency bit 8-15 |
| 421 | */ |
| 422 | 422 | case 0x86: /* Audio 4 freq (lo) |
| 423 | | Bit 0-7 - Audio channel 4 frequency bit 0-7 |
| 424 | | */ |
| 423 | Bit 0-7 - Audio channel 4 frequency bit 0-7 |
| 424 | */ |
| 425 | 425 | case 0x87: /* Audio 4 freq (hi) |
| 426 | | Bit 0-7 - Audio channel 4 frequency bit 8-15 |
| 427 | | */ |
| 426 | Bit 0-7 - Audio channel 4 frequency bit 8-15 |
| 427 | */ |
| 428 | 428 | case 0x88: /* Audio 1 volume |
| 429 | | Bit 0-3 - Right volume audio channel 1 |
| 430 | | Bit 4-7 - Left volume audio channel 1 |
| 431 | | */ |
| 429 | Bit 0-3 - Right volume audio channel 1 |
| 430 | Bit 4-7 - Left volume audio channel 1 |
| 431 | */ |
| 432 | 432 | case 0x89: /* Audio 2 volume |
| 433 | | Bit 0-3 - Right volume audio channel 2 |
| 434 | | Bit 4-7 - Left volume audio channel 2 |
| 435 | | */ |
| 433 | Bit 0-3 - Right volume audio channel 2 |
| 434 | Bit 4-7 - Left volume audio channel 2 |
| 435 | */ |
| 436 | 436 | case 0x8a: /* Audio 3 volume |
| 437 | | Bit 0-3 - Right volume audio channel 3 |
| 438 | | Bit 4-7 - Left volume audio channel 3 |
| 439 | | */ |
| 437 | Bit 0-3 - Right volume audio channel 3 |
| 438 | Bit 4-7 - Left volume audio channel 3 |
| 439 | */ |
| 440 | 440 | case 0x8b: /* Audio 4 volume |
| 441 | | Bit 0-3 - Right volume audio channel 4 |
| 442 | | Bit 4-7 - Left volume audio channel 4 |
| 443 | | */ |
| 441 | Bit 0-3 - Right volume audio channel 4 |
| 442 | Bit 4-7 - Left volume audio channel 4 |
| 443 | */ |
| 444 | 444 | case 0x8c: /* Sweep step |
| 445 | | Bit 0-7 - Sweep step |
| 446 | | */ |
| 445 | Bit 0-7 - Sweep step |
| 446 | */ |
| 447 | 447 | case 0x8d: /* Sweep time |
| 448 | | Bit 0-7 - Sweep time |
| 449 | | */ |
| 448 | Bit 0-7 - Sweep time |
| 449 | */ |
| 450 | 450 | case 0x8e: /* Noise control |
| 451 | | Bit 0-2 - Noise generator type |
| 452 | | Bit 3 - Reset |
| 453 | | Bit 4 - Enable |
| 454 | | Bit 5-7 - Unknown |
| 455 | | */ |
| 451 | Bit 0-2 - Noise generator type |
| 452 | Bit 3 - Reset |
| 453 | Bit 4 - Enable |
| 454 | Bit 5-7 - Unknown |
| 455 | */ |
| 456 | 456 | case 0x8f: /* Sample location |
| 457 | | Bit 0-7 - Sample address location 0 00xxxxxx xx000000 |
| 458 | | */ |
| 457 | Bit 0-7 - Sample address location 0 00xxxxxx xx000000 |
| 458 | */ |
| 459 | 459 | case 0x90: /* Audio control |
| 460 | | Bit 0 - Audio 1 enable |
| 461 | | Bit 1 - Audio 2 enable |
| 462 | | Bit 2 - Audio 3 enable |
| 463 | | Bit 3 - Audio 4 enable |
| 464 | | Bit 4 - Unknown |
| 465 | | Bit 5 - Audio 2 voice mode enable |
| 466 | | Bit 6 - Audio 3 sweep mode enable |
| 467 | | Bit 7 - Audio 4 noise mode enable |
| 468 | | */ |
| 460 | Bit 0 - Audio 1 enable |
| 461 | Bit 1 - Audio 2 enable |
| 462 | Bit 2 - Audio 3 enable |
| 463 | Bit 3 - Audio 4 enable |
| 464 | Bit 4 - Unknown |
| 465 | Bit 5 - Audio 2 voice mode enable |
| 466 | Bit 6 - Audio 3 sweep mode enable |
| 467 | Bit 7 - Audio 4 noise mode enable |
| 468 | */ |
| 469 | 469 | case 0x91: /* Audio output |
| 470 | | Bit 0 - Mono select |
| 471 | | Bit 1-2 - Output volume |
| 472 | | Bit 3 - External stereo |
| 473 | | Bit 4-6 - Unknown |
| 474 | | Bit 7 - External speaker (Read-only, set by hardware) |
| 475 | | */ |
| 470 | Bit 0 - Mono select |
| 471 | Bit 1-2 - Output volume |
| 472 | Bit 3 - External stereo |
| 473 | Bit 4-6 - Unknown |
| 474 | Bit 7 - External speaker (Read-only, set by hardware) |
| 475 | */ |
| 476 | 476 | case 0x92: /* Noise counter shift register (lo) |
| 477 | | Bit 0-7 - Noise counter shift register bit 0-7 |
| 478 | | */ |
| 477 | Bit 0-7 - Noise counter shift register bit 0-7 |
| 478 | */ |
| 479 | 479 | case 0x93: /* Noise counter shift register (hi) |
| 480 | | Bit 0-6 - Noise counter shift register bit 8-14 |
| 481 | | bit 7 - Unknown |
| 482 | | */ |
| 480 | Bit 0-6 - Noise counter shift register bit 8-14 |
| 481 | bit 7 - Unknown |
| 482 | */ |
| 483 | 483 | case 0x94: /* Master volume |
| 484 | | Bit 0-3 - Master volume |
| 485 | | Bit 4-7 - Unknown |
| 486 | | */ |
| 484 | Bit 0-3 - Master volume |
| 485 | Bit 4-7 - Unknown |
| 486 | */ |
| 487 | 487 | m_sound->port_w(space, offset, data); |
| 488 | 488 | break; |
| 489 | 489 | case 0xa0: /* Hardware type - this is probably read only |
| 490 | | Bit 0 - Enable cartridge slot and/or disable bios |
| 491 | | Bit 1 - Hardware type: 0 = WS, 1 = WSC |
| 492 | | Bit 2-7 - Unknown |
| 493 | | */ |
| 490 | Bit 0 - Enable cartridge slot and/or disable bios |
| 491 | Bit 1 - Hardware type: 0 = WS, 1 = WSC |
| 492 | Bit 2-7 - Unknown |
| 493 | */ |
| 494 | 494 | if ((data & 0x01) && !m_bios_disabled) |
| 495 | 495 | m_bios_disabled = 1; |
| 496 | 496 | break; |
| 497 | | |
| 497 | |
| 498 | 498 | case 0xb0: /* Interrupt base vector |
| 499 | | Bit 0-7 - Interrupt base vector |
| 500 | | */ |
| 499 | Bit 0-7 - Interrupt base vector |
| 500 | */ |
| 501 | 501 | break; |
| 502 | 502 | case 0xb1: /* Communication byte |
| 503 | | Bit 0-7 - Communication byte |
| 504 | | */ |
| 503 | Bit 0-7 - Communication byte |
| 504 | */ |
| 505 | 505 | break; |
| 506 | 506 | case 0xb2: /* Interrupt enable |
| 507 | | Bit 0 - Serial transmit interrupt enable |
| 508 | | Bit 1 - Key press interrupt enable |
| 509 | | Bit 2 - RTC alarm interrupt enable |
| 510 | | Bit 3 - Serial receive interrupt enable |
| 511 | | Bit 4 - Drawing line detection interrupt enable |
| 512 | | Bit 5 - VBlank timer interrupt enable |
| 513 | | Bit 6 - VBlank interrupt enable |
| 514 | | Bit 7 - HBlank timer interrupt enable |
| 515 | | */ |
| 507 | Bit 0 - Serial transmit interrupt enable |
| 508 | Bit 1 - Key press interrupt enable |
| 509 | Bit 2 - RTC alarm interrupt enable |
| 510 | Bit 3 - Serial receive interrupt enable |
| 511 | Bit 4 - Drawing line detection interrupt enable |
| 512 | Bit 5 - VBlank timer interrupt enable |
| 513 | Bit 6 - VBlank interrupt enable |
| 514 | Bit 7 - HBlank timer interrupt enable |
| 515 | */ |
| 516 | 516 | break; |
| 517 | 517 | case 0xb3: /* serial communication control |
| 518 | | Bit 0 - Receive complete |
| 519 | | Bit 1 - Error |
| 520 | | Bit 2 - Send complete |
| 521 | | Bit 3-4 - Unknown |
| 522 | | Bit 5 - Send data interrupt generation |
| 523 | | Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps |
| 524 | | bit 7 - Receive data interrupt generation |
| 525 | | */ |
| 518 | Bit 0 - Receive complete |
| 519 | Bit 1 - Error |
| 520 | Bit 2 - Send complete |
| 521 | Bit 3-4 - Unknown |
| 522 | Bit 5 - Send data interrupt generation |
| 523 | Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps |
| 524 | bit 7 - Receive data interrupt generation |
| 525 | */ |
| 526 | 526 | // data |= 0x02; |
| 527 | 527 | m_ws_portram[0xb1] = 0xff; |
| 528 | 528 | if (data & 0x80) |
| r242066 | r242067 | |
| 536 | 536 | } |
| 537 | 537 | break; |
| 538 | 538 | case 0xb5: /* Read controls |
| 539 | | Bit 0-3 - Current state of input lines (read-only) |
| 540 | | Bit 4-6 - Select line of inputs to read |
| 541 | | 001 - Read Y cursors |
| 542 | | 010 - Read X cursors |
| 543 | | 100 - Read START,A,B buttons |
| 544 | | Bit 7 - Unknown |
| 545 | | */ |
| 539 | Bit 0-3 - Current state of input lines (read-only) |
| 540 | Bit 4-6 - Select line of inputs to read |
| 541 | 001 - Read Y cursors |
| 542 | 010 - Read X cursors |
| 543 | 100 - Read START,A,B buttons |
| 544 | Bit 7 - Unknown |
| 545 | */ |
| 546 | 546 | data = data & 0xf0; |
| 547 | 547 | switch (data) |
| 548 | 548 | { |
| r242066 | r242067 | |
| 576 | 576 | } |
| 577 | 577 | break; |
| 578 | 578 | case 0xb6: /* Interrupt acknowledge |
| 579 | | Bit 0 - Serial transmit interrupt acknowledge |
| 580 | | Bit 1 - Key press interrupt acknowledge |
| 581 | | Bit 2 - RTC alarm interrupt acknowledge |
| 582 | | Bit 3 - Serial receive interrupt acknowledge |
| 583 | | Bit 4 - Drawing line detection interrupt acknowledge |
| 584 | | Bit 5 - VBlank timer interrupt acknowledge |
| 585 | | Bit 6 - VBlank interrupt acknowledge |
| 586 | | Bit 7 - HBlank timer interrupt acknowledge |
| 587 | | */ |
| 579 | Bit 0 - Serial transmit interrupt acknowledge |
| 580 | Bit 1 - Key press interrupt acknowledge |
| 581 | Bit 2 - RTC alarm interrupt acknowledge |
| 582 | Bit 3 - Serial receive interrupt acknowledge |
| 583 | Bit 4 - Drawing line detection interrupt acknowledge |
| 584 | Bit 5 - VBlank timer interrupt acknowledge |
| 585 | Bit 6 - VBlank interrupt acknowledge |
| 586 | Bit 7 - HBlank timer interrupt acknowledge |
| 587 | */ |
| 588 | 588 | clear_irq_line(data); |
| 589 | 589 | data = m_ws_portram[0xb6]; |
| 590 | 590 | break; |
| 591 | 591 | case 0xba: /* Internal EEPROM data (low) |
| 592 | | Bit 0-7 - Internal EEPROM data transfer bit 0-7 |
| 593 | | */ |
| 592 | Bit 0-7 - Internal EEPROM data transfer bit 0-7 |
| 593 | */ |
| 594 | 594 | case 0xbb: /* Internal EEPROM data (high) |
| 595 | | Bit 0-7 - Internal EEPROM data transfer bit 8-15 |
| 596 | | */ |
| 595 | Bit 0-7 - Internal EEPROM data transfer bit 8-15 |
| 596 | */ |
| 597 | 597 | break; |
| 598 | 598 | case 0xbc: /* Internal EEPROM address (low) |
| 599 | | Bit 0-7 - Internal EEPROM address bit 1-8 |
| 600 | | */ |
| 599 | Bit 0-7 - Internal EEPROM address bit 1-8 |
| 600 | */ |
| 601 | 601 | case 0xbd: /* Internal EEPROM address (high) |
| 602 | | Bit 0 - Internal EEPROM address bit 9(?) |
| 603 | | Bit 1-7 - Unknown |
| 604 | | Only 1KByte internal EEPROM?? |
| 605 | | */ |
| 602 | Bit 0 - Internal EEPROM address bit 9(?) |
| 603 | Bit 1-7 - Unknown |
| 604 | Only 1KByte internal EEPROM?? |
| 605 | */ |
| 606 | 606 | break; |
| 607 | 607 | case 0xbe: /* Internal EEPROM command |
| 608 | | Bit 0 - Read complete (read only) |
| 609 | | Bit 1 - Write complete (read only) |
| 610 | | Bit 2-3 - Unknown |
| 611 | | Bit 4 - Read |
| 612 | | Bit 5 - Write |
| 613 | | Bit 6 - Protect |
| 614 | | Bit 7 - Initialize |
| 615 | | */ |
| 608 | Bit 0 - Read complete (read only) |
| 609 | Bit 1 - Write complete (read only) |
| 610 | Bit 2-3 - Unknown |
| 611 | Bit 4 - Read |
| 612 | Bit 5 - Write |
| 613 | Bit 6 - Protect |
| 614 | Bit 7 - Initialize |
| 615 | */ |
| 616 | 616 | if (data & 0x20) |
| 617 | 617 | { |
| 618 | 618 | UINT16 addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; |
| r242066 | r242067 | |
| 654 | 654 | logerror( "Write to unsupported port: %X - %X\n", offset, data ); |
| 655 | 655 | break; |
| 656 | 656 | } |
| 657 | | |
| 657 | |
| 658 | 658 | /* Update the port value */ |
| 659 | 659 | m_ws_portram[offset] = data; |
| 660 | 660 | } |
trunk/src/mess/video/wswan_video.c
| r242066 | r242067 | |
| 1 | 1 | /*************************************************************************** |
| 2 | | |
| 2 | |
| 3 | 3 | wswan_video.c |
| 4 | | |
| 4 | |
| 5 | 5 | File to handle video emulation of the Bandai WonderSwan VDP. |
| 6 | | |
| 6 | |
| 7 | 7 | Anthony Kruize |
| 8 | 8 | Wilbert Pol |
| 9 | | |
| 9 | |
| 10 | 10 | TODO: |
| 11 | 11 | - remove the redundant parts of m_regs |
| 12 | 12 | - split the Color VDP from the Mono VDP? |
| 13 | | |
| 13 | |
| 14 | 14 | ***************************************************************************/ |
| 15 | 15 | |
| 16 | 16 | #include "wswan_video.h" |
| r242066 | r242067 | |
| 32 | 32 | save_item(NAME(m_palette_port)); |
| 33 | 33 | save_item(NAME(m_pal)); |
| 34 | 34 | save_item(NAME(m_regs)); |
| 35 | | |
| 35 | |
| 36 | 36 | save_item(NAME(m_layer_bg_enable)); |
| 37 | 37 | save_item(NAME(m_layer_fg_enable)); |
| 38 | 38 | save_item(NAME(m_sprites_enable)); |
| r242066 | r242067 | |
| 79 | 79 | void wswan_video_device::device_start() |
| 80 | 80 | { |
| 81 | 81 | machine().first_screen()->register_screen_bitmap(m_bitmap); |
| 82 | | |
| 82 | |
| 83 | 83 | m_timer = timer_alloc(TIMER_SCANLINE); |
| 84 | 84 | m_timer->adjust(attotime::from_ticks(256, 3072000), 0, attotime::from_ticks(256, 3072000)); |
| 85 | | |
| 85 | |
| 86 | 86 | // bind callbacks |
| 87 | 87 | m_set_irq_cb.bind_relative_to(*owner()); |
| 88 | 88 | m_snd_dma_cb.bind_relative_to(*owner()); |
| r242066 | r242067 | |
| 166 | 166 | m_timer_vblank_mode = 0; |
| 167 | 167 | m_timer_vblank_reload = 0; |
| 168 | 168 | m_timer_vblank_count = 0; /* Vertical blank timer counter value */ |
| 169 | | |
| 169 | |
| 170 | 170 | memset(m_sprite_table_buffer, 0, sizeof(m_sprite_table_buffer)); |
| 171 | 171 | memset(m_main_palette, 0, sizeof(m_main_palette)); |
| 172 | 172 | memcpy(m_regs, vdp_regs_init, 256); |
| r242066 | r242067 | |
| 190 | 190 | |
| 191 | 191 | void wswan_video_device::setup_palettes() |
| 192 | 192 | { |
| 193 | | if (m_color_mode) |
| 193 | if (m_color_mode) |
| 194 | 194 | { |
| 195 | | for (int i = 0; i < 16; i++) |
| 196 | | for (int j = 0; j < 16; j++) |
| 195 | for (int i = 0; i < 16; i++) |
| 196 | for (int j = 0; j < 16; j++) |
| 197 | 197 | m_pal[i][j] = ((m_palette_vram[(i << 5) + j * 2 + 1] << 8) | m_palette_vram[(i << 5) + j * 2]) & 0x0fff; |
| 198 | | } |
| 199 | | else |
| 198 | } |
| 199 | else |
| 200 | 200 | { |
| 201 | | for (int i = 0; i < 16; i++) |
| 201 | for (int i = 0; i < 16; i++) |
| 202 | 202 | { |
| 203 | 203 | m_pal[i][0] = (m_palette_port[(i << 1)] >> 0) & 0x07; |
| 204 | 204 | m_pal[i][1] = (m_palette_port[(i << 1)] >> 4) & 0x07; |
| r242066 | r242067 | |
| 212 | 212 | { |
| 213 | 213 | UINT16 map_addr = m_layer_bg_address + (((m_current_line + m_layer_bg_scroll_y) & 0xf8) << 3); |
| 214 | 214 | UINT8 start_column = (m_layer_bg_scroll_x >> 3); |
| 215 | | |
| 216 | | for (int column = 0; column < 29; column++) |
| 215 | |
| 216 | for (int column = 0; column < 29; column++) |
| 217 | 217 | { |
| 218 | 218 | UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; |
| 219 | 219 | int x_offset, tile_line, tile_address; |
| r242066 | r242067 | |
| 221 | 221 | | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; |
| 222 | 222 | int tile_number = tile_data & 0x01ff; |
| 223 | 223 | int tile_palette = (tile_data >> 9) & 0x0f; |
| 224 | | |
| 224 | |
| 225 | 225 | tile_line = (m_current_line + m_layer_bg_scroll_y) & 0x07; |
| 226 | 226 | if (tile_data & 0x8000) // vflip |
| 227 | 227 | tile_line = 7 - tile_line; |
| 228 | | |
| 229 | | if (m_colors_16) |
| 228 | |
| 229 | if (m_colors_16) |
| 230 | 230 | { |
| 231 | 231 | tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); |
| 232 | | if (m_tile_packed) |
| 232 | if (m_tile_packed) |
| 233 | 233 | { |
| 234 | 234 | plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; |
| 235 | | } |
| 236 | | else |
| 235 | } |
| 236 | else |
| 237 | 237 | { |
| 238 | 238 | plane0 = m_vram[tile_address + 0]; |
| 239 | 239 | plane1 = m_vram[tile_address + 1] << 1; |
| 240 | 240 | plane2 = m_vram[tile_address + 2] << 2; |
| 241 | 241 | plane3 = m_vram[tile_address + 3] << 3; |
| 242 | 242 | } |
| 243 | | } |
| 244 | | else |
| 243 | } |
| 244 | else |
| 245 | 245 | { |
| 246 | 246 | tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); |
| 247 | | if (m_tile_packed) |
| 247 | if (m_tile_packed) |
| 248 | 248 | { |
| 249 | 249 | plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; |
| 250 | | } |
| 251 | | else |
| 250 | } |
| 251 | else |
| 252 | 252 | { |
| 253 | 253 | plane0 = m_vram[tile_address + 0]; |
| 254 | 254 | plane1 = m_vram[tile_address + 1] << 1; |
| r242066 | r242067 | |
| 256 | 256 | plane3 = 0; |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | | |
| 260 | | for (int x = 0; x < 8; x++) |
| 259 | |
| 260 | for (int x = 0; x < 8; x++) |
| 261 | 261 | { |
| 262 | 262 | int col; |
| 263 | | if (m_tile_packed) |
| 263 | if (m_tile_packed) |
| 264 | 264 | { |
| 265 | | if (m_colors_16) |
| 265 | if (m_colors_16) |
| 266 | 266 | { |
| 267 | 267 | col = plane0 & 0x0f; |
| 268 | 268 | plane0 = plane0 >> 4; |
| 269 | | } |
| 270 | | else |
| 269 | } |
| 270 | else |
| 271 | 271 | { |
| 272 | 272 | col = plane0 & 0x03; |
| 273 | 273 | plane0 = plane0 >> 2; |
| 274 | 274 | } |
| 275 | | } |
| 276 | | else |
| 275 | } |
| 276 | else |
| 277 | 277 | { |
| 278 | 278 | col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); |
| 279 | 279 | plane3 = plane3 >> 1; |
| r242066 | r242067 | |
| 282 | 282 | plane0 = plane0 >> 1; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | | if (tile_data & 0x4000) |
| 285 | if (tile_data & 0x4000) |
| 286 | 286 | x_offset = x + (column << 3) - (m_layer_bg_scroll_x & 0x07); |
| 287 | 287 | else |
| 288 | 288 | x_offset = 7 - x + (column << 3) - (m_layer_bg_scroll_x & 0x07); |
| 289 | 289 | |
| 290 | | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 290 | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 291 | 291 | { |
| 292 | | if (m_colors_16) |
| 292 | if (m_colors_16) |
| 293 | 293 | { |
| 294 | | if (col) |
| 294 | if (col) |
| 295 | 295 | { |
| 296 | 296 | if (m_color_mode) |
| 297 | 297 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 298 | | else |
| 298 | else |
| 299 | 299 | { |
| 300 | 300 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 301 | 301 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | | } |
| 305 | | else |
| 304 | } |
| 305 | else |
| 306 | 306 | { |
| 307 | | if (col || !(tile_palette & 4)) |
| 307 | if (col || !(tile_palette & 4)) |
| 308 | 308 | { |
| 309 | 309 | if (m_color_mode) |
| 310 | 310 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 322 | 322 | UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); |
| 323 | 323 | UINT8 start_column = (m_layer_fg_scroll_x >> 3); |
| 324 | 324 | |
| 325 | | for (int column = 0; column < 29; column++) |
| 325 | for (int column = 0; column < 29; column++) |
| 326 | 326 | { |
| 327 | 327 | UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; |
| 328 | 328 | int x_offset, tile_line, tile_address; |
| r242066 | r242067 | |
| 330 | 330 | | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; |
| 331 | 331 | int tile_number = tile_data & 0x01ff; |
| 332 | 332 | int tile_palette = (tile_data >> 9) & 0x0f; |
| 333 | | |
| 333 | |
| 334 | 334 | tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; |
| 335 | 335 | if (tile_data & 0x8000) // vflip |
| 336 | 336 | tile_line = 7 - tile_line; |
| 337 | | |
| 338 | | if (m_colors_16) |
| 337 | |
| 338 | if (m_colors_16) |
| 339 | 339 | { |
| 340 | 340 | tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); |
| 341 | | if (m_tile_packed) |
| 341 | if (m_tile_packed) |
| 342 | 342 | { |
| 343 | 343 | plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; |
| 344 | | } |
| 345 | | else |
| 344 | } |
| 345 | else |
| 346 | 346 | { |
| 347 | 347 | plane0 = m_vram[tile_address + 0]; |
| 348 | 348 | plane1 = m_vram[tile_address + 1] << 1; |
| 349 | 349 | plane2 = m_vram[tile_address + 2] << 2; |
| 350 | 350 | plane3 = m_vram[tile_address + 3] << 3; |
| 351 | 351 | } |
| 352 | | } |
| 353 | | else |
| 352 | } |
| 353 | else |
| 354 | 354 | { |
| 355 | 355 | tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); |
| 356 | | if (m_tile_packed) |
| 356 | if (m_tile_packed) |
| 357 | 357 | { |
| 358 | 358 | plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; |
| 359 | | } |
| 360 | | else |
| 359 | } |
| 360 | else |
| 361 | 361 | { |
| 362 | 362 | plane0 = m_vram[tile_address + 0]; |
| 363 | 363 | plane1 = m_vram[tile_address + 1] << 1; |
| r242066 | r242067 | |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | | for (int x = 0; x < 8; x++ ) |
| 369 | for (int x = 0; x < 8; x++ ) |
| 370 | 370 | { |
| 371 | 371 | int col; |
| 372 | | if (m_tile_packed) |
| 372 | if (m_tile_packed) |
| 373 | 373 | { |
| 374 | | if (m_colors_16) |
| 374 | if (m_colors_16) |
| 375 | 375 | { |
| 376 | 376 | col = plane0 & 0x0f; |
| 377 | 377 | plane0 = plane0 >> 4; |
| 378 | | } |
| 379 | | else |
| 378 | } |
| 379 | else |
| 380 | 380 | { |
| 381 | 381 | col = plane0 & 0x03; |
| 382 | 382 | plane0 = plane0 >> 2; |
| 383 | 383 | } |
| 384 | | } |
| 385 | | else |
| 384 | } |
| 385 | else |
| 386 | 386 | { |
| 387 | 387 | col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); |
| 388 | 388 | plane3 = plane3 >> 1; |
| r242066 | r242067 | |
| 391 | 391 | plane0 = plane0 >> 1; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | | if (tile_data & 0x4000) |
| 394 | if (tile_data & 0x4000) |
| 395 | 395 | x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 396 | 396 | else |
| 397 | 397 | x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 398 | 398 | |
| 399 | | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 399 | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 400 | 400 | { |
| 401 | | if (m_colors_16) |
| 401 | if (m_colors_16) |
| 402 | 402 | { |
| 403 | | if (col) |
| 403 | if (col) |
| 404 | 404 | { |
| 405 | 405 | // if (m_color_mode) { |
| 406 | 406 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 409 | 409 | // m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 410 | 410 | // } |
| 411 | 411 | } |
| 412 | | } |
| 413 | | else |
| 412 | } |
| 413 | else |
| 414 | 414 | { |
| 415 | | if (col || !(tile_palette & 4)) |
| 415 | if (col || !(tile_palette & 4)) |
| 416 | 416 | { |
| 417 | 417 | if (m_color_mode) |
| 418 | 418 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 429 | 429 | { |
| 430 | 430 | UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); |
| 431 | 431 | UINT8 start_column = (m_layer_fg_scroll_x >> 3); |
| 432 | | |
| 433 | | for (int column = 0; column < 29; column++) |
| 432 | |
| 433 | for (int column = 0; column < 29; column++) |
| 434 | 434 | { |
| 435 | 435 | UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; |
| 436 | 436 | int x_offset, tile_line, tile_address; |
| r242066 | r242067 | |
| 438 | 438 | | m_vram[map_addr + (((start_column + column) & 0x1f) << 1)]; |
| 439 | 439 | int tile_number = tile_data & 0x01ff; |
| 440 | 440 | int tile_palette = (tile_data >> 9) & 0x0f; |
| 441 | | |
| 441 | |
| 442 | 442 | tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; |
| 443 | 443 | if (tile_data & 0x8000) // vflip |
| 444 | 444 | tile_line = 7 - tile_line; |
| 445 | 445 | |
| 446 | | |
| 447 | | if (m_colors_16) |
| 446 | |
| 447 | if (m_colors_16) |
| 448 | 448 | { |
| 449 | 449 | tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); |
| 450 | | if (m_tile_packed) |
| 450 | if (m_tile_packed) |
| 451 | 451 | { |
| 452 | 452 | plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; |
| 453 | | } |
| 454 | | else |
| 453 | } |
| 454 | else |
| 455 | 455 | { |
| 456 | 456 | plane0 = m_vram[tile_address + 0]; |
| 457 | 457 | plane1 = m_vram[tile_address + 1] << 1; |
| 458 | 458 | plane2 = m_vram[tile_address + 2] << 2; |
| 459 | 459 | plane3 = m_vram[tile_address + 3] << 3; |
| 460 | 460 | } |
| 461 | | } |
| 462 | | else |
| 461 | } |
| 462 | else |
| 463 | 463 | { |
| 464 | 464 | tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); |
| 465 | | if (m_tile_packed) |
| 465 | if (m_tile_packed) |
| 466 | 466 | { |
| 467 | 467 | plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; |
| 468 | | } |
| 469 | | else |
| 468 | } |
| 469 | else |
| 470 | 470 | { |
| 471 | 471 | plane0 = m_vram[tile_address + 0]; |
| 472 | 472 | plane1 = m_vram[tile_address + 1] << 1; |
| r242066 | r242067 | |
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | | for (int x = 0; x < 8; x++) |
| 478 | for (int x = 0; x < 8; x++) |
| 479 | 479 | { |
| 480 | 480 | int col; |
| 481 | | if (m_tile_packed) |
| 481 | if (m_tile_packed) |
| 482 | 482 | { |
| 483 | | if (m_colors_16) |
| 483 | if (m_colors_16) |
| 484 | 484 | { |
| 485 | 485 | col = plane0 & 0x0f; |
| 486 | 486 | plane0 = plane0 >> 4; |
| 487 | | } |
| 488 | | else |
| 487 | } |
| 488 | else |
| 489 | 489 | { |
| 490 | 490 | col = plane0 & 0x03; |
| 491 | 491 | plane0 = plane0 >> 2; |
| 492 | 492 | } |
| 493 | | } |
| 494 | | else |
| 493 | } |
| 494 | else |
| 495 | 495 | { |
| 496 | 496 | col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); |
| 497 | 497 | plane3 = plane3 >> 1; |
| r242066 | r242067 | |
| 500 | 500 | plane0 = plane0 >> 1; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | | if (tile_data & 0x4000) |
| 503 | if (tile_data & 0x4000) |
| 504 | 504 | x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 505 | 505 | else |
| 506 | 506 | x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 507 | 507 | |
| 508 | | if (x_offset >= 0 && x_offset >= m_window_fg_left && x_offset < m_window_fg_right && x_offset < WSWAN_X_PIXELS) |
| 508 | if (x_offset >= 0 && x_offset >= m_window_fg_left && x_offset < m_window_fg_right && x_offset < WSWAN_X_PIXELS) |
| 509 | 509 | { |
| 510 | | if (m_colors_16) |
| 510 | if (m_colors_16) |
| 511 | 511 | { |
| 512 | | if (col) |
| 512 | if (col) |
| 513 | 513 | { |
| 514 | 514 | if (m_color_mode) |
| 515 | 515 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 517 | 517 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 518 | 518 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 519 | 519 | } |
| 520 | | } |
| 521 | | else |
| 520 | } |
| 521 | else |
| 522 | 522 | { |
| 523 | | if (col || !(tile_palette & 4)) |
| 523 | if (col || !(tile_palette & 4)) |
| 524 | 524 | { |
| 525 | 525 | if (m_color_mode) |
| 526 | 526 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 537 | 537 | { |
| 538 | 538 | UINT16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 3); |
| 539 | 539 | UINT8 start_column = (m_layer_fg_scroll_x >> 3); |
| 540 | | |
| 541 | | for (int column = 0; column < 29; column++) |
| 540 | |
| 541 | for (int column = 0; column < 29; column++) |
| 542 | 542 | { |
| 543 | 543 | UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; |
| 544 | 544 | int x_offset, tile_line, tile_address; |
| r242066 | r242067 | |
| 550 | 550 | tile_line = (m_current_line + m_layer_fg_scroll_y) & 0x07; |
| 551 | 551 | if (tile_data & 0x8000) // vflip |
| 552 | 552 | tile_line = 7 - tile_line; |
| 553 | | |
| 554 | | if (m_colors_16) |
| 553 | |
| 554 | if (m_colors_16) |
| 555 | 555 | { |
| 556 | 556 | tile_address = ((tile_data & 0x2000) ? 0x8000 : 0x4000) + (tile_number * 32) + (tile_line << 2); |
| 557 | | if (m_tile_packed) |
| 557 | if (m_tile_packed) |
| 558 | 558 | { |
| 559 | 559 | plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; |
| 560 | | } |
| 561 | | else |
| 560 | } |
| 561 | else |
| 562 | 562 | { |
| 563 | 563 | plane0 = m_vram[tile_address + 0]; |
| 564 | 564 | plane1 = m_vram[tile_address + 1] << 1; |
| 565 | 565 | plane2 = m_vram[tile_address + 2] << 2; |
| 566 | 566 | plane3 = m_vram[tile_address + 3] << 3; |
| 567 | 567 | } |
| 568 | | } |
| 569 | | else |
| 568 | } |
| 569 | else |
| 570 | 570 | { |
| 571 | 571 | tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); |
| 572 | | if (m_tile_packed) |
| 572 | if (m_tile_packed) |
| 573 | 573 | { |
| 574 | 574 | plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; |
| 575 | | } |
| 576 | | else |
| 575 | } |
| 576 | else |
| 577 | 577 | { |
| 578 | 578 | plane0 = m_vram[tile_address + 0]; |
| 579 | 579 | plane1 = m_vram[tile_address + 1] << 1; |
| r242066 | r242067 | |
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | | for (int x = 0; x < 8; x++) |
| 585 | for (int x = 0; x < 8; x++) |
| 586 | 586 | { |
| 587 | 587 | int col; |
| 588 | | if (m_tile_packed) |
| 588 | if (m_tile_packed) |
| 589 | 589 | { |
| 590 | | if (m_colors_16) |
| 590 | if (m_colors_16) |
| 591 | 591 | { |
| 592 | 592 | col = plane0 & 0x0f; |
| 593 | 593 | plane0 = plane0 >> 4; |
| 594 | | } |
| 595 | | else |
| 594 | } |
| 595 | else |
| 596 | 596 | { |
| 597 | 597 | col = plane0 & 0x03; |
| 598 | 598 | plane0 = plane0 >> 2; |
| 599 | 599 | } |
| 600 | | } |
| 601 | | else |
| 600 | } |
| 601 | else |
| 602 | 602 | { |
| 603 | 603 | col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); |
| 604 | 604 | plane3 = plane3 >> 1; |
| r242066 | r242067 | |
| 607 | 607 | plane0 = plane0 >> 1; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | | if (tile_data & 0x4000) |
| 610 | if (tile_data & 0x4000) |
| 611 | 611 | x_offset = x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 612 | 612 | else |
| 613 | 613 | x_offset = 7 - x + (column << 3) - (m_layer_fg_scroll_x & 0x07); |
| 614 | 614 | |
| 615 | | if ((x_offset >= 0 && x_offset < m_window_fg_left) || (x_offset >= m_window_fg_right && x_offset < WSWAN_X_PIXELS)) |
| 615 | if ((x_offset >= 0 && x_offset < m_window_fg_left) || (x_offset >= m_window_fg_right && x_offset < WSWAN_X_PIXELS)) |
| 616 | 616 | { |
| 617 | | if (m_colors_16) |
| 617 | if (m_colors_16) |
| 618 | 618 | { |
| 619 | | if (col) |
| 619 | if (col) |
| 620 | 620 | { |
| 621 | 621 | if (m_color_mode) |
| 622 | 622 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 624 | 624 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 625 | 625 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 626 | 626 | } |
| 627 | | } |
| 628 | | else |
| 627 | } |
| 628 | else |
| 629 | 629 | { |
| 630 | | if (col || !(tile_palette & 4)) |
| 630 | if (col || !(tile_palette & 4)) |
| 631 | 631 | { |
| 632 | 632 | if (m_color_mode) |
| 633 | 633 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 645 | 645 | if (m_sprite_count == 0) |
| 646 | 646 | return; |
| 647 | 647 | |
| 648 | | for (int i = m_sprite_first + m_sprite_count - 1; i >= m_sprite_first; i--) |
| 648 | for (int i = m_sprite_first + m_sprite_count - 1; i >= m_sprite_first; i--) |
| 649 | 649 | { |
| 650 | 650 | UINT16 tile_data = (m_sprite_table_buffer[i * 4 + 1] << 8) | m_sprite_table_buffer[i * 4]; |
| 651 | 651 | UINT8 y = m_sprite_table_buffer[ i * 4 + 2 ]; |
| 652 | 652 | UINT8 x = m_sprite_table_buffer[ i * 4 + 3 ]; |
| 653 | 653 | int tile_line = (m_current_line - y) & 0xff; |
| 654 | 654 | |
| 655 | | if ((tile_line >= 0) && (tile_line < 8) && ((tile_data & 0x2000) == mask)) |
| 655 | if ((tile_line >= 0) && (tile_line < 8) && ((tile_data & 0x2000) == mask)) |
| 656 | 656 | { |
| 657 | 657 | UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; |
| 658 | 658 | int x_offset, tile_address; |
| r242066 | r242067 | |
| 662 | 662 | |
| 663 | 663 | if (tile_data & 0x8000) |
| 664 | 664 | tile_line = 7 - tile_line; |
| 665 | | |
| 666 | | if (m_colors_16) |
| 665 | |
| 666 | if (m_colors_16) |
| 667 | 667 | { |
| 668 | 668 | tile_address = 0x4000 + (tile_number * 32) + (tile_line << 2); |
| 669 | | if (m_tile_packed) |
| 669 | if (m_tile_packed) |
| 670 | 670 | { |
| 671 | 671 | plane0 = (m_vram[tile_address + 0] << 24) | (m_vram[tile_address + 1] << 16) | (m_vram[tile_address + 2] << 8) | m_vram[tile_address + 3]; |
| 672 | | } |
| 673 | | else |
| 672 | } |
| 673 | else |
| 674 | 674 | { |
| 675 | 675 | plane0 = m_vram[tile_address + 0]; |
| 676 | 676 | plane1 = m_vram[tile_address + 1] << 1; |
| 677 | 677 | plane2 = m_vram[tile_address + 2] << 2; |
| 678 | 678 | plane3 = m_vram[tile_address + 3] << 3; |
| 679 | 679 | } |
| 680 | | } |
| 681 | | else |
| 680 | } |
| 681 | else |
| 682 | 682 | { |
| 683 | 683 | tile_address = 0x2000 + (tile_number * 16) + (tile_line << 1); |
| 684 | | if (m_tile_packed) |
| 684 | if (m_tile_packed) |
| 685 | 685 | { |
| 686 | 686 | plane0 = (m_vram[tile_address + 0] << 8) | m_vram[tile_address + 1]; |
| 687 | | } |
| 688 | | else |
| 687 | } |
| 688 | else |
| 689 | 689 | { |
| 690 | 690 | plane0 = m_vram[tile_address + 0]; |
| 691 | 691 | plane1 = m_vram[tile_address + 1] << 1; |
| r242066 | r242067 | |
| 693 | 693 | plane3 = 0; |
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | | |
| 697 | | if (m_window_sprites_enable) |
| 696 | |
| 697 | if (m_window_sprites_enable) |
| 698 | 698 | { |
| 699 | | if (tile_data & 0x1000) |
| 699 | if (tile_data & 0x1000) |
| 700 | 700 | { |
| 701 | 701 | if (m_current_line >= m_window_sprites_top && m_current_line <= m_window_sprites_bottom) |
| 702 | 702 | check_clip = 1; |
| 703 | | } |
| 704 | | else |
| 703 | } |
| 704 | else |
| 705 | 705 | { |
| 706 | 706 | if (m_current_line < m_window_sprites_top || m_current_line > m_window_sprites_bottom) |
| 707 | 707 | continue; |
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | | |
| 711 | | for (int j = 0; j < 8; j++) |
| 710 | |
| 711 | for (int j = 0; j < 8; j++) |
| 712 | 712 | { |
| 713 | 713 | int col; |
| 714 | | if (m_tile_packed) |
| 714 | if (m_tile_packed) |
| 715 | 715 | { |
| 716 | | if (m_colors_16) |
| 716 | if (m_colors_16) |
| 717 | 717 | { |
| 718 | 718 | col = plane0 & 0x0f; |
| 719 | 719 | plane0 = plane0 >> 4; |
| 720 | | } |
| 721 | | else |
| 720 | } |
| 721 | else |
| 722 | 722 | { |
| 723 | 723 | col = plane0 & 0x03; |
| 724 | 724 | plane0 = plane0 >> 2; |
| 725 | 725 | } |
| 726 | | } |
| 727 | | else |
| 726 | } |
| 727 | else |
| 728 | 728 | { |
| 729 | 729 | col = (plane3 & 8) | (plane2 & 4) | (plane1 & 2) | (plane0 & 1); |
| 730 | 730 | plane3 = plane3 >> 1; |
| r242066 | r242067 | |
| 740 | 740 | |
| 741 | 741 | x_offset = x_offset & 0xff; |
| 742 | 742 | |
| 743 | | if (m_window_sprites_enable) |
| 743 | if (m_window_sprites_enable) |
| 744 | 744 | { |
| 745 | | if (tile_data & 0x1000 && check_clip) |
| 745 | if (tile_data & 0x1000 && check_clip) |
| 746 | 746 | { |
| 747 | 747 | if (x_offset >= m_window_sprites_left && x_offset <= m_window_sprites_right) |
| 748 | 748 | continue; |
| 749 | | } |
| 750 | | else |
| 749 | } |
| 750 | else |
| 751 | 751 | { |
| 752 | | if (x_offset < m_window_sprites_left || x_offset > m_window_sprites_right) |
| 752 | if (x_offset < m_window_sprites_left || x_offset > m_window_sprites_right) |
| 753 | 753 | { |
| 754 | 754 | // continue; |
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 758 | if (x_offset >= 0 && x_offset < WSWAN_X_PIXELS) |
| 759 | 759 | { |
| 760 | | if (m_colors_16) |
| 760 | if (m_colors_16) |
| 761 | 761 | { |
| 762 | | if (col) |
| 762 | if (col) |
| 763 | 763 | { |
| 764 | 764 | if (m_color_mode) |
| 765 | 765 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 767 | 767 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 768 | 768 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| 769 | 769 | } |
| 770 | | } |
| 771 | | else |
| 770 | } |
| 771 | else |
| 772 | 772 | { |
| 773 | | if (col || !(tile_palette & 4)) |
| 773 | if (col || !(tile_palette & 4)) |
| 774 | 774 | { |
| 775 | 775 | if (m_color_mode) |
| 776 | 776 | m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; |
| r242066 | r242067 | |
| 788 | 788 | void wswan_video_device::refresh_scanline() |
| 789 | 789 | { |
| 790 | 790 | setup_palettes(); |
| 791 | | |
| 791 | |
| 792 | 792 | rectangle rec(0, WSWAN_X_PIXELS, m_current_line, m_current_line); |
| 793 | | if (m_lcd_control) |
| 793 | if (m_lcd_control) |
| 794 | 794 | { |
| 795 | 795 | /* Not sure if these background color checks and settings are correct */ |
| 796 | 796 | if (m_color_mode && m_colors_16) |
| r242066 | r242067 | |
| 798 | 798 | else |
| 799 | 799 | m_bitmap.fill(m_main_palette[m_bg_control & 0x07], rec); |
| 800 | 800 | } |
| 801 | | else |
| 801 | else |
| 802 | 802 | { |
| 803 | 803 | m_bitmap.fill(0, rec); |
| 804 | 804 | return; |
| 805 | 805 | } |
| 806 | | |
| 806 | |
| 807 | 807 | // Draw background layer |
| 808 | 808 | if (m_layer_bg_enable) |
| 809 | 809 | draw_background(); |
| 810 | | |
| 810 | |
| 811 | 811 | // Draw sprites between background and foreground layers |
| 812 | 812 | if (m_sprites_enable) |
| 813 | 813 | handle_sprites(0); |
| 814 | | |
| 814 | |
| 815 | 815 | // Draw foreground layer, taking window settings into account |
| 816 | | if (m_layer_fg_enable) |
| 816 | if (m_layer_fg_enable) |
| 817 | 817 | { |
| 818 | | switch (m_window_fg_mode) |
| 818 | switch (m_window_fg_mode) |
| 819 | 819 | { |
| 820 | 820 | case 0: // FG inside & outside window area |
| 821 | 821 | draw_foreground_0(); |
| r242066 | r242067 | |
| 835 | 835 | break; |
| 836 | 836 | } |
| 837 | 837 | } |
| 838 | | |
| 838 | |
| 839 | 839 | // Draw sprites in front of foreground layer |
| 840 | 840 | if (m_sprites_enable) |
| 841 | 841 | handle_sprites(0x2000); |
| r242066 | r242067 | |
| 881 | 881 | value = m_timer_vblank_count >> 8; |
| 882 | 882 | break; |
| 883 | 883 | } |
| 884 | | |
| 884 | |
| 885 | 885 | return value; |
| 886 | 886 | } |
| 887 | 887 | |
| r242066 | r242067 | |
| 900 | 900 | m_palette_port[offset & 0x1f] = data; |
| 901 | 901 | return; |
| 902 | 902 | } |
| 903 | | |
| 903 | |
| 904 | 904 | switch (offset) |
| 905 | 905 | { |
| 906 | 906 | case 0x00: // Display control |
| r242066 | r242067 | |
| 1140 | 1140 | { |
| 1141 | 1141 | if (m_current_line < 144) |
| 1142 | 1142 | refresh_scanline(); |
| 1143 | | |
| 1143 | |
| 1144 | 1144 | // Decrement 12kHz (HBlank) counter |
| 1145 | 1145 | if (m_timer_hblank_enable && m_timer_hblank_reload != 0) |
| 1146 | 1146 | { |
| r242066 | r242067 | |
| 1152 | 1152 | m_timer_hblank_count = m_timer_hblank_reload; |
| 1153 | 1153 | else |
| 1154 | 1154 | m_timer_hblank_reload = 0; |
| 1155 | | |
| 1155 | |
| 1156 | 1156 | logerror( "trigerring hbltmr interrupt\n" ); |
| 1157 | 1157 | m_set_irq_cb(WSWAN_VIDEO_IFLAG_HBLTMR); |
| 1158 | 1158 | } |
| 1159 | 1159 | } |
| 1160 | | |
| 1160 | |
| 1161 | 1161 | // Handle Sound DMA |
| 1162 | 1162 | m_snd_dma_cb(); |
| 1163 | | |
| 1163 | |
| 1164 | 1164 | // m_current_line = (m_current_line + 1) % 159; |
| 1165 | | |
| 1165 | |
| 1166 | 1166 | if (m_current_line == 144) // buffer sprite table |
| 1167 | 1167 | { |
| 1168 | 1168 | memcpy(m_sprite_table_buffer, &m_vram[m_sprite_table_address], 512); |
| 1169 | 1169 | m_sprite_first = m_sprite_first_latch; // always zero? |
| 1170 | 1170 | m_sprite_count = m_sprite_count_latch; |
| 1171 | 1171 | } |
| 1172 | | |
| 1172 | |
| 1173 | 1173 | if (m_current_line == 144) |
| 1174 | 1174 | { |
| 1175 | 1175 | m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBL); |
| r242066 | r242067 | |
| 1184 | 1184 | m_timer_vblank_count = m_timer_vblank_reload; |
| 1185 | 1185 | else |
| 1186 | 1186 | m_timer_vblank_reload = 0; |
| 1187 | | |
| 1187 | |
| 1188 | 1188 | logerror("triggering vbltmr interrupt\n"); |
| 1189 | 1189 | m_set_irq_cb(WSWAN_VIDEO_IFLAG_VBLTMR); |
| 1190 | 1190 | } |
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | | |
| 1193 | |
| 1194 | 1194 | // m_current_line = (m_current_line + 1) % 159; |
| 1195 | | |
| 1195 | |
| 1196 | 1196 | if (m_current_line == m_line_compare) |
| 1197 | 1197 | m_set_irq_cb(WSWAN_VIDEO_IFLAG_LCMP); |
| 1198 | | |
| 1198 | |
| 1199 | 1199 | m_current_line = (m_current_line + 1) % 159; |
| 1200 | 1200 | } |
| 1201 | 1201 | |