Previous 15994 Revisions Next

r1258 Monday 12th November, 2007 at 08:56:28 UTC by Curt Coder
[QL] Separated video emulation. Connected the keyboard to the IPC.
[src/mess]mess.mak
[src/mess/drivers]ql.c
[src/mess/video]ql.c* ql.h*

src/mess/video/ql.c
r0r1258
1#include "video/ql.h"
2 
3static int mode4_colors[] = { 0, 2, 4, 7 };
4 
5PALETTE_INIT( ql )
6{
7   palette_set_color_rgb(machine,  0x00, 0x00, 0x00, 0x00 );
8   palette_set_color_rgb(machine,  0x01, 0x00, 0x00, 0xff );
9   palette_set_color_rgb(machine,  0x02, 0x00, 0xff, 0x00 );
10   palette_set_color_rgb(machine,  0x03, 0x00, 0xff, 0xff );
11   palette_set_color_rgb(machine,  0x04, 0xff, 0x00, 0x00 );
12   palette_set_color_rgb(machine,  0x05, 0xff, 0x00, 0xff );
13   palette_set_color_rgb(machine,  0x06, 0xff, 0xff, 0x00 );
14   palette_set_color_rgb(machine,  0x07, 0xff, 0xff, 0xff );
15}
16 
17WRITE8_HANDLER( ql_videoram_w )
18{
19   int i, x, y, r, g, color, byte0, byte1;
20   int offs;
21 
22   videoram[offset] = data;
23 
24   offs = offset / 2;
25 
26   byte0 = videoram[offs];
27   byte1 = videoram[offs + 1];
28 
29   x = (offs % 64) << 3;
30   y = offs / 64;
31 
32//   logerror("ofs %u data %u x %u y %u\n", offset, data, x, y);
33 
34      /*
35 
36      # Note: QL video is encoded as 2-byte chunks
37      # msb->lsb (Green Red)
38      # mode 4: GGGGGGGG RRRRRRRR
39      # R+G=White
40 
41      */
42 
43      for (i = 0; i < 8; i++)
44      {
45         r = (byte1 & 0x80) >> 6;
46         g = (byte0 & 0x80) >> 7;
47 
48         color = r | g;
49         
50//         logerror("x %u y %u color %u\n", x, y, color);
51 
52         *BITMAP_ADDR16(tmpbitmap, y, x++) = Machine->pens[mode4_colors[color]];
53 
54         byte0 <<= 1;
55         byte1 <<= 1;
56 
57      }
58 
59      /*
60 
61      # Note: QL video is encoded as 2-byte chunks
62      # msb->lsb (Green Flash Red Blue)
63      # mode 8: GFGFGFGF RBRBRBRB
64 
65      */
66 
67/*
68      for (i = 0; i < 8; i++)
69      {
70         r = (data & 0x0080) >> 5;
71         g = (data & 0x8000) >> 14;
72         b = (data & 0x0040) >> 6;
73         f = (data & 0x4000) >> 14;
74 
75         color = r | g | b;
76 
77         plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
78         plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
79 
80         data <<= 2;
81      }
82*/
83}
84 
85WRITE8_HANDLER( ql_video_ctrl_w )
86{
87   /*
88   18063 is write only (Quasar p.618)
89   bit 1: 0: screen on, 1: screen off
90   bit 3: 0: mode 512, 1: mode 256
91   bit 7: 0: base=0x20000, 1: base=0x28000
92   */
93}
src/mess/video/ql.h
r0r1258
1#include "driver.h"
2#include "video/generic.h"
3 
4PALETTE_INIT( ql );
5WRITE8_HANDLER( ql_videoram_w );
6WRITE8_HANDLER( ql_video_ctrl_w );
src/mess/mess.mak
r1257r1258
617617   $(MESS_MACHINE)/spectrum.o      \
618618   $(MESS_FORMATS)/zx81_p.o      \
619619   $(MESS_DRIVERS)/ql.o      \
620   $(MESS_VIDEO)/ql.o      \
620621   $(MESS_FORMATS)/tzx_cas.o      \
621622
622623$(MESSOBJ)/apple.a:   \
src/mess/drivers/ql.c
r1257r1258
11#include "driver.h"
2#include "cpu/i8039/i8039.h"
23#include "video/generic.h"
4#include "video/ql.h"
35#include "inputx.h"
46
57/*
r1257r1258
1517
1618*/
1719
18/* video */
19
20static int mode4_colors[] = { 0, 2, 4, 7 };
21
22PALETTE_INIT( ql )
23{
24   palette_set_color_rgb(machine,  0x00, 0x00, 0x00, 0x00 );
25   palette_set_color_rgb(machine,  0x01, 0x00, 0x00, 0xff );
26   palette_set_color_rgb(machine,  0x02, 0x00, 0xff, 0x00 );
27   palette_set_color_rgb(machine,  0x03, 0x00, 0xff, 0xff );
28   palette_set_color_rgb(machine,  0x04, 0xff, 0x00, 0x00 );
29   palette_set_color_rgb(machine,  0x05, 0xff, 0x00, 0xff );
30   palette_set_color_rgb(machine,  0x06, 0xff, 0xff, 0x00 );
31   palette_set_color_rgb(machine,  0x07, 0xff, 0xff, 0xff );
32}
33
34WRITE8_HANDLER( ql_videoram_w )
35{
36   int i, x, y, r, g, color, byte0, byte1;
37   int offs;
38
39   videoram[offset] = data;
40
41   offs = offset / 2;
42
43   byte0 = videoram[offs];
44   byte1 = videoram[offs + 1];
45
46   x = (offs % 64) << 3;
47   y = offs / 64;
48
49//   logerror("ofs %u data %u x %u y %u\n", offset, data, x, y);
50
51      /*
52
53      # Note: QL video is encoded as 2-byte chunks
54      # msb->lsb (Green Red)
55      # mode 4: GGGGGGGG RRRRRRRR
56      # R+G=White
57
58      */
59
60      for (i = 0; i < 8; i++)
61      {
62         r = (byte1 & 0x80) >> 6;
63         g = (byte0 & 0x80) >> 7;
64
65         color = r | g;
66         
67//         logerror("x %u y %u color %u\n", x, y, color);
68
69         *BITMAP_ADDR16(tmpbitmap, y, x++) = Machine->pens[mode4_colors[color]];
70
71         byte0 <<= 1;
72         byte1 <<= 1;
73
74      }
75
76      /*
77
78      # Note: QL video is encoded as 2-byte chunks
79      # msb->lsb (Green Flash Red Blue)
80      # mode 8: GFGFGFGF RBRBRBRB
81
82      */
83
84/*
85      for (i = 0; i < 8; i++)
86      {
87         r = (data & 0x0080) >> 5;
88         g = (data & 0x8000) >> 14;
89         b = (data & 0x0040) >> 6;
90         f = (data & 0x4000) >> 14;
91
92         color = r | g | b;
93
94         plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
95         plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
96
97         data <<= 2;
98      }
99*/
100}
101
10220/* Read/Write Handlers */
10321
104WRITE8_HANDLER( video_ctrl_w )
105{
106   /*
107   18063 is write only (Quasar p.618)
108   bit 1: 0: screen on, 1: screen off
109   bit 3: 0: mode 512, 1: mode 256
110   bit 7: 0: base=0x20000, 1: base=0x28000
111   */
112}
113
11422static int ZXmode, ZXbps;
11523
116WRITE8_HANDLER( zx8302_w )
24static WRITE8_HANDLER( zx8302_w )
11725{
11826   ZXmode = data & 0x18;
11927
r1257r1258
13846   }
13947}
14048
141WRITE8_HANDLER( i8049_w )
49static WRITE8_HANDLER( i8049_w )
14250{
14351   /*
14452   process 8049 commands (p92)
r1257r1258
17280   */
17381}
17482
175WRITE8_HANDLER( mdv_ctrl_w )
83static WRITE8_HANDLER( mdv_ctrl_w )
17684{
17785   /*
17886   MDV control
r1257r1258
201109   */
202110}
203111
204WRITE8_HANDLER( mdv_data_w )
112static WRITE8_HANDLER( mdv_data_w )
205113{
206114}
207115
208READ8_HANDLER( mdv_status_r )
116static READ8_HANDLER( mdv_status_r )
209117{
210118   return 0x0;
211119}
212120
213WRITE8_HANDLER( clock_w )
121static WRITE8_HANDLER( clock_w )
214122{
215123}
216124
125/* Intelligent Peripheral Controller (IPC) */
126
127static UINT8 ipc_keylatch;
128
129static WRITE8_HANDLER( ipc_port1_w )
130{
131   /*
132     
133      bit      description
134     
135      0      Keyboard column output (KBD0)
136      1      Keyboard column output (KBD1)
137      2      Keyboard column output (KBD2)
138      3      Keyboard column output (KBD3)
139      4      Keyboard column output (KBD4)
140      5      Keyboard column output (KBD5)
141      6      Keyboard column output (KBD6)
142      7      Keyboard column output (KBD7)
143
144   */
145
146   ipc_keylatch = data;
147}
148
149static WRITE8_HANDLER( ipc_port2_w )
150{
151   /*
152     
153      bit      description
154     
155      0      IPC INT (pin 6)
156      1      Speaker output
157      2      CPU IPL 0-2 (pin 42)
158      3      ULA IPLIL (pin 26), CPU IPL 1 (pin 41)
159      4      J6 CTS (pin 5)
160      5      J5 DTR (pin 4)
161      6      N/C
162      7      ULA COMDATA (pin 35)
163
164   */
165   
166}
167
168static READ8_HANDLER( ipc_port2_r )
169{
170   /*
171     
172      bit      description
173     
174      0      IPC INT (pin 6)
175      1      Speaker output
176      2      CPU IPL 0-2 (pin 42)
177      3      ULA IPLIL (pin 26), CPU IPL 1 (pin 41)
178      4      J6 CTS (pin 5)
179      5      J5 DTR (pin 4)
180      6      N/C
181      7      ULA COMDATA (pin 35)
182
183   */
184
185   return 0;
186}
187
188static READ8_HANDLER( ipc_t1_r )
189{
190   /*
191     
192      bit      description
193     
194      0      ULA BAUDK4 (pin 5)
195
196   */
197
198   return 0;
199}
200
201static READ8_HANDLER( ipc_bus_r )
202{
203   /*
204     
205      bit      description
206     
207      0      Keyboard row input (KBI0)
208      1      Keyboard row input (KBI1)
209      2      Keyboard row input (KBI2)
210      3      Keyboard row input (KBI3)
211      4      Keyboard row input (KBI4)
212      5      Keyboard row input (KBI5)
213      6      Keyboard row input (KBI6)
214      7      Keyboard row input (KBI7)
215
216   */
217
218   if (ipc_keylatch & 0x01) return readinputportbytag("ROW0");
219   if (ipc_keylatch & 0x02) return readinputportbytag("ROW1");
220   if (ipc_keylatch & 0x04) return readinputportbytag("ROW2");
221   if (ipc_keylatch & 0x08) return readinputportbytag("ROW3");
222   if (ipc_keylatch & 0x10) return readinputportbytag("ROW4");
223   if (ipc_keylatch & 0x20) return readinputportbytag("ROW5");
224   if (ipc_keylatch & 0x40) return readinputportbytag("ROW6");
225   if (ipc_keylatch & 0x80) return readinputportbytag("ROW7");
226
227   return 0xff;
228}
229
217230/* Memory Maps */
218231
219232static ADDRESS_MAP_START( ql_map, ADDRESS_SPACE_PROGRAM, 8 )
r1257r1258
226239   AM_RANGE(0x018021, 0x018021) AM_WRITENOP // ???
227240   AM_RANGE(0x018022, 0x018022) AM_WRITE(mdv_data_w)
228241   AM_RANGE(0x018023, 0x018023) AM_WRITENOP // ???
229   AM_RANGE(0x018063, 0x018063) AM_WRITE(video_ctrl_w)
242   AM_RANGE(0x018063, 0x018063) AM_WRITE(ql_video_ctrl_w)
230243   AM_RANGE(0x020000, 0x027fff) AM_RAM AM_WRITE(ql_videoram_w) AM_BASE(&videoram)
231244   AM_RANGE(0x028000, 0x02ffff) AM_RAM // videoram 2
232245   AM_RANGE(0x030000, 0x03ffff) AM_RAM // onboard RAM
r1257r1258
239252   AM_RANGE(0x000, 0x7ff) AM_ROM
240253ADDRESS_MAP_END
241254
255static ADDRESS_MAP_START( ipc_io_map, ADDRESS_SPACE_IO, 8 )
256   AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(ipc_port1_w)
257   AM_RANGE(I8039_p2, I8039_p2) AM_READWRITE(ipc_port2_r, ipc_port2_w)
258   AM_RANGE(I8039_t1, I8039_t1) AM_READ(ipc_t1_r)
259   AM_RANGE(I8039_bus, I8039_bus) AM_READ(ipc_bus_r)
260ADDRESS_MAP_END
261
242262/* Input Ports */
243263
244264static INPUT_PORTS_START( ql )
r1257r1258
340360   MDRV_CPU_ADD(M68008, 15000000/2)   // 7.5 MHz
341361   MDRV_CPU_PROGRAM_MAP(ql_map, 0)
342362
343   MDRV_CPU_ADD(I8039, 11000000)      // 11 MHz (i8049 IPC)
363   MDRV_CPU_ADD(I8048, 11000000)      // 11 MHz (i8049 IPC)
344364   MDRV_CPU_PROGRAM_MAP(ipc_map, 0)
365   MDRV_CPU_IO_MAP(ipc_io_map, 0)
345366
346367   MDRV_SCREEN_REFRESH_RATE(50)
347368   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r1257r1258
400421
401422   ROM_REGION( 0x800, REGION_CPU2, 0 )
402423   ROM_LOAD( "ipc8049.ic24", 0x0000, 0x0800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) )
403   ROM_LOAD( "v07.ic24",     0x0000, 0x0800, CRC(051111f9) SHA1(83ed562464df89b9fdd9740db51d45884a512696) ) // V0.7
424//   ROM_LOAD( "v07.ic24",     0x0000, 0x0800, CRC(051111f9) SHA1(83ed562464df89b9fdd9740db51d45884a512696) ) // V0.7
404425ROM_END
405426
406427ROM_START( ql_jsu )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team