Previous 15994 Revisions Next

r5675 Thursday 10th September, 2009 at 14:41:17 UTC by Dirk Best
[SAMCOUPE] Cleanups
[src/mess/drivers]samcoupe.c
[src/mess/includes]samcoupe.h
[src/mess/video]samcoupe.c

src/mess/video/samcoupe.c
r5674r5675
162162
163163   /* line interrupt? */
164164   if (asic->line_int == scanline)
165      samcoupe_irq(screen->machine->firstcpu, 0x01);
165      samcoupe_irq(screen->machine->firstcpu, SAM_LINE_INT);
166166
167167   /* display disabled? (only in mode 3 or 4) */
168168   if ((asic->vmpr & 0x40) && (asic->border & 0x80))
src/mess/includes/samcoupe.h
r5674r5675
1212#define SAMCOUPE_H_
1313
1414
15#define SAM_LINE_INT   0x01
16#define SAM_FRAME_INT   0x08
17
18
1519typedef struct _coupe_asic coupe_asic;
1620struct _coupe_asic
1721{
src/mess/drivers/samcoupe.c
r5674r5675
11/***************************************************************************
22
3 SAM Coupe Driver - Written By Lee Hammerton
3    SAM Coupe
44
5    Miles Gordon Technology, 1989
56
6    Sam Coupe Memory Map - Based around the current spectrum.c (for obvious reasons!!)
7    Driver by Lee Hammerton, Dirk Best
78
8    CPU:
9        0000-7fff Banked rom/ram
10        8000-ffff Banked rom/ram
119
10    Notes:
11    ------
1212
13Interrupts:
13    Beware - the early ROMs are very buggy, and tend to go mad once BASIC
14    starts paging.  ROM 10 (version 1.0) requires the CALL after F9 or BOOT
15    because the ROM loads the bootstrap but fails to execute it. The address
16    depends on the RAM size:
1417
15Changes:
18    On a 256K SAM: CALL 229385
19    Or on a 512K (or larger) machine: CALL 491529
1620
17 V0.2   - Added FDC support. - Based on 1771 document. Coupe had a 1772... (any difference?)
18            floppy supports only read sector single mode at present will add write sector
19            in next version.
20          Fixed up palette - had red & green wrong way round.
2121
22    Todo:
23    -----
2224
23 KT 26-Aug-2000 - Changed to use wd179x code. This is the same as the 1772.
24                - Coupe supports the basic disk image format, but can be changed in
25                  the future to support others
25    - Tape
26    - Attribute read
27    - Better timing
28    - Harddisk interfaces
2629
27Note on the bioses:
28 SAM Coupe ROM Images
29 --------------------
30
31 This archive contains many versions of the SAM Coupe 32K ROM image, released
32 with kind permission from the ROM author, Dr Andy Wright.
33
34 Thanks to Simon N Goodwin for supplying the files, which include two dumped
35 from pre-production hardware (and which only work with the early hardware!).
36
37 Beware - the early ROMs are very buggy, and tend to go mad once BASIC starts
38 paging.  ROM 10 (version 1.0) requires the CALL after F9 or BOOT because the
39 ROM loads the bootstrap but fails to execute it. The address depends on the
40 RAM size:
41
42 On a 256K SAM:
43
44    CALL 229385
45
46 Or on a 512K (or larger) machine:
47
48    CALL 491529
49
50 --
51 Uploaded by Simon Owen <simon.owen@simcoupe.org>
52
5330***************************************************************************/
5431
5532/* core includes */
r5674r5675
6946#include "formats/coupedsk.h"
7047
7148
49/***************************************************************************
50    CONSTANTS
51***************************************************************************/
52
7253#define SAMCOUPE_XTAL_X1  XTAL_24MHz
7354#define SAMCOUPE_XTAL_X2  XTAL_4_433619MHz
7455
7556
57/***************************************************************************
58    I/O PORTS
59***************************************************************************/
7660
77/*************************************
78 *
79 *  I/O port handling
80 *
81 *************************************/
82
8361static READ8_HANDLER( samcoupe_disk_r )
8462{
8563   const device_config *fdc = devtag_get_device(space->machine, "wd1772");
r5674r5675
10078   return 0xff;
10179}
10280
103
10481static WRITE8_HANDLER( samcoupe_disk_w )
10582{
10683   const device_config *fdc = devtag_get_device(space->machine, "wd1772");
r5674r5675
11996   }
12097}
12198
122
12399static READ8_HANDLER( samcoupe_pen_r )
124100{
125101   const device_config *scr = space->machine->primary_screen;
r5674r5675
139115   return data;
140116}
141117
142
143118static WRITE8_HANDLER( samcoupe_clut_w )
144119{
145120   coupe_asic *asic = space->machine->driver_data;
146121   asic->clut[(offset >> 8) & 0x0f] = data & 0x7f;
147122}
148123
149
150124static READ8_HANDLER( samcoupe_status_r )
151125{
152126   coupe_asic *asic = space->machine->driver_data;
r5674r5675
165139   return data | asic->status;
166140}
167141
168
169142static WRITE8_HANDLER( samcoupe_line_int_w )
170143{
171144   coupe_asic *asic = space->machine->driver_data;
172145   asic->line_int = data;
173146}
174147
175
176148static READ8_HANDLER( samcoupe_lmpr_r )
177149{
178150   coupe_asic *asic = space->machine->driver_data;
179151   return asic->lmpr;
180152}
181153
182
183154static WRITE8_HANDLER( samcoupe_lmpr_w )
184155{
185156   const address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5674r5675
189160   samcoupe_update_memory(space_program);
190161}
191162
192
193163static READ8_HANDLER( samcoupe_hmpr_r )
194164{
195165   coupe_asic *asic = space->machine->driver_data;
196166   return asic->hmpr;
197167}
198168
199
200169static WRITE8_HANDLER( samcoupe_hmpr_w )
201170{
202171   const address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5674r5675
206175   samcoupe_update_memory(space_program);
207176}
208177
209
210178static READ8_HANDLER( samcoupe_vmpr_r )
211179{
212180   coupe_asic *asic = space->machine->driver_data;
213181   return asic->vmpr;
214182}
215183
216
217184static WRITE8_HANDLER( samcoupe_vmpr_w )
218185{
219186   const address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5674r5675
223190   samcoupe_update_memory(space_program);
224191}
225192
226
227193static READ8_HANDLER( samcoupe_midi_r )
228194{
229195   logerror("%s: read from midi port\n", cpuexec_describe_context(space->machine));
230196   return 0xff;
231197}
232198
233
234199static WRITE8_HANDLER( samcoupe_midi_w )
235200{
236201   logerror("%s: write to midi port: 0x%02x\n", cpuexec_describe_context(space->machine), data);
237202}
238203
239
240204static READ8_HANDLER( samcoupe_keyboard_r )
241205{
242206   UINT8 data = 0xff;
r5674r5675
261225   return data | 0xe0;
262226}
263227
264
265228static WRITE8_HANDLER( samcoupe_border_w )
266229{
267230   const device_config *speaker = devtag_get_device(space->machine, "speaker");
r5674r5675
272235   speaker_level_w(speaker, (data >> 4) & 0x01);
273236}
274237
275
276238static READ8_HANDLER( samcoupe_attributes_r )
277239{
278240   if (video_screen_get_vblank(space->machine->primary_screen))
r5674r5675
288250   }
289251}
290252
291
292253static READ8_DEVICE_HANDLER( samcoupe_lpt1_busy_r )
293254{
294255   return centronics_busy_r(device);
295256}
296257
297
298258static WRITE8_DEVICE_HANDLER( samcoupe_lpt1_strobe_w )
299259{
300260   centronics_strobe_w(device, data);
301261}
302262
303
304263static READ8_DEVICE_HANDLER( samcoupe_lpt2_busy_r )
305264{
306265   return centronics_busy_r(device);
307266}
308267
309
310268static WRITE8_DEVICE_HANDLER( samcoupe_lpt2_strobe_w )
311269{
312270   centronics_strobe_w(device, data);
313271}
314272
315273
274/***************************************************************************
275    ADDRESS MAPS
276***************************************************************************/
316277
317/*************************************
318 *
319 *  Address maps
320 *
321 *************************************/
322
323278static ADDRESS_MAP_START( samcoupe_mem, ADDRESS_SPACE_PROGRAM, 8 )
324279   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK(1)
325280   AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(2)
r5674r5675
327282   AM_RANGE(0xc000, 0xffff) AM_RAMBANK(4)
328283ADDRESS_MAP_END
329284
330
331285static ADDRESS_MAP_START( samcoupe_io, ADDRESS_SPACE_IO, 8 )
332286   AM_RANGE(0x0080, 0x0081) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(samcoupe_ext_mem_w)
333287   AM_RANGE(0x00e0, 0x00e7) AM_MIRROR(0xff10) AM_MASK(0xffff) AM_READWRITE(samcoupe_disk_r, samcoupe_disk_w)
r5674r5675
348302ADDRESS_MAP_END
349303
350304
305/***************************************************************************
306    INTERRUPTS
307***************************************************************************/
351308
352/*************************************
353 *
354 *  Interrupts
355 *
356 *************************************/
357
358309static TIMER_CALLBACK( irq_off )
359310{
360311   coupe_asic *asic = machine->driver_data;
r5674r5675
366317   asic->status |= param;
367318}
368319
369
370320void samcoupe_irq(const device_config *device, UINT8 src)
371321{
372322   coupe_asic *asic = device->machine->driver_data;
r5674r5675
379329   asic->status &= ~src;
380330}
381331
382
383332static INTERRUPT_GEN( samcoupe_frame_interrupt )
384333{
385334   /* signal frame interrupt */
386   samcoupe_irq(device, 0x08);
335   samcoupe_irq(device, SAM_FRAME_INT);
387336}
388337
389338
339/***************************************************************************
340    INPUT PORTS
341***************************************************************************/
390342
391/*************************************
392 *
393 *  Input ports
394 *
395 *************************************/
396
397343static INPUT_PORTS_START( samcoupe )
398344   PORT_START("keyboard_row_fe")
399345   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
r5674r5675
489435INPUT_PORTS_END
490436
491437
438/***************************************************************************
439    PALETTE
440***************************************************************************/
492441
493/*************************************
494 *
495 *  Palette
496 *
497 *************************************/
498
499442/*
500443    Decode colours for the palette as follows:
501444
r5674r5675
534477}
535478
536479
480/***************************************************************************
481    MACHINE DRIVERS
482***************************************************************************/
537483
538/*************************************
539 *
540 *  Machine drivers
541 *
542 *************************************/
543
544484static MACHINE_DRIVER_START( samcoupe )
545485   /* basic machine hardware */
546486   MDRV_CPU_ADD("maincpu", Z80, SAMCOUPE_XTAL_X1/4) /* 6 MHz */
r5674r5675
577517MACHINE_DRIVER_END
578518
579519
580/*************************************
581 *
582 *  ROM definitions
583 *
584 *************************************/
520/***************************************************************************
521    ROM DEFINITIONS
522***************************************************************************/
585523
586524/*
587525    The bios is actually 32K. This is the combined version of the two old 16K MESS roms.
r5674r5675
621559ROM_END
622560
623561
562/***************************************************************************
563    SYSTEM CONFIG
564***************************************************************************/
624565
625/*************************************
626 *
627 *  Devices
628 *
629 *************************************/
630
631566static void samcoupe_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
632567{
633568   /* floppy */
r5674r5675
643578   }
644579}
645580
646
647static SYSTEM_CONFIG_START(samcoupe)
581static SYSTEM_CONFIG_START( samcoupe )
648582   CONFIG_RAM(256 * 1024)
649583   CONFIG_RAM_DEFAULT(512 * 1024)
650584   CONFIG_RAM(256 * 1024 + 1 * 1024 * 1024)
r5674r5675
659593SYSTEM_CONFIG_END
660594
661595
596/***************************************************************************
597    GAME DRIVERS
598***************************************************************************/
662599
663/*************************************
664 *
665 *  Game drivers
666 *
667 *************************************/
668
669/*    YEAR  NAME      PARENT  COMPAT  MACHINE  INPUT  INIT   CONFIG  COMPANY                        FULLNAME     FLAGS */
670COMP( 1989, samcoupe, 0,      0,   samcoupe,  samcoupe, 0,   samcoupe,  "Miles Gordon Technology plc", "Sam Coupe", 0 )
600/*    YEAR  NAME      PARENT  COMPAT  MACHINE   INPUT     INIT  CONFIG    COMPANY                        FULLNAME     FLAGS */
601COMP( 1989, samcoupe, 0,      0,      samcoupe, samcoupe, 0,    samcoupe, "Miles Gordon Technology plc", "SAM Coupe", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team