Previous 15994 Revisions Next

r14130 Monday 23rd January, 2012 at 02:50:47 UTC by Robbbert
AIM65: modernised.
[src/mess/drivers]aim65.c
[src/mess/includes]aim65.h
[src/mess/machine]aim65.c
[src/mess/video]aim65.c

src/mess/machine/aim65.c
r14129r14130
55******************************************************************************/
66
77
8#include "emu.h"
98#include "includes/aim65.h"
109
11/* Peripheral chips */
12#include "machine/6821pia.h"
13#include "machine/6522via.h"
1410
15/* DL1416A display chip */
16#include "video/dl1416.h"
17
18/* M6502 main CPU */
19#include "cpu/m6502/m6502.h"
20
21#include "machine/ram.h"
22
23
2411/******************************************************************************
25 Global variables
26******************************************************************************/
27
28
29
30
31
32/******************************************************************************
3312 Interrupt handling
3413******************************************************************************/
3514
r14129r14130
8160}
8261
8362
84WRITE8_DEVICE_HANDLER(aim65_pia_a_w)
63WRITE8_MEMBER( aim65_state::aim65_pia_a_w )
8564{
86   aim65_state *state = device->machine().driver_data<aim65_state>();
87   state->m_pia_a = data;
88   aim65_pia(device->machine());
65   m_pia_a = data;
66   aim65_pia(machine());
8967}
9068
9169
92WRITE8_DEVICE_HANDLER(aim65_pia_b_w)
70WRITE8_MEMBER( aim65_state::aim65_pia_b_w )
9371{
94   aim65_state *state = device->machine().driver_data<aim65_state>();
95   state->m_pia_b = data;
96   aim65_pia(device->machine());
72   m_pia_b = data;
73   aim65_pia(machine());
9774}
9875
9976
r14129r14130
129106******************************************************************************/
130107
131108
132READ8_DEVICE_HANDLER(aim65_riot_b_r)
109READ8_MEMBER( aim65_state::aim65_riot_b_r )
133110{
134   aim65_state *state = device->machine().driver_data<aim65_state>();
135111   static const char *const keynames[] =
136112   {
137113      "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
138114      "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7"
139115   };
140116
141   int row, data = 0xff;
117   UINT8 row, data = 0xff;
142118
143119   /* scan keyboard rows */
144120   for (row = 0; row < 8; row++)
145121   {
146      if (!(state->m_riot_port_a & (1 << row)))
147         data &= input_port_read(device->machine(), keynames[row]);
122      if (!BIT(m_riot_port_a, row))
123         data &= input_port_read(machine(), keynames[row]);
148124   }
149125
150126   return data;
151127}
152128
153129
154WRITE8_DEVICE_HANDLER(aim65_riot_a_w)
130WRITE8_MEMBER( aim65_state::aim65_riot_a_w )
155131{
156   aim65_state *state = device->machine().driver_data<aim65_state>();
157   state->m_riot_port_a = data;
132   m_riot_port_a = data;
158133}
159134
160135
161WRITE_LINE_DEVICE_HANDLER(aim65_riot_irq)
162{
163   cputag_set_input_line(device->machine(), "maincpu", M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
164}
165136
166
167
168137/***************************************************************************
169138    DRIVER INIT
170139***************************************************************************/
src/mess/video/aim65.c
r14129r14130
55
66******************************************************************************/
77
8#include "emu.h"
9
108#include "includes/aim65.h"
11#include "machine/6522via.h"
129
13
14
1510//UINT16 *printerRAM;
1611
1712
r14129r14130
3732 */
3833
3934
40static void aim65_printer_inc(aim65_state *state)
35static TIMER_CALLBACK(aim65_printer_timer)
4136{
37   aim65_state *state = machine.driver_data<aim65_state>();
38   via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
39
40   via_0->write_cb1(state->m_printer_level);
41   via_0->write_cb1(!state->m_printer_level);
42   state->m_printer_level ^= 1;
43
4244   if (state->m_printer_dir)
4345   {
44      if (state->m_printer_x > 0) {
46      if (state->m_printer_x > 0)
4547         state->m_printer_x--;
46      }
47      else {
48      else
49      {
4850         state->m_printer_dir = 0;
4951         state->m_printer_x++;
5052         state->m_printer_y++;
r14129r14130
5254   }
5355   else
5456   {
55      if (state->m_printer_x < 9) {
57      if (state->m_printer_x < 9)
5658         state->m_printer_x++;
57      }
58      else {
59      else
60      {
5961         state->m_printer_dir = 1;
6062         state->m_printer_x--;
6163         state->m_printer_y++;
r14129r14130
6870   state->m_flag_b=0;
6971}
7072
71static void aim65_printer_cr(aim65_state *state)
72{
73   state->m_printer_x=0;
74   state->m_printer_y++;
75   if (state->m_printer_y > 500) state->m_printer_y = 0;
76   state->m_flag_a=state->m_flag_b=0;
77}
7873
79static TIMER_CALLBACK(aim65_printer_timer)
74WRITE8_MEMBER( aim65_state::aim65_printer_on )
8075{
81   aim65_state *state = machine.driver_data<aim65_state>();
82   via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
83
84   via_0->write_cb1(state->m_printer_level);
85   via_0->write_cb1(!state->m_printer_level);
86   state->m_printer_level = !state->m_printer_level;
87   aim65_printer_inc(state);
88}
89
90
91WRITE8_DEVICE_HANDLER( aim65_printer_on )
92{
93   aim65_state *state = device->machine().driver_data<aim65_state>();
94   via6522_device *via_0 = device->machine().device<via6522_device>("via6522_0");
76   via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
9577   if (!data)
9678   {
97      aim65_printer_cr(state);
98      state->m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10));
79      m_printer_x=0;
80      m_printer_y++;
81      if (m_printer_y > 500) m_printer_y = 0;
82      m_flag_a = m_flag_b=0;
9983      via_0->write_cb1(0);
100      state->m_printer_level = 1;
84      //m_print_timer->adjust(attotime::zero, 0, attotime::from_usec(10));
85      m_printer_level = 1;
10186   }
10287   else
103      state->m_print_timer->reset();
88   {
89      m_print_timer->reset();
90   }
10491}
10592
10693
107WRITE8_DEVICE_HANDLER( aim65_printer_data_a )
94WRITE8_MEMBER( aim65_state::aim65_printer_data_a )
10895{
10996#if 0
110   aim65_state *state = device->machine().driver_data<aim65_state>();
111   if (state->m_flag_a == 0) {
112      printerRAM[(state->m_printer_y * 20) + state->m_printer_x] |= data;
113      state->m_flag_a = 1;
97   if (m_flag_a == 0)
98   {
99      printerRAM[(m_printer_y * 20) + m_printer_x] |= data;
100      m_flag_a = 1;
114101   }
115102#endif
116103}
117104
118WRITE8_DEVICE_HANDLER( aim65_printer_data_b )
105WRITE8_MEMBER( aim65_state::aim65_printer_data_b )
119106{
120107#if 0
121   aim65_state *state = device->machine().driver_data<aim65_state>();
122108   data &= 0x03;
123109
124   if (state->m_flag_b == 0) {
125      printerRAM[(state->m_printer_y * 20) + state->m_printer_x ] |= (data << 8);
126      state->m_flag_b = 1;
110   if (m_flag_b == 0)
111   {
112      printerRAM[(m_printer_y * 20) + m_printer_x ] |= (data << 8);
113      m_flag_b = 1;
127114   }
128115#endif
129116}
r14129r14130
137124   videoram_size = 600 * 10 * 2;
138125   printerRAM = auto_alloc_array(machine, UINT16, videoram_size / 2);
139126   memset(printerRAM, 0, videoram_size);
127   VIDEO_START_CALL(generic);
128#endif
140129   state->m_printer_x = 0;
141130   state->m_printer_y = 0;
142131   state->m_printer_dir = 0;
143   state->m_flag_a=0;
144   state->m_flag_b=0;
145
146
132   state->m_flag_a = 0;
133   state->m_flag_b = 0;
147134   state->m_printer_level = 0;
148
149   VIDEO_START_CALL(generic);
150#endif
151135}
152136
153137
r14129r14130
155139SCREEN_UPDATE( aim65 )
156140{
157141   /* Display printer output */
158#if 0
159142   dir = 1;
160143   for(y = 0; y<500;y++)
161144   {
r14129r14130
182165      else
183166         dir = 0;
184167   }
185#endif
186
187168   return 0;
188169}
189170#endif
190
src/mess/includes/aim65.h
r14129r14130
99#ifndef AIM65_H_
1010#define AIM65_H_
1111
12#include "emu.h"
13#include "cpu/m6502/m6502.h"
14#include "video/dl1416.h"
1215#include "machine/6522via.h"
16#include "machine/6532riot.h"
17#include "machine/6821pia.h"
18#include "imagedev/cartslot.h"
19#include "machine/ram.h"
1320
14
1521/** R6502 Clock.
1622 *
1723 * The R6502 on AIM65 operates at 1 MHz. The frequency reference is a 4 MHz
r14129r14130
2733   aim65_state(const machine_config &mconfig, device_type type, const char *tag)
2834      : driver_device(mconfig, type, tag) { }
2935
36   DECLARE_WRITE8_MEMBER(aim65_pia_a_w);
37   DECLARE_WRITE8_MEMBER(aim65_pia_b_w);
38   DECLARE_READ8_MEMBER(aim65_riot_b_r);
39   DECLARE_WRITE8_MEMBER(aim65_riot_a_w);
40   DECLARE_WRITE8_MEMBER(aim65_printer_data_a);
41   DECLARE_WRITE8_MEMBER(aim65_printer_data_b);
42   DECLARE_WRITE8_MEMBER(aim65_printer_on);
3043   UINT8 m_pia_a;
3144   UINT8 m_pia_b;
3245   UINT8 m_riot_port_a;
46   emu_timer *m_print_timer;
3347   int m_printer_x;
3448   int m_printer_y;
35   int m_printer_dir;
36   int m_flag_a;
37   int m_flag_b;
38   emu_timer *m_print_timer;
39   int m_printer_level;
49   bool m_printer_dir;
50   bool m_flag_a;
51   bool m_flag_b;
52   bool m_printer_level;
4053};
4154
4255
r14129r14130
4861void aim65_update_ds4(device_t *device, int digit, int data);
4962void aim65_update_ds5(device_t *device, int digit, int data);
5063
51WRITE8_DEVICE_HANDLER(aim65_pia_a_w);
52WRITE8_DEVICE_HANDLER(aim65_pia_b_w);
5364
54READ8_DEVICE_HANDLER(aim65_riot_b_r);
55WRITE8_DEVICE_HANDLER(aim65_riot_a_w);
56WRITE_LINE_DEVICE_HANDLER(aim65_riot_irq);
57
5865MACHINE_START( aim65 );
5966
6067
r14129r14130
6370VIDEO_START( aim65 );
6471
6572/* Printer */
66WRITE8_DEVICE_HANDLER( aim65_printer_data_a );
67WRITE8_DEVICE_HANDLER( aim65_printer_data_b );
68WRITE8_DEVICE_HANDLER( aim65_printer_on );
6973
7074
75
7176#endif /* AIM65_H_ */
src/mess/drivers/aim65.c
r14129r14130
1111    - Front panel Run/Step switch (switch S2)
1212
1313******************************************************************************/
14#define ADDRESS_MAP_MODERN
1415
15#include "emu.h"
1616#include "includes/aim65.h"
17#include "cpu/m6502/m6502.h"
18#include "video/dl1416.h"
19#include "machine/6522via.h"
20#include "machine/6532riot.h"
21#include "machine/6821pia.h"
22#include "imagedev/cartslot.h"
23#include "machine/ram.h"
2417#include "aim65.lh"
2518
2619
r14129r14130
2922***************************************************************************/
3023
3124/* Note: RAM is mapped dynamically in machine/aim65.c */
32static ADDRESS_MAP_START( aim65_mem, AS_PROGRAM, 8 )
25static ADDRESS_MAP_START( aim65_mem, AS_PROGRAM, 8, aim65_state )
3326   AM_RANGE( 0x1000, 0x9fff ) AM_NOP /* User available expansions */
34   AM_RANGE( 0xa000, 0xa00f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE_MODERN("via6522_1", via6522_device, read, write)/* User VIA */
27   AM_RANGE( 0xa000, 0xa00f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_1", via6522_device, read, write) // user via
3528   AM_RANGE( 0xa400, 0xa47f ) AM_RAM /* RIOT RAM */
36   AM_RANGE( 0xa480, 0xa497 ) AM_DEVREADWRITE("riot", riot6532_r, riot6532_w)
29   AM_RANGE( 0xa480, 0xa497 ) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w)
3730   AM_RANGE( 0xa498, 0xa7ff ) AM_NOP /* Not available */
38   AM_RANGE( 0xa800, 0xa80f ) AM_MIRROR(0x3f0)  AM_DEVREADWRITE_MODERN("via6522_0", via6522_device, read, write)
39   AM_RANGE( 0xac00, 0xac03 ) AM_DEVREADWRITE_MODERN("pia6821", pia6821_device, read, write)
31   AM_RANGE( 0xa800, 0xa80f ) AM_MIRROR(0x3f0) AM_DEVREADWRITE("via6522_0", via6522_device, read, write) // system via
32   AM_RANGE( 0xac00, 0xac03 ) AM_DEVREADWRITE("pia6821", pia6821_device, read, write)
4033   AM_RANGE( 0xac04, 0xac43 ) AM_RAM /* PIA RAM */
4134   AM_RANGE( 0xac44, 0xafff ) AM_NOP /* Not available */
4235   AM_RANGE( 0xb000, 0xffff ) AM_ROM /* 5 ROM sockets */
r14129r14130
140133    DEVICE INTERFACES
141134***************************************************************************/
142135
136/* Riot interface Z33 */
143137static const riot6532_interface aim65_riot_interface =
144138{
145139   DEVCB_NULL,
146   DEVCB_HANDLER(aim65_riot_b_r),
147   DEVCB_HANDLER(aim65_riot_a_w),
140   DEVCB_DRIVER_MEMBER(aim65_state, aim65_riot_b_r),
141   DEVCB_DRIVER_MEMBER(aim65_state, aim65_riot_a_w),
148142   DEVCB_NULL,
149   DEVCB_LINE(aim65_riot_irq)
143   DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE)
150144};
151145
152/* system via interface */
146/* system via interface Z32 */
153147static const via6522_interface aim65_system_via =
154148{
155149   DEVCB_NULL,
r14129r14130
158152   DEVCB_NULL,
159153   DEVCB_NULL,
160154   DEVCB_NULL,
155   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_data_a),
156   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_data_b),
161157   DEVCB_NULL,
162158   DEVCB_NULL,
163159   DEVCB_NULL,
164   DEVCB_NULL,
165   DEVCB_NULL,
166   DEVCB_NULL,
160   DEVCB_DRIVER_MEMBER(aim65_state, aim65_printer_on),
167161   DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE)
168162};
169163
170/* user via interface */
164/* user via interface Z1 */
171165static const via6522_interface aim65_user_via =
172166{
173   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
174   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
167   DEVCB_NULL,
168   DEVCB_NULL,
169   DEVCB_NULL,
170   DEVCB_NULL,
171   DEVCB_NULL,
172   DEVCB_NULL,
173   DEVCB_NULL,
174   DEVCB_NULL,
175   DEVCB_NULL,
176   DEVCB_NULL,
177   DEVCB_NULL,
178   DEVCB_NULL,
175179   DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE)
176180};
177181
182/* R6520 interface U1 */
178183static const pia6821_interface aim65_pia_config =
179184{
180   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
181   DEVCB_HANDLER(aim65_pia_a_w), DEVCB_HANDLER(aim65_pia_b_w),
182   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
185   DEVCB_NULL,
186   DEVCB_NULL,
187   DEVCB_NULL,
188   DEVCB_NULL,
189   DEVCB_NULL,
190   DEVCB_NULL,
191   DEVCB_DRIVER_MEMBER(aim65_state, aim65_pia_a_w),
192   DEVCB_DRIVER_MEMBER(aim65_state, aim65_pia_b_w),
193   DEVCB_NULL,
194   DEVCB_NULL,
195   DEVCB_NULL,
196   DEVCB_NULL
183197};
184198
185199
r14129r14130
268282    GAME DRIVERS
269283***************************************************************************/
270284
271/*   YEAR  NAME         PARENT  COMPAT  MACHINE  INPUT   INIT    COMPANY     FULLNAME  FLAGS */
272COMP(1977, aim65,      0,      0,      aim65,   aim65,  0,      "Rockwell", "AIM 65", GAME_NO_SOUND )
285/*   YEAR  NAME         PARENT  COMPAT  MACHINE  INPUT   INIT    COMPANY    FULLNAME    FLAGS */
286COMP(1977, aim65,       0,      0,      aim65,   aim65,  0,     "Rockwell", "AIM 65", GAME_NO_SOUND_HW )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team