summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/alto2/a2roms.h
blob: 1d1cc149660bce477608252f25c7b3fee3006d8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// license:BSD-3-Clause
// copyright-holders:Juergen Buchmueller
/*****************************************************************************
 *
 *   Xerox AltoII RAM PROM loading and decoding
 *
 *****************************************************************************/
#ifndef _CPU_A2ROMS_H_
#define _CPU_A2ROMS_H_


/**
 * @brief structure to define a ROM's or PROM's loading options
 */
typedef struct {
	const char *name;       //!< default filename of the ROM image
	const char *altname;    //!< alternate filename of the ROM image
	const char *crc32;      //!< CRC32 hash of the file
	const char *sha1;       //!< SHA1 hash of the file
	size_t size;            //!< size of the file, and elements in destination memory
	const uint8_t amap[16];   //!< address bit mapping
	uint32_t axor;            //!< address XOR mask (applied to source address)
	uint32_t dxor;            //!< data XOR mask (applied before shifting and mapping)
	uint8_t width;            //!< width in bits
	uint8_t shift;            //!< left shift in bits
	const uint8_t dmap[16];   //!< data bit mapping
	uint32_t dand;            //!< ANDing destination with this value, before XORing the data
	size_t type;            //!< type of the destination, i.e. sizeof(type)
}   prom_load_t;

#define ZERO            0
#define KEEP            ~0U

#define AMAP_DEFAULT        {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
#define AMAP_CONST_PROM     {3,2,1,4,5,6,7,0,}
#define AMAP_REVERSE_0_7    {7,6,5,4,3,2,1,0,}

#define DMAP_DEFAULT        {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
#define DMAP_REVERSE_0_3    {3,2,1,0,}

extern uint8_t* prom_load(running_machine& machine, const prom_load_t* prom, const uint8_t* src, int pages = 1, int segments = 1);
#endif // _CPU_A2ROMS_H_