Previous 15994 Revisions Next

r11516 Wednesday 11th May, 2011 at 22:06:16 UTC by Gordon Jefferyes
[BBC] removed all the old video speed hacks, getting ready to switch over to using the MC6845 in the MAME core. (GordonJ)
[src/mess/includes]bbc.h
[src/mess/machine]bbc.c
[src/mess/video]bbc.c

src/mess/machine/bbc.c
r11515r11516
2323#include "machine/ctronics.h"
2424#include "imagedev/cassette.h"
2525
26/* BBC Memory Size */
27/* this stores the DIP switch setting for the DFS type being used */
28/* this stores the DIP switch setting for the SWRAM type being used */
2926
30/* if 0 then we are emulating a BBC B style machine
31   if 1 then we are emulating a BBC Master style machine */
32
33
34/****************************
35 IRQ inputs
36*****************************/
37
38
39/************************
40Sideways RAM/ROM code
41*************************/
42
43//This is the latch that holds the sideways ROM bank to read
44
45//This stores the sideways RAM latch type.
46//Acorn and others use the bbc_rombank latch to select the write bank to be used.(type 0)
47//Solidisc use the BBC's userport to select the write bank to be used (type 1)
48
49
50
5127/*************************
5228Model A memory handling functions
5329*************************/
r11515r11516
6339{
6440   bbc_state *state = space->machine().driver_data<bbc_state>();
6541   space->machine().region("maincpu")->base()[offset]=data;
66
67   // this array is set so that the video emulator know which addresses to redraw
68   state->m_vidmem[offset]=1;
6942}
7043
7144/*************************
r11515r11516
9568   if (state->m_RAMSize)
9669   {
9770      space->machine().region("maincpu")->base()[offset + 0x4000] = data;
98      // this array is set so that the video emulator know which addresses to redraw
99      state->m_vidmem[offset + 0x4000] = 1;
10071   }
10172   else
10273   {
10374      space->machine().region("maincpu")->base()[offset] = data;
104      state->m_vidmem[offset] = 1;
10575   }
10676
10777}
r11515r11516
197167{
198168   bbc_state *state = space->machine().driver_data<bbc_state>();
199169   space->machine().region("maincpu")->base()[offset]=data;
200
201   // this array is set so that the video emulator know which addresses to redraw
202   state->m_vidmem[offset]=1;
203170}
204171
205172
206
207
208
209173/* the next two function handle reads and write to the shadow video ram area
210174   between 0x3000 and 0x7fff
211175
r11515r11516
250214   {
251215      // not in shadow ram mode so just write to normal ram
252216      ram[offset + 0x3000] = data;
253      state->m_vidmem[offset + 0x3000] = 1;
254217   }
255218   else
256219   {
r11515r11516
258221      {
259222         // if VDUDriver set then write to shadow ram
260223         ram[offset + 0xb000] = data;
261         state->m_vidmem[offset + 0xb000] = 1;
262224      }
263225      else
264226      {
265227         // else write to normal ram
266228         ram[offset + 0x3000] = data;
267         state->m_vidmem[offset + 0x3000] = 1;
268229      }
269230   }
270231}
r11515r11516
371332
372333*/
373334
374//static int ACCCON_IRR=0; This is defined at the top in the IRQ code
375335
376336READ8_HANDLER ( bbcm_ACCCON_read )
377337{
r11515r11516
389349   logerror("ACCCON write  %d %d \n",offset,data);
390350
391351   tempIRR=state->m_ACCCON_IRR;
392   state->m_ACCCON_IRR=(data>>7)&1;
393352
353
354   state->m_ACCCON_IRR=(data>>7)&1;
394355   state->m_ACCCON_TST=(data>>6)&1;
395356   state->m_ACCCON_IFJ=(data>>5)&1;
396357   state->m_ACCCON_ITU=(data>>4)&1;
r11515r11516
473434{
474435   bbc_state *state = space->machine().driver_data<bbc_state>();
475436   space->machine().region("maincpu")->base()[offset] = data;
476   state->m_vidmem[offset] = 1;
477437}
478438
479439
r11515r11516
508468   if (state->m_ACCCON_X)
509469   {
510470      ram[offset + 0xb000] = data;
511      state->m_vidmem[offset + 0xb000] = 1;
512471   }
513472   else
514473   {
515474      if (state->m_ACCCON_E && bbcm_vdudriverset(space->machine()))
516475      {
517476         ram[offset + 0xb000] = data;
518         state->m_vidmem[offset + 0xb000] = 1;
519477      }
520478      else
521479      {
522480         ram[offset + 0x3000] = data;
523         state->m_vidmem[offset + 0x3000] = 1;
524481      }
525482   }
526483}
r11515r11516
7867436       8K  &6000 (or &2000) 24K        0   1
787744B6 - Operates the CAPS lock LED  (Pin 17 keyboard connector)
788745B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector)
789
790
791746******************************************************************************/
792747
793748
794749
795
796
797
798
799// this is a counter on the keyboard
800
801
802750INTERRUPT_GEN( bbcb_keyscan )
803751{
804752   bbc_state *state = device->machine().driver_data<bbc_state>();
r11515r11516
10641012         if (state->m_b4_video0 == 0)
10651013         {
10661014            state->m_b4_video0 = 1;
1067            bbc_setscreenstart(device->machine(), state->m_b4_video0, state->m_b5_video1);
10681015         }
10691016         break;
10701017      case 5:
10711018         if (state->m_b5_video1 == 0)
10721019         {
10731020            state->m_b5_video1 = 1;
1074            bbc_setscreenstart(device->machine(), state->m_b4_video0, state->m_b5_video1);
10751021         }
10761022         break;
10771023      case 6:
r11515r11516
11511097         if (state->m_b4_video0 == 1)
11521098         {
11531099            state->m_b4_video0 = 0;
1154            bbc_setscreenstart(device->machine(), state->m_b4_video0, state->m_b5_video1);
11551100         }
11561101         break;
11571102      case 5:
11581103         if (state->m_b5_video1 == 1)
11591104         {
11601105            state->m_b5_video1 = 0;
1161            bbc_setscreenstart(device->machine(), state->m_b4_video0, state->m_b5_video1);
11621106         }
11631107         break;
11641108      case 6:
r11515r11516
13591303  BBC 2C199 Serial Interface Cassette
13601304****************************************/
13611305
1362//static int longbit=0;
1363//static int shortbit = 0;
13641306
13651307
1366
13671308static void MC6850_Receive_Clock(running_machine &machine, int new_clock)
13681309{
13691310   bbc_state *state = machine.driver_data<bbc_state>();
r11515r11516
21162057   {
21172058      /* 32K Model B */
21182059      memory_set_bankptr(machine, "bank3", ram + 0x4000);
2119      bbc_set_video_memory_lookups(machine, 32);
2060      state->m_memorySize=32;
21202061   }
21212062   else
21222063   {
21232064      /* 16K just repeat the lower 16K*/
21242065      memory_set_bankptr(machine, "bank3", ram);
2125      bbc_set_video_memory_lookups(machine, 16);
2066      state->m_memorySize=16;
21262067   }
21272068
21282069   memory_set_bankptr(machine, "bank4", machine.region("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
src/mess/includes/bbc.h
r11515r11516
2323public:
2424   bbc_state(const machine_config &mconfig, device_type type, const char *tag)
2525      : driver_device(mconfig, type, tag) { }
26   int m_RAMSize;         // BBC Memory Size
27   int m_DFSType;         // this stores the DIP switch setting for the DFS type being used
28   int m_SWRAMtype;      // this stores the DIP switch setting for the SWRAM type being used
29   int m_Master;         // if 0 then we are emulating a BBC B style machine
30                     // if 1 then we are emulating a BBC Master style machine
2631
27   unsigned char m_vidmem[0x10000];
28   int m_RAMSize;
29   int m_DFSType;
30   int m_SWRAMtype;
31   int m_Master;
32   int m_ACCCON_IRR;
33   int m_rombank;
34   int m_userport;
35   int m_pagedRAM;
36   int m_vdusel;
32   int m_ACCCON_IRR;      //  IRQ inputs
33
34   int m_rombank;         // This is the latch that holds the sideways ROM bank to read
35
36   int m_userport;         // This stores the sideways RAM latch type.
37                     // Acorn and others use the bbc_rombank latch to select the write bank to be used.(type 0)
38                     // Solidisc use the BBC's userport to select the write bank to be used (type 1)
39
40   int m_pagedRAM;         // BBC B+ memory handling
41   int m_vdusel;         // BBC B+ memory handling
42
43                     /*
44                     ACCCON
45
46                     b7 IRR  1=Causes an IRQ to the processor
47                     b6 TST  1=Selects &FC00-&FEFF read from OS-ROM
48                     b5 IFJ  1=Internal 1 MHz bus
49                           0=External 1MHz bus
50                     b4 ITU  1=Internal Tube
51                           0=External Tube
52                     b3 Y    1=Read/Write HAZEL &C000-&DFFF RAM
53                           0=Read/Write ROM &C000-&DFFF OS-ROM
54                     b2 X    1=Read/Write LYNNE
55                           0=Read/WRITE main memory &3000-&8000
56                     b1 E    1=Causes shadow if VDU code
57                           0=Main all the time
58                     b0 D    1=Display LYNNE as screen
59                           0=Display main RAM screen
60
61                     ACCCON is a read/write register
62                     */
63
3764   int m_ACCCON;
3865   int m_ACCCON_TST;
3966   int m_ACCCON_IFJ;
r11515r11516
4269   int m_ACCCON_X;
4370   int m_ACCCON_E;
4471   int m_ACCCON_D;
72
73
74                     /*
75                     The addressable latch
76                     This 8 bit addressable latch is operated from port B lines 0-3.
77                     PB0-PB2 are set to the required address of the output bit to be set.
78                     PB3 is set to the value which should be programmed at that bit.
79                     The function of the 8 output bits from this latch are:-
80
81                     B0 - Write Enable to the sound generator IC
82                     B1 - READ select on the speech processor
83                     B2 - WRITE select on the speech processor
84                     B3 - Keyboard write enable
85                     B4,B5 - these two outputs define the number to be added to the
86                     start of screen address in hardware to control hardware scrolling:-
87                     Mode    Size    Start of screen  Number to add  B5      B4
88                     0,1,2   20K &3000        12K        1       1
89                     3       16K &4000        16K        0   0
90                     4,5     10K &5800 (or &1800) 22K        1   0
91                     6       8K  &6000 (or &2000) 24K        0   1
92                     B6 - Operates the CAPS lock LED  (Pin 17 keyboard connector)
93                     B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector)
94                     */
95
4596   int m_b0_sound;
4697   int m_b1_speech_read;
4798   int m_b2_speech_write;
r11515r11516
50101   int m_b5_video1;
51102   int m_b6_caps_lock_led;
52103   int m_b7_shift_lock_led;
53   int m_MC146818_WR;
54   int m_MC146818_DS;
55   int m_MC146818_AS;
56   int m_MC146818_CE;
104
105   int m_MC146818_WR;      // FE30 bit 1 replaces  b1_speech_read
106   int m_MC146818_DS;      // FE30 bit 2 replaces  b2_speech_write
107   int m_MC146818_AS;      // 6522 port b bit 7
108   int m_MC146818_CE;      // 6522 port b bit 6
109
57110   int m_via_system_porta;
58   int m_column;
111
112   int m_column;         // this is a counter in the keyboard circuit
113   
114
115                     /***************************************
116                       BBC 2C199 Serial Interface Cassette
117                     ****************************************/
118
59119   double m_last_dev_val;
60120   int m_wav_len;
61121   int m_len0;
r11515r11516
64124   int m_len3;
65125   int m_mc6850_clock;
66126   emu_timer *m_tape_timer;
67   int m_previous_i8271_int_state;
127
128
129                     /**************************************
130                        i8271 disc control
131                     ***************************************/
132
133   int m_previous_i8271_int_state;   // 8271 interupt status
134
135
136
137                     /**************************************
138                        WD1770 disc control
139                     ***************************************/
68140   int m_drive_control;
69141   int m_wd177x_irq_state;
70142   int m_wd177x_drq_state;
71143   int m_previous_wd177x_int_state;
72144   int m_1770_IntEnabled;
145
146                     /**************************************
147                        Opus Challenger Disc control
148                     ***************************************/                 
73149   int m_opusbank;
74   int m_video_refresh;
150
151
152
153                     /**************************************
154                        Video Code
155                     ***************************************/                 
156
157   int m_memorySize;
158
159
160// this is the real location of the start of the BBC's ram in the emulation
161// it can be changed if shadow ram is being used to point at the upper 32K of RAM
162
163// this is the screen memory location of the next pixels to be drawn
164
165// this is a more global variable to store the bitmap variable passed in in the bbc_vh_screenrefresh function
166
167// this is the X and Y screen location in emulation pixels of the next pixels to be drawn
168
169
75170   unsigned char *m_BBC_Video_RAM;
76   unsigned char *m_vidmem_RAM;
77171   UINT16 *m_BBC_display;
78172   UINT16 *m_BBC_display_left;
79173   UINT16 *m_BBC_display_right;
80174   bitmap_t *m_BBC_bitmap;
81175   int m_y_screen_pos;
82   unsigned int m_video_ram_lookup0[0x4000];
83   unsigned int m_video_ram_lookup1[0x4000];
84   unsigned int m_video_ram_lookup2[0x4000];
85   unsigned int m_video_ram_lookup3[0x4000];
86   unsigned int *m_video_ram_lookup;
87176   unsigned char m_pixel_bits[256];
88177   int m_BBC_HSync;
89178   int m_BBC_VSync;
r11515r11516
203292VIDEO_START( bbcm );
204293SCREEN_UPDATE( bbc );
205294
295static void BBC_draw_hi_res(running_machine &machine);
296static void BBC_draw_teletext(running_machine &machine);
297
206298void bbc_draw_RGB_in(device_t *device, int offset, int data);
207299void bbc_set_video_memory_lookups(running_machine &machine, int ramsize);
208300void bbc_frameclock(running_machine &machine);
209301void bbc_setscreenstart(running_machine &machine, int b4, int b5);
210302void bbcbp_setvideoshadow(running_machine &machine, int vdusel);
211303
304
212305WRITE8_HANDLER ( bbc_videoULA_w );
213306
214307WRITE8_HANDLER ( bbc_6845_w );
src/mess/video/bbc.c
r11515r11516
1414#include "saa505x.h"
1515
1616
17static void BBC_draw_hi_res(running_machine &machine);
18static void BBC_draw_teletext(running_machine &machine);
1917
20/************************************************************************
21 * video_refresh flag is used in optimising the screen redrawing
22 * it is set whenever a 6845 or VideoULA registers are change.
23 * This will then cause a full screen refresh.
24 * The vidmem array is used to optimise the screen redrawing
25 * whenever a memory location is written to the same location is set in the vidmem array
26 * if none of the video registers have been changed and a full redraw is not needed
27 * the video display emulation will only redraw the video memory locations that have been changed.
28 ************************************************************************/
2918
30
31// this is the real location of the start of the BBC's ram in the emulation
32// it can be changed if shadow ram is being used to point at the upper 32K of RAM
33
34// this is the real location of the start of the memory changed look up optimisation array
35// it can be changed if shadow ram is being used to point at the upper 32K of the lookup table
36
37// this is the screen memory location of the next pixels to be drawn
38
39
40// this is a more global variable to store the bitmap variable passed in in the bbc_vh_screenrefresh function
41
42// this is the X and Y screen location in emulation pixels of the next pixels to be drawn
43
4419/************************************************************************
4520 * video memory lookup arrays.
4621 * this is a set of quick lookup arrays that stores the logic for the following:
r11515r11516
6035 * the output of S4 is linked out to a 0v supply by link S25 to just access the 16K memory area.
6136 ************************************************************************/
6237
63
64
65void bbc_set_video_memory_lookups(running_machine &machine, int ramsize)
38unsigned int calculate_video_address(bbc_state *state,int ma)
6639{
67   bbc_state *state = machine.driver_data<bbc_state>();
40   // ma = output from IC2 6845 MA address
6841
69   int ma; // output from IC2 6845 MA address
7042
71   int c0,c1; // output from IC32 74LS259 bits 4 and 5
72   int ma12; // bit 12 of 6845 MA address
43   int c0=state->m_b4_video0; // output from IC32 74LS259 bits 4 and 5
44   int c1=state->m_b5_video1;
7345
74   int b1,b2,b3,b4; // 4 bit input B on IC39 74LS283 (4 bit adder)
75   int a,b,s;
46   /* the 4 bit input port b on IC39 are produced by 4 NAND gates.
47    these NAND gates take their
48    inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */
7649
77   unsigned int m;
50   /* get bit m12 from the 6845 */
51   int ma12=(ma>>12)&1;
7852
79   for(c1=0;c1<2;c1++)
80   {
81      for(c0=0;c0<2;c0++)
82      {
83         if ((c0==0) && (c1==0)) state->m_video_ram_lookup=state->m_video_ram_lookup0;
84         if ((c0==1) && (c1==0)) state->m_video_ram_lookup=state->m_video_ram_lookup1;
85         if ((c0==0) && (c1==1)) state->m_video_ram_lookup=state->m_video_ram_lookup2;
86         if ((c0==1) && (c1==1)) state->m_video_ram_lookup=state->m_video_ram_lookup3;
53    // 4 bit input B on IC39 74LS283 (4 bit adder)
54   /* 3 input NAND part of IC 36 */
55   int b1=(~(c1&c0&ma12))&1;
56   /* 2 input NAND part of IC40 (b3 is calculated before b2 and b4 because b3 feed back into b2 and b4) */
57   int b3=(~(c0&ma12))&1;
58   /* 3 input NAND part of IC 36 */
59   int b2=(~(c1&b3&ma12))&1;
60   /* 2 input NAND part of IC 27 */
61   int b4=(~(b3&ma12))&1;
8762
88         for(ma=0;ma<0x4000;ma++)
89         {
63   /* inputs port a to IC39 are MA8 to MA11 from the 6845 */
64   int a=(ma>>8)&0xf;
65   /* inputs port b to IC39 are taken from the NAND gates b1 to b4 */
66   int b=(b1<<0)|(b2<<1)|(b3<<2)|(b4<<3);
9067
68   /* IC39 performs the 4 bit add with the carry input set high */
69   int s=(a+b+1)&0xf;
9170
92            /* the 4 bit input port b on IC39 are produced by 4 NAND gates.
93                these NAND gates take their
94                inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */
95
96            /* get bit m12 from the 6845 */
97            ma12=(ma>>12)&1;
98
99            /* 3 input NAND part of IC 36 */
100            b1=(~(c1&c0&ma12))&1;
101            /* 2 input NAND part of IC40 (b3 is calculated before b2 and b4 because b3 feed back into b2 and b4) */
102            b3=(~(c0&ma12))&1;
103            /* 3 input NAND part of IC 36 */
104            b2=(~(c1&b3&ma12))&1;
105            /* 2 input NAND part of IC 27 */
106            b4=(~(b3&ma12))&1;
107
108            /* inputs port a to IC39 are MA8 to MA11 from the 6845 */
109            a=(ma>>8)&0xf;
110            /* inputs port b to IC39 are taken from the NAND gates b1 to b4 */
111            b=(b1<<0)|(b2<<1)|(b3<<2)|(b4<<3);
112
113            /* IC39 performs the 4 bit add with the carry input set high */
114            s=(a+b+1)&0xf;
115
116            /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate
117                   the memory location required for the hi res video.
118                   if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip
119                   Note: the RA0,RA1,RA2 inputs to IC8 in high res modes will need to be added else where */
120            if ((ma>>13)&1)
121            {
122               m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11);
123            } else {
124               m=((ma&0xff)<<3)|(s<<11);
125            }
126            if (ramsize==16)
127            {
128               state->m_video_ram_lookup[ma]=m & 0x3fff;
129            } else {
130               state->m_video_ram_lookup[ma]=m;
131            }
132
133         }
134      }
71   /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate
72       the memory location required for the hi res video.
73       if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip
74       Note: the RA0,RA1,RA2 inputs to IC8 in high res modes will need to be added else where */
75   unsigned int m;
76   if ((ma>>13)&1)
77   {
78      m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11);
79   } else {
80      m=((ma&0xff)<<3)|(s<<11);
13581   }
136}
82   if (state->m_memorySize==16)
83      return  m & 0x3fff;
13784
138
139/* called from 6522 system via */
140void bbc_setscreenstart(running_machine &machine, int c0, int c1)
141{
142   bbc_state *state = machine.driver_data<bbc_state>();
143   if ((c0==0) && (c1==0)) state->m_video_ram_lookup=state->m_video_ram_lookup0;
144   if ((c0==1) && (c1==0)) state->m_video_ram_lookup=state->m_video_ram_lookup1;
145   if ((c0==0) && (c1==1)) state->m_video_ram_lookup=state->m_video_ram_lookup2;
146   if ((c0==1) && (c1==1)) state->m_video_ram_lookup=state->m_video_ram_lookup3;
147
148   // emulation refresh optimisation
149   state->m_video_refresh=1;
85   return m;
15086}
15187
15288
r11515r11516
198134   {
199135      state->m_Teletext_Latch=0;
200136   } else {
201      state->m_Teletext_Latch=(state->m_BBC_Video_RAM[state->m_video_ram_lookup[meml]]&0x7f)|state->m_Teletext_Latch_Input_D7;
137      state->m_Teletext_Latch=(state->m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|state->m_Teletext_Latch_Input_D7;
202138   }
203139
204140}
r11515r11516
229165
230166   int tpal,tcol,vpos;
231167
232
233   // emulation refresh optimisation
234   state->m_video_refresh=1;
235
236168   // Make sure vpos is never <0 2008-10-11 PHS.
237169   vpos=space->machine().primary_screen->vpos();
238170   if(vpos==0)
r11515r11516
290222      break;
291223   }
292224
293   // emulation refresh optimisation
294   state->m_video_refresh=1;
295225}
296226
297227
r11515r11516
309239      state->m_VideoULA_CR_counter-=1;
310240      if (state->m_VideoULA_CR_counter<=0) {
311241         state->m_VideoULA_CR=0;
312         state->m_video_refresh=state->m_video_refresh&0xfb;
313242         set_cursor(state);
314243      }
315244   }
r11515r11516
350279   {
351280
352281      // read the memory location for the next screen location.
353      // the logic for the memory location address is very complicated so it
354      // is stored in a number of look up arrays (and is calculated once at the start of the emulator).
355      // this is actually does by the latch IC's not the Video ULA
356      meml=state->m_video_ram_lookup[m6845_memory_address_r(0)]|(state->m_BBC_Character_Row&0x7);
357282
358      if (state->m_vidmem_RAM[meml] || state->m_video_refresh )
359      {
360         state->m_vidmem_RAM[meml]=0;
361         i=state->m_BBC_Video_RAM[meml];
283      meml=calculate_video_address(state,m6845_memory_address_r(0))|(state->m_BBC_Character_Row&0x7);
362284
363         for(sc1=0;sc1<state->m_pixels_per_byte;sc1++)
364         {
365            BBC_ula_drawpixel(state, state->m_videoULA_pallet_lookup[state->m_pixel_bits[i]], state->m_emulation_pixels_per_real_pixel);
366            i=(i<<1)|1;
367         }
368      } else {
369         state->m_BBC_display += state->m_emulation_pixels_per_byte;
370      }
371   } else {
372      if (state->m_video_refresh)
285      i=state->m_BBC_Video_RAM[meml];
286
287      for(sc1=0;sc1<state->m_pixels_per_byte;sc1++)
373288      {
374         // if the display is not enable, just draw a blank area.
375         BBC_ula_drawpixel(state, 0, state->m_emulation_pixels_per_byte);
376      } else {
377         state->m_BBC_display += state->m_emulation_pixels_per_byte;
289         BBC_ula_drawpixel(state, state->m_videoULA_pallet_lookup[state->m_pixel_bits[i]], state->m_emulation_pixels_per_real_pixel);
290         i=(i<<1)|1;
378291      }
292
293   } else {
294      // if the display is not enable, just draw a blank area.
295      BBC_ula_drawpixel(state, 0, state->m_emulation_pixels_per_byte);
379296   }
380297}
381298
r11515r11516
486403   if (data&2) {
487404      state->m_VideoULA_CR_counter=state->m_emulation_cursor_size;
488405      state->m_VideoULA_CR=1;
489      // turn on the video refresh for the cursor area
490      state->m_video_refresh=state->m_video_refresh|4;
491406      // set the pallet on
492407      if (data&1) set_cursor(state);
493408   }
r11515r11516
526441         break;
527442   }
528443
529   // emulation refresh optimisation
530   state->m_video_refresh=1;
531444}
532445
533446 READ8_HANDLER (bbc_6845_r)
r11515r11516
558471{
559472   bbc_state *state = screen->machine().driver_data<bbc_state>();
560473   long c;
561   int full_refresh;
562474
563475   //logerror ("Box %d by %d \n",cliprect->min_y,cliprect->max_y);
564476
565477   c = 0; // this is used to time out the screen redraw, in the case that the 6845 is in some way out state.
566   full_refresh = 1;
567478
479
568480   state->m_BBC_bitmap=bitmap;
569481
570482   state->m_BBC_display_left=BITMAP_ADDR16(state->m_BBC_bitmap, 0, 0);
571483   state->m_BBC_display_right=state->m_BBC_display_left;
572484   state->m_BBC_display=state->m_BBC_display_left;
573485
574   // state->m_video_refresh is set if any of the 6845 or Video ULA registers are changed
575   // this then forces a full screen redraw
576
577   if (full_refresh)
578   {
579      state->m_video_refresh=state->m_video_refresh|2;
580   }
581
582486   // loop until the end of the Vertical Sync pulse
583487   // or until a timeout (this catches the 6845 with silly register values that would not give a VSYNC signal)
584488   while((state->m_BBC_VSync)&&(c<60000))
r11515r11516
603507      c++;
604508   }
605509
606   // redrawn the screen so reset state->m_video_refresh
607   state->m_video_refresh=0;
608
609510   return 0;
610511}
611512
r11515r11516
622523   if (vdusel)
623524   {
624525      state->m_BBC_Video_RAM= machine.region("maincpu")->base()+0x8000;
625      state->m_vidmem_RAM=(state->m_vidmem)+0x8000;
626526   } else {
627527      state->m_BBC_Video_RAM= machine.region("maincpu")->base();
628      state->m_vidmem_RAM=state->m_vidmem;
629528   }
630529}
631530
r11515r11516
634533 * Initialize the BBC video emulation
635534 ************************************************************************/
636535
637static void common_init(running_machine &machine)
536static void common_init(running_machine &machine, int memorySize)
638537{
639538   bbc_state *state = machine.driver_data<bbc_state>();
640539   state->m_emulation_cursor_size = 1;
r11515r11516
650549   state->m_saa505x = machine.device("saa505x");
651550
652551   state->m_BBC_Video_RAM = machine.region("maincpu")->base();
653   state->m_vidmem_RAM = state->m_vidmem;
654552   state->m_draw_function = *BBC_draw_hi_res;
553   state->m_memorySize=memorySize;
554
655555}
656556
657557VIDEO_START( bbca )
658558{
659   common_init(machine);
660   bbc_set_video_memory_lookups(machine, 16);
559   common_init(machine,16);
661560}
662561
663562VIDEO_START( bbcb )
664563{
665   common_init(machine);
564   common_init(machine,32);
666565}
667566
668567VIDEO_START( bbcbp )
669568{
670   common_init(machine);
671   bbc_set_video_memory_lookups(machine, 32);
569   common_init(machine,32);
672570}
673571
674572VIDEO_START( bbcm )
675573{
676   common_init(machine);
677   bbc_set_video_memory_lookups(machine, 32);
574   common_init(machine,32);
678575}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team