src/mess/video/fmtowns.c
| r9149 | r9150 | |
| 514 | 514 | towns_state* state = space->machine->driver_data<towns_state>(); |
| 515 | 515 | UINT8 ret = 0; |
| 516 | 516 | UINT16 xpos; |
| 517 | |
| 518 | // logerror("VID: read port %04x\n",offset+0xfd90); |
| 517 | 519 | switch(offset) |
| 518 | 520 | { |
| 519 | 521 | case 0x00: |
| r9149 | r9150 | |
| 543 | 545 | ret |= 0x01; |
| 544 | 546 | return ret; |
| 545 | 547 | } |
| 546 | | // logerror("VID: read port %04x\n",offset+0xfd90); |
| 547 | 548 | return 0x00; |
| 548 | 549 | } |
| 549 | 550 | |
| r9149 | r9150 | |
| 580 | 581 | state->video.towns_layer_ctrl = data; |
| 581 | 582 | break; |
| 582 | 583 | } |
| 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); |
| 584 | 585 | } |
| 585 | 586 | |
| 586 | 587 | READ8_HANDLER(towns_video_ff81_r) |
| r9149 | r9150 | |
| 933 | 934 | off += scroll; |
| 934 | 935 | } |
| 935 | 936 | 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; |
| 938 | 938 | } |
| 939 | 939 | else |
| 940 | 940 | { |
| r9149 | r9150 | |
| 946 | 946 | off += scroll; |
| 947 | 947 | } |
| 948 | 948 | 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; |
| 951 | 950 | } |
| 952 | 951 | |
| 953 | 952 | off += line * linesize; |
| r9149 | r9150 | |
| 972 | 971 | off+=2; |
| 973 | 972 | } |
| 974 | 973 | } |
| 975 | | else |
| 974 | |
| 975 | if(hzoom == 2) |
| 976 | 976 | { // x2 horizontal zoom |
| 977 | 977 | for(x=rect->min_x;x<rect->max_x;x+=2) |
| 978 | 978 | { |
| r9149 | r9150 | |
| 995 | 995 | off+=2; |
| 996 | 996 | } |
| 997 | 997 | } |
| 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 | |
| 998 | 1035 | } |
| 999 | 1036 | |
| 1000 | 1037 | void towns_crtc_draw_scan_layer_256(running_machine* machine, bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline) |
| r9149 | r9150 | |
| 1026 | 1063 | off += scroll; |
| 1027 | 1064 | } |
| 1028 | 1065 | 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; |
| 1031 | 1067 | } |
| 1032 | 1068 | else |
| 1033 | 1069 | { |
| r9149 | r9150 | |
| 1039 | 1075 | off += scroll; |
| 1040 | 1076 | } |
| 1041 | 1077 | 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; |
| 1044 | 1079 | } |
| 1045 | 1080 | |
| 1046 | 1081 | off += line * linesize; |
| r9149 | r9150 | |
| 1060 | 1095 | off++; |
| 1061 | 1096 | } |
| 1062 | 1097 | } |
| 1063 | | else |
| 1098 | |
| 1099 | if(hzoom == 2) |
| 1064 | 1100 | { // x2 horizontal zoom |
| 1065 | 1101 | for(x=rect->min_x;x<rect->max_x;x+=2) |
| 1066 | 1102 | { |
| r9149 | r9150 | |
| 1079 | 1115 | off++; |
| 1080 | 1116 | } |
| 1081 | 1117 | } |
| 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 | } |
| 1082 | 1150 | } |
| 1083 | 1151 | |
| 1084 | 1152 | void towns_crtc_draw_scan_layer_16(running_machine* machine, bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline) |
| r9149 | r9150 | |
| 1110 | 1178 | off += scroll; |
| 1111 | 1179 | } |
| 1112 | 1180 | 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; |
| 1115 | 1182 | } |
| 1116 | 1183 | else |
| 1117 | 1184 | { |
| r9149 | r9150 | |
| 1123 | 1190 | off += scroll; |
| 1124 | 1191 | } |
| 1125 | 1192 | 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; |
| 1128 | 1194 | } |
| 1129 | 1195 | |
| 1130 | 1196 | off += line * linesize; |
| r9149 | r9150 | |
| 1152 | 1218 | off++; |
| 1153 | 1219 | } |
| 1154 | 1220 | } |
| 1155 | | else |
| 1221 | |
| 1222 | if(hzoom == 2) |
| 1156 | 1223 | { // x2 horizontal zoom |
| 1157 | 1224 | for(x=rect->min_x;x<rect->max_x;x+=4) |
| 1158 | 1225 | { |
| r9149 | r9150 | |
| 1187 | 1254 | off++; |
| 1188 | 1255 | } |
| 1189 | 1256 | } |
| 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 | } |
| 1190 | 1317 | } |
| 1191 | 1318 | |
| 1192 | 1319 | void towns_crtc_draw_layer(running_machine* machine,bitmap_t* bitmap,const rectangle* rect,int layer) |