Previous 15994 Revisions Next

r9150 Friday 17th September, 2010 at 05:11:50 UTC by Barry Rodewald
[FMTOWNS] Implemented x5 horizontal zoom, Shadow of the Beast is now playable.
[src/mess/video]fmtowns.c

src/mess/video/fmtowns.c
r9149r9150
514514   towns_state* state = space->machine->driver_data<towns_state>();
515515   UINT8 ret = 0;
516516   UINT16 xpos;
517
518//    logerror("VID: read port %04x\n",offset+0xfd90);
517519   switch(offset)
518520   {
519521      case 0x00:
r9149r9150
543545            ret |= 0x01;
544546         return ret;
545547   }
546//  logerror("VID: read port %04x\n",offset+0xfd90);
547548   return 0x00;
548549}
549550
r9149r9150
580581         state->video.towns_layer_ctrl = data;
581582         break;
582583   }
583   //logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90);
584   logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90);
584585}
585586
586587READ8_HANDLER(towns_video_ff81_r)
r9149r9150
933934         off += scroll;
934935      }
935936      off += (state->video.towns_crtc_reg[11] - state->video.towns_crtc_reg[22]);
936      if(state->video.towns_crtc_reg[27] & 0x0100)
937         hzoom = 2;
937      hzoom = ((state->video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
938938   }
939939   else
940940   {
r9149r9150
946946         off += scroll;
947947      }
948948      off += (state->video.towns_crtc_reg[9] - state->video.towns_crtc_reg[18]);
949      if(state->video.towns_crtc_reg[27] & 0x0001)
950         hzoom = 2;
949      hzoom = (state->video.towns_crtc_reg[27] & 0x000f) + 1;
951950   }
952951
953952   off += line * linesize;
r9149r9150
972971         off+=2;
973972      }
974973   }
975   else
974
975   if(hzoom == 2)
976976   {  // x2 horizontal zoom
977977      for(x=rect->min_x;x<rect->max_x;x+=2)
978978      {
r9149r9150
995995         off+=2;
996996      }
997997   }
998
999   if(hzoom == 5)
1000   {  // x5 horizontal zoom
1001      for(x=rect->min_x;x<rect->max_x;x+=5)
1002      {
1003         if(state->video.towns_video_reg[0] & 0x10)
1004            off &= 0x3ffff;  // 2 layers
1005         else
1006            off &= 0x7ffff;  // 1 layer
1007         colour = (state->towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->towns_gfxvram[off+(layer*0x40000)];
1008         if(colour < 0x8000)
1009         {
1010            *BITMAP_ADDR32(bitmap,scanline,x) =
1011               ((colour & 0x001f) << 3)
1012               | ((colour & 0x7c00) << 1)
1013               | ((colour & 0x03e0) << 14);
1014            *BITMAP_ADDR32(bitmap,scanline,x+1) =
1015               ((colour & 0x001f) << 3)
1016               | ((colour & 0x7c00) << 1)
1017               | ((colour & 0x03e0) << 14);
1018            *BITMAP_ADDR32(bitmap,scanline,x+2) =
1019               ((colour & 0x001f) << 3)
1020               | ((colour & 0x7c00) << 1)
1021               | ((colour & 0x03e0) << 14);
1022            *BITMAP_ADDR32(bitmap,scanline,x+3) =
1023               ((colour & 0x001f) << 3)
1024               | ((colour & 0x7c00) << 1)
1025               | ((colour & 0x03e0) << 14);
1026            *BITMAP_ADDR32(bitmap,scanline,x+4) =
1027               ((colour & 0x001f) << 3)
1028               | ((colour & 0x7c00) << 1)
1029               | ((colour & 0x03e0) << 14);
1030         }
1031         off+=2;
1032      }
1033   }
1034
9981035}
9991036
10001037void towns_crtc_draw_scan_layer_256(running_machine* machine, bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline)
r9149r9150
10261063         off += scroll;
10271064      }
10281065      off += (state->video.towns_crtc_reg[11] - state->video.towns_crtc_reg[22]);
1029      if(state->video.towns_crtc_reg[27] & 0x0100)
1030         hzoom = 2;
1066      hzoom = ((state->video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
10311067   }
10321068   else
10331069   {
r9149r9150
10391075         off += scroll;
10401076      }
10411077      off += (state->video.towns_crtc_reg[9] - state->video.towns_crtc_reg[18]);
1042      if(state->video.towns_crtc_reg[27] & 0x0001)
1043         hzoom = 2;
1078      hzoom = (state->video.towns_crtc_reg[27] & 0x000f) + 1;
10441079   }
10451080
10461081   off += line * linesize;
r9149r9150
10601095         off++;
10611096      }
10621097   }
1063   else
1098
1099   if(hzoom == 2)
10641100   {  // x2 horizontal zoom
10651101      for(x=rect->min_x;x<rect->max_x;x+=2)
10661102      {
r9149r9150
10791115         off++;
10801116      }
10811117   }
1118
1119   if(hzoom == 5)
1120   {  // x5 horizontal zoom
1121      for(x=rect->min_x;x<rect->max_x;x+=5)
1122      {
1123         colour = state->towns_gfxvram[off+(layer*0x40000)+1];
1124         if(colour != 0)
1125         {
1126            *BITMAP_ADDR32(bitmap,scanline,x) =
1127               (state->video.towns_palette_r[colour] << 16)
1128               | (state->video.towns_palette_g[colour] << 8)
1129               | (state->video.towns_palette_b[colour]);
1130            *BITMAP_ADDR32(bitmap,scanline,x+1) =
1131               (state->video.towns_palette_r[colour] << 16)
1132               | (state->video.towns_palette_g[colour] << 8)
1133               | (state->video.towns_palette_b[colour]);
1134            *BITMAP_ADDR32(bitmap,scanline,x+2) =
1135               (state->video.towns_palette_r[colour] << 16)
1136               | (state->video.towns_palette_g[colour] << 8)
1137               | (state->video.towns_palette_b[colour]);
1138            *BITMAP_ADDR32(bitmap,scanline,x+3) =
1139               (state->video.towns_palette_r[colour] << 16)
1140               | (state->video.towns_palette_g[colour] << 8)
1141               | (state->video.towns_palette_b[colour]);
1142            *BITMAP_ADDR32(bitmap,scanline,x+4) =
1143               (state->video.towns_palette_r[colour] << 16)
1144               | (state->video.towns_palette_g[colour] << 8)
1145               | (state->video.towns_palette_b[colour]);
1146         }
1147         off++;
1148      }
1149   }
10821150}
10831151
10841152void towns_crtc_draw_scan_layer_16(running_machine* machine, bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline)
r9149r9150
11101178         off += scroll;
11111179      }
11121180      off += (state->video.towns_crtc_reg[11] - state->video.towns_crtc_reg[22]);
1113      if(state->video.towns_crtc_reg[27] & 0x0100)
1114         hzoom = 2;
1181      hzoom = ((state->video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1;
11151182   }
11161183   else
11171184   {
r9149r9150
11231190         off += scroll;
11241191      }
11251192      off += (state->video.towns_crtc_reg[9] - state->video.towns_crtc_reg[18]);
1126      if(state->video.towns_crtc_reg[27] & 0x0001)
1127         hzoom = 2;
1193      hzoom = (state->video.towns_crtc_reg[27] & 0x000f) + 1;
11281194   }
11291195
11301196   off += line * linesize;
r9149r9150
11521218         off++;
11531219      }
11541220   }
1155   else
1221
1222   if(hzoom == 2)
11561223   {  // x2 horizontal zoom
11571224      for(x=rect->min_x;x<rect->max_x;x+=4)
11581225      {
r9149r9150
11871254         off++;
11881255      }
11891256   }
1257
1258   if(hzoom == 5)
1259   {  // x5 horizontal zoom
1260      for(x=rect->min_x;x<rect->max_x;x+=10)
1261      {
1262         if(state->video.towns_video_reg[0] & 0x10)
1263            off &= 0x3ffff;  // 2 layers
1264         else
1265            off &= 0x7ffff;  // 1 layer
1266         colour = state->towns_gfxvram[off+(layer*0x40000)] >> 4;
1267         if(colour != 0)
1268         {
1269            *BITMAP_ADDR32(bitmap,scanline,x+5) =
1270               (state->video.towns_palette_r[colour] << 16)
1271               | (state->video.towns_palette_g[colour] << 8)
1272               | (state->video.towns_palette_b[colour]);
1273            *BITMAP_ADDR32(bitmap,scanline,x+6) =
1274               (state->video.towns_palette_r[colour] << 16)
1275               | (state->video.towns_palette_g[colour] << 8)
1276               | (state->video.towns_palette_b[colour]);
1277            *BITMAP_ADDR32(bitmap,scanline,x+7) =
1278               (state->video.towns_palette_r[colour] << 16)
1279               | (state->video.towns_palette_g[colour] << 8)
1280               | (state->video.towns_palette_b[colour]);
1281            *BITMAP_ADDR32(bitmap,scanline,x+8) =
1282               (state->video.towns_palette_r[colour] << 16)
1283               | (state->video.towns_palette_g[colour] << 8)
1284               | (state->video.towns_palette_b[colour]);
1285            *BITMAP_ADDR32(bitmap,scanline,x+9) =
1286               (state->video.towns_palette_r[colour] << 16)
1287               | (state->video.towns_palette_g[colour] << 8)
1288               | (state->video.towns_palette_b[colour]);
1289         }
1290         colour = state->towns_gfxvram[off+(layer*0x40000)] & 0x0f;
1291         if(colour != 0)
1292         {
1293            *BITMAP_ADDR32(bitmap,scanline,x) =
1294               (state->video.towns_palette_r[colour] << 16)
1295               | (state->video.towns_palette_g[colour] << 8)
1296               | (state->video.towns_palette_b[colour]);
1297            *BITMAP_ADDR32(bitmap,scanline,x+1) =
1298               (state->video.towns_palette_r[colour] << 16)
1299               | (state->video.towns_palette_g[colour] << 8)
1300               | (state->video.towns_palette_b[colour]);
1301            *BITMAP_ADDR32(bitmap,scanline,x+2) =
1302               (state->video.towns_palette_r[colour] << 16)
1303               | (state->video.towns_palette_g[colour] << 8)
1304               | (state->video.towns_palette_b[colour]);
1305            *BITMAP_ADDR32(bitmap,scanline,x+3) =
1306               (state->video.towns_palette_r[colour] << 16)
1307               | (state->video.towns_palette_g[colour] << 8)
1308               | (state->video.towns_palette_b[colour]);
1309            *BITMAP_ADDR32(bitmap,scanline,x+4) =
1310               (state->video.towns_palette_r[colour] << 16)
1311               | (state->video.towns_palette_g[colour] << 8)
1312               | (state->video.towns_palette_b[colour]);
1313         }
1314         off++;
1315      }
1316   }
11901317}
11911318
11921319void towns_crtc_draw_layer(running_machine* machine,bitmap_t* bitmap,const rectangle* rect,int layer)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team