src/mess/video/arcadia.c
| r3460 | r3461 | |
| 1 | 1 | /****************************************************************************** |
| 2 | | PeT mess@utanet.at 2001 |
| 3 | | ******************************************************************************/ |
| 4 | | #include "driver.h" |
| 5 | | #include "includes/arcadia.h" |
| 2 | Consolidation and enhancment of documentation by Manfred Schneider based on previous work from |
| 3 | PeT mess@utanet.at and Paul Robson (autismuk@aol.com) |
| 6 | 4 | |
| 7 | | /* TODO: implement the RESET key on the front panel |
| 8 | | uncrapify the color table code |
| 9 | | find a dump of the charactyer ROM |
| 10 | | convert the drawing code to tilemap |
| 5 | Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ |
| 11 | 6 | |
| 12 | | Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ |
| 7 | TODO: find a dump of the charactyer ROM |
| 8 | convert the drawing code to tilemap |
| 13 | 9 | |
| 14 | | */ |
| 15 | | |
| 16 | | /* |
| 17 | 10 | emulation of signetics 2637 video/audio device |
| 18 | 11 | |
| 19 | | seams to me like a special microcontroller |
| 20 | | mask programmed |
| 21 | | 1k x 8 ram available; only first 0x300 bytes mapped to cpu |
| 22 | | */ |
| 12 | General |
| 13 | The UVI is capable of controlling 512 Bytes of RAM. It also generates a select signal |
| 14 | for a 128 byte wide area. |
| 15 | This whole addres space maps in the arcadia and compatible machines from $1800 - $1AFF. |
| 23 | 16 | |
| 24 | | /* |
| 25 | | 0x18fe bit 4 set means sound off? |
| 17 | 1. Video Memory |
| 26 | 18 | |
| 27 | | Sound is implemented on the latest code version, but I lost the |
| 28 | | source to it. I *think* it's a straightforward value to frequency |
| 29 | | calculation, might be 7874/(n+1) (from the Acetronic system), |
| 30 | | but it is almost certainly something like |
| 31 | | |
| 32 | | Clock Freq / (2^Something) / (Byte Data + 1) |
| 33 | | |
| 34 | | It is more or less right on the release version, so a bit of |
| 35 | | experimenting should come up with the right code. |
| 36 | | |
| 37 | | I also believe (and this isn't clear from the tech I think) that |
| 38 | | the CPU is frozen during display time. |
| 39 | | |
| 40 | | PSR |
| 41 | | |
| 42 | | |
| 43 | | Technical Information about the Emerson Arcadia 2001 |
| 44 | | |
| 45 | | Written by Paul Robson (autismuk@aol.com) |
| 46 | | |
| 47 | | Created on 25th June 1998. |
| 48 | | Last updated on 22nd July 1998. |
| 49 | | |
| 50 | | Introduction |
| 51 | | ------------ |
| 52 | | |
| 53 | | This document is an attempt to exactly describe the internal workings of |
| 54 | | the Emerson Arcadia 2001 Videogame Console. |
| 55 | | |
| 56 | | 1. General |
| 57 | | ---------- |
| 58 | | |
| 59 | | - Signetics 2650 CPU at 3.58 Mhz |
| 60 | | - 1k x 8 of RAM (physically present but mostly unavailable :-( ) |
| 61 | | - 128 x 208 pixel resolution (alternate 128 x 104 mode available) |
| 62 | | - 16 x 26 background display (2 colour 8 x 8 pixel characters) (can be 16x13= |
| 63 | | ) |
| 64 | | - 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels) |
| 65 | | - total of 8 user defined characters available... jaw drops in amazement. |
| 66 | | - 2 x 2 axis Analogue Joysticks |
| 67 | | - 2 x 12 button Controllers |
| 68 | | - 3 buttons on system unit and CPU Reset |
| 69 | | - Single channel beeper |
| 70 | | |
| 71 | | 2. Memory map |
| 72 | | ------------- |
| 73 | | |
| 74 | | The memory map of the 2001 is below. |
| 75 | | |
| 76 | | 0000..0FFF 4k ROM Block 1 (first 4k of a cartridge) |
| 77 | | 1000..17FF (Unmapped) |
| 78 | | 1800..18CF Screen display , upper 13 lines, characters/palette high bit= |
| 79 | | s |
| 80 | | 18D0..18EF Free for user programs. |
| 81 | | 18F0..18F7 Sprite coordinates y0x0y1x1y2x2y3x3 (Section 10). |
| 82 | | The sprite uses a UDG 0 =3D $1980,1 =3D $1988,2 =3D $1990 3=20= |
| 83 | | =3D $1998 |
| 84 | | 18F8..18FB User memory. |
| 85 | | 18FC A control byte, function unknown [is almost always EE ED or=20= |
| 86 | | EF] |
| 87 | | 18FD..18FE Sound Hardware Pitch & Volume. The 3 high bits of 18FE contr= |
| 88 | | ol |
| 89 | | the horizontal scanline scrolling. |
| 90 | | 18FF Current Character Line |
| 91 | | 1900..1902 Keypad Player 1 |
| 92 | | 1903 Unmapped |
| 93 | | 1904..1906 Keypad Player 2 |
| 94 | | 1907 Unmapped |
| 95 | | 1908 Controller Buttons |
| 96 | | 1909..197F Unmapped |
| 97 | | 1980..19BF User defined characters (8 possible, 8 bytes per character) |
| 98 | | 19C0..19F7 Unknown usage - not used for anything, apparently. |
| 99 | | 19F8 Screen resolution (bit 6) |
| 100 | | 19F9 Background Colour / Colour #0 (bits 0..5) |
| 101 | | 19FA Sprite Colour 2 & 3 (bits 0..5) |
| 102 | | 19FB Sprite Colour 0 & 1 (bits 0..5) |
| 103 | | 19FC..19FD Sprite-Sprite & Sprite-Background Collision bits (see later) |
| 104 | | 19FE..19FF Paddles (read only) 19FE is Player 2 , 19FF is Player 1 |
| 105 | | 1A00..1ACF Screen display , lower 13 lines, characters/palette high bit= |
| 106 | | s |
| 107 | | 1AD0..1AFF User memory |
| 108 | | 1B00..1FFF Unmapped |
| 109 | | 2000..2FFF 4k ROM Block 2 (for 8k carts such as Jungler) |
| 110 | | 3000..7FFF Unknown. The flyers talk about the ability to have 28k |
| 111 | | carts. This would only be feasible if 0000-7FFF was all ROM |
| 112 | | except for the '1111' page. |
| 113 | | |
| 114 | | 3. Video Memory |
| 115 | | --------------- |
| 116 | | |
| 117 | 19 | The screen table is at 1800-CF and 1A00-CF. Each page has 13 lines of the |
| 118 | 20 | screen (16 bytes per line,26 lines in total, 208 scan lines). The 2 most |
| 119 | 21 | significant bits of each byte are colour data, the 6 least significant |
| r3460 | r3461 | |
| 145 | 47 | half width/double height perhaps. Breakaway sets this when the bats are |
| 146 | 48 | double size in vertical mode. |
| 147 | 49 | |
| 148 | | 4. Character codes |
| 149 | | ------------------ |
| 150 | 50 | |
| 51 | 2. Character codes |
| 52 | |
| 151 | 53 | Character codes 00..37 to be in a ROM somewhere in the Emerson. These |
| 152 | 54 | are known, others may be discovered by comparing the screen snapshots |
| 153 | 55 | against the character tables. If the emulator displays an exclamation |
| r3460 | r3461 | |
| 159 | 61 | 10..19 0..9 |
| 160 | 62 | 1A..33 A..Z |
| 161 | 63 | 34 Decimal Point |
| 162 | | 35..37 Unknown - Control Characters ? |
| 64 | 35 comma |
| 65 | 36 + |
| 66 | 37 $ |
| 163 | 67 | 38..3F User Defined Characters (8 off, from 1980..19FF) |
| 164 | 68 | |
| 165 | 69 | Character data is stored 8 bits per character , as a single plane graphic |
| r3460 | r3461 | |
| 167 | 71 | are two colours per character and 4 possible palette selections for the |
| 168 | 72 | background. |
| 169 | 73 | |
| 170 | | A character set is available from Paul Robson (autismuk@aol.com) on |
| 171 | | request. |
| 172 | 74 | |
| 173 | | 5. ROM Images |
| 174 | | ------------- |
| 75 | 3. Sound |
| 175 | 76 | |
| 176 | | ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM it is |
| 177 | | also loaded into 2000-2FFF. I do not know how 12k images or greater |
| 178 | | are mapped but I doubt that many exist (there is very little RAM |
| 179 | | available for user programs). |
| 77 | fixed frequency sound and random Noise generator. |
| 78 | 18FD pitch (lower 7 bits) |
| 79 | 18FE volume ( bits 0 - 2) |
| 80 | 18fe bit 3 set means sound on |
| 81 | 18fe bit 4 set means random noise on |
| 180 | 82 | |
| 181 | | 6. Controls |
| 182 | | ----------- |
| 83 | Calculation of sound frequency is done as follows |
| 84 | 1/Freq = 2 (pitch +1) * (horizontal line period) |
| 183 | 85 | |
| 184 | | All key controls are indicated by a bit going to '1'. Unused bits at |
| 185 | | the memory location are set to zero. |
| 86 | |
| 87 | 4. Sprites |
| 186 | 88 | |
| 187 | | Keypads |
| 188 | | ------- |
| 189 | | |
| 190 | | 1900-1902 (Player 1) 1904-1906 (Player 2) |
| 191 | | |
| 192 | | The keypads are arranged as follows :- |
| 193 | | |
| 194 | | 1 2 3 |
| 195 | | 4 5 6 |
| 196 | | 7 8 9 |
| 197 | | Enter 0 Clear |
| 198 | | |
| 199 | | Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6 |
| 200 | | The topmost key is bit 3, the lowermost key is bit 0. |
| 201 | | |
| 202 | | Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty. |
| 203 | | These keys are "latched" i.e. a press causes a logic 1 to appear |
| 204 | | on the current frame. |
| 205 | | |
| 206 | | The paddles are mapped onto 19FE (player 2) and 19FF (player 1). The |
| 207 | | currently selected direction seems to toggle every frame, and the |
| 208 | | only way it seems to be possible to work out which axis is being |
| 209 | | accessed is to count the number of frames. Each game I have tried |
| 210 | | is doing this. "Cat Tracks" swaps the paddles every game ; the reason |
| 211 | | is as yet unknown. |
| 212 | | |
| 213 | | The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and |
| 214 | | 1905 bit 3. |
| 215 | | |
| 216 | | 7. Sound |
| 217 | | -------- |
| 218 | | |
| 219 | | Single channel buzz. Need to do more with this ! |
| 220 | | |
| 221 | | 18FC control byte ? |
| 222 | | 18FD pitch |
| 223 | | 18FE volume ? (lower 4 bits) |
| 224 | | |
| 225 | | 8. Sprites |
| 226 | | ---------- |
| 227 | | |
| 228 | 89 | Sprite pointers are at 18F0..18F7 (there are four of them). The graphics |
| 229 | 90 | used are the ones in the 1980..19BF UDG table (the first four). |
| 230 | 91 | |
| 231 | | Sprite addresses (x,y) are converted to offsets in the 128 x 208 as follows=20= |
| 232 | | :- |
| 92 | Sprite addresses (x,y) are converted to offsets in the 128 x 208 as follows: |
| 233 | 93 | |
| 234 | 94 | 1) 1's complement the y coordinate |
| 235 | 95 | 2) subtract 16 from the y coordinate |
| 236 | | 3) subtract 44 from the x coordinate |
| 96 | 3) subtract 43 from the x coordinate |
| 237 | 97 | |
| 238 | | 9. Palette |
| 239 | | ---------- |
| 98 | 5. Palette |
| 240 | 99 | |
| 241 | 100 | The Palette is encoded between 19F8-19FB. This section describes the method |
| 242 | | by which colours are allocated. There are 8 colours, information is coded 3=20 |
| 243 | | bits per colour (usually 2 colours per byte) |
| 101 | by which colours are allocated. There are 8 colours, information is coded |
| 102 | 3 bits per colour (usually 2 colours per byte) |
| 244 | 103 | |
| 245 | | Colour Code Name Colour Elements |
| 246 | | ------ ---- ---- --------------- |
| 247 | | 7 111 Black (GRB =3D 000) |
| 248 | | 6 110 Blue (GRB =3D 001) |
| 249 | | 5 101 Red (GRB =3D 010) |
| 250 | | 4 100 Magenta (GRB =3D 011) |
| 251 | | 3 011 Green (GRB =3D 100) |
| 252 | | 2 010 Cyan (GRB =3D 101) |
| 253 | | 1 001 Yellow (GRB =3D 110) |
| 254 | | 0 000 White (GRB =3D 111) |
| 104 | Colour Code Name |
| 105 | ------ ----- ------- |
| 106 | 7 111 Black |
| 107 | 6 110 Blue |
| 108 | 5 101 Red |
| 109 | 4 100 Magenta |
| 110 | 3 011 Green |
| 111 | 2 010 Cyan |
| 112 | 1 001 Yellow |
| 113 | 0 000 White |
| 255 | 114 | |
| 256 | | Bits 0..2 of $19F9 are the background colour |
| 257 | | Bits 3..5 of $19F9 are the colours of tile set 0 |
| 258 | | tiles 1,2 and 3 are generated by adding 2,4,6 to the colour. |
| 259 | | this is probably what the xor gates are for ! |
| 260 | | Bits 0..5 of $19FB are the colours of Sprites 0 & 1 (sprite 1 is low bits) |
| 115 | Bits 0..2 of $19F9 are the screen colour |
| 116 | Bits 3..5 of $19F9 are the colours of characters |
| 117 | Bit 6 of $19f9 is for poti axis |
| 118 | Bit 7 of $19f9 is for character size (1 = 8x8; 0 = 8x16) |
| 261 | 119 | Bits 0..5 of $19FA are the colours of Sprites 2 & 3 (sprite 3 is low bits) |
| 120 | Bit 6 of $19FA is for size of sprite 3 (0 = 8x16; 1 = 8x8) |
| 121 | Bit 7 of $19FA is for size of sprite 2 (0 = 8x16; 1 = 8x8) |
| 122 | Bits 0..5 of $19FB are the colours of Sprites 0 & 1 (sprite 1 is low bits) |
| 123 | Bit 6 of $19FB is for size of sprite 1 (0 = 8x16; 1 = 8x8) |
| 124 | Bit 7 of $19FB is for size of sprite 0 (0 = 8x16; 1 = 8x8) |
| 262 | 125 | |
| 263 | | Bits 6..7 of $19F9..B and all of $19F8 (except bit 6) currently has |
| 264 | | no known function. Brightness ??? |
| 265 | 126 | |
| 266 | | 10. Collision Detection |
| 267 | | ----------------------- |
| 127 | 6. Collision Detection |
| 268 | 128 | |
| 269 | 129 | Bits are set to zero on a collision - I think they are reset at the |
| 270 | 130 | frame start. There are two locations : one is for sprite/background |
| r3460 | r3461 | |
| 279 | 139 | bit 4 is sprite 1 / 3 collision (guess) |
| 280 | 140 | bit 5 is sprite 2 / 3 collision (guess) |
| 281 | 141 | |
| 282 | | 11. Other information |
| 283 | | --------------------- |
| 284 | | |
| 285 | | Interrupts are not supported.. maybe. All cartridges have a RETC UN |
| 286 | | at 0003 (presumably the interrupt vector). This may be called on VSYNC |
| 287 | | or VBLANK, but until I find a cart which uses it, who cares ! |
| 288 | | |
| 289 | | The Read/Write 2650 CPU Commands do not appear to be connected to |
| 290 | | anything in hardware. No cartridge has been found which uses them. |
| 291 | | The emulator crashes to the debugger with these commands, as it does |
| 292 | | with any illegal commands. |
| 293 | | |
| 294 | | 12. Frame Description |
| 295 | | --------------------- |
| 296 | | |
| 297 | | This describes the frame rendition (for NTSC). The description Starts at |
| 298 | | the end of a display frame, e.g. scanline 216 on the diagram. For a PAL |
| 299 | | machine these will be slightly different - however I don't think that |
| 300 | | this would affect anything because of the way timing is usually done on |
| 301 | | games, and the fact that scanline level operations are virtually |
| 302 | | impossible. |
| 303 | | |
| 304 | | 1. Set the VBLANK (SENSE) line to logic 1, indicating entry of vblank |
| 305 | | 2. Set the current character address to $FD (off screen) |
| 306 | | 3. Wait for 46+8 Scanlines. (see frame diagram) |
| 307 | | 4. Set the VBLANK (SENSE) line to logic 0. |
| 308 | | 5. Reset the Collision Bytes to $FF |
| 309 | | 6. For 1800..18C0, then for 1A00..1AC0 (if not low resolution) |
| 310 | | 6a. Set the current character address to $Fx |
| 311 | | 6b. wait for 8 (standard) or 16 (low resolution) Scanlines |
| 312 | | 6c. Render the line using the current character & vertical scroll data |
| 313 | | 6d. Draw all sprites which terminate in the area just drawn. |
| 314 | | 7. Restart the frame (from Stage 1). |
| 315 | | |
| 316 | | Stage 5 can be replaced by execute 208 Scanlines if this is not a 'redraw' |
| 317 | | frame. |
| 318 | | |
| 319 | | 0 --------------------------- |
| 320 | | ! Initial Vertical Blank ! |
| 321 | | 8 --------------------------- |
| 322 | | ! Display (208 scanlines) ! |
| 323 | | 216 --------------------------- |
| 324 | | ! Frame Retrace ! |
| 325 | | 262 --------------------------- |
| 326 | | |
| 327 | | --------------------------------------------------------------- |
| 328 | | |
| 329 | | pet additions: |
| 330 | | Golf has a 4kbyte block at 0x0000 and a 2kbyte block at 0x4000. |
| 331 | | |
| 332 | | 19f9 bit 6 |
| 333 | | switches between the axes of the analog stick |
| 334 | | of both? players |
| 335 | | (must not affect ad converter immediately) |
| 336 | | |
| 337 | | Sprites are used around the playfield a lot |
| 338 | | (space vultures, grand slam tennis, space attack, ...) |
| 339 | | some cartridges think the left 16? pixels are not displayed |
| 340 | | so I display a 32 pixel frame left and right, |
| 341 | | a 8 pixel frame at the top and a bottom frame of 24 pixel |
| 342 | | |
| 343 | | character color ((ch&0xc0)>>5) | ((mem[0x19f9]&8)>>3) |
| 344 | | |
| 345 | | 1903 palladium player 1 4 additional keys |
| 346 | | 1907 palladium player 2 4 additional keys |
| 347 | | |
| 348 | | 19f8 bit 6 |
| 349 | | off 13 charlines |
| 350 | | on 26 charlines |
| 351 | | 19f9 |
| 352 | | bit 7 |
| 353 | | off doublescan |
| 354 | | on no doublescan |
| 355 | | |
| 142 | |
| 143 | 7. Graphic Mode |
| 356 | 144 | 19f8 bit 7 graphics mode on (lower 6 bits descripe rectangles) |
| 357 | 145 | 0xc0 in line switches to graphics mode in this line |
| 358 | 146 | 0x40 in line switches to char mode in this line |
| 359 | | 22111000 |
| 360 | | 22111000 |
| 361 | | 22111000 |
| 362 | | 22111000 |
| 363 | | 55444333 |
| 364 | | 55444333 |
| 365 | | 55444333 |
| 366 | | 55444333 |
| 147 | 22211100 |
| 148 | 22211100 |
| 149 | 22211100 |
| 150 | 22211100 |
| 151 | 55544433 |
| 152 | 55544433 |
| 153 | 55544433 |
| 154 | 55544433 |
| 367 | 155 | |
| 368 | | sprite doublescanned (vertical enlarged) |
| 369 | | sprite 0 0x19fb bit 7 |
| 370 | | sprite 1 0x19fb bit 6 |
| 371 | | sprite 2 0x19fa bit 7 |
| 372 | | sprite 3 0x19fa bit 6 |
| 373 | | |
| 374 | | 18fc crtc vertical position register |
| 375 | | in PAL palladium |
| 376 | | 0xff 16*16+6 visible |
| 377 | | about 8 lines above and below |
| 378 | | 0x00 in PAL palladium |
| 379 | | 7 lines visible |
| 380 | | |
| 381 | | 18fd |
| 382 | | bit 7 on |
| 383 | | alternate character mode color2x2 |
| 384 | | (2 backgrounds, 2 foreground colors) |
| 385 | | |
| 386 | | color2x2 |
| 387 | | character bit 7 -> background select |
| 388 | | 0 19f8 bits 2..0 |
| 389 | | 1 19f9 bits 2..0 |
| 390 | | character bit 6 -> foreground select |
| 391 | | 0 19f8 bits 5..3 |
| 392 | | 1 19f9 bits 5..3 |
| 393 | | |
| 394 | | normal mode: |
| 395 | | character bit 7..6 foreground colors bits 2..1 |
| 396 | | 19f9 bits 0..2 ->background color |
| 397 | | 19f9 bit3 foreground color bit 0 |
| 398 | | |
| 399 | | 19f8, 19f9 readback alway 0xff |
| 400 | | 1900 readback 0x5y |
| 401 | | 17bf readback 0x54 |
| 402 | | 1b00 holds value for a moment, gets 0x50 |
| 403 | | |
| 404 | | sprite y position |
| 405 | | basically the same as crtc vertical psoition register, but 1 line later |
| 406 | | |
| 407 | | sprite x position |
| 408 | | not 44 but 43 |
| 409 | | |
| 156 | 8. Memory Map |
| 157 | The offsets in the following memory Map are from the view of the UVI. |
| 158 | In the arcadia and compatibles the base offset is $1800 thats how the CPU sees the UVI |
| 159 | |
| 160 | 0000 - 00FF external RAM |
| 161 | 0000 - 00CF upper screen character/graphics codes organised as 16 char x 13 rows |
| 162 | 00D0 - 00EF RAM (not used by UVI, can be used by CPU) |
| 163 | 00F0 vertical offset object 0 |
| 164 | 00F1 horizontal offset object 0 |
| 165 | 00F2 vertical offset object 1 |
| 166 | 00F3 horizontal offset object 1 |
| 167 | 00F4 vertical offset object 2 |
| 168 | 00F5 horizontal offset object 2 |
| 169 | 00F6 vertical offset object 3 |
| 170 | 00F7 horizontal offset object 3 |
| 171 | 00F8 - 00FB RAM (not used by UVI, can be used by CPU) |
| 172 | 00FC complement number of rows from the trailing edge of VRST |
| 173 | to the start of character display |
| 174 | 00FD bit0 - 6 sound frequeny, bit 7 color mode |
| 175 | 00FE bit0 - 2 loudness, bit 3 sound enable when set, bit 4 random noise enable when set |
| 176 | bit 5 - 7 delay for row of characters |
| 177 | 00FF bit 0 - 3 DMA number, bit 4 - 7 unused |
| 178 | 0100 - 017F CE area. In arcadia used for keypad. |
| 179 | 0180 - 01FF internal UVI registers |
| 180 | 0180 - 0187 image of object 0 or UDC-code $38 |
| 181 | 0188 - 018F image of object 1 or UDC-code $39 |
| 182 | 0190 - 0197 image of object 2 or UDC-code $3A |
| 183 | 0198 - 019F image of object 3 or UDC-code $3B |
| 184 | 01A0 - 01A7 image of UDC-code $3C |
| 185 | 01A8 - 01AF image of UDC-code $3D |
| 186 | 01B0 - 01B7 image of UDC-code $3E |
| 187 | 01B8 - 01BF image of UDC-code $3F |
| 188 | 01C0 - 01F7 unused |
| 189 | 01F8 bit 0 - 2 alternate screen color, bit 3 - 5 alternate character color |
| 190 | bit 6 Refresh mode when set entire character field will be display twice |
| 191 | bit 7 Grahics mode |
| 192 | 01F9 bit 0 - 2 screen color, bit 3 - 5 character color |
| 193 | bit 6 poti mux control |
| 194 | bit 7 character size when set size=8x8 else size=8x16 |
| 195 | 01FA bit 0 - 2 color of object 3, bit 3 - 5 color of object 2 |
| 196 | bit 6 size of object 3 when set size=8x8 else size=8x16 |
| 197 | bit 7 size of object 2 when set size=8x8 else size=8x16 |
| 198 | 01FB bit 0 - 2 color of object 1, bit 3 - 5 color of object 0 |
| 199 | bit 6 size of object 1 when set size=8x8 else size=8x16 |
| 200 | bit 7 size of object 0 when set size=8x8 else size=8x16 |
| 201 | 01FC object - character collision bits |
| 202 | bit 0 when low object 0 collided with character |
| 203 | bit 1 when low object 1 collided with character |
| 204 | bit 2 when low object 2 collided with character |
| 205 | bit 3 when low object 3 collided with character |
| 206 | bit 4 - 7 unused set to high |
| 207 | 01FD inter object collision |
| 208 | bit 0 - when low object 1 and 2 collide |
| 209 | bit 1 - when low object 1 and 3 collide |
| 210 | bit 2 - when low object 1 and 4 collide |
| 211 | bit 3 - when low object 2 and 3 collide |
| 212 | bit 4 - when low object 2 and 4 collide |
| 213 | bit 5 - when low object 3 and 4 collide |
| 214 | bit 6 - 7 unused set to high |
| 215 | 01FE digital value of POT1 or POT3 input. Valid only during VRST |
| 216 | 01FF digital value of POT2 or POT4 input. Valid only furing VRST |
| 217 | 0200 - 02FF 2nd external RAM |
| 218 | 0200 - 02CF lower screen character/graphics codes organised as 16 char x 13 rows |
| 219 | 02D0 - 02FF RAM (not used by UVI, can be used by CPU) |
| 410 | 220 | */ |
| 411 | 221 | |
| 222 | #include "driver.h" |
| 223 | #include "includes/arcadia.h" |
| 412 | 224 | |
| 413 | 225 | static UINT8 arcadia_rectangle[0x40][8]; |
| 414 | 226 | static UINT8 chars[0x40][8]={ |
| r3460 | r3461 | |
| 430 | 242 | { 255,254,252,248,240,224,192,128 }, //; 0E (diagonal block) |
| 431 | 243 | { 255,127,63,31,15,7,3,1 }, // ; 0F (diagonal block) |
| 432 | 244 | { 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c },// 10 0 |
| 433 | | { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 10 1 |
| 434 | | { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 10 2 |
| 435 | | { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 10 3 |
| 436 | | { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 10 4 |
| 437 | | { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 10 5 |
| 438 | | { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 10 6 |
| 439 | | { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 10 7 |
| 440 | | { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 10 8 |
| 441 | | { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 10 9 |
| 442 | | { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 10 A |
| 443 | | { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 10 B |
| 444 | | { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 10 C |
| 445 | | { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 10 D |
| 446 | | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 10 E |
| 447 | | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 10 F |
| 448 | | { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 10 G |
| 449 | | { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 10 H |
| 450 | | { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 10 I |
| 451 | | { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 10 J |
| 452 | | { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 10 K |
| 453 | | { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 10 L |
| 454 | | { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 10 M |
| 455 | | { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 10 N |
| 456 | | { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 10 O |
| 457 | | { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 10 P |
| 458 | | { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 10 Q |
| 459 | | { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 10 R |
| 460 | | { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 10 S |
| 461 | | { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 10 T |
| 462 | | { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 10 U |
| 463 | | { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 10 V |
| 464 | | { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 10 W |
| 465 | | { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 10 X |
| 466 | | { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 10 Y |
| 467 | | { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 10 Z |
| 245 | { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 11 1 |
| 246 | { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 12 2 |
| 247 | { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 13 3 |
| 248 | { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 14 4 |
| 249 | { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 15 5 |
| 250 | { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 16 6 |
| 251 | { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 17 7 |
| 252 | { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 18 8 |
| 253 | { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 19 9 |
| 254 | { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 1A A |
| 255 | { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 1B B |
| 256 | { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 1C C |
| 257 | { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 1D D |
| 258 | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 1E E |
| 259 | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 1F F |
| 260 | { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 20 G |
| 261 | { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 21 H |
| 262 | { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 22 I |
| 263 | { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 23 J |
| 264 | { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 24 K |
| 265 | { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 25 L |
| 266 | { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 26 M |
| 267 | { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 27 N |
| 268 | { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 28 O |
| 269 | { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 29 P |
| 270 | { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 2A Q |
| 271 | { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 2B R |
| 272 | { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 2C S |
| 273 | { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 2D T |
| 274 | { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 2E U |
| 275 | { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 2F V |
| 276 | { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 30 W |
| 277 | { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 31 X |
| 278 | { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 32 Y |
| 279 | { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 33 Z |
| 468 | 280 | { 0,0,0,0,0,0,0,8 }, // 34 . |
| 469 | 281 | { 0,0,0,0,0,8,8,0x10 }, // 35 , |
| 470 | 282 | { 0,0,8,8,0x3e,8,8,0 }, // 36 + |
| r3460 | r3461 | |
| 488 | 300 | int breaker; |
| 489 | 301 | union { |
| 490 | 302 | UINT8 data[0x400]; |
| 491 | | struct { |
| 492 | | // 0x1800 |
| 493 | | UINT8 chars1[13][16]; |
| 494 | | UINT8 ram1[2][16]; |
| 495 | | struct { |
| 496 | | UINT8 y,x; |
| 497 | | } pos[4]; |
| 498 | | UINT8 ram2[4]; |
| 499 | | UINT8 vpos; |
| 500 | | UINT8 sound1, sound2; |
| 501 | | UINT8 char_line; |
| 502 | | // 0x1900 |
| 503 | | UINT8 pad1a, pad1b, pad1c, pad1d; |
| 504 | | UINT8 pad2a, pad2b, pad2c, pad2d; |
| 505 | | UINT8 keys, unmapped3[0x80-9]; |
| 506 | | UINT8 chars[8][8]; |
| 507 | | UINT8 unknown[0x38]; |
| 508 | | UINT8 pal[4]; |
| 509 | | UINT8 collision_bg, |
| 510 | | collision_sprite; |
| 511 | | UINT8 ad[2]; |
| 512 | | // 0x1a00 |
| 513 | | UINT8 chars2[13][16]; |
| 514 | | UINT8 ram3[3][16]; |
| 515 | | } d; |
| 516 | | } reg; |
| 303 | struct { |
| 304 | // 0x1800 |
| 305 | UINT8 chars1[13][16]; |
| 306 | UINT8 ram1[2][16]; |
| 307 | struct { |
| 308 | UINT8 y,x; |
| 309 | } pos[4]; |
| 310 | UINT8 ram2[4]; |
| 311 | UINT8 vpos; |
| 312 | UINT8 sound1, sound2; |
| 313 | UINT8 char_line; |
| 314 | // 0x1900 |
| 315 | UINT8 pad1a, pad1b, pad1c, pad1d; |
| 316 | UINT8 pad2a, pad2b, pad2c, pad2d; |
| 317 | UINT8 keys, unmapped3[0x80-9]; |
| 318 | UINT8 chars[8][8]; |
| 319 | UINT8 unknown[0x38]; |
| 320 | UINT8 pal[4]; |
| 321 | UINT8 collision_bg, |
| 322 | collision_sprite; |
| 323 | UINT8 ad[2]; |
| 324 | // 0x1a00 |
| 325 | UINT8 chars2[13][16]; |
| 326 | UINT8 ram3[3][16]; |
| 327 | } d; |
| 328 | } reg; |
| 517 | 329 | bitmap_t *bitmap; |
| 518 | 330 | } arcadia_video={ 0 }; |
| 519 | 331 | |
| r3460 | r3461 | |
| 558 | 370 | case 0x108: data=input_port_read(machine, "panel");break; |
| 559 | 371 | #if 0 |
| 560 | 372 | case 0x1fe: |
| 561 | | if (arcadia_video.ad_select) data=input_port_read(machine, "controller1_joy_y")<<3; |
| 562 | | else data=input_port_read(machine, "controller1_joy_x")<<3; |
| 373 | if (arcadia_video.ad_select) |
| 374 | data=input_port_read(machine, "controller1_joy_y")<<3; |
| 375 | else |
| 376 | data=input_port_read(machine, "controller1_joy_x")<<3; |
| 563 | 377 | break; |
| 564 | 378 | case 0x1ff: |
| 565 | | if (arcadia_video.ad_select) data=input_port_read(machine, "controller2_joy_y")<<3; |
| 566 | | else data=input_port_read(machine, "controller2_joy_x")<<3; |
| 379 | if (arcadia_video.ad_select) |
| 380 | data=input_port_read(machine, "controller2_joy_y")<<3; |
| 381 | else |
| 382 | data=input_port_read(machine, "controller2_joy_x")<<3; |
| 567 | 383 | break; |
| 568 | 384 | #else |
| 569 | 385 | case 0x1fe: |
| r3460 | r3461 | |
| 595 | 411 | |
| 596 | 412 | WRITE8_HANDLER(arcadia_video_w) |
| 597 | 413 | { |
| 414 | arcadia_video.reg.data[offset]=data; |
| 598 | 415 | switch (offset) { |
| 599 | 416 | case 0xfc: |
| 600 | | arcadia_video.reg.data[offset]=data; |
| 601 | 417 | arcadia_video.ypos=255-data+YPOS; |
| 602 | 418 | break; |
| 603 | 419 | case 0xfd: |
| 604 | | arcadia_video.reg.data[offset]=data; |
| 605 | 420 | arcadia_soundport_w(machine, offset&3, data); |
| 606 | 421 | arcadia_video.multicolor=data&0x80; |
| 607 | 422 | break; |
| 608 | 423 | case 0xfe: |
| 609 | | arcadia_video.reg.data[offset]=data; |
| 610 | 424 | arcadia_soundport_w(machine, offset&3, data); |
| 611 | 425 | arcadia_video.shift=(data>>5); |
| 612 | 426 | break; |
| 613 | 427 | case 0xf0: case 0xf2: case 0xf4: case 0xf6: |
| 614 | | arcadia_video.reg.data[offset]=data; |
| 615 | 428 | arcadia_video.pos[(offset>>1)&3].y=(data^0xff)+1; |
| 616 | 429 | break; |
| 617 | 430 | case 0xf1: case 0xf3: case 0xf5: case 0xf7: |
| 618 | | arcadia_video.reg.data[offset]=data; |
| 619 | 431 | arcadia_video.pos[(offset>>1)&3].x=data-43; |
| 620 | 432 | break; |
| 621 | 433 | case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187: |
| r3460 | r3461 | |
| 626 | 438 | case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af: |
| 627 | 439 | case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7: |
| 628 | 440 | case 0x1b8: case 0x1b9: case 0x1ba: case 0x1bb: case 0x1bc: case 0x1bd: case 0x1be: case 0x1bf: |
| 629 | | arcadia_video.reg.data[offset]=data; |
| 630 | 441 | chars[0x38|((offset>>3)&7)][offset&7]=data; |
| 631 | 442 | break; |
| 632 | 443 | case 0x1f8: |
| 633 | | arcadia_video.reg.data[offset]=data; |
| 634 | 444 | arcadia_video.lines26=data&0x40; |
| 635 | 445 | arcadia_video.graphics=data&0x80; |
| 636 | 446 | break; |
| 637 | 447 | case 0x1f9: |
| 638 | | arcadia_video.reg.data[offset]=data; |
| 639 | 448 | arcadia_video.doublescan=!(data&0x80); |
| 640 | 449 | arcadia_video.ad_delay=10; |
| 641 | 450 | break; |
| 642 | | default: |
| 643 | | arcadia_video.reg.data[offset]=data; |
| 644 | 451 | } |
| 645 | 452 | } |
| 646 | 453 | |
| 647 | | INLINE void arcadia_draw_char(running_machine *machine, bitmap_t *bitmap, UINT8 *ch, int color, |
| 454 | INLINE void arcadia_draw_char(running_machine *machine, bitmap_t *bitmap, UINT8 *ch, int charcode, |
| 648 | 455 | int y, int x) |
| 649 | 456 | { |
| 650 | | /* 7-Sep-2007 - whomever wrote this crap code was dynamically remapping |
| 651 | | * the color table, a vile gross hack. Doesn't look like this is going |
| 652 | | * to survive the 0.118u5 transition */ |
| 653 | | int k,b; |
| 654 | | if (arcadia_video.multicolor) { |
| 655 | | int c; |
| 656 | | if (color&0x40) c=arcadia_video.reg.d.pal[1]; |
| 657 | | else c=arcadia_video.reg.d.pal[0]; |
| 658 | | /*imachine->gfx[0]->colortable[1]=(c>>3)&7;*/ |
| 457 | int k,b,cc,sc, colour; |
| 458 | if (arcadia_video.multicolor) |
| 459 | { |
| 460 | if (charcode&0x40) |
| 461 | cc=((arcadia_video.reg.d.pal[1]>>3)&7); |
| 462 | else |
| 463 | cc=((arcadia_video.reg.d.pal[0]>>3)&7); |
| 659 | 464 | |
| 660 | | if (color&0x80) c=arcadia_video.reg.d.pal[1]; |
| 661 | | else c=arcadia_video.reg.d.pal[0]; |
| 662 | | /*machine->gfx[0]->colortable[0]=c&7;*/ |
| 465 | if (charcode&0x80) |
| 466 | sc=(arcadia_video.reg.d.pal[1]&7); |
| 467 | else |
| 468 | sc=(arcadia_video.reg.d.pal[0]&7); |
| 663 | 469 | |
| 664 | | } else { |
| 665 | | /*machine->gfx[0]->colortable[1]= |
| 666 | | ((arcadia_video.reg.d.pal[1]>>3)&1)|((color>>5)&6);*/ |
| 470 | } |
| 471 | else |
| 472 | { |
| 473 | cc=((arcadia_video.reg.d.pal[1]>>3)&1)|((charcode>>5)&6); |
| 474 | sc=(arcadia_video.reg.d.pal[1]&7); |
| 667 | 475 | } |
| 476 | colour = (((sc << 3) | cc) + 4); |
| 668 | 477 | |
| 669 | | if (arcadia_video.doublescan) { |
| 670 | | for (k=0; (k<8)&&(y<bitmap->height); k++, y+=2) { |
| 478 | if (arcadia_video.doublescan) |
| 479 | { |
| 480 | for (k=0; (k<8)&&(y<bitmap->height); k++, y+=2) |
| 481 | { |
| 671 | 482 | b=ch[k]; |
| 672 | 483 | arcadia_video.bg[y][x>>3]|=b>>(x&7); |
| 673 | 484 | arcadia_video.bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| r3460 | r3461 | |
| 675 | 486 | if (y+1<bitmap->height) { |
| 676 | 487 | arcadia_video.bg[y+1][x>>3]|=b>>(x&7); |
| 677 | 488 | arcadia_video.bg[y+1][(x>>3)+1]|=b<<(8-(x&7)); |
| 678 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 489 | drawgfx(bitmap, machine->gfx[0], b,colour, |
| 679 | 490 | 0,0,x,y, |
| 680 | 491 | 0, TRANSPARENCY_NONE,0); |
| 681 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 492 | drawgfx(bitmap, machine->gfx[0], b,colour, |
| 682 | 493 | 0,0,x,y+1, |
| 683 | 494 | 0, TRANSPARENCY_NONE,0); |
| 684 | 495 | } |
| 685 | | } |
| 686 | | } else { |
| 687 | | for (k=0; (k<8)&&(y<bitmap->height); k++, y++) { |
| 496 | } |
| 497 | } |
| 498 | else |
| 499 | { |
| 500 | for (k=0; (k<8)&&(y<bitmap->height); k++, y++) |
| 501 | { |
| 688 | 502 | b=ch[k]; |
| 689 | 503 | arcadia_video.bg[y][x>>3]|=b>>(x&7); |
| 690 | 504 | arcadia_video.bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| 691 | 505 | |
| 692 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 506 | drawgfx(bitmap, machine->gfx[0], b,colour, |
| 693 | 507 | 0,0,x,y, |
| 694 | 508 | 0, TRANSPARENCY_NONE,0); |
| 695 | | } |
| 509 | } |
| 696 | 510 | } |
| 697 | 511 | } |
| 698 | 512 | |
| r3460 | r3461 | |
| 703 | 517 | int graphics=arcadia_video.graphics; |
| 704 | 518 | h=arcadia_video.doublescan?16:8; |
| 705 | 519 | |
| 706 | | if (bitmap->height-arcadia_video.line<h) h=bitmap->height-arcadia_video.line; |
| 707 | | plot_box(bitmap, 0, y, bitmap->width, h, 0); |
| 520 | if (bitmap->height-arcadia_video.line<h) |
| 521 | h=bitmap->height-arcadia_video.line; |
| 522 | |
| 523 | plot_box(bitmap, 0, y, bitmap->width, h, (arcadia_video.reg.d.pal[1]&7)); |
| 708 | 524 | memset(arcadia_video.bg[y], 0, sizeof(arcadia_video.bg[0])*h); |
| 709 | | for (x=XPOS+arcadia_video.shift, j=0; j<16;j++,x+=8) { |
| 710 | | ch=chars1[j]; |
| 711 | | // hangman switches with 0x40 |
| 712 | | // alien invaders shield lines start with 0xc0 |
| 713 | | if ((ch&0x3f)==0) { |
| 714 | | switch (ch) { |
| 715 | | case 0xc0: graphics=TRUE;break; |
| 716 | | case 0x40: graphics=FALSE;break; |
| 717 | | // case 0x80: |
| 525 | |
| 526 | for (x=XPOS+arcadia_video.shift, j=0; j<16;j++,x+=8) |
| 527 | { |
| 528 | ch=chars1[j]; |
| 529 | // hangman switches with 0x40 |
| 530 | // alien invaders shield lines start with 0xc0 |
| 531 | if ((ch&0x3f)==0) |
| 532 | { |
| 533 | switch (ch) { |
| 534 | case 0xc0: graphics=TRUE;break; |
| 535 | case 0x40: graphics=FALSE;break; |
| 536 | // case 0x80: |
| 718 | 537 | // alien invaders shields are empty 0x80 |
| 719 | | // popmessage(5, "graphics code 0x80 used"); |
| 720 | | } |
| 721 | | } |
| 722 | | if (graphics) |
| 723 | | arcadia_draw_char(machine, bitmap, arcadia_rectangle[ch&0x3f], ch, y, x); |
| 724 | | else |
| 725 | | arcadia_draw_char(machine, bitmap, chars[ch&0x3f], ch, y, x); |
| 538 | // popmessage(5, "graphics code 0x80 used"); |
| 539 | } |
| 540 | } |
| 541 | if (graphics) |
| 542 | arcadia_draw_char(machine, bitmap, arcadia_rectangle[ch&0x3f], ch, y, x); |
| 543 | else |
| 544 | arcadia_draw_char(machine, bitmap, chars[ch&0x3f], ch, y, x); |
| 726 | 545 | } |
| 727 | 546 | } |
| 728 | 547 | |
| r3460 | r3461 | |
| 746 | 565 | |
| 747 | 566 | static void arcadia_draw_sprites(running_machine *machine, bitmap_t *bitmap) |
| 748 | 567 | { |
| 749 | | int i, k, x, y; |
| 568 | int i, k, x, y, color=0; |
| 750 | 569 | UINT8 b; |
| 751 | 570 | |
| 752 | 571 | arcadia_video.reg.d.collision_bg|=0xf; |
| 753 | 572 | arcadia_video.reg.d.collision_sprite|=0x3f; |
| 754 | | for (i=0; i<4; i++) { |
| 573 | for (i=0; i<4; i++) |
| 574 | { |
| 755 | 575 | int doublescan = FALSE; |
| 756 | 576 | if (arcadia_video.pos[i].y<=-YPOS) continue; |
| 757 | 577 | if (arcadia_video.pos[i].y>=bitmap->height-YPOS-8) continue; |
| 758 | 578 | if (arcadia_video.pos[i].x<=-XPOS) continue; |
| 759 | 579 | if (arcadia_video.pos[i].x>=128+XPOS-8) continue; |
| 760 | 580 | |
| 761 | | /* 7-Sep-2007 - whomever wrote this crap code was dynamically remapping |
| 762 | | * the color table, a vile gross hack. Doesn't look like this is going |
| 763 | | * to survive the 0.118u5 transition */ |
| 764 | | switch (i) { |
| 581 | switch (i) |
| 582 | { |
| 765 | 583 | case 0: |
| 766 | | /*machine->gfx[0]->colortable[1]=(arcadia_video.reg.d.pal[3]>>3)&7;*/ |
| 584 | color=(arcadia_video.reg.d.pal[3]>>3)&7; |
| 767 | 585 | doublescan=arcadia_video.reg.d.pal[3]&0x80?FALSE:TRUE; |
| 768 | 586 | break; |
| 769 | 587 | case 1: |
| 770 | | /*machine->gfx[0]->colortable[1]=arcadia_video.reg.d.pal[3]&7;*/ |
| 588 | color=arcadia_video.reg.d.pal[3]&7; |
| 771 | 589 | doublescan=arcadia_video.reg.d.pal[3]&0x40?FALSE:TRUE; |
| 772 | 590 | break; |
| 773 | 591 | case 2: |
| 774 | | /*machine->gfx[0]->colortable[1]=(arcadia_video.reg.d.pal[2]>>3)&7;*/ |
| 592 | color=(arcadia_video.reg.d.pal[2]>>3)&7; |
| 775 | 593 | doublescan=arcadia_video.reg.d.pal[2]&0x80?FALSE:TRUE; |
| 776 | 594 | break; |
| 777 | 595 | case 3: |
| 778 | | /*machine->gfx[0]->colortable[1]=arcadia_video.reg.d.pal[2]&7;*/ |
| 596 | color=arcadia_video.reg.d.pal[2]&7; |
| 779 | 597 | doublescan=arcadia_video.reg.d.pal[2]&0x40?FALSE:TRUE; |
| 780 | 598 | break; |
| 781 | 599 | } |
| 782 | | for (k=0; k<8; k++) { |
| 600 | for (k=0; k<8; k++) |
| 601 | { |
| 602 | int j, m; |
| 783 | 603 | b=arcadia_video.reg.d.chars[i][k]; |
| 784 | 604 | x=arcadia_video.pos[i].x+XPOS; |
| 785 | | if (!doublescan) { |
| 605 | if (!doublescan) |
| 606 | { |
| 786 | 607 | y=arcadia_video.pos[i].y+YPOS+k; |
| 787 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 788 | | 0,0,x,y, |
| 789 | | 0, TRANSPARENCY_PEN,0); |
| 790 | | } else { |
| 608 | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 609 | { |
| 610 | if (b & m) |
| 611 | { |
| 612 | *BITMAP_ADDR16(bitmap, y, x + j) = color; |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | else |
| 617 | { |
| 791 | 618 | y=arcadia_video.pos[i].y+YPOS+k*2; |
| 792 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 793 | | 0,0,x,y, |
| 794 | | 0, TRANSPARENCY_PEN,0); |
| 795 | | drawgfx(bitmap, machine->gfx[0], b,0, |
| 796 | | 0,0,x,y+1, |
| 797 | | 0, TRANSPARENCY_PEN,0); |
| 619 | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 620 | { |
| 621 | if (b & m) |
| 622 | { |
| 623 | *BITMAP_ADDR16(bitmap, y, x + j) = color; |
| 624 | *BITMAP_ADDR16(bitmap, y+1, x + j) = color; |
| 625 | } |
| 626 | } |
| 798 | 627 | } |
| 799 | | if (arcadia_video.reg.d.collision_bg&(1<<i)) { |
| 800 | | if ( (b<<(8-(x&7))) & ((arcadia_video.bg[y][x>>3]<<8) |
| 801 | | |arcadia_video.bg[y][(x>>3)+1]) ) |
| 802 | | arcadia_video.reg.d.collision_bg&=~(1<<i); |
| 628 | if (arcadia_video.reg.d.collision_bg&(1<<i)) |
| 629 | { |
| 630 | if ( (b<<(8-(x&7))) & ((arcadia_video.bg[y][x>>3]<<8) |
| 631 | |arcadia_video.bg[y][(x>>3)+1]) ) |
| 632 | arcadia_video.reg.d.collision_bg&=~(1<<i); |
| 803 | 633 | } |
| 804 | 634 | } |
| 805 | 635 | } |
| r3460 | r3461 | |
| 825 | 655 | // unbelievable, reflects only charline, but alien invaders uses it for |
| 826 | 656 | // alien scrolling |
| 827 | 657 | |
| 828 | | /* 7-Sep-2007 - whomever wrote this crap code was dynamically remapping |
| 829 | | * the color table, a vile gross hack. Doesn't look like this is going |
| 830 | | * to survive the 0.118u5 transition */ |
| 831 | | /*machine->gfx[0]->colortable[0]=arcadia_video.reg.d.pal[1]&7;*/ |
| 832 | | |
| 833 | 658 | if (arcadia_video.line<arcadia_video.ypos) |
| 834 | 659 | { |
| 835 | | plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, 0); |
| 660 | plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, (arcadia_video.reg.d.pal[1])&7); |
| 836 | 661 | memset(arcadia_video.bg[arcadia_video.line], 0, sizeof(arcadia_video.bg[0])); |
| 837 | 662 | } |
| 838 | 663 | else |
| r3460 | r3461 | |
| 843 | 668 | |
| 844 | 669 | if (arcadia_video.charline<13) |
| 845 | 670 | { |
| 846 | | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) { |
| 671 | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) |
| 672 | { |
| 847 | 673 | arcadia_vh_draw_line(machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos, |
| 848 | 674 | arcadia_video.reg.d.chars1[arcadia_video.charline]); |
| 849 | 675 | } |
| 850 | 676 | } |
| 851 | | else if (arcadia_video.lines26 && (arcadia_video.charline<26)) |
| 852 | | { |
| 853 | | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) |
| 677 | else |
| 678 | if (arcadia_video.lines26 && (arcadia_video.charline<26)) |
| 854 | 679 | { |
| 855 | | arcadia_vh_draw_line(machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos, |
| 856 | | arcadia_video.reg.d.chars2[arcadia_video.charline-13]); |
| 857 | | } |
| 680 | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) |
| 681 | { |
| 682 | arcadia_vh_draw_line(machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos, |
| 683 | arcadia_video.reg.d.chars2[arcadia_video.charline-13]); |
| 684 | } |
| 858 | 685 | arcadia_video.charline-=13; |
| 859 | | } |
| 860 | | else |
| 861 | | { |
| 686 | } |
| 687 | else |
| 688 | { |
| 862 | 689 | arcadia_video.charline=0xd; |
| 863 | | plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, 0); |
| 690 | plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, (arcadia_video.reg.d.pal[1])&7); |
| 864 | 691 | memset(arcadia_video.bg[arcadia_video.line], 0, sizeof(arcadia_video.bg[0])); |
| 865 | | } |
| 692 | } |
| 866 | 693 | } |
| 867 | 694 | if (arcadia_video.line==261) |
| 868 | 695 | arcadia_draw_sprites(machine, arcadia_video.bitmap); |
src/mess/drivers/arcadia.c
| r3460 | r3461 | |
| 1 | 1 | /****************************************************************************** |
| 2 | | PeT mess@utanet.at May 2001 |
| 2 | Consolidation and enhancment of documentation by Manfred Schneider based on previous work from |
| 3 | PeT mess@utanet.at and Paul Robson (autismuk@aol.com) |
| 3 | 4 | |
| 4 | | Paul Robson's Emulator at www.classicgaming.com/studio2 made it possible |
| 5 | | ******************************************************************************/ |
| 5 | Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ |
| 6 | 6 | |
| 7 | | /* |
| 8 | | Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ |
| 7 | TODO: implement the RESET key on the front panel |
| 8 | find a dump of the charactyer ROM |
| 9 | convert the drawing code to tilemap |
| 10 | |
| 11 | |
| 12 | 1. General |
| 13 | SYSTEM |
| 14 | - Signetics 2650 CPU at 3.58/4 Mhz(for NTSC) or at 4,433/5 (for PAL) |
| 15 | - 1k x 8 of RAM (physically present but only 512 byte available) |
| 16 | - 2 x 2 axis Analogue Joysticks |
| 17 | - 2 x 12 button Controllers |
| 18 | - 3 buttons on system unit and CPU Reset |
| 19 | VIDEO |
| 20 | - 128 x 208 pixel resolution (alternate 128 x 104 mode available) |
| 21 | - 16 x 26 (can be 16x13) background display (2 colour 8 x 8 pixel characters) |
| 22 | - 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels) |
| 23 | - total of 8 user defined characters available |
| 24 | SOUND |
| 25 | - Single channel beeper |
| 9 | 26 | |
| 10 | | TODO: Define a proper color table - see machine/arcadia.c for details |
| 11 | | */ |
| 12 | 27 | |
| 28 | 2. Memory map |
| 29 | The memory map of the 2001 is below. |
| 30 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) |
| 31 | 1000 - 13FF mirror of $1800-$1BFF |
| 32 | 1400 - 17FF mirror of $1800-$1BFF |
| 33 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) |
| 34 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits |
| 35 | 18D0 - 18EF Free for user programs. |
| 36 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 |
| 37 | 18F8 - 1908 registers of UVI |
| 38 | 1909 - 197F Unmapped |
| 39 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) |
| 40 | 19C0 - 19F7 Unmapped |
| 41 | 19F8 - 19FF registers of UVI |
| 42 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits |
| 43 | 1AD0 - 1AFF User memory |
| 44 | 1B00 - 1BFF mirror of 1900-19FF |
| 45 | 1C00 - 1FFF mirror of 1800-1BFF |
| 46 | 2000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler) |
| 47 | 3000 - 3FFF mirror of 1000-1FFF |
| 48 | 4000 - 4FFF mirror of 0000-0FFF |
| 49 | 5000 - 5FFF mirror of 1000-1FFF |
| 50 | 6000 - 6FFF mirror of 0000-0FFF |
| 51 | 7000 - 7FFF mirror of 1000-1FFF |
| 52 | |
| 53 | The Palladium VCG memory map is as follows. |
| 54 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) |
| 55 | 1000 - 17FF could be ROM or RAM but no Cartridge uses this |
| 56 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) |
| 57 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits |
| 58 | 18D0 - 18EF Free for user programs. |
| 59 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 |
| 60 | 18F8 - 1908 registers of UVI |
| 61 | 1909 - 197F Unmapped |
| 62 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) |
| 63 | 19C0 - 19F7 Unmapped |
| 64 | 19F8 - 19FF registers of UVI |
| 65 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits |
| 66 | 1AD0 - 1AFF User memory |
| 67 | 1B00 - 1BFF mirror of 1900-19FF |
| 68 | 1C00 - 1FFF could be ROM or RAM but no Cartridge uses this |
| 69 | 2000 - 2FFF 4k ROM Block (for 8k carts such as Jungler) |
| 70 | 3000 - 3FFF could be ROM or RAM but no Cartridge uses this |
| 71 | 4000 - 4FFF 4k ROM Block (first 2K used by Golf) |
| 72 | 5000 - 5FFF 4k ROM Block |
| 73 | 6000 - 6FFF 4k ROM Block |
| 74 | 7000 - 7FFF 4k ROM Block |
| 75 | |
| 76 | |
| 77 | 3. ROM Images |
| 78 | ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the |
| 79 | second half of the Rom is located at 2000-2FFF. Except for the Golf cart |
| 80 | which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on |
| 81 | Palladium VCG. |
| 82 | |
| 83 | |
| 84 | 4. Controls |
| 85 | All key controls are indicated by a bit going to '1'. Unused bits at |
| 86 | the memory location are set to zero. |
| 87 | |
| 88 | Keypads |
| 89 | |
| 90 | 1900-1902 (Player 1) 1904-1906 (Player 2) |
| 91 | The keypads are arranged as follows :- |
| 92 | |
| 93 | 1 2 3 |
| 94 | 4 5 6 |
| 95 | 7 8 9 |
| 96 | Enter 0 Clear |
| 97 | |
| 98 | Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6 |
| 99 | The topmost key is bit 3, the lowermost key is bit 0. |
| 100 | |
| 101 | Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty. |
| 102 | These keys are "latched" i.e. a press causes a logic 1 to appear |
| 103 | on the current frame. |
| 104 | |
| 105 | The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and |
| 106 | 1905 bit 3. |
| 107 | |
| 108 | Palladium has 4 additional key per keypad which are mapped at |
| 109 | 1903 palladium player 1 |
| 110 | 1907 palladium player 2 |
| 111 | |
| 112 | |
| 113 | 5. Other information |
| 114 | Interrupts are not supported |
| 115 | The Read/Write 2650 CPU Port-Commands do not appear to be connected to |
| 116 | anything in hardware. No cartridge has been found which uses them. |
| 117 | |
| 118 | ******************************************************************************/ |
| 119 | |
| 13 | 120 | #include <assert.h> |
| 14 | 121 | #include "driver.h" |
| 15 | 122 | #include "cpu/s2650/s2650.h" |
| r3460 | r3461 | |
| 281 | 388 | |
| 282 | 389 | static const gfx_layout arcadia_charlayout = |
| 283 | 390 | { |
| 284 | | 8,1, |
| 285 | | 256, /* 256 characters */ |
| 286 | | 1, /* 1 bits per pixel */ |
| 391 | 8, /*width*/ |
| 392 | 1, /*heigth*/ |
| 393 | 256, /* 256 characters */ |
| 394 | 1, /* 1 bits per pixel */ |
| 287 | 395 | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 288 | | /* x offsets */ |
| 289 | | { |
| 290 | | 0, |
| 291 | | 1, |
| 292 | | 2, |
| 293 | | 3, |
| 294 | | 4, |
| 295 | | 5, |
| 296 | | 6, |
| 297 | | 7, |
| 298 | | }, |
| 299 | | /* y offsets */ |
| 300 | | { 0 }, |
| 396 | { 0, 1, 2, 3, 4, 5, 6, 7 }, /* x offsets */ |
| 397 | { 0 }, /* y offsets */ |
| 301 | 398 | 1*8 |
| 302 | 399 | }; |
| 303 | 400 | |
| 304 | 401 | static GFXDECODE_START( arcadia ) |
| 305 | | GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 128 ) |
| 402 | GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 68 ) |
| 306 | 403 | GFXDECODE_END |
| 307 | 404 | |
| 308 | | static const rgb_t arcadia_palette[] = |
| 405 | static const rgb_t arcadia_colors[] = |
| 309 | 406 | { |
| 310 | 407 | RGB_WHITE, /* white */ |
| 311 | 408 | MAKE_RGB(0xff, 0xff, 0x00), /* yellow */ |
| r3460 | r3461 | |
| 317 | 414 | RGB_BLACK /* black */ |
| 318 | 415 | }; |
| 319 | 416 | |
| 320 | | static const unsigned short arcadia_colortable[2][2] = { |
| 321 | | { 0, 1 }, |
| 322 | | { 1, 0 } |
| 417 | static const unsigned short arcadia_palette[128+8] = /* bgnd, fgnd */ |
| 418 | { |
| 419 | 0,1,2,3,4,5,6,7, |
| 420 | |
| 421 | 0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, |
| 422 | 1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, |
| 423 | 2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, |
| 424 | 3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7, |
| 425 | 4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7, |
| 426 | 5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7, |
| 427 | 6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7, |
| 428 | 7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7 |
| 323 | 429 | }; |
| 324 | 430 | |
| 325 | 431 | static PALETTE_INIT( arcadia ) |
| 326 | 432 | { |
| 327 | | palette_set_colors(machine, 0, arcadia_palette, ARRAY_LENGTH(arcadia_palette)); |
| 433 | int i; |
| 434 | |
| 435 | machine->colortable = colortable_alloc(machine, 8); |
| 436 | |
| 437 | for (i = 0; i < 8; i++) |
| 438 | colortable_palette_set_color(machine->colortable, i, arcadia_colors[i]); |
| 439 | |
| 440 | for (i = 0; i < 128+8; i++) |
| 441 | colortable_entry_set_value(machine->colortable, i, arcadia_palette[i]); |
| 328 | 442 | } |
| 329 | 443 | |
| 330 | 444 | static MACHINE_DRIVER_START( arcadia ) |
| 331 | 445 | /* basic machine hardware */ |
| 332 | | MDRV_CPU_ADD("main", S2650, 3580000/3) /* 1.796 Mhz */ |
| 446 | MDRV_CPU_ADD("main", S2650, 3580000/4) /* 0.895 Mhz */ |
| 333 | 447 | MDRV_CPU_PROGRAM_MAP(arcadia_mem, 0) |
| 334 | 448 | MDRV_CPU_IO_MAP(arcadia_io, 0) |
| 335 | 449 | MDRV_CPU_PERIODIC_INT(arcadia_video_line, 262*60) |