Previous 15994 Revisions Next

r5138 Saturday 4th July, 2009 at 02:41:15 UTC by Barry Rodewald
[FM77AV] Implemented ALU PSET function. Text in Space Harrier is now visible.
[src/mess/video]fm7.c

src/mess/video/fm7.c
r5137r5138
120120   fm7_video.vram_access = 0;
121121}
122122
123static void fm7_alu_function_pset(UINT32 offset)
124{
125   // PSET - simply sets the pixels to the selected logical colour
126   int x;
127   UINT8 dat;
128   int page = 0;
129   UINT8 mask;
130   
131   if(offset > 0xc000)
132      page = 1;
133   
134   for(x=0;x<3;x++) // cycle through banks
135   {
136      if(fm7_alu.lcolour & (1 << x))
137         dat = 0xff;
138      else
139         dat = 0;
140
141      mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & fm7_alu.mask;
142      dat &= ~fm7_alu.mask;
143      dat |= mask;
144         
145      fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)] = dat;
146   }
147}
148
149static void fm7_alu_function(UINT32 offset)
150{
151   switch(fm7_alu.command & 0x07)
152   {
153      case 0x00: // PSET
154         fm7_alu_function_pset(offset);
155         break;
156      case 0x02: // OR
157      case 0x03: // AND
158      case 0x04: // XOR
159      case 0x05: // NOT
160      case 0x06: // TILEPAINT
161      case 0x07: // COMPARE
162         logerror("ALU: Unimplemented draw mode %i used\n",fm7_alu.command & 0x07);
163         break;
164      case 0x01:
165      default:
166         logerror("ALU: Invalid draw mode %i used\n",fm7_alu.command & 0x07);
167   }
168}
169
123170READ8_HANDLER( fm7_vram_r )
124171{
125172   int offs;
126173   UINT16 page = 0x0000;
174
175   if(fm7_video.active_video_page != 0)
176      page = 0xc000;
177
178   if(fm7_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure)
179   {
180      fm7_alu_function(offset+page);
181   }
127182   
128183   if(offset < 0x4000 && (fm7_video.multi_page & 0x01))
129184      return 0xff;
r5137r5138
132187   if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04))
133188      return 0xff;
134189   
135   if(fm7_video.active_video_page != 0)
136      page = 0xc000;
137
138190   offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff);
139191   return fm7_video_ram[offs + page];
140192}
r5137r5138
144196   int offs;
145197   UINT16 page = 0x0000;
146198   
199   if(fm7_video.active_video_page != 0)
200      page = 0xc000;
201
202   if(fm7_alu.command & 0x80) // ALU active
203   {
204      fm7_alu_function(offset+page);
205      return;
206   }
207   
147208   if(offset < 0x4000 && (fm7_video.multi_page & 0x01))
148209      return;
149210   if((offset < 0x8000 && offset >=0x4000) && (fm7_video.multi_page & 0x02))
r5137r5138
151212   if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04))
152213      return;
153214     
154   if(fm7_video.active_video_page != 0)
155      page = 0xc000;
156
157215   offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff);
158216   if(fm7_video.vram_access != 0)
159217      fm7_video_ram[offs+page] = data;
r5137r5138
167225
168226   if(!fm7_video.sub_halt)  // no access if sub CPU is not halted.
169227      return;
228
229   if(fm7_video.active_video_page != 0)
230      page = 0xc000;
231
232   if(fm7_alu.command & 0x80) // ALU active
233   {
234      fm7_alu_function(offset+page);
235      return;
236   }
170237   
171238   if(offset < 0x4000 && (fm7_video.multi_page & 0x01))
172239      return;
r5137r5138
175242   if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04))
176243      return;
177244     
178   if(fm7_video.active_video_page != 0)
179      page = 0xc000;
180
181245   offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff);
182246   fm7_video_ram[offs+page] = data;
183247}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team