Previous 199869 Revisions Next

r20486 Saturday 26th January, 2013 at 13:54:10 UTC by Robbbert
(MESS) Super80 cleanup of tags (nw)
[src/mess/drivers]super80.c
[src/mess/includes]super80.h
[src/mess/machine]super80.c
[src/mess/video]super80.c

trunk/src/mess/machine/super80.c
r20485r20486
11/* Super80.c written by Robbbert, 2005-2009. See driver source for documentation. */
22
3#include "emu.h"
43#include "includes/super80.h"
54
65
r20485r20486
1211   m_keylatch = data;
1312};
1413
15READ8_MEMBER(super80_state::pio_port_b_r)// cannot be modernised yet as super80 hangs at start
14READ8_MEMBER(super80_state::pio_port_b_r)
1615{
17   char kbdrow[6];
18   UINT8 i;
1916   UINT8 data = 0xff;
2017
21   for (i = 0; i < 8; i++)
22   {
23      sprintf(kbdrow,"X%d",i);
24      if (!BIT(m_keylatch, i)) data &= ioport(kbdrow)->read();
25   }
18   if (!BIT(m_keylatch, 0))
19      data &= m_io_x0->read();
20   if (!BIT(m_keylatch, 1))
21      data &= m_io_x1->read();
22   if (!BIT(m_keylatch, 2))
23      data &= m_io_x2->read();
24   if (!BIT(m_keylatch, 3))
25      data &= m_io_x3->read();
26   if (!BIT(m_keylatch, 4))
27      data &= m_io_x4->read();
28   if (!BIT(m_keylatch, 5))
29      data &= m_io_x5->read();
30   if (!BIT(m_keylatch, 6))
31      data &= m_io_x6->read();
32   if (!BIT(m_keylatch, 7))
33      data &= m_io_x7->read();
2634
2735   return data;
2836};
r20485r20486
5058      state->m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
5159
5260   /* does user want to hear the sound? */
53   if BIT(machine.root_device().ioport("CONFIG")->read(), 3)
61   if BIT(state->m_io_config->read(), 3)
5462      state->m_cass->change_state(CASSETTE_SPEAKER_ENABLED,CASSETTE_MASK_SPEAKER);
5563   else
5664      state->m_cass->change_state(CASSETTE_SPEAKER_MUTED,CASSETTE_MASK_SPEAKER);
r20485r20486
104112TIMER_CALLBACK_MEMBER(super80_state::super80_halfspeed)
105113{
106114   UINT8 go_fast = 0;
107   if ( (!BIT(m_shared, 2)) | (!BIT(machine().root_device().ioport("CONFIG")->read(), 1)) )    /* bit 2 of port F0 is low, OR user turned on config switch */
115   if ( (!BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 1)) )    /* bit 2 of port F0 is low, OR user turned on config switch */
108116      go_fast++;
109117
110118   /* code to slow down computer to 1 MHz by halting cpu on every second frame */
111119   if (!go_fast)
112120   {
113121      if (!m_int_sw)
114         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE);    // if going, stop it
122         m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);    // if going, stop it
115123
116124      m_int_sw++;
117125      if (m_int_sw > 1)
118126      {
119         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);     // if stopped, start it
127         m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);     // if stopped, start it
120128         m_int_sw = 0;
121129      }
122130   }
r20485r20486
124132   {
125133      if (m_int_sw < 8)                               // @2MHz, reset just once
126134      {
127         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
135         m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
128136         m_int_sw = 8;                           // ...not every time
129137      }
130138   }
r20485r20486
156164
157165READ8_MEMBER( super80_state::super80_f2_r )
158166{
159   UINT8 data = ioport("DSW")->read() & 0xf0;  // dip switches on pcb
167   UINT8 data = m_io_dsw->read() & 0xf0;  // dip switches on pcb
160168   data |= m_cass_data[2];         // bit 0 = output of U1, bit 1 = MDS cass state, bit 2 = current wave_state
161169   data |= 0x08;               // bit 3 - not used
162170   return data;
trunk/src/mess/includes/super80.h
r20485r20486
1#include "emu.h"
12#include "cpu/z80/z80.h"
23#include "cpu/z80/z80daisy.h"
34#include "sound/wave.h"
r20485r20486
2829         m_wave(*this, WAVE_TAG),
2930         m_speaker(*this, SPEAKER_TAG),
3031         m_centronics(*this, "centronics"),
31         m_6845(*this, "crtc")
32         m_6845(*this, "crtc"),
33         m_io_dsw(*this, "DSW"),
34         m_io_x0(*this, "X0"),
35         m_io_x1(*this, "X1"),
36         m_io_x2(*this, "X2"),
37         m_io_x3(*this, "X3"),
38         m_io_x4(*this, "X4"),
39         m_io_x5(*this, "X5"),
40         m_io_x6(*this, "X6"),
41         m_io_x7(*this, "X7"),
42         m_io_config(*this, "CONFIG")
3243   { }
3344
34   required_device<cpu_device> m_maincpu;
35   required_device<z80pio_device> m_pio;
36   required_device<cassette_image_device> m_cass;
37   required_device<wave_device> m_wave;
38   required_device<speaker_sound_device> m_speaker;
39   required_device<centronics_device> m_centronics;
40   optional_device<mc6845_device> m_6845;
4145   DECLARE_READ8_MEMBER( super80v_low_r );
4246   DECLARE_READ8_MEMBER( super80v_high_r );
4347   DECLARE_WRITE8_MEMBER( super80v_low_w );
r20485r20486
5256   DECLARE_WRITE8_MEMBER( super80r_f0_w );
5357   DECLARE_READ8_MEMBER( super80_read_ff );
5458   DECLARE_WRITE8_MEMBER( pio_port_a_w );
55   //DECLARE_READ8_MEMBER( pio_port_b_r );
59   DECLARE_READ8_MEMBER( pio_port_b_r );
5660   virtual void machine_reset();
5761   UINT8 m_shared;
5862   UINT8 m_keylatch;
r20485r20486
7478   UINT8 *m_p_videoram;
7579   UINT8 *m_p_colorram;
7680   UINT8 *m_p_pcgram;
81   UINT8 *m_p_ram;
7782   void mc6845_cursor_configure();
7883   DECLARE_DRIVER_INIT(super80);
7984   DECLARE_DRIVER_INIT(super80v);
r20485r20486
8994   TIMER_CALLBACK_MEMBER(super80_timer);
9095   TIMER_CALLBACK_MEMBER(super80_reset);
9196   TIMER_CALLBACK_MEMBER(super80_halfspeed);
92   DECLARE_READ8_MEMBER(pio_port_b_r);
97   required_device<cpu_device> m_maincpu;
98   required_device<z80pio_device> m_pio;
99   required_device<cassette_image_device> m_cass;
100   required_device<wave_device> m_wave;
101   required_device<speaker_sound_device> m_speaker;
102   required_device<centronics_device> m_centronics;
103   optional_device<mc6845_device> m_6845;
104   required_ioport m_io_dsw;
105   required_ioport m_io_x0;
106   required_ioport m_io_x1;
107   required_ioport m_io_x2;
108   required_ioport m_io_x3;
109   required_ioport m_io_x4;
110   required_ioport m_io_x5;
111   required_ioport m_io_x6;
112   required_ioport m_io_x7;
113   required_ioport m_io_config;
93114};
94115
95116
trunk/src/mess/video/super80.c
r20485r20486
55    2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here. */
66
77
8#include "emu.h"
98#include "includes/super80.h"
109
1110
r20485r20486
7675   if (state)
7776   {
7877      /* if we chose another palette or colour mode, enable it */
79      UINT8 chosen_palette = (machine().root_device().ioport("CONFIG")->read() & 0x60)>>5;                // read colour dipswitches
78      UINT8 chosen_palette = (m_io_config->read() & 0x60)>>5;                // read colour dipswitches
8079
8180      if (chosen_palette != m_current_palette)                        // any changes?
8281      {
r20485r20486
9392{
9493   UINT8 y,ra,chr=32,gfx,screen_on=0;
9594   UINT16 sy=0,ma=m_vidpg,x;
96   UINT8 *RAM = memregion("maincpu")->base();
9795
98   output_set_value("cass_led",(m_shared & 0x20) ? 1 : 0);
96   output_set_value("cass_led",BIT(m_shared, 5));
9997
100   if ((m_shared & 4) || (!(machine().root_device().ioport("CONFIG")->read() & 4)))    /* bit 2 of port F0 is high, OR user turned on config switch */
98   if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2)))    /* bit 2 of port F0 is high, OR user turned on config switch */
10199      screen_on++;
102100
103101   for (y = 0; y < 16; y++)
r20485r20486
109107         for (x = 0; x < 32; x++)    // done this way to avoid x overflowing on page FF
110108         {
111109            if (screen_on)
112               chr = RAM[ma | x] & 0x3f;
110               chr = m_p_ram[ma | x] & 0x3f;
113111
114112            /* get pattern of pixels for that character scanline */
115113            gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)];
r20485r20486
134132{
135133   UINT8 y,ra,chr=32,gfx,screen_on=0;
136134   UINT16 sy=0,ma=m_vidpg,x;
137   UINT8 *RAM = memregion("maincpu")->base();
138135
139   output_set_value("cass_led",(m_shared & 0x20) ? 1 : 0);
136   output_set_value("cass_led",BIT(m_shared, 5));
140137
141   if ((m_shared & 4) || (!(machine().root_device().ioport("CONFIG")->read() & 4)))    /* bit 2 of port F0 is high, OR user turned on config switch */
138   if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2)))    /* bit 2 of port F0 is high, OR user turned on config switch */
142139      screen_on++;
143140
144141   for (y = 0; y < 16; y++)
r20485r20486
150147         for (x = 0; x < 32; x++)
151148         {
152149            if (screen_on)
153               chr = RAM[ma | x];
150               chr = m_p_ram[ma | x];
154151
155152            /* get pattern of pixels for that character scanline */
156153            gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0);
r20485r20486
175172{
176173   UINT8 y,ra,chr=32,gfx,screen_on=0;
177174   UINT16 sy=0,ma=m_vidpg,x;
178   UINT8 *RAM = memregion("maincpu")->base();
179175
180   output_set_value("cass_led",(m_shared & 0x20) ? 1 : 0);
176   output_set_value("cass_led",BIT(m_shared, 5));
181177
182   if ((m_shared & 4) || (!(machine().root_device().ioport("CONFIG")->read() & 4)))    /* bit 2 of port F0 is high, OR user turned on config switch */
178   if ((BIT(m_shared, 2)) | (!BIT(m_io_config->read(), 2)))    /* bit 2 of port F0 is high, OR user turned on config switch */
183179      screen_on++;
184180
185181   for (y = 0; y < 16; y++)
r20485r20486
191187         for (x = 0; x < 32; x++)
192188         {
193189            if (screen_on)
194               chr = RAM[ma | x];
190               chr = m_p_ram[ma | x];
195191
196192            /* get pattern of pixels for that character scanline */
197193            gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)];
r20485r20486
216212{
217213   UINT8 y,ra,chr=32,gfx,screen_on=0;
218214   UINT16 sy=0,ma=m_vidpg,x;
219   UINT8 col, bg=0, fg=0, options=machine().root_device().ioport("CONFIG")->read();
220   UINT8 *RAM = memregion("maincpu")->base();
215   UINT8 col, bg=0, fg=0, options=m_io_config->read();
221216
222217   /* get selected character generator */
223218   UINT8 cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */
224219
225   output_set_value("cass_led",(m_shared & 0x20) ? 1 : 0);
220   output_set_value("cass_led",BIT(m_shared, 5));
226221
227   if ((m_shared & 4) || (!(options & 4))) /* bit 2 of port F0 is high, OR user turned on config switch */
222   if ((BIT(m_shared, 2)) | (!BIT(options, 2)))    /* bit 2 of port F0 is high, OR user turned on config switch */
228223      screen_on++;
229224
230225   if (screen_on)
r20485r20486
244239         for (x = 0; x < 32; x++)
245240         {
246241            if (screen_on)
247               chr = RAM[ma | x];
242               chr = m_p_ram[ma | x];
248243
249244            if (!(options & 0x40))
250245            {
251               col = RAM[0xfe00 | ma | x]; /* byte of colour to display */
246               col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */
252247               fg = col & 0x0f;
253248               bg = (col & 0xf0) >> 4;
254249            }
r20485r20486
279274{
280275   m_vidpg = 0xfe00;
281276   m_p_chargen = memregion("chargen")->base();
277   m_p_ram = memregion("maincpu")->base();
282278}
283279
284280/**************************** I/O PORTS *****************************************************************/
r20485r20486
384380   m_framecnt++;
385381   m_speed = m_mc6845_reg[10]&0x20, m_flash = m_mc6845_reg[10]&0x40; // cursor modes
386382   m_cursor = (m_mc6845_reg[14]<<8) | m_mc6845_reg[15]; // get cursor position
387   m_s_options=machine().root_device().ioport("CONFIG")->read();
388   output_set_value("cass_led",(m_shared & 0x20) ? 1 : 0);
383   m_s_options=m_io_config->read();
384   output_set_value("cass_led",BIT(m_shared, 5));
389385   m_6845->screen_update(screen, bitmap, cliprect);
390386   return 0;
391387}
trunk/src/mess/drivers/super80.c
r20485r20486
181181
182182***********************************************************************************************************/
183183
184#include "emu.h"
185184#include "super80.lh"
186185#include "includes/super80.h"
187
188186#include "formats/z80bin.h"
189187
190#define MASTER_CLOCK            (XTAL_12MHz)
191#define PIXEL_CLOCK         (MASTER_CLOCK/2)
192#define HTOTAL              (384)
193#define HBEND               (0)
194#define HBSTART             (256)
195#define VTOTAL              (240)
196#define VBEND               (0)
197#define VBSTART             (160)
188#define MASTER_CLOCK   (XTAL_12MHz)
189#define PIXEL_CLOCK   (MASTER_CLOCK/2)
190#define HTOTAL      (384)
191#define HBEND      (0)
192#define HBSTART      (256)
193#define VTOTAL      (240)
194#define VBEND      (0)
195#define VBSTART      (160)
198196
199197#define SUPER80V_SCREEN_WIDTH       (560)
200198#define SUPER80V_SCREEN_HEIGHT      (300)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team