Previous 199869 Revisions Next

r32203 Friday 19th September, 2014 at 13:16:16 UTC by Barry Rodewald
trident: implemented basic bitblt and bresenham line functions.
[src/emu/bus/isa]trident.c trident.h

trunk/src/emu/bus/isa/trident.c
r32202r32203
1414
1515#define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0)
1616
17#define READPIXEL8(x,y) (vga.memory[(y*offset() + x) % vga.svga_intf.vram_size])
18#define WRITEPIXEL8(x,y,c) if(x<tri.accel_dest_y_clip && y<tri.accel_dest_y_clip) \
19   (vga.memory[(y*offset() + x) % vga.svga_intf.vram_size] = c)
20
21#define LOG (1)
22
1723trident_vga_device::trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1824   : svga_device(mconfig, TRIDENT_VGA, "Trident TGUI9680", tag, owner, clock, "trident_vga", __FILE__)
1925{
r32202r32203
4147   save_pointer(vga.crtc.data,"CRTC Registers",0x100);
4248   save_pointer(vga.sequencer.data,"Sequencer Registers",0x100);
4349   save_pointer(vga.attribute.data,"Attribute Registers", 0x15);
50   save_pointer(tri.accel_pattern,"Pattern Data", 0x80);
4451
4552   m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
4653   vga.svga_intf.seq_regcount = 0x0f;
r32202r32203
164171            break;
165172      }
166173   }
167   logerror("Trident SR%02X: read %02x\n",index,res);
174   if(LOG) logerror("Trident SR%02X: read %02x\n",index,res);
168175   return res;
169176}
170177
r32202r32203
178185   }
179186   else
180187   {
181      logerror("Trident SR%02X: %s mode write %02x\n",index,tri.new_mode ? "new" : "old",data);
188      if(LOG) logerror("Trident SR%02X: %s mode write %02x\n",index,tri.new_mode ? "new" : "old",data);
182189      switch(index)
183190      {
184191         case 0x0b:
r32202r32203
265272         break;
266273      }
267274   }
268   logerror("Trident CR%02X: read %02x\n",index,res);
275   if(LOG) logerror("Trident CR%02X: read %02x\n",index,res);
269276   return res;
270277}
271278void trident_vga_device::trident_crtc_reg_write(UINT8 index, UINT8 data)
r32202r32203
277284   }
278285   else
279286   {
280      logerror("Trident CR%02X: write %02x\n",index,data);
287      if(LOG) logerror("Trident CR%02X: write %02x\n",index,data);
281288      switch(index)
282289      {
283290      case 0x1e:  // Module Testing Register
r32202r32203
345352         break;
346353      }
347354   }
348   logerror("Trident GC%02X: read %02x\n",index,res);
355   if(LOG) logerror("Trident GC%02X: read %02x\n",index,res);
349356   return res;
350357}
351358
r32202r32203
355362      gc_reg_write(index,data);
356363   else
357364   {
358      logerror("Trident GC%02X: write %02x\n",index,data);
365      if(LOG) logerror("Trident GC%02X: write %02x\n",index,data);
359366      switch(index)
360367      {
361368      case 0x0e:  // New Source Address Register (bit 1 is inverted here, also)
r32202r32203
524531   {
525532   case 2:
526533      res = port_03c0_r(space,5,mem_mask);
527      logerror("Trident: 83c6 read %02x\n",res);
534      if(LOG) logerror("Trident: 83c6 read %02x\n",res);
528535      break;
529536   case 4:
530537      res = vga.sequencer.index;
531      logerror("Trident: 83c8 seq read %02x\n",res);
538      if(LOG) logerror("Trident: 83c8 seq read %02x\n",res);
532539      break;
533540   }
534541   return res;
r32202r32203
539546   switch(offset)
540547   {
541548   case 2:
542      logerror("Trident: 83c6 seq write %02x\n",data);
549      if(LOG) logerror("Trident: 83c6 seq write %02x\n",data);
543550      port_03c0_w(space,5,data,mem_mask);
544551      break;
545552   case 4:
546      logerror("Trident: 83c8 seq index write %02x\n",data);
553      if(LOG) logerror("Trident: 83c8 seq index write %02x\n",data);
547554      vga.sequencer.index = data;
548555      break;
549556   }
r32202r32203
696703   {
697704   case 0x02:  // Operation Mode
698705      tri.accel_opermode = (tri.accel_opermode & 0xff00) | data;
699      logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode);
706      if(LOG) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode);
700707      break;
701708   case 0x03:
702709      tri.accel_opermode = (tri.accel_opermode & 0x00ff) | (data << 8);
703      logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode);
710      if(LOG) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode);
704711      break;
705712   case 0x04:  // Command register
706713      tri.accel_command = data;
707      switch(data)
708      {
709      case 0x00:
710         logerror("Trident: Command: NOP\n");
711         break;
712      case 0x01:
713         logerror("Trident: Command: BitBLT ROP3\n");
714         break;
715      case 0x02:
716         logerror("Trident: Command: BitBLT ROP4\n");
717         break;
718      case 0x03:
719         logerror("Trident: Command: Scanline\n");
720         break;
721      case 0x04:
722         logerror("Trident: Command: Bresenham Line\n");
723         break;
724      case 0x05:
725         logerror("Trident: Command: Short Vector\n");
726         break;
727      case 0x06:
728         logerror("Trident: Command: Fast Line\n");
729         break;
730      case 0x07:
731         logerror("Trident: Command: Trapezoid Fill\n");
732         break;
733      case 0x08:
734         logerror("Trident: Command: Ellipse\n");
735         break;
736      case 0x09:
737         logerror("Trident: Command: Ellipse Fill\n");
738         break;
739      default:
740         logerror("Trident: Unknown acceleration command %02x\n",data);
741      }
714      accel_command();
742715      break;
743716   case 0x07:  // Foreground Mix?
744717      tri.accel_fmix = data;
745      logerror("Trident: FMIX set to %02x\n",data);
718      if(LOG) logerror("Trident: FMIX set to %02x\n",data);
746719      break;
747720   case 0x08:  // Draw flags
748721      tri.accel_drawflags = (tri.accel_drawflags & 0xffffff00) | data;
749      logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
722      if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
750723      break;
751724   case 0x09:
752725      tri.accel_drawflags = (tri.accel_drawflags & 0xffff00ff) | (data << 8);
753      logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
726      if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
754727      break;
755728   case 0x0a:
756729      tri.accel_drawflags = (tri.accel_drawflags & 0xff00ffff) | (data << 16);
757      logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
730      if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
758731      break;
759732   case 0x0b:
760733      tri.accel_drawflags = (tri.accel_drawflags & 0x00ffffff) | (data << 24);
761      logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
734      if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags);
762735      break;
763736   case 0x0c:  // Foreground Colour
764737      tri.accel_fgcolour = (tri.accel_fgcolour & 0xffffff00) | data;
765      logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
738      if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
766739      break;
767740   case 0x0d:
768741      tri.accel_fgcolour = (tri.accel_fgcolour & 0xffff00ff) | (data << 8);
769      logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
742      if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
770743      break;
771744   case 0x0e:
772745      tri.accel_fgcolour = (tri.accel_fgcolour & 0xff00ffff) | (data << 16);
773      logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
746      if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
774747      break;
775748   case 0x0f:
776749      tri.accel_fgcolour = (tri.accel_fgcolour & 0x00ffffff) | (data << 24);
777      logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
750      if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour);
778751      break;
779752   case 0x10:  // Background Colour
780753      tri.accel_bgcolour = (tri.accel_bgcolour & 0xffffff00) | data;
781      logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
754      if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
782755      break;
783756   case 0x11:
784757      tri.accel_bgcolour = (tri.accel_bgcolour & 0xffff00ff) | (data << 8);
785      logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
758      if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
786759      break;
787760   case 0x12:
788761      tri.accel_bgcolour = (tri.accel_bgcolour & 0xff00ffff) | (data << 16);
789      logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
762      if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
790763      break;
791764   case 0x13:
792765      tri.accel_bgcolour = (tri.accel_bgcolour & 0x00ffffff) | (data << 24);
793      logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
766      if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour);
794767      break;
795768   case 0x14:  // Pattern Location
796769      tri.accel_pattern_loc = (tri.accel_pattern_loc & 0xff00) | data;
797      logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc);
770      if(LOG) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc);
771      debugger_break(machine());
798772      break;
799773   case 0x15:
800774      tri.accel_pattern_loc = (tri.accel_pattern_loc & 0x00ff) | (data << 8);
801      logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc);
775      if(LOG) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc);
776      debugger_break(machine());
802777      break;
803778   case 0x18:  // Destination X
804779      tri.accel_dest_x = (tri.accel_dest_x & 0xff00) | data;
805      logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x);
780      if(LOG) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x);
806781      break;
807782   case 0x19:
808783      tri.accel_dest_x = (tri.accel_dest_x & 0x00ff) | (data << 8);
809      logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x);
784      if(LOG) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x);
810785      break;
811786   case 0x1a:  // Destination Y
812787      tri.accel_dest_y = (tri.accel_dest_y & 0xff00) | data;
813      logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y);
788      if(LOG) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y);
814789      break;
815790   case 0x1b:
816791      tri.accel_dest_y = (tri.accel_dest_y & 0x00ff) | (data << 8);
817      logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y);
792      if(LOG) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y);
818793      break;
819794   case 0x1c:  // Source X
820795      tri.accel_source_x = (tri.accel_source_x & 0xff00) | data;
821      logerror("Trident: Source X set to %04x\n",tri.accel_source_x);
796      if(LOG) logerror("Trident: Source X set to %04x\n",tri.accel_source_x);
822797      break;
823798   case 0x1d:
824799      tri.accel_source_x = (tri.accel_source_x & 0x00ff) | (data << 8);
825      logerror("Trident: Source X set to %04x\n",tri.accel_source_x);
800      if(LOG) logerror("Trident: Source X set to %04x\n",tri.accel_source_x);
826801      break;
827802   case 0x1e:  // Source Y
828803      tri.accel_source_y = (tri.accel_source_y & 0xff00) | data;
829      logerror("Trident: Source Y set to %04x\n",tri.accel_source_y);
804      if(LOG) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y);
830805      break;
831806   case 0x1f:
832807      tri.accel_source_y = (tri.accel_source_y & 0x00ff) | (data << 8);
833      logerror("Trident: Source Y set to %04x\n",tri.accel_source_y);
808      if(LOG) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y);
834809      break;
835810   case 0x20:  // Dimension(?) X
836811      tri.accel_dim_x = (tri.accel_dim_x & 0xff00) | data;
837      logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x);
812      if(LOG) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x);
838813      break;
839814   case 0x21:
840815      tri.accel_dim_x = (tri.accel_dim_x & 0x00ff) | (data << 8);
841      logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x);
816      if(LOG) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x);
842817      break;
843818   case 0x22:  // Dimension(?) Y
844819      tri.accel_dim_y = (tri.accel_dim_y & 0xff00) | data;
845      logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y);
820      if(LOG) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y);
846821      break;
847822   case 0x23:
848823      tri.accel_dim_y = (tri.accel_dim_y & 0x00ff) | (data << 8);
849      logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y);
824      if(LOG) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y);
850825      break;
851826   case 0x24:  // Style
852827      tri.accel_style = (tri.accel_style & 0xffffff00) | data;
853      logerror("Trident: Style set to %08x\n",tri.accel_style);
828      if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style);
854829      break;
855830   case 0x25:
856831      tri.accel_style = (tri.accel_style & 0xffff00ff) | (data << 8);
857      logerror("Trident: Style set to %08x\n",tri.accel_style);
832      if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style);
858833      break;
859834   case 0x26:
860835      tri.accel_style = (tri.accel_style & 0xff00ffff) | (data << 16);
861      logerror("Trident: Style set to %08x\n",tri.accel_style);
836      if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style);
862837      break;
863838   case 0x27:
864839      tri.accel_style = (tri.accel_style & 0x00ffffff) | (data << 24);
865      logerror("Trident: Style set to %08x\n",tri.accel_style);
840      if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style);
866841      break;
867842   case 0x28:  // Source Clip X
868843      tri.accel_source_x_clip = (tri.accel_source_x_clip & 0xff00) | data;
869      logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip);
844      if(LOG) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip);
870845      break;
871846   case 0x29:
872847      tri.accel_source_x_clip = (tri.accel_source_x_clip & 0x00ff) | (data << 8);
873      logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip);
848      if(LOG) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip);
874849      break;
875850   case 0x2a:  // Source Clip Y
876851      tri.accel_source_y_clip = (tri.accel_source_y_clip & 0xff00) | data;
877      logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip);
852      if(LOG) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip);
878853      break;
879854   case 0x2b:
880855      tri.accel_source_y_clip = (tri.accel_source_y_clip & 0x00ff) | (data << 8);
881      logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip);
856      if(LOG) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip);
882857      break;
883858   case 0x2c:  // Destination Clip X
884859      tri.accel_dest_x_clip = (tri.accel_dest_x_clip & 0xff00) | data;
885      logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip);
860      if(LOG) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip);
886861      break;
887862   case 0x2d:
888863      tri.accel_dest_x_clip = (tri.accel_dest_x_clip & 0x00ff) | (data << 8);
889      logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip);
864      if(LOG) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip);
890865      break;
891866   case 0x2e:  // Destination Clip Y
892867      tri.accel_dest_y_clip = (tri.accel_dest_y_clip & 0xff00) | data;
893      logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip);
868      if(LOG) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip);
894869      break;
895870   case 0x2f:
896871      tri.accel_dest_y_clip = (tri.accel_dest_y_clip & 0x00ff) | (data << 8);
897      logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip);
872      if(LOG) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip);
898873      break;
899874   case 0x48:  // CKEY (Chromakey?)
900875      tri.accel_ckey = (tri.accel_ckey & 0xffffff00) | data;
901      logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
876      if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
902877      break;
903878   case 0x49:
904879      tri.accel_ckey = (tri.accel_ckey & 0xffff00ff) | (data << 8);
905      logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
880      if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
906881      break;
907882   case 0x4a:
908883      tri.accel_ckey = (tri.accel_ckey & 0xff00ffff) | (data << 16);
909      logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
884      if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
910885      break;
911886   case 0x4b:
912887      tri.accel_ckey = (tri.accel_ckey & 0x00ffffff) | (data << 24);
913      logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
888      if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey);
914889      break;
915890   case 0x58:  // Foreground Pattern Colour
916891      tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xffffff00) | data;
917      logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
892      if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
918893      break;
919894   case 0x59:
920895      tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xffff00ff) | (data << 8);
921      logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
896      if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
922897      break;
923898   case 0x5a:
924899      tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xff00ffff) | (data << 16);
925      logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
900      if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
926901      break;
927902   case 0x5b:
928903      tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0x00ffffff) | (data << 24);
929      logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
904      if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour);
930905      break;
931906   case 0x5c:  // Background Pattern Colour
932907      tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xffffff00) | data;
933      logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
908      if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
934909      break;
935910   case 0x5d:
936911      tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xffff00ff) | (data << 8);
937      logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
912      if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
938913      break;
939914   case 0x5e:
940915      tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xff00ffff) | (data << 16);
941      logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
916      if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
942917      break;
943918   case 0x5f:
944919      tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0x00ffffff) | (data << 24);
945      logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
920      if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour);
946921      break;
947922   default:
948      logerror("Trident: unimplemented acceleration register offset %02x write %02x\n",offset,data);
923      if(LOG) logerror("Trident: unimplemented acceleration register offset %02x write %02x\n",offset,data);
949924   }
950925}
926
927void trident_vga_device::accel_command()
928{
929   switch(tri.accel_command)
930   {
931   case 0x00:
932      if(LOG) logerror("Trident: Command: NOP\n");
933      break;
934   case 0x01:
935      if(LOG) logerror("Trident: Command: BitBLT ROP3 (Source %i,%i Dest %i,%i Size %i,%i)\n",tri.accel_source_x,tri.accel_source_y,tri.accel_dest_x,tri.accel_dest_y,tri.accel_dim_x,tri.accel_dim_y);
936      logerror("BitBLT: Drawflags = %08x\n",tri.accel_drawflags);
937      accel_bitblt();
938      break;
939   case 0x02:
940      if(LOG) logerror("Trident: Command: BitBLT ROP4\n");
941      break;
942   case 0x03:
943      if(LOG) logerror("Trident: Command: Scanline\n");
944      break;
945   case 0x04:
946      if(LOG) logerror("Trident: Command: Bresenham Line (Source %i,%i Dest %i,%i Size %i,%i)\n",tri.accel_source_x,tri.accel_source_y,tri.accel_dest_x,tri.accel_dest_y,tri.accel_dim_x,tri.accel_dim_y);
947      accel_line();
948      break;
949   case 0x05:
950      if(LOG) logerror("Trident: Command: Short Vector\n");
951      break;
952   case 0x06:
953      if(LOG) logerror("Trident: Command: Fast Line\n");
954      break;
955   case 0x07:
956      if(LOG) logerror("Trident: Command: Trapezoid Fill\n");
957      break;
958   case 0x08:
959      if(LOG) logerror("Trident: Command: Ellipse\n");
960      break;
961   case 0x09:
962      if(LOG) logerror("Trident: Command: Ellipse Fill\n");
963      break;
964   default:
965      logerror("Trident: Unknown acceleration command %02x\n",tri.accel_command);
966   }
967}
968
969void trident_vga_device::accel_bitblt()
970{
971   int x,y;
972   int sx,sy;
973   int xdir,ydir;
974   int xstart,xend,ystart,yend;
975
976   if(tri.accel_drawflags & 0x0200)
977   {
978      xdir = -1;
979      xstart = tri.accel_dest_x;
980      xend = tri.accel_dest_x-tri.accel_dim_x-1;
981   }
982   else
983   {
984      xdir = 1;
985      xstart = tri.accel_dest_x;
986      xend = tri.accel_dest_x+tri.accel_dim_x+1;
987   }
988   if(tri.accel_drawflags & 0x0100)
989   {
990      ydir = -1;
991      ystart = tri.accel_dest_y;
992      yend = tri.accel_dest_y-tri.accel_dim_y-1;
993   }
994   else
995   {
996      ydir = 1;
997      ystart = tri.accel_dest_y;
998      yend = tri.accel_dest_y+tri.accel_dim_y+1;
999   }
1000   sy = tri.accel_source_y;
1001
1002//   printf("BitBLT: flags=%08x source %i, %i dest %i, %i size %i, %i dir %i,%i\n",
1003//         tri.accel_drawflags,tri.accel_source_x,tri.accel_source_y,tri.accel_dest_x,tri.accel_dest_y,
1004//         tri.accel_dim_x,tri.accel_dim_y,xdir,ydir);
1005   for(y=ystart;y!=yend;y+=ydir,sy+=ydir)
1006   {
1007      sx = tri.accel_source_x;
1008      for(x=xstart;x!=xend;x+=xdir,sx+=xdir)
1009      {
1010         if(tri.accel_drawflags & 0x4000)  // Solid fill
1011         {
1012            WRITEPIXEL8(x,y,tri.accel_fgcolour);
1013         }
1014         else
1015         {
1016            WRITEPIXEL8(x,y,READPIXEL8(sx,sy));
1017         }
1018      }
1019   }
1020}
1021
1022void trident_vga_device::accel_line()
1023{
1024   UINT8 col = tri.accel_fgcolour & 0xff;
1025//    TGUI_SRC_XY(dmin-dmaj,dmin);
1026//    TGUI_DEST_XY(x,y);
1027//    TGUI_DIM_XY(dmin+e,len);
1028   INT16 dx = abs(tri.accel_source_x);
1029   INT16 dy = abs(tri.accel_source_y);
1030   INT16 err = tri.accel_dim_x - tri.accel_source_y;
1031   int sx = (tri.accel_drawflags & 0x0200) ? -1 : 1;
1032   int sy = (tri.accel_drawflags & 0x0100) ? -1 : 1;
1033   int count = 0;
1034   INT16 temp;
1035
1036//   if(LOG_8514) logerror("8514/A: Command (%04x) - Line (Bresenham) - %i,%i  Axial %i, Diagonal %i, Error %i, Major Axis %i, Minor Axis %i\n",ibm8514.current_cmd,
1037//      ibm8514.curr_x,ibm8514.curr_y,ibm8514.line_axial_step,ibm8514.line_diagonal_step,ibm8514.line_errorterm,ibm8514.rect_width,ibm8514.rect_height);
1038
1039   if(tri.accel_drawflags & 0x400)
1040   {
1041      temp = dx; dx = dy; dy = temp;
1042   }
1043   for(;;)
1044   {
1045      WRITEPIXEL8(tri.accel_dest_x,tri.accel_dest_y,col);
1046      if (count > tri.accel_dim_y) break;
1047      count++;
1048      if((err*2) > -dy)
1049      {
1050         err -= dy;
1051         tri.accel_dest_x += sx;
1052      }
1053      if((err*2) < dx)
1054      {
1055         err += dx;
1056         tri.accel_dest_y += sy;
1057      }
1058   }
1059}
trunk/src/emu/bus/isa/trident.h
r32202r32203
7171      UINT32 accel_fgcolour;
7272      UINT32 accel_bgcolour;
7373      UINT16 accel_pattern_loc;
74      UINT16 accel_source_x;
75      UINT16 accel_source_y;
76      UINT16 accel_dest_x;
77      UINT16 accel_dest_y;
78      UINT16 accel_dim_x;
79      UINT16 accel_dim_y;
74      INT16 accel_source_x;
75      INT16 accel_source_y;
76      INT16 accel_dest_x;
77      INT16 accel_dest_y;
78      INT16 accel_dim_x;
79      INT16 accel_dim_y;
8080      UINT32 accel_style;
8181      UINT32 accel_ckey;
82      UINT16 accel_source_x_clip;
83      UINT16 accel_source_y_clip;
84      UINT16 accel_dest_x_clip;
85      UINT16 accel_dest_y_clip;
82      INT16 accel_source_x_clip;
83      INT16 accel_source_y_clip;
84      INT16 accel_dest_x_clip;
85      INT16 accel_dest_y_clip;
8686      UINT32 accel_fg_pattern_colour;
8787      UINT32 accel_bg_pattern_colour;
8888      UINT8 accel_pattern[0x80];
r32202r32203
9696   void trident_crtc_reg_write(UINT8 index, UINT8 data);
9797   UINT8 trident_gc_reg_read(UINT8 index);
9898   void trident_gc_reg_write(UINT8 index, UINT8 data);
99
100   void accel_command();
101   void accel_bitblt();
102   void accel_line();
99103};
100104
101105

Previous 199869 Revisions Next


© 1997-2024 The MAME Team