summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/comx_thm.c
blob: ffb6b78f787f6a936e5d09766724080eaf57605b (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**********************************************************************

    COMX-35 Thermal Printer Card emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

**********************************************************************/

#include "comx_thm.h"



//**************************************************************************
//  MACROS/CONSTANTS
//**************************************************************************



//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

const device_type COMX_THM = &device_creator<comx_thm_device>;


//-------------------------------------------------
//  ROM( comx_thm )
//-------------------------------------------------

ROM_START( comx_thm )
	ROM_REGION( 0x2000, "c000", 0 )
	ROM_LOAD( "thermal.bin", 0x0000, 0x1000, CRC(41a72ba8) SHA1(3a8760c78bd8c7bec2dbf26657b930c9a6814803) )
ROM_END


//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const rom_entry *comx_thm_device::device_rom_region() const
{
	return ROM_NAME( comx_thm );
}


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  comx_thm_device - constructor
//-------------------------------------------------

comx_thm_device::comx_thm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
	device_t(mconfig, COMX_THM, "COMX-35 Thermal Printer Card", tag, owner, clock),
	device_comx_expansion_card_interface(mconfig, *this)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void comx_thm_device::device_start()
{
	m_rom = memregion("c000")->base();
}


//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void comx_thm_device::device_reset()
{
}


//-------------------------------------------------
//  comx_mrd_r - memory read
//-------------------------------------------------

UINT8 comx_thm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
{
	UINT8 data = 0;

	if (offset >= 0xc000 && offset < 0xd000)
	{
		data = m_rom[offset & 0xfff];
	}

	return data;
}


//-------------------------------------------------
//  comx_io_r - I/O read
//-------------------------------------------------

UINT8 comx_thm_device::comx_io_r(address_space &space, offs_t offset)
{
	/*
        INP 2 is used for the printer status, where:
        b0=1: Printer Not Ready
        b1=1: Energizing Head
        b2=1: Head At Position 0
    */

	return 0;
}


//-------------------------------------------------
//  comx_io_w - I/O write
//-------------------------------------------------

void comx_thm_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
{
	/*
        OUT 2 is used to control the thermal printer where:
        Q = 0, b0-7: Pixel 1 to 8
        Q = 1, b7: Pixel 9 (if b0-6=#21)
        Q = 1, b3=1: Move head right
        Q = 1, b0-7=#12: Move head left
    */
}