Previous 15994 Revisions Next

r11525 Thursday 12th May, 2011 at 18:22:28 UTC by Gordon Jefferyes
[BBC] Cleaning up the BBC driver in an effort to switch to MAMEs MC6845, also removed large amounts of unused code from the m6845 code in MESS [GordonJ]
[src/mess/drivers]bbc.c
[src/mess/includes]bbc.h
[src/mess/machine]bbc.c
[src/mess/video]bbc.c m6845.c m6845.h

src/mess/machine/bbc.c
r11524r11525
44    MESS Driver By:
55
66    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
7    mess_bbc@romvault.com
88
99******************************************************************************/
1010
src/mess/includes/bbc.h
r11524r11525
44 *
55 * BBC Model B
66 *
7 * Driver by Gordon Jefferyes <mess_bbc@gjeffery.dircon.co.uk>
7 * Driver by Gordon Jefferyes <mess_bbc@romvault.com>
88 *
99 ****************************************************************************/
1010
r11524r11525
1616#include "machine/i8271.h"
1717#include "machine/wd17xx.h"
1818#include "machine/upd7002.h"
19#include "video/mc6845.h"
1920
20
2121class bbc_state : public driver_device
2222{
2323public:
r11524r11525
176176   unsigned char m_pixel_bits[256];
177177   int m_BBC_HSync;
178178   int m_BBC_VSync;
179   int m_BBC_Character_Row;
180   int m_BBC_DE;
181179   device_t *m_saa505x;
182   int m_Teletext_Latch_Input_D7;
180
181
182
183183   int m_Teletext_Latch;
184   int m_VideoULA_DE;
185184   int m_VideoULA_CR;
186185   int m_VideoULA_CR_counter;
187186   int m_videoULA_Reg;
r11524r11525
191190   int m_videoULA_characters_per_line;
192191   int m_videoULA_teletext_normal_select;
193192   int m_videoULA_flash_colour_select;
193   
194   
195   
194196   int m_pixels_per_byte;
195197   int m_emulation_pixels_per_real_pixel;
196198   int m_emulation_pixels_per_byte;
199   
197200   int m_emulation_cursor_size;
198201   int m_cursor_state;
202   
199203   int m_videoULA_pallet0[16];
200204   int m_videoULA_pallet1[16];
201205   int *m_videoULA_pallet_lookup;
206
207   // this is the pixel position of the start of a scanline
208   // -96 sets the screen display to the middle of emulated screen.
202209   int m_x_screen_offset;
203210   int m_y_screen_offset;
211   
204212   void (*m_draw_function)(running_machine &machine);
205213};
206214
207215
208216/*----------- defined in machine/bbc.c -----------*/
209217
218
219extern const mc6845_interface bbc_mc6845_intf;
220
221
210222extern const via6522_interface bbcb_system_via;
211223extern const via6522_interface bbcb_user_via;
212224extern const wd17xx_interface bbc_wd17xx_interface;
r11524r11525
235247
236248
237249WRITE8_HANDLER ( bbc_memorybp1_w );
238//READ8_HANDLER  ( bbc_memorybp2_r );
239250WRITE8_HANDLER ( bbc_memorybp2_w );
240251WRITE8_HANDLER ( bbc_memorybp4_w );
241252WRITE8_HANDLER ( bbc_memorybp4_128_w );
r11524r11525
244255
245256
246257WRITE8_HANDLER ( bbc_memorybm1_w );
247//READ8_HANDLER  ( bbc_memorybm2_r );
248258WRITE8_HANDLER ( bbc_memorybm2_w );
249259WRITE8_HANDLER ( bbc_memorybm4_w );
250260WRITE8_HANDLER ( bbc_memorybm5_w );
r11524r11525
255265WRITE8_HANDLER ( bbcm_ACCCON_write );
256266
257267
258//WRITE8_HANDLER ( bbc_bank4_w );
259
260268/* disc support */
261269
262270DEVICE_IMAGE_LOAD ( bbcb_cart );
src/mess/video/m6845.c
r11524r11525
693693   crtc.personality = p;
694694}
695695
696// A few helper functions to help avoid heavy use of m6845_get/set_state()
697696int m6845_get_register(int reg)
698697{
699698   return crtc.registers[reg];
700699}
701
702int m6845_get_scanline_counter()
703{
704   return crtc.Scan_Line_Counter;
705}
706
707int m6845_get_row_counter()
708{
709   return crtc.Character_Row_Counter;
710}
711
712
713#if 0
714
715/* KT:
716
717  The following bit of code uses timers to set/reset the vsync output of the 6845.
718  If a function has been setup in the interface it will be executed with the new vsync
719  value.
720
721  */
722
723/* calculate the number of cycles to the next vsync */
724/* ignores Reg 5! - to be completed */
725int     m6845_cycles_to_vsync(void)
726{
727   /* passed vertical sync position */
728   int cycles_per_frame;
729
730   int cycles_into_frame;
731   int scans_per_character = R9_scan_lines_per_character+1;
732   int chars_per_line = R0_horizontal_total+1;
733   int cycles_to_vsync_start;
734
735   /* calculate current position into frame as char cycles */
736   /* scans into frames */
737   cycles_into_frame  = crtc.Character_Row_Counter*scans_per_character;
738   cycles_into_frame += crtc.Scan_Line_Counter;
739   /* scans into frames as char cycles */
740   cycles_into_frame *= chars_per_line;
741   /* total cycles into frame */
742   cycles_into_frame += crtc.Horizontal_Counter;
743
744   /* cycles to vsync start as char cycles */
745   cycles_to_vsync_start = R7_vertical_sync_position*scans_per_character;
746   cycles_to_vsync_start *= chars_per_line;
747
748
749   if (cycles_into_frame<cycles_to_vsync_start)
750   {
751      /* not gone past vertical sync yet! */
752      return cycles_to_vsync_start - cycles_into_frame;
753   }
754
755   cycles_per_frame = (R4_vertical_total+1)*scans_per_character*chars_per_line;
756
757   return (cycles_per_frame - cycles_into_frame) + cycles_to_vsync_start;
758}
759
760/* calculate the number of CRTC cycles for VSYNC */
761int     m6845_cycles_to_vsync_end(void)
762{
763        /* if we are in vsync */
764        if (crtc.VSYNC)
765        {
766           return (R0_horizontal_total+1)*(crtc.vertical_sync_width-crtc.Vertical_Sync_Width_Counter);
767        }
768
769        return m6845_cycles_to_vsync() + ((R0_horizontal_total+1)*crtc.vertical_sync_width);
770}
771
772
773/* number of crtc cycles for whole frame */
774static int m6845_cycles_per_frame(void)
775{
776   int scan_lines_per_character = R9_scan_lines_per_character+1;
777   int chars_per_line = R0_horizontal_total+1;
778
779   return /* time for all rows */
780         ((R4_vertical_total+1)*chars_per_line*scan_lines_per_character)
781         /* add time for scanlines in vertical adjust */
782         +(R5_vertical_total_adjust*chars_per_line);
783}
784
785/* number of crtc cycles for vsync */
786static int m6845_vsync_length_in_cycles(void)
787{
788   int length;
789
790   /* if length is programmed as 0, actual length for hd6845s is 16 */
791   length = crtc.vertical_sync_width;
792
793   if (length==0)
794   {
795      length = 16;
796   }
797
798   /* cycles for vsync */
799   return (R0_horizontal_total+1)*length;
800}
801
802
803/* remove "vsync set" timer */
804static void m6845_remove_vsync_set_timer(void)
805{
806   if (crtc.vsync_set_timer!=NULL)
807   {
808      crtc.vsync_set_timer->adjust(attotime::never);
809   }
810}
811
812/* remove "vsync clear" timer */
813static void m6845_remove_vsync_clear_timer(void)
814{
815   if (crtc.vsync_clear_timer != NULL)
816   {
817      crtc.vsync_clear_timer->adjust(attotime::never);
818   }
819}
820
821/* setup new time for "vsync set" */
822static void m6845_set_new_vsync_set_time(int cycles)
823{
824   int crtc_cycles_to_vsync_start;
825
826   /* get cycles to vsync start, or if vsync cannot be reached
827    cycles will be -1 */
828   crtc_cycles_to_vsync_start = cycles;
829
830   m6845_remove_vsync_set_timer();
831
832   //crtc.vsync_set_timer = machine.scheduler().timer_alloc(FUNC(m6845_vsync_set_timer_callback));
833   if (crtc_cycles_to_vsync_start!=-1)
834   {
835      crtc.vsync_set_timer->adjust(attotime::from_usec(crtc_cycles_to_vsync_start));
836   }
837}
838
839/* setup new time for "vsync clear" */
840static void m6845_set_new_vsync_clear_time(int cycles)
841{
842   int crtc_cycles_to_vsync_end;
843
844   m6845_remove_vsync_clear_timer();
845
846   /* get number of cycles to end of vsync */
847   crtc_cycles_to_vsync_end = cycles;
848
849   //crtc.vsync_clear_timer = machine.scheduler().timer_alloc(FUNC(m6845_vsync_clear_timer_callback));
850   if (crtc_cycles_to_vsync_end!=-1)
851   {
852      crtc.vsync_clear_timer->adjust(attotime::from_usec(crtc_cycles_to_vsync_end));
853   }
854}
855
856/* for these two below, might be better to record the current cpu time, and use that
857to recalculate where the start/end of the vsync will next occur! */
858
859static TIMER_CALLBACK( m6845_vsync_clear_timer_callback )
860{
861   /* clear vsync */
862   crtc.VSYNC = 0;
863
864   /* call function to let emulation "know" */
865   if (crtc.intf->out_VS_func) (crtc.intf->out_VS_func)(machine,0,crtc.VSYNC); /* call VS update */
866
867
868   /* if we got to here the vsync has just ended */
869   /* the next vsync will occur in cycles per frame - vsync length in cycles */
870   /* this will work as long as the vsync length has not been reprogrammed while the vsync was active! */
871   /* setup time for vsync set timer */
872   m6845_set_new_vsync_set_time(m6845_cycles_per_frame()-m6845_vsync_length_in_cycles());
873
874   /* prevent timer from being free'd and don't let it trigger again */
875   crtc.vsync_clear_timer->adjust(attotime::never);
876}
877
878/* called when vsync is set */
879static TIMER_CALLBACK( m6845_vsync_set_timer_callback )
880{
881   /* set vsync */
882   crtc.VSYNC = 1;
883
884   /* call function to let emulation "know" */
885   if (crtc.intf->out_VS_func) (crtc.intf->out_VS_func)(machine,0,crtc.VSYNC); /* call VS update */
886
887
888   /* if we got to here the vsync has just been set, and has just started */
889   /* the next timer will be in vsync length cycles unless it is reprogrammed as the VSYNC
890    is active, in this case, the new vsync end will be re-calculated */
891
892   /* setup time for vsync clear timer */
893   m6845_set_new_vsync_clear_time( m6845_vsync_length_in_cycles());
894
895   /* prevent timer from being free'd and don't let it trigger again */
896   crtc.vsync_set_timer->reset();
897}
898static void m6845_recalc_cycles_to_vsync_end(void)
899{
900   int cycles_to_vsync_end = m6845_cycles_to_vsync_end();
901
902   /* if we're in vsync, the end is important, otherwise we are waiting for the next vsync
903    to start. The start is not affected by the length of the vsync */
904   if (crtc.VSYNC)
905   {
906      m6845_set_new_vsync_clear_time(cycles_to_vsync_end);
907   }
908}
909
910static void m6845_recalc_cycles_to_vsync_start(void)
911{
912   int cycles_to_vsync_start = m6845_cycles_to_vsync();
913
914   /* if we're not in vsync, the end is important, otherwise we are waiting for the end
915    of the vsync */
916   if (!crtc.VSYNC)
917   {
918      m6845_set_new_vsync_set_time(cycles_to_vsync_start);
919   }
920}
921
922/* ignores r5 ! to be completed */
923void m6845_recalc(int offset,int num_cycles)
924{
925   int cycles;
926   int num_scan_lines;
927   int scans_into_frame;
928   int scan_lines_per_char = (R9_scan_lines_per_character+1);
929   int scan_lines_per_frame = (R4_vertical_total+1)*scan_lines_per_char;
930   cycles = num_cycles + crtc.Horizontal_Counter;
931
932   /* calculate number of scan-lines */
933   num_scan_lines = cycles/(R0_horizontal_total+1);
934   num_scan_lines+=crtc.Scan_Line_Counter;
935   /* set new horizontal counter */
936   crtc.Horizontal_Counter = cycles % (R0_horizontal_total+1);
937
938   scans_into_frame = crtc.Character_Row_Counter*scan_lines_per_char;
939
940   while ((scans_into_frame+num_scan_lines)>=scan_lines_per_frame)
941   {
942      int scans_to_end_of_frame;
943
944      scans_to_end_of_frame = scan_lines_per_frame - scans_into_frame;
945      num_scan_lines -= scans_to_end_of_frame;
946      scans_into_frame = 0;
947      /* subtract R5 lines here! */
948
949   }
950
951   /* update row position */
952   crtc.Character_Row_Counter = num_scan_lines/scan_lines_per_char;
953   /* remainder is the scan line counter */
954   crtc.Scan_Line_Counter = num_scan_lines % scan_lines_per_char;
955}
956
957#endif
src/mess/video/m6845.h
r11524r11525
5454int m6845_display_enabled_r(int offset);
5555int m6845_cursor_enabled_r(int offset);
5656
57#if 0
58void m6845_recalc(int offset, int cycles);
59#endif
60
6157void m6845_set_address(int address);
6258
6359void m6845_reset(void);
6460
6561void m6845_set_personality(m6845_personality_t personality);
6662
67int m6845_get_register(int reg);
68int m6845_get_scanline_counter(void);
69int m6845_get_row_counter(void);
63int m6845_get_register(int reg);
No newline at end of file
src/mess/video/bbc.c
r11524r11525
44    MESS Driver By:
55
66    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
7    mess_bbc@romvault.com
88
99******************************************************************************/
1010
r11524r11525
1212#include "includes/bbc.h"
1313#include "video/m6845.h"
1414#include "saa505x.h"
15#include "video/mc6845.h"
1516
17static MC6845_UPDATE_ROW( vid_update_row );
18static WRITE_LINE_DEVICE_HANDLER( vid_hsync_changed );
19static WRITE_LINE_DEVICE_HANDLER( vid_vsync_changed );
1620
1721static void BBC_draw_hi_res(running_machine &machine);
1822static void BBC_draw_teletext(running_machine &machine);
1923
24const mc6845_interface bbc_mc6845_intf =
25{
26   "screen",                  /* screen number */
27   8,                        /* numbers of pixels per video memory address */
28   NULL,                     /* begin_update */
29   vid_update_row,               /* update_row */
30   NULL,                     /* end_update */
31   DEVCB_NULL,                  /* on_de_changed */
32   DEVCB_NULL,                  /* on_cur_changed */
33   DEVCB_LINE(vid_hsync_changed),   /* on_hsync_changed */
34   DEVCB_LINE(vid_vsync_changed),   /* on_vsync_changed */
35   NULL
36};
2037
38static MC6845_UPDATE_ROW( vid_update_row )
39{
40   int x_pos;
41   int pixelno;
42   for(x_pos=0; x_pos<x_count; x_pos++)
43   {
44      for(pixelno=0; pixelno<8; pixelno++)
45      {
46         *BITMAP_ADDR16(bitmap, y, (x_pos*8)+pixelno)=2;
47      }
48   }
49}
50static WRITE_LINE_DEVICE_HANDLER( vid_hsync_changed )
51{
52}
2153
54static WRITE_LINE_DEVICE_HANDLER( vid_vsync_changed )
55{
56}
57
58
2259/************************************************************************
23 * video memory lookup arrays.
24 * this is a set of quick lookup arrays that stores the logic for the following:
25 * the array to be used is selected by the output from bits 4 and 5 (C0 and C1) on IC32 74LS259
26 * which is controlled by the system VIA.
2760 * C0 and C1 along with MA12 output from the 6845 drive 4 NAND gates in ICs 27,36 and 40
2861 * the outputs from these NAND gates (B1 to B4) along with MA8 to MA11 from the 6845 (A1 to B4) are added together
2962 * in IC39 74LS283 4 bit adder to form (S1 to S4) the logic is used to loop the screen memory for hardware scrolling.
r11524r11525
4275{
4376   // ma = output from IC2 6845 MA address
4477
45
4678   int c0=state->m_b4_video0; // output from IC32 74LS259 bits 4 and 5
4779   int c1=state->m_b5_video1;
4880
r11524r11525
5587
5688    // 4 bit input B on IC39 74LS283 (4 bit adder)
5789   /* 3 input NAND part of IC 36 */
58   int b1=(~(c1&c0&ma12))&1;
90   int b1=(~(c1 & c0 & ma12)) & 1;
5991   /* 2 input NAND part of IC40 (b3 is calculated before b2 and b4 because b3 feed back into b2 and b4) */
60   int b3=(~(c0&ma12))&1;
92   int b3=(~(c0 & ma12)) & 1;
6193   /* 3 input NAND part of IC 36 */
62   int b2=(~(c1&b3&ma12))&1;
94   int b2=(~(c1 & b3 & ma12)) & 1;
6395   /* 2 input NAND part of IC 27 */
64   int b4=(~(b3&ma12))&1;
96   int b4=(~(b3 & ma12)) & 1;
6597
66   /* inputs port a to IC39 are MA8 to MA11 from the 6845 */
67   int a=(ma>>8)&0xf;
6898   /* inputs port b to IC39 are taken from the NAND gates b1 to b4 */
6999   int b=(b1<<0)|(b2<<1)|(b3<<2)|(b4<<3);
70100
101   /* inputs port a to IC39 are MA8 to MA11 from the 6845 */
102   int a=(ma>>8)&0xf;
103
71104   /* IC39 performs the 4 bit add with the carry input set high */
72105   int s=(a+b+1)&0xf;
73106
74107   /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate
75108       the memory location required for the hi res video.
76       if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip
77       Note: the RA0,RA1,RA2 inputs to IC8 in high res modes will need to be added else where */
109       if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip*/
78110   unsigned int m;
79111   if ((ma>>13)&1)
80112   {
113      // IC 10 and IC 11
81114      m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11);
82115   } else {
83      m=((ma&0xff)<<3)|(s<<11);
116      // IC 8 and IC 9
117      m=((ma&0xff)<<3)|(s<<11)|(m6845_row_address_r(0)&0x7);
84118   }
85119   if (state->m_memorySize==16)
86120      return  m & 0x3fff;
r11524r11525
90124
91125
92126
93/* this is a quick lookup array that puts bits 0,2,4,6 into bits 0,1,2,3
94   this is used by the pallette lookup in the video ULA */
95127
96static void set_pixel_lookup(bbc_state *state)
97{
98   int i;
99   for (i=0; i<256; i++)
100   {
101      state->m_pixel_bits[i] = (((i>>7)&1)<<3) | (((i>>5)&1)<<2) | (((i>>3)&1)<<1) | (((i>>1)&1)<<0);
102   }
103}
104128
105129/************************************************************************
106 * Outputs from the 6845
107 ************************************************************************/
108
109
110
111
112/************************************************************************
113130 * Teletext Interface circuits
114131 ************************************************************************/
115
116
117
118132static void BBC_draw_teletext(running_machine &machine)
119133{
120134   bbc_state *state = machine.driver_data<bbc_state>();
r11524r11525
123137   //Teletext Latch bit 6 is only passed onto bits 6 on the Teletext chip if DE is true
124138   //Teletext Latch bit 7 goes to LOSE on the Teletext chip
125139
126   int meml;
127
128140   teletext_LOSE_w(state->m_saa505x, 0, (state->m_Teletext_Latch>>7)&1);
129141
130142   teletext_F1(state->m_saa505x);
131143
132   teletext_data_w(state->m_saa505x, 0, (state->m_Teletext_Latch&0x3f)|((state->m_Teletext_Latch&0x40)|(state->m_BBC_DE?0:0x40)));
144   teletext_data_w(state->m_saa505x, 0, (state->m_Teletext_Latch&0x3f)|((state->m_Teletext_Latch&0x40)|(m6845_display_enabled_r(0)?0:0x40)));
133145
134   meml=m6845_memory_address_r(0);
146   int meml=m6845_memory_address_r(0);
135147
136148   if (((meml>>13)&1)==0)
137149   {
138150      state->m_Teletext_Latch=0;
139151   } else {
140      state->m_Teletext_Latch=(state->m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|state->m_Teletext_Latch_Input_D7;
152      state->m_Teletext_Latch=(state->m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|(m6845_display_enabled_r(0)?0x80:0);
141153   }
142154
143155}
r11524r11525
145157 * VideoULA
146158 ************************************************************************/
147159
148
149
150
151160static const int pixels_per_byte_set[8]={ 2,4,8,16,1,2,4,8 };
152161
153162static const int emulation_pixels_per_real_pixel_set[4]={ 8,4,2,1 };
154163
155
156164static const int width_of_cursor_set[8]={ 0,0,1,2,1,0,2,4 };
157165
166/* this is a quick lookup array that puts bits 0,2,4,6 into bits 0,1,2,3
167   this is used by the pallette lookup in the video ULA */
168static void set_pixel_lookup(bbc_state *state)
169{
170   int i;
171   for (i=0; i<256; i++)
172   {
173      state->m_pixel_bits[i] = (((i>>7)&1)<<3) | (((i>>5)&1)<<2) | (((i>>3)&1)<<1) | (((i>>1)&1)<<0);
174   }
175}
158176
159// this is the pixel position of the start of a scanline
160// -96 sets the screen display to the middle of emulated screen.
161177
162
163
164
165178WRITE8_HANDLER ( bbc_videoULA_w )
166179{
167180   bbc_state *state = space->machine().driver_data<bbc_state>();
168181
169   int tpal,tcol,vpos;
170
171182   // Make sure vpos is never <0 2008-10-11 PHS.
172   vpos=space->machine().primary_screen->vpos();
183   int vpos=space->machine().primary_screen->vpos();
173184   if(vpos==0)
174185     space->machine().primary_screen->update_partial(vpos);
175186   else
176187     space->machine().primary_screen->update_partial(vpos -1 );
177188
178//  logerror("setting videoULA %s at %.4x size:%.4x\n",image_filename(image), addr, size);
179189   logerror("setting videoULA %.4x to:%.4x   at :%d \n",data,offset,space->machine().primary_screen->vpos() );
180190
181191
r11524r11525
218228      break;
219229   // Set a pallet register in the Video ULA
220230   case 1:
221      tpal=(data>>4)&0x0f;
222      tcol=data&0x0f;
231      int tpal=(data>>4)&0x0f;
232      int tcol=data&0x0f;
223233      state->m_videoULA_pallet0[tpal]=tcol^7;
224234      state->m_videoULA_pallet1[tpal]=tcol<8?tcol^7:tcol;
225235      break;
r11524r11525
278288   unsigned char i=0;
279289   int sc1;
280290
281   if (state->m_VideoULA_DE)
291   // this is IC38 and IC41 takes 6845 DisplayEnabled and 6845 RA3
292   int DE=m6845_display_enabled_r(0) && (!(m6845_row_address_r(0)&8));
293
294   if (DE)
282295   {
283
284296      // read the memory location for the next screen location.
297      meml=calculate_video_address(state,m6845_memory_address_r(0));
285298
286      meml=calculate_video_address(state,m6845_memory_address_r(0))|(state->m_BBC_Character_Row&0x7);
287
288299      i=state->m_BBC_Video_RAM[meml];
289300
290301      for(sc1=0;sc1<state->m_pixels_per_byte;sc1++)
r11524r11525
311322
312323
313324
314
315
316
317325/************************************************************************
318326 * BBC circuits controlled by 6845 Outputs
319327 ************************************************************************/
320328
321static void BBC_Set_VideoULA_DE(bbc_state *state)
322{
323   state->m_VideoULA_DE=(state->m_BBC_DE) && (!(state->m_BBC_Character_Row&8));
324}
325329
326static void BBC_Set_Teletext_DE(bbc_state *state)
327{
328   state->m_Teletext_Latch_Input_D7=state->m_BBC_DE?0x80:0;
329}
330
331// called when the 6845 changes the character row
332static void BBC_Set_Character_Row(running_machine &machine, int offset, int data)
333{
334   bbc_state *state = machine.driver_data<bbc_state>();
335   state->m_BBC_Character_Row=data;
336   BBC_Set_VideoULA_DE(state);
337}
338
339330// called when the 6845 changes the HSync
340331static void BBC_Set_HSync(running_machine &machine, int offset, int data)
341332{
r11524r11525
388379
389380}
390381
391// called when the 6845 changes the Display Enabled
392static void BBC_Set_DE(running_machine &machine, int offset, int data)
393{
394   bbc_state *state = machine.driver_data<bbc_state>();
395   state->m_BBC_DE=data;
396   BBC_Set_VideoULA_DE(state);
397   BBC_Set_Teletext_DE(state);
398
399}
400
401
402382// called when the 6845 changes the Cursor Enabled
403383static void BBC_Set_CRE(running_machine &machine, int offset, int data)
404384{
r11524r11525
415395static const struct m6845_interface BBC6845 =
416396{
417397   0,// Memory Address register
418   BBC_Set_Character_Row,// Row Address register
398   0,// Row Address register
419399   BBC_Set_HSync,// Horizontal status
420400   BBC_Set_VSync,// Vertical status
421   BBC_Set_DE,// Display Enabled status
401   0,// Display Enabled status
422402   0,// Cursor status
423403   BBC_Set_CRE, // Cursor status Emulation
424404};
r11524r11525
433413
434414WRITE8_HANDLER ( bbc_6845_w )
435415{
416   /*device_t *mc6845 = space->machine().device("mc6845");
417   switch(offset & 1)
418   {
419      case 0 :
420         mc6845_address_w(mc6845,0,data);
421         break;
422      case 1 :
423         mc6845_register_w(mc6845,0,data);
424         break;
425   }
426   return;*/
427
436428   switch (offset&1)
437429   {
438430      case 0:
r11524r11525
447439
448440 READ8_HANDLER (bbc_6845_r)
449441{
442
443   /*device_t *mc6845 = space->machine().device("mc6845");
444
445   switch (offset&1)
446   {
447      case 0: return mc6845_status_r(mc6845,0); break;
448      case 1: return mc6845_register_r(mc6845,0); break;
449   }
450   return 0;*/
451
450452   int retval=0;
451453
452454   switch (offset&1)
r11524r11525
471473
472474SCREEN_UPDATE( bbc )
473475{
476
477   //device_t *devconf = screen->machine().device("mc6845");
478   //mc6845_update( devconf, bitmap, cliprect);
479
480 //   return 0;
481
482
483
474484   bbc_state *state = screen->machine().driver_data<bbc_state>();
475485   long c;
476486
r11524r11525
542552   state->m_x_screen_offset = -96;
543553   state->m_y_screen_offset = -8;
544554
545   state->m_VideoULA_DE = 0;
546555   state->m_VideoULA_CR = 7;
547556   state->m_VideoULA_CR_counter = 0;
548557
src/mess/drivers/bbc.c
r11524r11525
66    MESS Driver By:
77
88    Gordon Jefferyes
9    mess_bbc@gjeffery.dircon.co.uk
9   mess_bbc@romvault.com
1010
1111******************************************************************************/
1212
r11524r11525
810810   MCFG_PALETTE_INIT(bbc)
811811   MCFG_SAA505X_VIDEO_ADD("saa505x", bbc_saa505x_intf)
812812
813//    MCFG_MC6845_ADD("mc6845",MC6845,2000000, bbc_mc6845_intf)
814
813815   MCFG_VIDEO_START(bbca)
814816
815817   /* sound hardware */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team