Previous 15994 Revisions Next

r1207 Thursday 1st November, 2007 at 16:41:19 UTC by Wilbert Pol
[OSBORNE1] Added opbase handler to handle switching of bios rom for the interruupt handler.
[src/mess/machine]osborne1.c

src/mess/machine/osborne1.c
r1206r1207
55- IRQ1 = IRQA from the video PIA
66- IRQ2 = IRQA from the IEEE488 PIA
77
8Interrupt handling on the Osborne-1 is a bit akward. When an interrupt is
9taken by the Z80 the ROMMODE is enabled on each fetch of an instruction
10byte. During execution of an instruction the previous ROMMODE setting
11is used.
12
813***************************************************************************/
914
1015#include "driver.h"
r1206r1207
3338   UINT8   start_y;
3439   /* other outputs from the video pia */
3540   UINT8   beep;
41   /* bankswitch setting */
42   UINT8   bankswitch;
43   UINT8   in_irq_handler;
3644} osborne1;
3745
3846/* Prototypes */
r1206r1207
6674
6775   /* Check whether regular RAM is enabled */
6876   if ( ! osborne1.bank2_enabled ) {
69      return mess_ram[ 0x2000 + offset ];
77      data = mess_ram[ 0x2000 + offset ];
78   } else {
79      switch( offset & 0x0F00 ) {
80      case 0x100:   /* Floppy */
81         data = wd17xx_r( offset );
82         break;
83      case 0x200:   /* Keyboard */
84         /* Row 0 */
85         if ( offset & 0x01 )   data &= readinputport(0);
86         /* Row 1 */
87         if ( offset & 0x02 )   data &= readinputport(1);
88         /* Row 2 */
89         if ( offset & 0x04 )   data &= readinputport(2);
90         /* Row 3 */
91         if ( offset & 0x08 )   data &= readinputport(3);
92         /* Row 4 */
93         if ( offset & 0x10 )   data &= readinputport(4);
94         /* Row 5 */
95         if ( offset & 0x20 )   data &= readinputport(5);
96         /* Row 6 */
97         if ( offset & 0x40 )   data &= readinputport(6);
98         /* Row 7 */
99         if ( offset & 0x80 )   data &= readinputport(7);
100         break;
101      case 0x900:   /* IEEE488 PIA */
102         data = pia_0_r( offset & 0x03 );
103         break;
104      case 0xA00:   /* Serial */
105         break;
106      case 0xC00:   /* Video PIA */
107         data = pia_1_r( offset & 0x03 );
108         break;
109      }
70110   }
71   switch( offset & 0x0F00 ) {
72   case 0x100:   /* Floppy */
73      data = wd17xx_r( offset );
74      break;
75   case 0x200:   /* Keyboard */
76      /* Row 0 */
77      if ( offset & 0x01 )   data &= readinputport(0);
78      /* Row 1 */
79      if ( offset & 0x02 )   data &= readinputport(1);
80      /* Row 2 */
81      if ( offset & 0x04 )   data &= readinputport(2);
82      /* Row 3 */
83      if ( offset & 0x08 )   data &= readinputport(3);
84      /* Row 4 */
85      if ( offset & 0x10 )   data &= readinputport(4);
86      /* Row 5 */
87      if ( offset & 0x20 )   data &= readinputport(5);
88      /* Row 6 */
89      if ( offset & 0x40 )   data &= readinputport(6);
90      /* Row 7 */
91      if ( offset & 0x80 )   data &= readinputport(7);
92      break;
93   case 0x900:   /* IEEE488 PIA */
94      data = pia_0_r( offset & 0x03 );
95      break;
96   case 0xA00:   /* Serial */
97      break;
98   case 0xC00:   /* Video PIA */
99      data = pia_1_r( offset & 0x03 );
100      break;
101   }
102111   return data;
103112}
104113
r1206r1207
106115   /* Check whether regular RAM is enabled */
107116   if ( ! osborne1.bank2_enabled ) {
108117      mess_ram[ 0x2000 + offset ] = data;
118   } else {
119      /* Handle writes to the I/O area */
120      switch( offset & 0x0F00 ) {
121      case 0x100:   /* Floppy */
122         wd17xx_w( offset, data );
123         break;
124      case 0x900:   /* IEEE488 PIA */
125         pia_0_w( offset & 0x03, data );
126         break;
127      case 0xA00:   /* Serial */
128         break;
129      case 0xC00:   /* Video PIA */
130         pia_1_w( offset & 0x03, data );
131         break;
132      }
109133   }
110   /* Handle writes to the I/O area */
111   switch( offset & 0x0F00 ) {
112   case 0x100:   /* Floppy */
113      wd17xx_w( offset, data );
114      break;
115   case 0x900:   /* IEEE488 PIA */
116      pia_0_w( offset & 0x03, data );
117      break;
118   case 0xA00:   /* Serial */
119      break;
120   case 0xC00:   /* Video PIA */
121      pia_1_w( offset & 0x03, data );
122      break;
123   }
124134}
125135
126136WRITE8_HANDLER( osborne1_3000_w ) {
r1206r1207
168178   }
169179   osborne1.bank4_ptr = mess_ram + ( ( osborne1.bank3_enabled ) ? 0x10000 : 0xF000 );
170180   memory_set_bankptr( 4, osborne1.bank4_ptr );
181   osborne1.bankswitch = offset;
171182}
172183
184static OPBASE_HANDLER( osborne1_opbase ) {
185   if ( ( address & 0xF000 ) && osborne1.in_irq_handler ) {
186      osborne1.in_irq_handler = 0;
187      osborne1_bankswitch_w( osborne1.bankswitch, 0 );
188   }
189   return address;
190}
191
173192static void osborne1_z80_reset(int param) {
174193   osborne1.pia_1_irq_state = 0;
194   osborne1.in_irq_handler = 0;
175195}
176196
177197static int osborne1_z80_irq_state(int param) {
r1206r1207
180200
181201static int osborne1_z80_irq_ack(int param) {
182202   /* Enable ROM and I/O when IRQ is acknowledged */
203   UINT8   old_bankswitch = osborne1.bankswitch;
204   osborne1.in_irq_handler = 1;
183205   osborne1_bankswitch_w( 0, 0 );
206   osborne1.bankswitch = old_bankswitch;
184207   return 0xF8;
185208}
186209
r1206r1207
224247   osborne1.new_start_x = data >> 1;
225248   wd17xx_set_density( ( data & 0x01 ) ? DEN_FM_LO : DEN_FM_HI );
226249
227   logerror("Video pia port a write: %02X, density set to %s\n", data, data & 1 ? "DEN_FM_LO" : "DEN_FM_HI" );
250   //logerror("Video pia port a write: %02X, density set to %s\n", data, data & 1 ? "DEN_FM_LO" : "DEN_FM_HI" );
228251}
229252
230253static WRITE8_HANDLER( video_pia_port_b_w ) {
r1206r1207
235258   } else if ( data & 0x80 ) {
236259      wd17xx_set_drive( 1 );
237260   }
238   logerror("Video pia port b write: %02X\n", data );
261   //logerror("Video pia port b write: %02X\n", data );
239262}
240263
241264static void video_pia_irq_a_func(int state) {
r1206r1207
285308   }
286309   if ( y < 240 ) {
287310      /* Draw a line of the display */
288      UINT16 address = osborne1.start_y * 128 + osborne1.new_start_x + 10;
311      UINT16 address = osborne1.start_y * 128 + osborne1.new_start_x + 11;
289312      UINT16 *p = BITMAP_ADDR16( tmpbitmap, y, 0 );
290313      int x;
291314
r1206r1207
382405   osborne1.charrom = memory_region( REGION_GFX1 );
383406
384407   osborne1.video_timer = mame_timer_alloc( osborne1_video_callback );
385   mame_timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, 240, 0 ), 0, time_never );
408   mame_timer_adjust( osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0, time_never );
386409   pia_1_ca1_w( 0, 0 );
387410}
388411
389412DRIVER_INIT( osborne1 ) {
413   memset( &osborne1, 0, sizeof( osborne1 ) );
414
390415   osborne1.empty_4K = auto_malloc( 0x1000 );
391416   memset( osborne1.empty_4K, 0xFF, 0x1000 );
392417
r1206r1207
399424
400425   /* Configure the floppy disk interface */
401426   wd17xx_init( WD_TYPE_MB8877, NULL, NULL );
427
428   /* Set opbase handler to handle special irq cases */
429   memory_set_opbase_handler( 0, osborne1_opbase );
402430}
403431

Previous 15994 Revisions Next


© 1998-2018 The MESS Team