trunk/src/emu/cpu/tms0980/tms0980.c
| r242140 | r242141 | |
| 48 | 48 | - Execute: |
| 49 | 49 | 1. Execute BRANCH/CALL/RETN part #1 |
| 50 | 50 | |
| 51 | */ |
| 51 | 52 | |
| 53 | #include "tms0980.h" |
| 54 | #include "debugger.h" |
| 55 | |
| 56 | /* |
| 57 | |
| 52 | 58 | The MCU cores contains a set of fixed instructions and a set of |
| 53 | 59 | instructions created using microinstructions. A subset of the |
| 54 | 60 | instruction set could be defined from the microinstructions by |
| r242140 | r242141 | |
| 58 | 64 | cycle #2: C8(?), CKM, NE(?), STO |
| 59 | 65 | cycle #3,#4: AUTA, AUTY |
| 60 | 66 | |
| 67 | unknown cycle: CME, SSE, SSS |
| 68 | |
| 61 | 69 | */ |
| 62 | 70 | |
| 63 | | #include "tms0980.h" |
| 64 | | #include "debugger.h" |
| 71 | /* Microinstructions */ |
| 72 | #define M_15TN 0x00000001 /* 15 to -ALU */ |
| 73 | #define M_ATN 0x00000002 /* ACC to -ALU */ |
| 74 | #define M_AUTA 0x00000004 /* ALU to ACC */ |
| 75 | #define M_AUTY 0x00000008 /* ALU to Y */ |
| 76 | #define M_C8 0x00000010 /* CARRY8 to STATUS */ |
| 77 | #define M_CIN 0x00000020 /* Carry In to ALU */ |
| 78 | #define M_CKM 0x00000040 /* CKB to MEM */ |
| 79 | #define M_CKN 0x00000080 /* CKB to -ALU */ |
| 80 | #define M_CKP 0x00000100 /* CKB to +ALU */ |
| 81 | #define M_CME 0x00000200 /* Conditional Memory Enable */ |
| 82 | #define M_DMTP 0x00000400 /* DAM to +ALU */ |
| 83 | #define M_MTN 0x00000800 /* MEM to -ALU */ |
| 84 | #define M_MTP 0x00001000 /* MEM to +ALU */ |
| 85 | #define M_NATN 0x00002000 /* ~ACC to -ALU */ |
| 86 | #define M_NDMTP 0x00004000 /* ~DAM to +ALU */ |
| 87 | #define M_NE 0x00008000 /* COMP to STATUS */ |
| 88 | #define M_SSE 0x00010000 /* Special Status Enable */ |
| 89 | #define M_SSS 0x00020000 /* Special Status Sample */ |
| 90 | #define M_STO 0x00040000 /* ACC to MEM */ |
| 91 | #define M_STSL 0x00080000 /* STATUS to Status Latch */ |
| 92 | #define M_YTP 0x00100000 /* Y to +ALU */ |
| 65 | 93 | |
| 94 | /* Standard/fixed instructions - these are documented more in their specific handlers below */ |
| 95 | #define F_BR 0x00000001 |
| 96 | #define F_CALL 0x00000002 |
| 97 | #define F_CLO 0x00000004 |
| 98 | #define F_COMC 0x00000008 |
| 99 | #define F_COMX 0x00000010 |
| 100 | #define F_COMX8 0x00000020 |
| 101 | #define F_LDP 0x00000040 |
| 102 | #define F_LDX 0x00000080 |
| 103 | #define F_OFF 0x00000100 |
| 104 | #define F_RBIT 0x00000200 |
| 105 | #define F_REAC 0x00000400 |
| 106 | #define F_RETN 0x00000800 |
| 107 | #define F_RSTR 0x00001000 |
| 108 | #define F_SAL 0x00002000 |
| 109 | #define F_SBIT 0x00004000 |
| 110 | #define F_SBL 0x00008000 |
| 111 | #define F_SEAC 0x00010000 |
| 112 | #define F_SETR 0x00020000 |
| 113 | #define F_TDO 0x00040000 |
| 114 | #define F_XDA 0x00080000 |
| 115 | |
| 116 | |
| 66 | 117 | // supported types: |
| 67 | 118 | // note: dice information assumes the orientation is pictured with RAM at the bottom-left |
| 68 | 119 | |
| r242140 | r242141 | |
| 289 | 340 | |
| 290 | 341 | |
| 291 | 342 | |
| 292 | | /* Standard/fixed instructions */ |
| 293 | | #define F_BR 0x00000001 |
| 294 | | #define F_CALL 0x00000002 |
| 295 | | #define F_CLO 0x00000004 |
| 296 | | #define F_COMC 0x00000008 |
| 297 | | #define F_COMX 0x00000010 |
| 298 | | #define F_COMX8 0x00000020 |
| 299 | | #define F_LDP 0x00000040 |
| 300 | | #define F_LDX 0x00000080 |
| 301 | | #define F_OFF 0x00000100 |
| 302 | | #define F_RBIT 0x00000200 |
| 303 | | #define F_REAC 0x00000400 |
| 304 | | #define F_RETN 0x00000800 |
| 305 | | #define F_RSTR 0x00001000 |
| 306 | | #define F_SAL 0x00002000 |
| 307 | | #define F_SBIT 0x00004000 |
| 308 | | #define F_SBL 0x00008000 |
| 309 | | #define F_SEAC 0x00010000 |
| 310 | | #define F_SETR 0x00020000 |
| 311 | | #define F_TDO 0x00040000 |
| 312 | | #define F_XDA 0x00080000 |
| 313 | | |
| 314 | | /* Microinstructions */ |
| 315 | | #define M_15TN 0x00000001 |
| 316 | | #define M_ATN 0x00000002 |
| 317 | | #define M_AUTA 0x00000004 |
| 318 | | #define M_AUTY 0x00000008 |
| 319 | | #define M_C8 0x00000010 |
| 320 | | #define M_CIN 0x00000020 |
| 321 | | #define M_CKM 0x00000040 |
| 322 | | #define M_CKN 0x00000080 |
| 323 | | #define M_CKP 0x00000100 |
| 324 | | #define M_CME 0x00000200 |
| 325 | | #define M_DMTP 0x00000400 |
| 326 | | #define M_MTN 0x00000800 |
| 327 | | #define M_MTP 0x00001000 |
| 328 | | #define M_NATN 0x00002000 |
| 329 | | #define M_NDMTP 0x00004000 |
| 330 | | #define M_NE 0x00008000 |
| 331 | | #define M_SSE 0x00010000 |
| 332 | | #define M_SSS 0x00020000 |
| 333 | | #define M_STO 0x00040000 |
| 334 | | #define M_STSL 0x00080000 |
| 335 | | #define M_YTP 0x00100000 |
| 336 | | |
| 337 | | |
| 338 | | |
| 339 | 343 | //------------------------------------------------- |
| 340 | 344 | // device_start - device-specific startup |
| 341 | 345 | //------------------------------------------------- |
trunk/src/mame/drivers/galpani2.c
| r242140 | r242141 | |
| 337 | 337 | AM_RANGE(0x300000, 0x301fff) AM_RAM // ? |
| 338 | 338 | AM_RANGE(0x302000, 0x303fff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 339 | 339 | AM_RANGE(0x304000, 0x30401f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w) |
| 340 | | AM_RANGE(0x308000, 0x308001) AM_WRITENOP // ? 0 at startup |
| 341 | | AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP // ? hblank effect ? |
| 342 | | AM_RANGE(0x310000, 0x3101ff) AM_RAM_WRITE(galpani2_palette_0_w) AM_SHARE("palette.0") // ? |
| 340 | // AM_RANGE(0x308000, 0x308001) AM_WRITENOP // ? 0 at startup |
| 341 | // AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP // ? hblank effect ? |
| 342 | AM_RANGE(0x310000, 0x3101ff) AM_RAM_DEVWRITE("bg8palette", palette_device, write) AM_SHARE("bg8palette") // ? |
| 343 | 343 | AM_RANGE(0x314000, 0x314001) AM_WRITENOP // ? flip backgrounds ? |
| 344 | 344 | AM_RANGE(0x318000, 0x318001) AM_READWRITE(galpani2_eeprom_r, galpani2_eeprom_w) // EEPROM |
| 345 | 345 | AM_RANGE(0x380000, 0x387fff) AM_RAM // Palette? |
| 346 | 346 | AM_RANGE(0x388000, 0x38ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // Palette |
| 347 | | AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP // ? at startup of service mode |
| 347 | // AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP // ? at startup of service mode |
| 348 | 348 | |
| 349 | | AM_RANGE(0x400000, 0x43ffff) AM_RAM_WRITE(galpani2_bg8_0_w) AM_SHARE("bg8.0") // Background 0 |
| 349 | AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("bg8.0") // Background 0 |
| 350 | 350 | AM_RANGE(0x440000, 0x440001) AM_RAM AM_SHARE("bg8_scrollx.0") // Background 0 Scroll X |
| 351 | 351 | AM_RANGE(0x480000, 0x480001) AM_RAM AM_SHARE("bg8_scrolly.0") // Background 0 Scroll Y |
| 352 | | AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ? 0 at startup only |
| 353 | | AM_RANGE(0x500000, 0x53ffff) AM_RAM_WRITE(galpani2_bg8_1_w) AM_SHARE("bg8.1") // Background 1 |
| 352 | // AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP // ? 0 at startup only |
| 353 | AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_SHARE("bg8.1") // Background 1 |
| 354 | 354 | AM_RANGE(0x540000, 0x540001) AM_RAM AM_SHARE("bg8_scrollx.1") // Background 1 Scroll X |
| 355 | AM_RANGE(0x580000, 0x580001) AM_RAM AM_SHARE("bg8_scrolly.1") // Background 1 Scroll Y |
| 356 | // AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP // ? 0 at startup only |
| 355 | 357 | |
| 356 | 358 | AM_RANGE(0x540572, 0x540573) AM_READNOP // ? galpani2 at F0A4 |
| 357 | 359 | AM_RANGE(0x54057a, 0x54057b) AM_READNOP // ? galpani2 at F148 |
| r242140 | r242141 | |
| 363 | 365 | AM_RANGE(0x5405c2, 0x5405c3) AM_READNOP // ? galpani2 at F0A4 and F148 |
| 364 | 366 | AM_RANGE(0x5405ca, 0x5405cb) AM_READNOP // ? galpani2 at F148 |
| 365 | 367 | |
| 366 | | AM_RANGE(0x580000, 0x580001) AM_RAM AM_SHARE("bg8_scrolly.1") // Background 1 Scroll Y |
| 367 | | AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP // ? 0 at startup only |
| 368 | | AM_RANGE(0x600000, 0x600001) AM_WRITENOP // Watchdog |
| 368 | AM_RANGE(0x600000, 0x600001) AM_NOP // Watchdog |
| 369 | 369 | AM_RANGE(0x640000, 0x640001) AM_WRITE8(galpani2_mcu_init_w, 0x00ff ) // ? 0 before resetting and at startup, Reset mcu ? |
| 370 | 370 | AM_RANGE(0x680000, 0x680001) AM_WRITE8(galpani2_mcu_nmi1_w, 0x00ff) // ? 0 -> 1 -> 0 (lev 5) / 0 -> $10 -> 0 |
| 371 | 371 | AM_RANGE(0x6c0000, 0x6c0001) AM_WRITE8(galpani2_coin_lockout_w, 0xff00 ) // Coin + Card Lockout |
| r242140 | r242141 | |
| 403 | 403 | static ADDRESS_MAP_START( galpani2_mem2, AS_PROGRAM, 16, galpani2_state ) |
| 404 | 404 | AM_RANGE(0x000000, 0x03ffff) AM_ROM // ROM |
| 405 | 405 | AM_RANGE(0x100000, 0x13ffff) AM_RAM AM_SHARE("ram2") // Work RAM |
| 406 | | AM_RANGE(0x400000, 0x4fffff) AM_RAM_WRITE(galpani2_bg15_w) AM_SHARE("bg15") // bg15 |
| 407 | | AM_RANGE(0x500000, 0x5fffff) AM_RAM // bg15 |
| 408 | | AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only |
| 409 | | AM_RANGE(0x640000, 0x640001) AM_WRITENOP // ? 0 at startup only |
| 410 | | AM_RANGE(0x680000, 0x680001) AM_WRITENOP // ? 0 at startup only |
| 411 | | AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP // ? 0 at startup only |
| 412 | | AM_RANGE(0x700000, 0x700001) AM_WRITENOP // Watchdog |
| 406 | AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_SHARE("bg15") // bg15 |
| 407 | // AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only |
| 408 | // AM_RANGE(0x640000, 0x640001) AM_WRITENOP // ? 0 at startup only |
| 409 | // AM_RANGE(0x680000, 0x680001) AM_WRITENOP // ? 0 at startup only |
| 410 | // AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP // ? 0 at startup only |
| 411 | AM_RANGE(0x700000, 0x700001) AM_NOP // Watchdog |
| 413 | 412 | // AM_RANGE(0x740000, 0x740001) AM_WRITENOP // ? Reset mcu |
| 414 | 413 | AM_RANGE(0x780000, 0x780001) AM_WRITE8(galpani2_mcu_nmi2_w, 0x00ff) // ? 0 -> 1 -> 0 (lev 5) |
| 415 | 414 | AM_RANGE(0x7c0000, 0x7c0001) AM_WRITEONLY AM_SHARE("rombank") // Rom Bank |
| r242140 | r242141 | |
| 626 | 625 | MCFG_SCREEN_SIZE(320, 256) |
| 627 | 626 | MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1-16) |
| 628 | 627 | MCFG_SCREEN_UPDATE_DRIVER(galpani2_state, screen_update_galpani2) |
| 629 | | MCFG_SCREEN_PALETTE("palette") |
| 630 | 628 | |
| 631 | 629 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", galpani2) |
| 632 | | MCFG_PALETTE_ADD("palette", 0x4000 + 0x200 + 0x8000) // sprites, bg8, bg15 |
| 630 | MCFG_PALETTE_ADD("palette", 0x4000) // sprites |
| 633 | 631 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 634 | | MCFG_PALETTE_INIT_OWNER(galpani2_state, galpani2) |
| 635 | 632 | |
| 633 | MCFG_PALETTE_ADD("bg8palette", 0x200/2) // bg8 |
| 634 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 635 | |
| 636 | MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */ |
| 637 | MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) |
| 638 | MCFG_PALETTE_INIT_OWNER(galpani2_state,galpani2) |
| 639 | |
| 636 | 640 | MCFG_DEVICE_ADD_KC002_SPRITES |
| 637 | 641 | kaneko16_sprite_device::set_offsets(*device, 0x10000 - 0x16c0 + 0xc00, 0); |
| 638 | 642 | MCFG_KANEKO16_SPRITE_GFXDECODE("gfxdecode") |
trunk/src/mame/includes/galpani2.h
| r242140 | r242141 | |
| 21 | 21 | m_spriteram(*this, "spriteram"), |
| 22 | 22 | m_oki2(*this, "oki2"), |
| 23 | 23 | m_eeprom(*this, "eeprom"), |
| 24 | | m_palette(*this, "palette") |
| 25 | | { } |
| 24 | m_palette(*this, "palette"), |
| 25 | m_bg15palette(*this, "bgpalette"), |
| 26 | m_bg8palette(*this, "bg8palette") |
| 27 | { } |
| 26 | 28 | |
| 27 | 29 | required_shared_ptr_array<UINT16, 2> m_bg8; |
| 28 | 30 | optional_shared_ptr_array<UINT16, 2> m_palette_val; |
| r242140 | r242141 | |
| 35 | 37 | UINT16 m_old_mcu_nmi1; |
| 36 | 38 | UINT16 m_old_mcu_nmi2; |
| 37 | 39 | required_shared_ptr<UINT16> m_rombank; |
| 38 | | bitmap_ind16 *m_bg8_bitmap[2]; |
| 39 | | bitmap_ind16 *m_bg15_bitmap; |
| 40 | 40 | |
| 41 | 41 | required_device<cpu_device> m_maincpu; |
| 42 | 42 | required_device<cpu_device> m_subcpu; |
| r242140 | r242141 | |
| 55 | 55 | virtual void machine_reset(); |
| 56 | 56 | virtual void video_start(); |
| 57 | 57 | DECLARE_PALETTE_INIT(galpani2); |
| 58 | | UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 58 | UINT32 screen_update_galpani2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 59 | void copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer); |
| 60 | void copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 61 | |
| 59 | 62 | TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1); |
| 60 | 63 | TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2); |
| 61 | 64 | void galpani2_mcu_nmi1(); |
| 62 | 65 | void galpani2_mcu_nmi2(); |
| 63 | 66 | /*----------- defined in video/galpani2.c -----------*/ |
| 64 | | inline void galpani2_bg8_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_); |
| 65 | | inline void galpani2_palette_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_); |
| 66 | 67 | |
| 67 | | DECLARE_WRITE16_MEMBER( galpani2_palette_0_w ); |
| 68 | | DECLARE_WRITE16_MEMBER( galpani2_palette_1_w ); |
| 69 | | |
| 70 | | DECLARE_WRITE16_MEMBER( galpani2_bg8_0_w ); |
| 71 | | DECLARE_WRITE16_MEMBER( galpani2_bg8_1_w ); |
| 72 | | |
| 73 | | DECLARE_WRITE16_MEMBER( galpani2_bg15_w ); |
| 74 | 68 | required_device<okim6295_device> m_oki2; |
| 75 | 69 | required_device<eeprom_serial_93cxx_device> m_eeprom; |
| 76 | 70 | required_device<palette_device> m_palette; |
| 71 | required_device<palette_device> m_bg15palette; |
| 72 | required_device<palette_device> m_bg8palette; |
| 73 | |
| 77 | 74 | }; |
trunk/src/mame/video/galpani2.c
| r242140 | r242141 | |
| 55 | 55 | WRITE16_MEMBER( galpani2_bg8_regs_1_w ) { galpani2_bg8_regs_w(space, offset, data, mem_mask, 1); } |
| 56 | 56 | #endif |
| 57 | 57 | |
| 58 | | inline void galpani2_state::galpani2_bg8_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_) |
| 59 | | { |
| 60 | | int x,y,pen; |
| 61 | | UINT16 newword = COMBINE_DATA(&m_bg8[_n_][offset]); |
| 62 | | pen = newword & 0xff; |
| 63 | | x = (offset % 512); /* 512 x 256 */ |
| 64 | | y = (offset / 512); |
| 65 | | m_bg8_bitmap[_n_]->pix16(y, x) = 0x4000 + pen; |
| 66 | | } |
| 67 | 58 | |
| 68 | | WRITE16_MEMBER( galpani2_state::galpani2_bg8_0_w ) { galpani2_bg8_w(offset, data, mem_mask, 0); } |
| 69 | | WRITE16_MEMBER( galpani2_state::galpani2_bg8_1_w ) { galpani2_bg8_w(offset, data, mem_mask, 1); } |
| 70 | 59 | |
| 71 | | inline void galpani2_state::galpani2_palette_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_) |
| 72 | | { |
| 73 | | UINT16 newword = COMBINE_DATA(&m_palette_val[_n_][offset]); |
| 74 | | m_palette->set_pen_color( offset + 0x4000 + _n_ * 0x100, pal5bit(newword >> 5), pal5bit(newword >> 10), pal5bit(newword >> 0) ); |
| 75 | | } |
| 76 | | |
| 77 | | WRITE16_MEMBER( galpani2_state::galpani2_palette_0_w ) { galpani2_palette_w(offset, data, mem_mask, 0); } |
| 78 | | WRITE16_MEMBER( galpani2_state::galpani2_palette_1_w ) { galpani2_palette_w(offset, data, mem_mask, 1); } |
| 79 | | |
| 80 | | |
| 81 | 60 | /*************************************************************************** |
| 82 | 61 | |
| 83 | 62 | |
| 84 | | xRGB Background Layer |
| 85 | | |
| 86 | | |
| 87 | | ***************************************************************************/ |
| 88 | | |
| 89 | | /* 8 horizontal pages of 256x256 pixels? */ |
| 90 | | WRITE16_MEMBER( galpani2_state::galpani2_bg15_w ) |
| 91 | | { |
| 92 | | UINT16 newword = COMBINE_DATA(&m_bg15[offset]); |
| 93 | | |
| 94 | | int x = (offset % 256) + (offset / (256*256)) * 256 ; |
| 95 | | int y = (offset / 256) % 256; |
| 96 | | |
| 97 | | m_bg15_bitmap->pix16(y, x) = 0x4200 + (newword & 0x7fff); |
| 98 | | } |
| 99 | | |
| 100 | | |
| 101 | | /*************************************************************************** |
| 102 | | |
| 103 | | |
| 104 | 63 | Video Init Functions |
| 105 | 64 | |
| 106 | 65 | |
| r242140 | r242141 | |
| 113 | 72 | |
| 114 | 73 | /* initialize 555 RGB lookup */ |
| 115 | 74 | for (i = 0; i < 0x8000; i++) |
| 116 | | palette.set_pen_color(0x4200+i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); |
| 75 | palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); |
| 117 | 76 | } |
| 118 | 77 | |
| 119 | 78 | void galpani2_state::video_start() |
| 120 | 79 | { |
| 121 | | m_bg15_bitmap = auto_bitmap_ind16_alloc(machine(), 256*8, 256); |
| 122 | | m_bg8_bitmap[0] = auto_bitmap_ind16_alloc(machine(), 512, 256); |
| 123 | | m_bg8_bitmap[1] = auto_bitmap_ind16_alloc(machine(), 512, 256); |
| 124 | 80 | } |
| 125 | 81 | |
| 126 | 82 | |
| r242140 | r242141 | |
| 132 | 88 | |
| 133 | 89 | ***************************************************************************/ |
| 134 | 90 | |
| 135 | | UINT32 galpani2_state::screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 91 | // based on videos these 8-bit layers actually get *blended* against the RGB555 layer |
| 92 | // it should be noted that in the layer at 0x500000 the upper 8 bits are set too, this could be related |
| 93 | void galpani2_state::copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer) |
| 136 | 94 | { |
| 95 | int x = - ( *m_bg8_scrollx[layer] + 0x200 - 0x0f5 ); |
| 96 | int y = - ( *m_bg8_scrolly[layer] + 0x200 - 0x1be ); |
| 97 | UINT16* ram = m_bg8[layer]; |
| 98 | |
| 99 | const pen_t *clut = &m_bg8palette->pen(0); |
| 100 | for (int xx = 0; xx < 320; xx++) |
| 101 | { |
| 102 | for (int yy = 0; yy < 240; yy++) |
| 103 | { |
| 104 | UINT16 pen = ram[(((y + yy) & 0xff) * 512) + ((x + xx) & 0x1ff)]; |
| 105 | if (pen) bitmap.pix32(yy, xx) = clut[pen & 0xff]; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // this seems to be 256x256 pages (arranged as 1024*256), but the game resolution is 320x240 |
| 111 | // https://www.youtube.com/watch?v=2b2SLFtC0uA is a video of the galpanic2j set, and shows the RGB pattern at |
| 112 | // startup covering all screen lines - is the hardware mixing bitmaps of different resolutions or is there a |
| 113 | // line select somewhere? I should find the gal images and find what resolution they're stored at too. |
| 114 | // (or is this just wrong format / layout due to protection?) |
| 115 | void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 116 | { |
| 117 | UINT16* ram = m_bg15 + 0x40000/2; |
| 118 | |
| 119 | //int x = 0; |
| 120 | //int y = 0; |
| 121 | |
| 122 | const pen_t *clut = &m_bg15palette->pen(0); |
| 123 | for (int xx = 0; xx < 320; xx++) |
| 124 | { |
| 125 | for (int yy = 0; yy < 240; yy++) |
| 126 | { |
| 127 | UINT16 pen = ram[(xx * 0x800) + yy]; |
| 128 | bitmap.pix32(yy, xx) = clut[pen & 0x7fff]; |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | UINT32 galpani2_state::screen_update_galpani2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 134 | { |
| 137 | 135 | int layers_ctrl = -1; |
| 138 | 136 | |
| 139 | | #ifdef MAME_DEBUG |
| 137 | #if 1 // MAME_DEBUG |
| 140 | 138 | if (machine().input().code_pressed(KEYCODE_Z)) |
| 141 | 139 | { |
| 142 | 140 | int msk = 0; |
| r242140 | r242141 | |
| 151 | 149 | bitmap.fill(0, cliprect); |
| 152 | 150 | screen.priority().fill(0, cliprect); |
| 153 | 151 | |
| 154 | | if (layers_ctrl & 0x1) |
| 155 | | { |
| 156 | | int x = 0; |
| 157 | | int y = 0; |
| 158 | | copyscrollbitmap_trans(bitmap, *m_bg15_bitmap, |
| 159 | | 1, &x, 1, &y, |
| 160 | | cliprect,0x4200 + 0); |
| 161 | | } |
| 162 | | |
| 163 | 152 | /* test mode: |
| 164 | 153 | 304000:0040 0000 0100 0000-0000 0000 0000 0000 (Sprite regs) |
| 165 | 154 | 304010:16C0 0200 16C0 0200-16C0 0200 16C0 0200 |
| 166 | 155 | 16c0/40 = 5b 200/40 = 8 |
| 167 | 156 | scrollx = f5, on screen x should be 0 (f5+5b = 150) */ |
| 168 | 157 | |
| 169 | | if (layers_ctrl & 0x2) |
| 170 | | { |
| 171 | | int x = - ( *m_bg8_scrollx[0] + 0x200 - 0x0f5 ); |
| 172 | | int y = - ( *m_bg8_scrolly[0] + 0x200 - 0x1be ); |
| 173 | | copyscrollbitmap_trans(bitmap, *m_bg8_bitmap[0], |
| 174 | | 1, &x, 1, &y, |
| 175 | | cliprect,0x4000 + 0); |
| 176 | | } |
| 177 | | |
| 178 | | if (layers_ctrl & 0x4) |
| 179 | | { |
| 180 | | int x = - ( *m_bg8_scrollx[1] + 0x200 - 0x0f5 ); |
| 181 | | int y = - ( *m_bg8_scrolly[1] + 0x200 - 0x1be ); |
| 182 | | copyscrollbitmap_trans(bitmap, *m_bg8_bitmap[1], |
| 183 | | 1, &x, 1, &y, |
| 184 | | cliprect,0x4000 + 0); |
| 185 | | } |
| 186 | | |
| 158 | if (layers_ctrl & 0x1) copybg15(screen, bitmap, cliprect); |
| 159 | if (layers_ctrl & 0x2) copybg8(screen, bitmap, cliprect, 0); |
| 160 | if (layers_ctrl & 0x4) copybg8(screen, bitmap, cliprect, 1); |
| 187 | 161 | if (layers_ctrl & 0x8) m_kaneko_spr->kaneko16_render_sprites(bitmap, cliprect, screen.priority(), m_spriteram, m_spriteram.bytes()); |
| 188 | 162 | return 0; |
| 189 | 163 | } |