src/mess/drivers/vboy.c
| r15941 | r15942 | |
| 73 | 73 | |
| 74 | 74 | required_device<cpu_device> m_maincpu; |
| 75 | 75 | |
| 76 | | DECLARE_READ32_MEMBER(port_02_read); |
| 77 | | DECLARE_WRITE32_MEMBER(port_02_write); |
| 76 | DECLARE_READ32_MEMBER(io_r); |
| 77 | DECLARE_WRITE32_MEMBER(io_w); |
| 78 | 78 | DECLARE_READ16_MEMBER(vip_r); |
| 79 | 79 | DECLARE_WRITE16_MEMBER(vip_w); |
| 80 | 80 | DECLARE_WRITE16_MEMBER(vboy_font0_w); |
| r15941 | r15942 | |
| 116 | 116 | |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | | READ32_MEMBER( vboy_state::port_02_read ) |
| 119 | |
| 120 | static VIDEO_START( vboy ) |
| 120 | 121 | { |
| 122 | vboy_state *state = machine.driver_data<vboy_state>(); |
| 123 | //int i; |
| 124 | |
| 125 | // Allocate memory for temporary screens |
| 126 | //state->m_bg_map[384*224]; |
| 127 | |
| 128 | state->m_screen_output.allocate(384, 224, BITMAP_FORMAT_IND16); |
| 129 | state->m_font = auto_alloc_array(machine, UINT16, 2048 * 8); |
| 130 | state->m_bgmap = auto_alloc_array(machine, UINT16, 0x20000 >> 1); |
| 131 | state->m_objects = state->m_bgmap + (0x1E000 >> 1); |
| 132 | state->m_columntab1 = state->m_bgmap + (0x1dc00 >> 1); |
| 133 | state->m_columntab2 = state->m_bgmap + (0x1de00 >> 1); |
| 134 | state->m_world = state->m_bgmap + (0x1d800 >> 1); |
| 135 | } |
| 136 | |
| 137 | static void put_obj(vboy_state *state, bitmap_ind16 &bitmap, int x, int y, UINT16 ch, bool flipx, bool flipy, UINT8 pal) |
| 138 | { |
| 139 | UINT16 data, code = ch; |
| 140 | UINT8 yi, xi, dat, col; |
| 141 | |
| 142 | for (yi = 0; yi < 8; yi++) |
| 143 | { |
| 144 | if (!flipy) |
| 145 | data = state->m_font[code * 8 + yi]; |
| 146 | else |
| 147 | data = state->m_font[code * 8 + (7-yi)]; |
| 148 | |
| 149 | for (xi = 0; xi < 8; xi++) |
| 150 | { |
| 151 | int res_x,res_y; |
| 152 | |
| 153 | if (!flipx) |
| 154 | dat = ((data >> (xi << 1)) & 0x03); |
| 155 | else |
| 156 | dat = ((data >> ((7-xi) << 1)) & 0x03); |
| 157 | |
| 158 | res_x = x + xi; |
| 159 | res_y = y + yi; |
| 160 | |
| 161 | col = (pal >> (dat*2)) & 3; |
| 162 | |
| 163 | if (dat) |
| 164 | bitmap.pix16((res_y), (res_x)) = state->machine().pens[col]; |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | static void put_char(vboy_state *state, int x, int y, UINT16 ch, bool flipx, bool flipy, UINT8 pal) |
| 170 | { |
| 171 | UINT16 data, code = ch; |
| 172 | UINT8 yi, xi, dat; |
| 173 | int col; |
| 174 | |
| 175 | for (yi = 0; yi < 8; yi++) |
| 176 | { |
| 177 | if (!flipy) |
| 178 | data = state->m_font[code * 8 + yi]; |
| 179 | else |
| 180 | data = state->m_font[code * 8 + (7-yi)]; |
| 181 | |
| 182 | for (xi = 0; xi < 8; xi++) |
| 183 | { |
| 184 | int res_x,res_y; |
| 185 | |
| 186 | if (!flipx) |
| 187 | dat = ((data >> (xi << 1)) & 0x03); |
| 188 | else |
| 189 | dat = ((data >> ((7-xi) << 1)) & 0x03); |
| 190 | |
| 191 | res_x = x + xi; |
| 192 | res_y = y + yi; |
| 193 | |
| 194 | col = (pal >> (dat*2)) & 3; |
| 195 | |
| 196 | if(dat == 0) |
| 197 | col = -1; |
| 198 | |
| 199 | state->m_bg_map[res_y*0x200+res_x] = col; |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | static void fill_bg_map(vboy_state *state, int num) |
| 205 | { |
| 206 | int i, j; |
| 207 | |
| 208 | // Fill background map |
| 209 | for (i = 0; i < 64; i++) |
| 210 | { |
| 211 | for (j = 0; j < 64; j++) |
| 212 | { |
| 213 | UINT16 val = state->m_bgmap[j + 64 * i + (num * 0x1000)]; |
| 214 | put_char(state, j * 8, i * 8, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.GPLT[(val >> 14) & 3]); |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | static UINT8 display_world(vboy_state *state, int num, bitmap_ind16 &bitmap, bool right, int &cur_spt) |
| 220 | { |
| 221 | num <<= 4; |
| 222 | UINT16 def = state->m_world[num]; |
| 223 | UINT8 lon = (def >> 15) & 1; |
| 224 | UINT8 ron = (def >> 14) & 1; |
| 225 | INT16 gx = state->m_world[num+1]; |
| 226 | INT16 gp = state->m_world[num+2]; |
| 227 | INT16 gy = state->m_world[num+3]; |
| 228 | INT16 mx = state->m_world[num+4]; |
| 229 | INT16 mp = state->m_world[num+5]; |
| 230 | INT16 my = state->m_world[num+6]; |
| 231 | UINT16 w = state->m_world[num+7]; |
| 232 | UINT16 h = state->m_world[num+8]; |
| 233 | UINT16 param_base = state->m_world[num+9] & 0xfff0; |
| 234 | // UINT16 overplane = state->m_world[num+10]; |
| 235 | UINT8 bg_map_num = def & 0x0f; |
| 236 | INT16 x,y; |
| 237 | UINT8 mode = (def >> 12) & 3; |
| 238 | UINT16 *vboy_paramtab; |
| 239 | int i; |
| 240 | |
| 241 | vboy_paramtab = state->m_bgmap + param_base; |
| 242 | |
| 243 | if(def & 0x40) // END flag |
| 244 | return 1; |
| 245 | |
| 246 | if (mode < 3) |
| 247 | { |
| 248 | fill_bg_map(state, bg_map_num); |
| 249 | if (BIT(def,15) && (!right)) |
| 250 | { |
| 251 | // Left screen |
| 252 | for(y=0;y<=h;y++) |
| 253 | { |
| 254 | for(x=0;x<=w;x++) |
| 255 | { |
| 256 | INT16 y1 = (y+gy); |
| 257 | INT16 x1 = (x+gx-gp); |
| 258 | int pix = 0; |
| 259 | if (mode==1) |
| 260 | x1 += vboy_paramtab[y*2]; |
| 261 | |
| 262 | pix = state->m_bg_map[((y+my) & 0x1ff)*0x200+((x+mx-mp) & 0x1ff)]; |
| 263 | |
| 264 | if(pix != -1) |
| 265 | if (y1>=0 && y1<224) |
| 266 | if (x1>=0 && x1<384) |
| 267 | bitmap.pix16(y1, x1) = state->machine().pens[pix & 3]; |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | if (BIT(def,14) && (right)) |
| 273 | { |
| 274 | // Right screen |
| 275 | for(y=0;y<=h;y++) |
| 276 | { |
| 277 | for(x=0; x<=w; x++) |
| 278 | { |
| 279 | INT16 y1 = (y+gy); |
| 280 | INT16 x1 = (x+gx+gp); |
| 281 | int pix = 0; |
| 282 | if (mode==1) |
| 283 | x1 += vboy_paramtab[y*2+1]; |
| 284 | |
| 285 | pix = state->m_bg_map[((y+my) & 0x1ff)*0x200+((x+mx+mp) & 0x1ff)]; |
| 286 | |
| 287 | if(pix != -1) |
| 288 | if (y1>=0 && y1<224) |
| 289 | if (x1>=0 && x1<384) |
| 290 | bitmap.pix16(y1, x1) = state->machine().pens[pix & 3]; |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | } |
| 295 | else |
| 296 | if (mode==2) |
| 297 | { |
| 298 | //popmessage("Mode 2 used"); |
| 299 | } |
| 300 | else |
| 301 | if (mode==3) |
| 302 | { |
| 303 | int start_offs, end_offs; |
| 304 | |
| 305 | if(cur_spt == -1) |
| 306 | { |
| 307 | popmessage("Cur spt used with -1 pointer!"); |
| 308 | return 0; |
| 309 | } |
| 310 | |
| 311 | start_offs = state->m_vip_regs.SPT[cur_spt]; |
| 312 | |
| 313 | end_offs = 0x3ff; |
| 314 | if(cur_spt != 0) |
| 315 | end_offs = state->m_vip_regs.SPT[cur_spt-1]; |
| 316 | |
| 317 | i = start_offs; |
| 318 | do |
| 319 | { |
| 320 | UINT16 start_ndx = i * 4; |
| 321 | INT16 jx = state->m_objects[start_ndx+0]; |
| 322 | INT16 jp = state->m_objects[start_ndx+1] & 0x3fff; |
| 323 | INT16 jy = state->m_objects[start_ndx+2] & 0x1ff; |
| 324 | UINT16 val = state->m_objects[start_ndx+3]; |
| 325 | UINT8 jlon = (state->m_objects[start_ndx+1] & 0x8000) >> 15; |
| 326 | UINT8 jron = (state->m_objects[start_ndx+1] & 0x4000) >> 14; |
| 327 | |
| 328 | if (!right && jlon) |
| 329 | put_obj(state, bitmap, (jx-jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.JPLT[(val>>14) & 3]); |
| 330 | |
| 331 | if(right && jron) |
| 332 | put_obj(state, bitmap, (jx+jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.JPLT[(val>>14) & 3]); |
| 333 | |
| 334 | i --; |
| 335 | i &= 0x3ff; |
| 336 | }while(i != end_offs); |
| 337 | |
| 338 | if((lon && !right) || (ron && right)) |
| 339 | cur_spt --; |
| 340 | } |
| 341 | |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static SCREEN_UPDATE_IND16( vboy_left ) |
| 346 | { |
| 347 | vboy_state *state = screen.machine().driver_data<vboy_state>(); |
| 348 | state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect); |
| 349 | int cur_spt; |
| 350 | |
| 351 | cur_spt = 3; |
| 352 | for(int i=31; i>=0; i--) |
| 353 | if (display_world(state, i, state->m_screen_output, 0,cur_spt)) break; |
| 354 | |
| 355 | copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect); |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | static SCREEN_UPDATE_IND16( vboy_right ) |
| 360 | { |
| 361 | vboy_state *state = screen.machine().driver_data<vboy_state>(); |
| 362 | state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect); |
| 363 | int cur_spt; |
| 364 | |
| 365 | cur_spt = 3; |
| 366 | for(int i=31; i>=0; i--) |
| 367 | if (display_world(state, i, state->m_screen_output, 1,cur_spt)) break; |
| 368 | |
| 369 | copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect); |
| 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | READ32_MEMBER( vboy_state::io_r ) |
| 374 | { |
| 121 | 375 | UINT32 value = 0x00; |
| 122 | 376 | |
| 123 | 377 | switch ((offset << 2)) |
| r15941 | r15942 | |
| 160 | 414 | } |
| 161 | 415 | return value; |
| 162 | 416 | } |
| 163 | | WRITE32_MEMBER( vboy_state::port_02_write ) |
| 417 | WRITE32_MEMBER( vboy_state::io_w ) |
| 164 | 418 | { |
| 165 | 419 | switch (offset<<2) |
| 166 | 420 | { |
| r15941 | r15942 | |
| 562 | 816 | AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror |
| 563 | 817 | |
| 564 | 818 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM |
| 565 | | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff |
| 819 | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff |
| 566 | 820 | //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 567 | 821 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff |
| 568 | 822 | AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM // Cart RAM - 8K NVRAM |
| r15941 | r15942 | |
| 591 | 845 | AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror |
| 592 | 846 | |
| 593 | 847 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM |
| 594 | | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff |
| 848 | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff |
| 595 | 849 | //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 596 | 850 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff |
| 597 | 851 | AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM // Cart RAM - 8K NVRAM |
| r15941 | r15942 | |
| 640 | 894 | } |
| 641 | 895 | |
| 642 | 896 | |
| 643 | | static VIDEO_START( vboy ) |
| 644 | | { |
| 645 | | vboy_state *state = machine.driver_data<vboy_state>(); |
| 646 | | //int i; |
| 647 | | |
| 648 | | // Allocate memory for temporary screens |
| 649 | | //state->m_bg_map[384*224]; |
| 650 | | |
| 651 | | state->m_screen_output.allocate(384, 224, BITMAP_FORMAT_IND16); |
| 652 | | state->m_font = auto_alloc_array(machine, UINT16, 2048 * 8); |
| 653 | | state->m_bgmap = auto_alloc_array(machine, UINT16, 0x20000 >> 1); |
| 654 | | state->m_objects = state->m_bgmap + (0x1E000 >> 1); |
| 655 | | state->m_columntab1 = state->m_bgmap + (0x1dc00 >> 1); |
| 656 | | state->m_columntab2 = state->m_bgmap + (0x1de00 >> 1); |
| 657 | | state->m_world = state->m_bgmap + (0x1d800 >> 1); |
| 658 | | } |
| 659 | | |
| 660 | | static void put_obj(vboy_state *state, bitmap_ind16 &bitmap, int x, int y, UINT16 ch, bool flipx, bool flipy, UINT8 pal) |
| 661 | | { |
| 662 | | UINT16 data, code = ch; |
| 663 | | UINT8 yi, xi, dat, col; |
| 664 | | |
| 665 | | for (yi = 0; yi < 8; yi++) |
| 666 | | { |
| 667 | | if (!flipy) |
| 668 | | data = state->m_font[code * 8 + yi]; |
| 669 | | else |
| 670 | | data = state->m_font[code * 8 + (7-yi)]; |
| 671 | | |
| 672 | | for (xi = 0; xi < 8; xi++) |
| 673 | | { |
| 674 | | int res_x,res_y; |
| 675 | | |
| 676 | | if (!flipx) |
| 677 | | dat = ((data >> (xi << 1)) & 0x03); |
| 678 | | else |
| 679 | | dat = ((data >> ((7-xi) << 1)) & 0x03); |
| 680 | | |
| 681 | | res_x = x + xi; |
| 682 | | res_y = y + yi; |
| 683 | | |
| 684 | | col = (pal >> (dat*2)) & 3; |
| 685 | | |
| 686 | | if (dat) |
| 687 | | bitmap.pix16((res_y), (res_x)) = state->machine().pens[col]; |
| 688 | | } |
| 689 | | } |
| 690 | | } |
| 691 | | |
| 692 | | static void put_char(vboy_state *state, int x, int y, UINT16 ch, bool flipx, bool flipy, UINT8 pal) |
| 693 | | { |
| 694 | | UINT16 data, code = ch; |
| 695 | | UINT8 yi, xi, dat; |
| 696 | | int col; |
| 697 | | |
| 698 | | for (yi = 0; yi < 8; yi++) |
| 699 | | { |
| 700 | | if (!flipy) |
| 701 | | data = state->m_font[code * 8 + yi]; |
| 702 | | else |
| 703 | | data = state->m_font[code * 8 + (7-yi)]; |
| 704 | | |
| 705 | | for (xi = 0; xi < 8; xi++) |
| 706 | | { |
| 707 | | int res_x,res_y; |
| 708 | | |
| 709 | | if (!flipx) |
| 710 | | dat = ((data >> (xi << 1)) & 0x03); |
| 711 | | else |
| 712 | | dat = ((data >> ((7-xi) << 1)) & 0x03); |
| 713 | | |
| 714 | | res_x = x + xi; |
| 715 | | res_y = y + yi; |
| 716 | | |
| 717 | | col = (pal >> (dat*2)) & 3; |
| 718 | | |
| 719 | | if(dat == 0) |
| 720 | | col = -1; |
| 721 | | |
| 722 | | state->m_bg_map[res_y*0x200+res_x] = col; |
| 723 | | } |
| 724 | | } |
| 725 | | } |
| 726 | | |
| 727 | | static void fill_bg_map(vboy_state *state, int num) |
| 728 | | { |
| 729 | | int i, j; |
| 730 | | |
| 731 | | // Fill background map |
| 732 | | for (i = 0; i < 64; i++) |
| 733 | | { |
| 734 | | for (j = 0; j < 64; j++) |
| 735 | | { |
| 736 | | UINT16 val = state->m_bgmap[j + 64 * i + (num * 0x1000)]; |
| 737 | | put_char(state, j * 8, i * 8, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.GPLT[(val >> 14) & 3]); |
| 738 | | } |
| 739 | | } |
| 740 | | } |
| 741 | | |
| 742 | | static UINT8 display_world(vboy_state *state, int num, bitmap_ind16 &bitmap, bool right, int &cur_spt) |
| 743 | | { |
| 744 | | num <<= 4; |
| 745 | | UINT16 def = state->m_world[num]; |
| 746 | | UINT8 lon = (def >> 15) & 1; |
| 747 | | UINT8 ron = (def >> 14) & 1; |
| 748 | | INT16 gx = state->m_world[num+1]; |
| 749 | | INT16 gp = state->m_world[num+2]; |
| 750 | | INT16 gy = state->m_world[num+3]; |
| 751 | | INT16 mx = state->m_world[num+4]; |
| 752 | | INT16 mp = state->m_world[num+5]; |
| 753 | | INT16 my = state->m_world[num+6]; |
| 754 | | UINT16 w = state->m_world[num+7]; |
| 755 | | UINT16 h = state->m_world[num+8]; |
| 756 | | UINT16 param_base = state->m_world[num+9] & 0xfff0; |
| 757 | | // UINT16 overplane = state->m_world[num+10]; |
| 758 | | UINT8 bg_map_num = def & 0x0f; |
| 759 | | INT16 x,y; |
| 760 | | UINT8 mode = (def >> 12) & 3; |
| 761 | | UINT16 *vboy_paramtab; |
| 762 | | int i; |
| 763 | | |
| 764 | | vboy_paramtab = state->m_bgmap + param_base; |
| 765 | | |
| 766 | | if(def & 0x40) // END flag |
| 767 | | return 1; |
| 768 | | |
| 769 | | if (mode < 3) |
| 770 | | { |
| 771 | | fill_bg_map(state, bg_map_num); |
| 772 | | if (BIT(def,15) && (!right)) |
| 773 | | { |
| 774 | | // Left screen |
| 775 | | for(y=0;y<=h;y++) |
| 776 | | { |
| 777 | | for(x=0;x<=w;x++) |
| 778 | | { |
| 779 | | INT16 y1 = (y+gy); |
| 780 | | INT16 x1 = (x+gx-gp); |
| 781 | | int pix = 0; |
| 782 | | if (mode==1) |
| 783 | | x1 += vboy_paramtab[y*2]; |
| 784 | | |
| 785 | | pix = state->m_bg_map[((y+my) & 0x1ff)*0x200+((x+mx-mp) & 0x1ff)]; |
| 786 | | |
| 787 | | if(pix != -1) |
| 788 | | if (y1>=0 && y1<224) |
| 789 | | if (x1>=0 && x1<384) |
| 790 | | bitmap.pix16(y1, x1) = state->machine().pens[pix & 3]; |
| 791 | | } |
| 792 | | } |
| 793 | | } |
| 794 | | |
| 795 | | if (BIT(def,14) && (right)) |
| 796 | | { |
| 797 | | // Right screen |
| 798 | | for(y=0;y<=h;y++) |
| 799 | | { |
| 800 | | for(x=0; x<=w; x++) |
| 801 | | { |
| 802 | | INT16 y1 = (y+gy); |
| 803 | | INT16 x1 = (x+gx+gp); |
| 804 | | int pix = 0; |
| 805 | | if (mode==1) |
| 806 | | x1 += vboy_paramtab[y*2+1]; |
| 807 | | |
| 808 | | pix = state->m_bg_map[((y+my) & 0x1ff)*0x200+((x+mx+mp) & 0x1ff)]; |
| 809 | | |
| 810 | | if(pix != -1) |
| 811 | | if (y1>=0 && y1<224) |
| 812 | | if (x1>=0 && x1<384) |
| 813 | | bitmap.pix16(y1, x1) = state->machine().pens[pix & 3]; |
| 814 | | } |
| 815 | | } |
| 816 | | } |
| 817 | | } |
| 818 | | else |
| 819 | | if (mode==2) |
| 820 | | { |
| 821 | | //popmessage("Mode 2 used"); |
| 822 | | } |
| 823 | | else |
| 824 | | if (mode==3) |
| 825 | | { |
| 826 | | int start_offs, end_offs; |
| 827 | | |
| 828 | | if(cur_spt == -1) |
| 829 | | { |
| 830 | | popmessage("Cur spt used with -1 pointer!"); |
| 831 | | return 0; |
| 832 | | } |
| 833 | | |
| 834 | | start_offs = state->m_vip_regs.SPT[cur_spt]; |
| 835 | | |
| 836 | | end_offs = 0x3ff; |
| 837 | | if(cur_spt != 0) |
| 838 | | end_offs = state->m_vip_regs.SPT[cur_spt-1]; |
| 839 | | |
| 840 | | i = start_offs; |
| 841 | | do |
| 842 | | { |
| 843 | | UINT16 start_ndx = i * 4; |
| 844 | | INT16 jx = state->m_objects[start_ndx+0]; |
| 845 | | INT16 jp = state->m_objects[start_ndx+1] & 0x3fff; |
| 846 | | INT16 jy = state->m_objects[start_ndx+2] & 0x1ff; |
| 847 | | UINT16 val = state->m_objects[start_ndx+3]; |
| 848 | | UINT8 jlon = (state->m_objects[start_ndx+1] & 0x8000) >> 15; |
| 849 | | UINT8 jron = (state->m_objects[start_ndx+1] & 0x4000) >> 14; |
| 850 | | |
| 851 | | if (!right && jlon) |
| 852 | | put_obj(state, bitmap, (jx-jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.JPLT[(val>>14) & 3]); |
| 853 | | |
| 854 | | if(right && jron) |
| 855 | | put_obj(state, bitmap, (jx+jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), state->m_vip_regs.JPLT[(val>>14) & 3]); |
| 856 | | |
| 857 | | i --; |
| 858 | | i &= 0x3ff; |
| 859 | | }while(i != end_offs); |
| 860 | | |
| 861 | | if((lon && !right) || (ron && right)) |
| 862 | | cur_spt --; |
| 863 | | } |
| 864 | | |
| 865 | | return 0; |
| 866 | | } |
| 867 | | |
| 868 | | static SCREEN_UPDATE_IND16( vboy_left ) |
| 869 | | { |
| 870 | | vboy_state *state = screen.machine().driver_data<vboy_state>(); |
| 871 | | state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect); |
| 872 | | int cur_spt; |
| 873 | | |
| 874 | | cur_spt = 3; |
| 875 | | for(int i=31; i>=0; i--) |
| 876 | | if (display_world(state, i, state->m_screen_output, 0,cur_spt)) break; |
| 877 | | |
| 878 | | copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect); |
| 879 | | return 0; |
| 880 | | } |
| 881 | | |
| 882 | | static SCREEN_UPDATE_IND16( vboy_right ) |
| 883 | | { |
| 884 | | vboy_state *state = screen.machine().driver_data<vboy_state>(); |
| 885 | | state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect); |
| 886 | | int cur_spt; |
| 887 | | |
| 888 | | cur_spt = 3; |
| 889 | | for(int i=31; i>=0; i--) |
| 890 | | if (display_world(state, i, state->m_screen_output, 1,cur_spt)) break; |
| 891 | | |
| 892 | | copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect); |
| 893 | | return 0; |
| 894 | | } |
| 895 | | |
| 896 | 897 | void vboy_state::m_timer_tick(UINT8 setting) |
| 897 | 898 | { |
| 898 | 899 | if(m_vboy_regs.tcr & 1 && ((m_vboy_regs.tcr & 0x10) == setting)) |