Previous 15994 Revisions Next

r5630 Monday 7th September, 2009 at 13:46:53 UTC by Curt Coder
[JTC] Added centronics and more video stuff.
[src/mess/drivers]jtc.c
[src/mess/includes]jtc.h

src/mess/includes/jtc.h
r5629r5630
55#define UB8830D_TAG      "ub8830d"
66#define CASSETTE_TAG   "cassette"
77#define SPEAKER_TAG      "speaker"
8#define CENTRONICS_TAG   "centronics"
89
10#define JTC_ES40_VIDEORAM_SIZE   0x2000
11
912typedef struct _jtc_state jtc_state;
1013struct _jtc_state
1114{
1215   /* video state */
16   UINT8 video_bank;
1317   UINT8 *video_ram;
18   UINT8 *color_ram_r;
19   UINT8 *color_ram_g;
20   UINT8 *color_ram_b;
1421
1522   /* devices */
1623   const device_config *cassette;
1724   const device_config *speaker;
25   const device_config *centronics;
1826};
1927
2028#endif
src/mess/drivers/jtc.c
r5629r5630
1010#include "includes/jtc.h"
1111#include "cpu/z8/z8.h"
1212#include "devices/cassette.h"
13#include "machine/ctronics.h"
1314#include "sound/speaker.h"
1415#include "sound/wave.h"
1516
1617/* Read/Write Handlers */
1718
19static WRITE8_HANDLER( p2_w )
20{
21   /*
22
23      bit      description
24
25      P20     
26      P21     
27      P22     
28      P23     
29      P24     
30      P25      centronics strobe output
31      P26      V4093 pins 1,2
32      P27      DL299 pin 18
33
34   */
35
36   jtc_state *state = space->machine->driver_data;
37
38   centronics_strobe_w(state->centronics, BIT(data, 5));
39}
40
1841static READ8_HANDLER( p3_r )
1942{
2043   /*
r5629r5630
2447      P30      tape input
2548      P31
2649      P32
27      P33
50      P33      centronics busy input
2851      P34
2952      P35
3053      P36      tape output
r5629r5630
3457
3558   jtc_state *state = space->machine->driver_data;
3659
37   return (cassette_input(state->cassette) < 0.0) ? 1 : 0;
60   UINT8 data = 0;
61
62   data |= (cassette_input(state->cassette) < 0.0) ? 1 : 0;
63   data |= centronics_busy_r(state->centronics) << 3;
64
65   return data;
3866}
3967
4068static WRITE8_HANDLER( p3_w )
r5629r5630
4674      P30      tape input
4775      P31
4876      P32
49      P33
77      P33      centronics busy input
5078      P34
5179      P35
5280      P36      tape output
r5629r5630
6391   speaker_level_w(state->speaker, BIT(data, 7));
6492}
6593
94static READ8_HANDLER( es40_videoram_r )
95{
96   jtc_state *state = space->machine->driver_data;
97
98   UINT8 data = 0;
99
100   if (state->video_bank & 0x80) data |= state->color_ram_r[offset];
101   if (state->video_bank & 0x40) data |= state->color_ram_g[offset];
102   if (state->video_bank & 0x20) data |= state->color_ram_b[offset];
103   if (state->video_bank & 0x10) data |= state->video_ram[offset];
104
105   return data;
106}
107
108static WRITE8_HANDLER( es40_videoram_w )
109{
110   jtc_state *state = space->machine->driver_data;
111
112   if (state->video_bank & 0x80) state->color_ram_r[offset] = data;
113   if (state->video_bank & 0x40) state->color_ram_g[offset] = data;
114   if (state->video_bank & 0x20) state->color_ram_b[offset] = data;
115   if (state->video_bank & 0x10) state->video_ram[offset] = data;
116}
117
118static WRITE8_HANDLER( es40_banksel_w )
119{
120   jtc_state *state = space->machine->driver_data;
121
122   state->video_bank = offset & 0xf0;
123}
124
66125/* Memory Maps */
67126
68127static ADDRESS_MAP_START( jtc_mem, ADDRESS_SPACE_PROGRAM, 8 )
r5629r5630
129188static ADDRESS_MAP_START( jtc_es40_mem, ADDRESS_SPACE_PROGRAM, 8 )
130189   ADDRESS_MAP_UNMAP_HIGH
131190   AM_RANGE(0x0800, 0x1fff) AM_ROM
132   AM_RANGE(0x4000, 0x5fff) AM_RAM // videoram
133//   AM_RANGE(0x6000, 0x63ff) AM_WRITE(es40_banksel_w)
191   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(es40_videoram_r, es40_videoram_w)
192   AM_RANGE(0x6000, 0x63ff) AM_WRITE(es40_banksel_w)
134193   AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x0ff0) AM_READ_PORT("Y1")
135194   AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x0ff0) AM_READ_PORT("Y2")
136195   AM_RANGE(0x7003, 0x7003) AM_MIRROR(0x0ff0) AM_READ_PORT("Y3")
r5629r5630
142201   AM_RANGE(0x7009, 0x7009) AM_MIRROR(0x0ff0) AM_READ_PORT("Y9")
143202   AM_RANGE(0x700a, 0x700a) AM_MIRROR(0x0ff0) AM_READ_PORT("Y10")
144203   AM_RANGE(0x700b, 0x700b) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11")
145   AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y11")
146   AM_RANGE(0x700d, 0x700d) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12")
204   AM_RANGE(0x700c, 0x700c) AM_MIRROR(0x0ff0) AM_READ_PORT("Y12")
147205   AM_RANGE(0x8000, 0xffff) AM_RAM//BANK(1)
148206ADDRESS_MAP_END
149207
r5629r5630
151209   ADDRESS_MAP_UNMAP_HIGH
152210   AM_RANGE(0x00, 0x00) AM_NOP // A8-A15
153211   AM_RANGE(0x01, 0x01) AM_NOP // AD0-AD7
154//   AM_RANGE(0x02, 0x02) AM_NOP
212   AM_RANGE(0x02, 0x02) AM_WRITE(p2_w)
155213   AM_RANGE(0x03, 0x03) AM_READWRITE(p3_r, p3_w)
156214ADDRESS_MAP_END
157215
r5629r5630
455513
456514   int x, y, sx;
457515
458   for (y = 0; y < 63; y++)
516   for (y = 0; y < 64; y++)
459517   {
460518      for (sx = 0; sx < 8; sx++)
461519      {
r5629r5630
478536
479537static VIDEO_UPDATE( jtc_es23 )
480538{
481   return 0;
539   jtc_state *state = screen->machine->driver_data;
540
541   int x, y, sx;
542
543   for (y = 0; y < 128; y++)
544   {
545      for (sx = 0; sx < 16; sx++)
546      {
547         UINT8 data = state->video_ram[(y * 16) + sx];
548
549         for (x = 0; x < 8; x++)
550         {
551            int color = BIT(data, x);
552            *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = color;
553         }
554      }
555   }
556
557    return 0;
482558}
483559
484560static PALETTE_INIT( jtc_es40 )
r5629r5630
487563
488564static VIDEO_START( jtc_es40 )
489565{
566   jtc_state *state = machine->driver_data;
567
568   /* allocate memory */
569   state->video_ram = auto_alloc_array(machine, UINT8, JTC_ES40_VIDEORAM_SIZE);
570   state->color_ram_r = auto_alloc_array(machine, UINT8, JTC_ES40_VIDEORAM_SIZE);
571   state->color_ram_g = auto_alloc_array(machine, UINT8, JTC_ES40_VIDEORAM_SIZE);
572   state->color_ram_b = auto_alloc_array(machine, UINT8, JTC_ES40_VIDEORAM_SIZE);
573
574   /* register for state saving */
575   state_save_register_global(machine, state->video_bank);
576   state_save_register_global_pointer(machine, state->video_ram, JTC_ES40_VIDEORAM_SIZE);
577   state_save_register_global_pointer(machine, state->color_ram_r, JTC_ES40_VIDEORAM_SIZE);
578   state_save_register_global_pointer(machine, state->color_ram_g, JTC_ES40_VIDEORAM_SIZE);
579   state_save_register_global_pointer(machine, state->color_ram_b, JTC_ES40_VIDEORAM_SIZE);
490580}
491581
492582static VIDEO_UPDATE( jtc_es40 )
493583{
494   return 0;
584   jtc_state *state = screen->machine->driver_data;
585
586   int x, y, sx;
587
588   for (y = 0; y < 192; y++)
589   {
590      for (sx = 0; sx < 40; sx++)
591      {
592         UINT8 data = state->video_ram[(y * 40) + sx];
593         UINT8 color_r = state->color_ram_r[(y * 40) + sx];
594         UINT8 color_g = state->color_ram_g[(y * 40) + sx];
595         UINT8 color_b = state->color_ram_b[(y * 40) + sx];
596
597         for (x = 0; x < 8; x++)
598         {
599            int color = (BIT(color_r, x) << 3) | (BIT(color_g, x) << 2) | (BIT(color_b, x) << 1) | BIT(data, x);
600
601            *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = color;
602         }
603      }
604   }
605
606    return 0;
495607}
496608
497609/* Machine Initialization */
r5629r5630
503615   /* find devices */
504616   state->cassette = devtag_get_device(machine, CASSETTE_TAG);
505617   state->speaker = devtag_get_device(machine, SPEAKER_TAG);
618   state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
506619
507620   /* register for state saving */
508621   //state_save_register_global(machine, state->);
r5629r5630
537650
538651   /* cassette */
539652   MDRV_CASSETTE_ADD(CASSETTE_TAG, jtc_cassette_config)
653
654   /* printer */
655   MDRV_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
540656MACHINE_DRIVER_END
541657
542658static MACHINE_DRIVER_START( jtc )
r5629r5630
656772
657773/* System Drivers */
658774
659/*    YEAR   NAME      PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG      COMPANY               FULLNAME            FLAGS */
660COMP( 1987, jtc,      0,       0,    jtc,    jtc,     0,      jtc,         "Jugend+Technik",   "CompJU+TEr",      GAME_NOT_WORKING)
661COMP( 1988, jtces88,   jtc,     0,    jtces88,jtc,     0,      jtces88,       "Jugend+Technik",   "CompJU+TEr (EMR-ES 1988)",   GAME_NOT_WORKING)
662COMP( 1989, jtces23,   jtc,     0,    jtces23,jtces23, 0,      jtces23,       "Jugend+Technik",   "CompJU+TEr (ES 2.3)",   GAME_NOT_WORKING)
663COMP( 1990, jtces40,   jtc,     0,    jtces40,jtces40, 0,      jtces40,       "Jugend+Technik",   "CompJU+TEr (ES 4.0)",   GAME_NOT_WORKING)
775/*    YEAR   NAME      PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG      COMPANY               FULLNAME               FLAGS */
776COMP( 1987, jtc,      0,       0,    jtc,    jtc,     0,      jtc,         "Jugend+Technik",   "CompJU+TEr",               GAME_NOT_WORKING )
777COMP( 1988, jtces88,   jtc,     0,    jtces88,jtc,     0,      jtces88,       "Jugend+Technik",   "CompJU+TEr (EMR-ES 1988)",   GAME_NOT_WORKING )
778COMP( 1989, jtces23,   jtc,     0,    jtces23,jtces23, 0,      jtces23,       "Jugend+Technik",   "CompJU+TEr (ES 2.3)",      GAME_NOT_WORKING )
779COMP( 1990, jtces40,   jtc,     0,    jtces40,jtces40, 0,      jtces40,       "Jugend+Technik",   "CompJU+TEr (ES 4.0)",      GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team