Previous 199869 Revisions Next

r40672 Thursday 10th September, 2015 at 22:26:02 UTC by Sergey Svishchev
isa_ibm_pgc: new skeleton driver
[scripts/src]bus.lua
[src/emu/bus/isa]isa_cards.c isa_cards.h pgc.c* pgc.h*
[src/mame/drivers]igs_m027.c
[src/mame/machine]pgmcrypt.c

trunk/scripts/src/bus.lua
r249183r249184
779779      MAME_DIR .. "src/emu/bus/isa/svga_cirrus.h",
780780      MAME_DIR .. "src/emu/bus/isa/ega.c",
781781      MAME_DIR .. "src/emu/bus/isa/ega.h",
782      MAME_DIR .. "src/emu/bus/isa/pgc.c",
783      MAME_DIR .. "src/emu/bus/isa/pgc.h",
782784      MAME_DIR .. "src/emu/bus/isa/vga.c",
783785      MAME_DIR .. "src/emu/bus/isa/vga.h",
784786      MAME_DIR .. "src/emu/bus/isa/vga_ati.c",
trunk/src/emu/bus/isa/isa_cards.c
r249183r249184
1818   SLOT_INTERFACE("aga", ISA8_AGA)
1919   SLOT_INTERFACE("aga_pc200", ISA8_AGA_PC200)
2020   SLOT_INTERFACE("ega", ISA8_EGA)
21   SLOT_INTERFACE("pgc", ISA8_PGC)
2122   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
2223   SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV)
2324   SLOT_INTERFACE("com", ISA8_COM)
r249183r249184
5556   SLOT_INTERFACE("cga", ISA8_CGA)
5657   SLOT_INTERFACE("wyse700", ISA8_WYSE700)
5758   SLOT_INTERFACE("ega", ISA8_EGA)
59   SLOT_INTERFACE("pgc", ISA8_PGC)
5860   SLOT_INTERFACE("vga", ISA8_VGA)
5961   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
6062   SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV)
trunk/src/emu/bus/isa/isa_cards.h
r249183r249184
1818#include "cga.h"
1919#include "aga.h"
2020#include "ega.h"
21#include "pgc.h"
2122#include "vga.h"
2223#include "vga_ati.h"
2324#include "svga_cirrus.h"
trunk/src/emu/bus/isa/pgc.c
r0r249184
1// license:BSD-3-Clause
2// copyright-holders:Sergey Svishchev
3
4/***************************************************************************
5
6  IBM Professional Graphics Controller (PGC), skeleton driver.
7
8  Designed for IBM by Vermont Microsystems.  References:
9
10  IBM Options and Adapters manual
11    http://www.minuszerodegrees.net/oa/OA%20-%20IBM%20Professional%20Graphics%20Controller.pdf
12    http://bitsavers.org/pdf/ibm/pc/cards/Technical_Reference_Options_and_Adapters_Volume_3.pdf
13  IBM Systems Journal white paper
14    http://wayback.archive.org/web/20061015235146/http://www.research.ibm.com/journal/sj/241/ibmsj2401D.pdf
15  John Elliott's page
16    http://www.seasip.info/VintagePC/pgc.html
17
18  To do:
19  - memory map (restore ROM mapping on reset, ...)
20  - various VRAM write modes
21  - what's up with irq 3 (= vblank irq)?
22  - "test pin of the microprocessor samples the hsync pulse"
23  - CGA emulator
24  - bus state handling?
25  - VRAM address translator ROM?
26
27***************************************************************************/
28
29#include "emu.h"
30
31//nclude "machine/ram.h"
32
33#include "pgc.h"
34
35#define VERBOSE_PGC     1
36
37#define DBG_LOG(N,M,A) \
38   do { \
39      if(VERBOSE_PGC>=N) \
40      { \
41         if( M ) \
42            logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \
43         logerror A; \
44      } \
45   } while (0)
46
47#define PGC_SCREEN_NAME "pgc_screen"
48
49#define PGC_TOTAL_HORZ 820
50#define PGC_DISP_HORZ  640
51#define PGC_HORZ_START 80
52
53#define PGC_TOTAL_VERT 508
54#define PGC_DISP_VERT  480
55#define PGC_VERT_START 10
56
57/*
58    Prototypes
59*/
60
61ROM_START( pgc )
62   ROM_REGION(0x100000, "maincpu", 0)
63   ROM_DEFAULT_BIOS("1985")
64
65   ROM_SYSTEM_BIOS(0, "1984", "1984 firmware, P/N 6137322/3")
66   ROMX_LOAD("ibm_6137323_pgc_card_27256.bin", 0x00000, 0x8000, CRC(f564f342) SHA1(c5ef17fd1569043cb59f61faf828ea8b0ee95526), ROM_BIOS(1))
67   ROMX_LOAD("ibm_6137322_pgc_card_27256.bin", 0x08000, 0x8000, CRC(5e6cc82f) SHA1(45b3ffb5a9c51986862f8d47b3e03dcaaf4073d5), ROM_BIOS(1))
68
69   ROM_SYSTEM_BIOS(1, "1985", "1985 firmware, P/N 59X7354/5")
70   ROMX_LOAD("pgc_u44.bin", 0x00000, 0x8000, CRC(71280241) SHA1(7042ccd4ebd03f576a256a433b8aa38d1b4fefa8), ROM_BIOS(2))
71   ROMX_LOAD("pgc_u43.bin", 0x08000, 0x8000, CRC(923f5ea3) SHA1(2b2a55d64b20d3a613b00c51443105aa03eca5d6), ROM_BIOS(2))
72
73   ROM_REGION(0x800, "commarea", ROMREGION_ERASE00)
74
75   ROM_REGION(0x1000, "chargen", 0)
76   ROM_LOAD("pgc_u27.bin", 0x0000, 0x1000, CRC(6be256cc) SHA1(deb1195886268dcddce10459911e020f7a9f74f7))
77ROM_END
78
79static INPUT_PORTS_START( pgc )
80   PORT_START("DSW")
81/*
82   PORT_DIPNAME( 0x01, 0x00, "CGA emulator")
83   PORT_DIPSETTING(    0x00, DEF_STR(No) )
84   PORT_DIPSETTING(    0x01, DEF_STR(Yes) )
85*/
86   PORT_DIPNAME( 0x02, 0x00, "Communication area")
87   PORT_DIPSETTING(    0x00, "C6000" )
88   PORT_DIPSETTING(    0x02, "C6400" )
89INPUT_PORTS_END
90
91/*
92write only
93   30000      LUT WR O L
94   30001      LUT WR I L
95   32000      MODE WT L
96   32001      NIBBLE WT L
97   3200A      ??
98   34000      FUNCTION WT L
99   34001      STARTADD WT L
100   36001      CURSOR WT L
101
102read only
103   38000      LUT RD O L
104   38001      LUT RD I L
105   3C001      INIT L/INIT H
106*/
107
108static ADDRESS_MAP_START( pgc_map, AS_PROGRAM, 8, isa8_pgc_device )
109   ADDRESS_MAP_UNMAP_HIGH
110   AM_RANGE(0x00000, 0x07fff) AM_ROM
111   AM_RANGE(0x08000, 0x0ffff) AM_ROM AM_REGION("maincpu", 0x8000)
112   AM_RANGE(0x10000, 0x1001f) AM_READWRITE(stateparam_r, stateparam_w)
113//   AM_RANGE(0x18000, 0x18fff) AM_RAM   // ??
114   AM_RANGE(0x28000, 0x287ff) AM_RAM AM_REGION("commarea", 0) AM_MIRROR(0x800)
115   AM_RANGE(0x3c000, 0x3c001) AM_READ(init_r)
116//   AM_RANGE(0x3e000, 0x3efff) AM_RAM   // ??
117   AM_RANGE(0xf8000, 0xfffff) AM_ROM AM_REGION("maincpu", 0x8000)
118ADDRESS_MAP_END
119
120static ADDRESS_MAP_START( pgc_io, AS_IO, 8, isa8_pgc_device )
121   ADDRESS_MAP_UNMAP_HIGH
122ADDRESS_MAP_END
123
124static const gfx_layout pgc_charlayout =
125{
126   8, 16,                  /* 8x16 pixels */
127   256,                    /* 256 characters */
128   1,                      /* 1 bits per pixel */
129   { 0 },                  /* no bitplanes */
130   /* x offsets */
131   { 0, 1, 2, 3, 4, 5, 6, 7 },
132   /* y offsets */
133   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
134   8*16                    /* every char takes 10 bytes */
135};
136
137static GFXDECODE_START( pgc )
138   GFXDECODE_REVERSEBITS("chargen", 0, pgc_charlayout, 0, 1)
139GFXDECODE_END
140
141MACHINE_CONFIG_FRAGMENT( pcvideo_pgc )
142   MCFG_CPU_ADD("maincpu", I8088, XTAL_24MHz/3)
143   MCFG_CPU_PROGRAM_MAP(pgc_map)
144   MCFG_CPU_IO_MAP(pgc_io)
145#if 0
146   MCFG_CPU_VBLANK_INT_DRIVER(PGC_SCREEN_NAME, isa8_pgc_device, vblank_irq)
147   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(isa8_pgc_device, irq_callback)
148#endif
149
150   MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", isa8_pgc_device, scanline_callback,
151      attotime::from_hz(60*PGC_TOTAL_VERT))
152   MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_50MHz/(2*PGC_HORZ_START)))
153
154   MCFG_SCREEN_ADD(PGC_SCREEN_NAME, RASTER)
155   MCFG_SCREEN_RAW_PARAMS(XTAL_50MHz/2,
156      PGC_TOTAL_HORZ, PGC_HORZ_START, PGC_HORZ_START+PGC_DISP_HORZ,
157      PGC_TOTAL_VERT, PGC_VERT_START, PGC_VERT_START+PGC_DISP_VERT)
158   MCFG_SCREEN_UPDATE_DRIVER(isa8_pgc_device, screen_update)
159   MCFG_SCREEN_PALETTE("palette")
160
161   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pgc)
162   MCFG_PALETTE_ADD( "palette", 256 )
163MACHINE_CONFIG_END
164
165//**************************************************************************
166//  GLOBAL VARIABLES
167//**************************************************************************
168
169const device_type ISA8_PGC = &device_creator<isa8_pgc_device>;
170
171
172//-------------------------------------------------
173//  machine_config_additions - device-specific
174//  machine configurations
175//-------------------------------------------------
176
177machine_config_constructor isa8_pgc_device::device_mconfig_additions() const
178{
179   return MACHINE_CONFIG_NAME( pcvideo_pgc );
180}
181
182//-------------------------------------------------
183//  rom_region - device-specific ROM region
184//-------------------------------------------------
185
186const rom_entry *isa8_pgc_device::device_rom_region() const
187{
188   return ROM_NAME( pgc );
189}
190
191//-------------------------------------------------
192//  input_ports - device-specific input ports
193//-------------------------------------------------
194
195ioport_constructor isa8_pgc_device::device_input_ports() const
196{
197   return INPUT_PORTS_NAME( pgc );
198}
199
200//**************************************************************************
201//  LIVE DEVICE
202//**************************************************************************
203
204//-------------------------------------------------
205//  isa8_pgc_device - constructor
206//-------------------------------------------------
207
208isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
209   device_t(mconfig, ISA8_PGC, "IBM Professional Graphics Controller", tag, owner, clock, "isa_ibm_pgc", __FILE__),
210   device_isa8_card_interface(mconfig, *this),
211   m_cpu(*this, "maincpu"),
212   m_screen(*this, PGC_SCREEN_NAME),
213   m_palette(*this, "palette")
214{
215}
216
217isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
218   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
219   device_isa8_card_interface(mconfig, *this),
220   m_cpu(*this, "maincpu"),
221   m_screen(*this, PGC_SCREEN_NAME),
222   m_palette(*this, "palette")
223{
224}
225
226//-------------------------------------------------
227//  device_start - device-specific startup
228//-------------------------------------------------
229
230void isa8_pgc_device::device_start()
231{
232   address_space &space = m_cpu->space( AS_PROGRAM );
233   int width = PGC_DISP_HORZ;
234   int height = PGC_DISP_VERT;
235
236   if (m_palette != NULL && !m_palette->started())
237      throw device_missing_dependencies();
238
239   set_isa_device();
240
241   for (int i = 0; i < 256; i++ )
242   {
243      m_palette->set_pen_color( i, 0, 0, 0 );
244   }
245
246   m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
247   m_bitmap->fill(0);
248
249   m_vram = auto_alloc_array(machine(), UINT8, 0x78000);
250   space.install_readwrite_bank(0x80000, 0xf7fff, "vram");
251   membank("vram")->set_base(m_vram);
252
253   m_eram = auto_alloc_array(machine(), UINT8, 0x8000);
254}
255
256//-------------------------------------------------
257//  device_reset - device-specific reset
258//-------------------------------------------------
259
260void isa8_pgc_device::device_reset()
261{
262   address_space &space = m_cpu->space( AS_PROGRAM );
263
264   memset(m_stateparam, 0, sizeof(m_stateparam));
265   memset(m_lut, 0, sizeof(m_lut));
266
267   m_commarea = memregion("commarea")->base();
268   if (BIT(ioport("DSW")->read(), 1))
269      m_isa->install_bank(0xc6400, 0xc67ff, 0, 0, "commarea", m_commarea);
270   else
271      m_isa->install_bank(0xc6000, 0xc63ff, 0, 0, "commarea", m_commarea);
272#if 0   
273   space.unmap_readwrite(0xf8000, 0xfffff);
274   space.install_rom(0xf8000, 0xfffff,
275      space.machine().root_device().memregion("maincpu")->base() + 0x8000);
276#endif
277}
278
279//
280
281INTERRUPT_GEN_MEMBER(isa8_pgc_device::vblank_irq)
282{
283   DBG_LOG(2,"irq",("vblank_irq\n"));
284   m_cpu->set_input_line(0, ASSERT_LINE);
285}
286
287IRQ_CALLBACK_MEMBER(isa8_pgc_device::irq_callback)
288{
289   DBG_LOG(2,"irq",("irq_callback\n"));
290   m_cpu->set_input_line(0, CLEAR_LINE);
291   return 3;
292}
293
294// memory handlers
295
296READ8_MEMBER( isa8_pgc_device::stateparam_r ) {
297   UINT8 ret;
298
299   ret = m_stateparam[offset >> 1];
300   if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
301   {
302      DBG_LOG(1,"stateparam",("R @ %02x == %02x\n", offset, ret));
303   }
304   return ret;
305}
306
307WRITE8_MEMBER( isa8_pgc_device::stateparam_w ) {
308   if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
309   {
310      DBG_LOG(1,"stateparam",("W @ %02x <- %02x\n", offset, data));
311   }
312   m_stateparam[offset >> 1] = data;
313}
314
315WRITE8_MEMBER( isa8_pgc_device::lut_w ) {
316   UINT8 o = (offset >> 1) * 3;
317
318   if (offset & 1) {
319      m_lut[o + 2] = (data & 15) << 4;
320      m_palette->set_pen_color( offset >> 1, m_lut[o], m_lut[o + 1], m_lut[o + 2] );
321      DBG_LOG(1,"lut",("W @ %02X <- %d %d %d\n",
322         offset >> 1, m_lut[o], m_lut[o + 1], m_lut[o + 2] ));
323   } else {
324      m_lut[o    ] = data & 0xf0;
325      m_lut[o + 1] = (data & 15) << 4;
326   }
327}
328
329READ8_MEMBER( isa8_pgc_device::init_r ) {
330   DBG_LOG(1,"INIT",("unmapping ROM\n"));
331   space.unmap_read(0xf8000, 0xfffff);
332
333   DBG_LOG(1,"INIT",("mapping emulator RAM\n"));
334   space.install_readwrite_bank(0xf8000, 0xfffff, "eram");
335   membank("eram")->set_base(m_eram);
336
337   DBG_LOG(1,"INIT",("mapping LUT\n"));
338   space.install_write_handler(0xf8400, 0xf85ff,
339      write8_delegate(FUNC(isa8_pgc_device::lut_w), this));
340   
341   return 0; // XXX ignored
342}
343
344TIMER_DEVICE_CALLBACK_MEMBER(isa8_pgc_device::scanline_callback)
345{
346   UINT16 x, y = m_screen->vpos();
347   UINT16 *p;
348   UINT8 *v;
349
350   // XXX hpos shifts every frame -- fix
351   if (y == 0) DBG_LOG(2,"scanline_cb",
352      ("frame %d x %.4d y %.3d\n",
353      (int) m_screen->frame_number(), m_screen->hpos(), y));
354
355   if (y < PGC_VERT_START) return;
356   y -= PGC_VERT_START;
357   if (y >= PGC_DISP_VERT) return;
358
359   // XXX address translation happens in hardware
360   v = &m_vram[y * 1024];
361   p = &m_bitmap->pix16(y, 0);
362
363   for (x = 0; x < PGC_DISP_HORZ; x++) {
364      *p++ = *v++;
365   }
366}
367
368UINT32 isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
369{
370   copybitmap(bitmap, *m_bitmap, 0, 0, PGC_HORZ_START, PGC_VERT_START, cliprect);
371   return 0;
372}
trunk/src/emu/bus/isa/pgc.h
r0r249184
1// license:BSD-3-Clause
2// copyright-holders:Sergey Svishchev
3
4#pragma once
5
6#ifndef __ISA_PGC_H__
7#define __ISA_PGC_H__
8
9#include "emu.h"
10
11#include "cpu/i86/i86.h"
12#include "isa.h"
13
14//**************************************************************************
15//  TYPE DEFINITIONS
16//**************************************************************************
17
18// ======================> isa8_pgc_device
19
20class isa8_pgc_device :
21   public device_t,
22   public device_isa8_card_interface
23{
24public:
25   // construction/destruction
26   isa8_pgc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
27   isa8_pgc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
28
29   // optional information overrides
30   virtual machine_config_constructor device_mconfig_additions() const;
31   virtual const rom_entry *device_rom_region() const;
32   virtual ioport_constructor device_input_ports() const;
33
34   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
35
36   TIMER_DEVICE_CALLBACK_MEMBER( scanline_callback );
37   INTERRUPT_GEN_MEMBER(vblank_irq);
38   IRQ_CALLBACK_MEMBER(irq_callback);
39
40   DECLARE_WRITE8_MEMBER( stateparam_w );
41   DECLARE_READ8_MEMBER( stateparam_r );
42   DECLARE_WRITE8_MEMBER( lut_w );
43   DECLARE_READ8_MEMBER( init_r );
44
45protected:
46   // device-level overrides
47   virtual void device_start();
48   virtual void device_reset();
49
50private:
51   required_device<i8088_cpu_device> m_cpu;
52   required_device<screen_device> m_screen;
53   required_device<palette_device> m_palette;
54
55   UINT8 *m_commarea;
56   UINT8 *m_vram;
57   UINT8 *m_eram;
58   UINT8 m_stateparam[16];
59   UINT8 m_lut[256*3];
60   bitmap_ind16 *m_bitmap;
61};
62
63
64// device type definition
65extern const device_type ISA8_PGC;
66
67#endif  /* __ISA_PGC_H__ */
trunk/src/mame/drivers/igs_m027.c
r249183r249184
562562   ROM_LOAD( "amazonia_igs027a", 0x00000, 0x4000, NO_DUMP )
563563
564564   ROM_REGION( 0x80000, "user1", 0 ) // external ARM data / prg
565   ROM_LOAD( "amazonia_v-104br.u23", 0x00000, 0x80000, CRC(103d465e) SHA1(68d088f24171e27c0a9b0660f81d3334f730637a) )
565   ROM_LOAD( "amazonia_v-104br.u23", 0x00000, 0x80000, CRC(c203f875) SHA1(e8465ac74b873cc4d372a656bb50994bffed8406) )
566566
567567   ROM_REGION( 0x480000, "gfx1", 0 )
568568   ROM_LOAD( "amazonia_cg.u11", 0x000000, 0x80000, CRC(2ac2cfd1) SHA1(f8750a4727ddabf1415dab6eaa4a72e60e86e7f1) )
trunk/src/mame/machine/pgmcrypt.c
r249183r249184
15721572   }
15731573}
15741574
1575
1576static UINT8 amazonia_tab[0x100] = { // seems to be correct
1577    0x87, 0x01, 0xd3, 0x6b, 0x79, 0x00, 0xbd, 0x81, 0xc7, 0x8f, 0x9b, 0xd9, 0x3b, 0x53, 0x09, 0x15,
1578    0x05, 0x57, 0x7b, 0x1f, 0x2f, 0x09, 0x47, 0xa1, 0x45, 0x00, 0xf7, 0xbf, 0x3d, 0x59, 0xd1, 0x19,
1579    0xad, 0xd5, 0xa1, 0x03, 0x2d, 0x35, 0xc7, 0x07, 0x09, 0x4f, 0x85, 0x95, 0x2b, 0x3f, 0x89, 0x09,
1580    0x49, 0x85, 0xb9, 0xe7, 0x4b, 0x53, 0x3f, 0x51, 0xff, 0x3b, 0xd5, 0xc9, 0xff, 0xfd, 0x53, 0x25,
1581    0xe3, 0xa9, 0x75, 0xd7, 0xa3, 0xfd, 0xf1, 0x5f, 0x51, 0xfb, 0xbb, 0x09, 0xf5, 0xc9, 0x91, 0xed,
1582    0xc7, 0xcd, 0xc9, 0x25, 0x93, 0x07, 0x63, 0x51, 0x69, 0xb3, 0x4b, 0x47, 0x85, 0x19, 0xe7, 0x1f,
1583    0x7f, 0xb3, 0xe9, 0x5f, 0xb5, 0x8b, 0x57, 0x83, 0xf5, 0xcb, 0xd5, 0xb1, 0x6d, 0xa3, 0x37, 0xbb,
1584    0xd7, 0x67, 0x45, 0x55, 0xe3, 0xdd, 0xcf, 0x97, 0xdd, 0xe9, 0xf1, 0xb5, 0xa7, 0x63, 0xa5, 0xfd,
1585    0xdb, 0x2b, 0x93, 0x13, 0x37, 0x95, 0x0d, 0x69, 0x4d, 0xf7, 0x6d, 0x03, 0x6f, 0x8b, 0x95, 0x69,
1586    0xd5, 0x8b, 0xc3, 0xeb, 0x0f, 0x8b, 0x97, 0x1b, 0xb1, 0x19, 0x5f, 0x89, 0x3d, 0x95, 0xa9, 0xb9,
1587    0x4f, 0x4b, 0x0b, 0x6b, 0x05, 0xd5, 0x2d, 0x0b, 0xb5, 0xb7, 0x19, 0x75, 0xcf, 0x35, 0xc3, 0xef,
1588    0x13, 0x71, 0xdb, 0x61, 0xf3, 0xcb, 0xd3, 0xd7, 0x3f, 0x79, 0x2d, 0x39, 0x21, 0x65, 0x07, 0x49,
1589    0x31, 0x47, 0xe9, 0xdd, 0xf3, 0x03, 0xcf, 0x5f, 0x7f, 0x45, 0x71, 0x83, 0x69, 0x5b, 0xd9, 0x47,
1590    0xef, 0x53, 0x27, 0x2f, 0x63, 0x55, 0x9f, 0xc1, 0xdf, 0x41, 0xf5, 0x41, 0x27, 0x8d, 0xdb, 0xa7,
1591    0xd9, 0x5b, 0xc7, 0xe5, 0xdd, 0xd7, 0x09, 0x5f, 0x09, 0xd7, 0x0d, 0xa1, 0x13, 0xb3, 0xef, 0x67,
1592    0xbb, 0x65, 0x3d, 0xcd, 0x3b, 0xdf, 0x0f, 0xd3, 0xe7, 0xab, 0x4d, 0x15, 0x29, 0xc5, 0x39, 0xc9
1575/*FIXME: This is incorrect. Was simply copied from fruitpar as an initial boilerplate code: */
1576static const UINT8 amazonia_tab[0x100] = {
1577   0xe9, 0x0b, 0x95, 0x7e, 0x0d, 0x7d, 0x5c, 0x1e, 0x81, 0x0e, 0xa6, 0xd4, 0x8e, 0x90, 0xd8, 0x54,
1578   0x27, 0x65, 0x51, 0x08, 0x1c, 0xa0, 0x3b, 0x51, 0x83, 0x60, 0x93, 0x02, 0x64, 0x69, 0x77, 0x1a,
1579   0xa4, 0x03, 0xb0, 0xc2, 0x34, 0x18, 0x80, 0x87, 0x7a, 0x88, 0xad, 0xd9, 0xff, 0xd0, 0xce, 0xc4,
1580   0x5b, 0xdc, 0xd5, 0xed, 0x5e, 0x29, 0xdd, 0xcf, 0x80, 0x1f, 0x36, 0x38, 0x8b, 0xae, 0xae, 0xfe,
1581   0x87, 0x27, 0x22, 0x07, 0xe6, 0x5d, 0x46, 0x79, 0xf1, 0xfc, 0xb1, 0x3d, 0x72, 0x29, 0x2c, 0xba,
1582   0xa3, 0x5b, 0x3c, 0xcf, 0x57, 0x79, 0xed, 0x12, 0x67, 0x34, 0xe1, 0x48, 0x5f, 0xa7, 0x9a, 0x24,
1583   0x6a, 0x2e, 0x04, 0x44, 0x7b, 0x84, 0x46, 0x6a, 0xbd, 0x20, 0xca, 0xf7, 0x3e, 0xd1, 0x8b, 0xad,
1584   0xd7, 0x98, 0x9e, 0xa6, 0x5e, 0xc6, 0x04, 0x90, 0x0f, 0x57, 0xae, 0x2b, 0x38, 0x8d, 0xd2, 0x0c,
1585   0x25, 0xd1, 0x6d, 0x73, 0x4b, 0xc6, 0x19, 0xd3, 0xb8, 0xae, 0x11, 0x01, 0xba, 0x02, 0x82, 0x17,
1586   0xcf, 0x4d, 0x14, 0x6a, 0xcd, 0x4a, 0xb9, 0xc1, 0x52, 0x3e, 0xb5, 0xd8, 0x6f, 0x98, 0xee, 0x16,
1587   0x90, 0xc6, 0x76, 0x8a, 0xaf, 0x5a, 0x56, 0x2b, 0xb9, 0x5e, 0x9e, 0x51, 0x40, 0xf4, 0xaa, 0x6e,
1588   0x63, 0x32, 0xb6, 0x12, 0xfb, 0x3c, 0xa5, 0x1f, 0x07, 0xa3, 0x0d, 0x49, 0x5a, 0xfe, 0x88, 0xd1,
1589   0x83, 0xc7, 0x37, 0x82, 0xfd, 0x78, 0x97, 0xec, 0x98, 0xe6, 0x88, 0xe0, 0x27, 0xde, 0x9a, 0x2c,
1590   0x6b, 0xfd, 0x9b, 0x98, 0x40, 0xd5, 0x5f, 0x20, 0x06, 0x3e, 0xcf, 0x74, 0x52, 0xf9, 0x35, 0xae,
1591   0xd6, 0x8c, 0xc7, 0x53, 0x8e, 0x59, 0x71, 0x8c, 0x2d, 0x00, 0xe7, 0xa5, 0xc7, 0xf8, 0xeb, 0xc7,
1592   0xbf, 0x68, 0xdc, 0xf2, 0xf4, 0x4c, 0x80, 0x3e, 0x27, 0xc5, 0x13, 0x52, 0xb0, 0xc0, 0x90, 0x2d
15931593};
15941594
15951595void amazonia_decrypt(running_machine &machine)
15961596{
15971597   int i;
1598   UINT16 *src = (UINT16 *)machine.root_device().memregion("user1")->base();
1598   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
15991599
16001600   int rom_size = 0x80000;
1601   for (i = 0; i < rom_size / 2; i++) {
1602      int x = amazonia_tab[(i / 2) & 0xff] << 8;
16031601
1604      if ((i & 0x040480) != 0x000080) x ^= 0x0001;
1605      if ((i & 0x004008) == 0x004008) x ^= 0x0002;
1606      if ((i & 0x080030) == 0x080010) x ^= 0x0004; // pin high??
1607      if ((i & 0x000242) != 0x000042) x ^= 0x0008;
1608      if ((i & 0x008100) == 0x008000) x ^= 0x0010;
1609      if ((i & 0x022004) != 0x000004) x ^= 0x0020; // verified
1610      if ((i & 0x011800) != 0x010000) x ^= 0x0040;
1611      if ((i & 0x004820) == 0x004820) x ^= 0x0080; // verified
1602   // not 100% verified
1603   for(i=0; i<rom_size/2; i++)
1604   {
1605      UINT16 x = src[i];
16121606
1613      src[i] ^= x;
1607      IGS27_CRYPT1
1608//      IGS27_CRYPT2
1609//      IGS27_CRYPT3
1610      IGS27_CRYPT4_ALT
1611      IGS27_CRYPT5
1612      IGS27_CRYPT6_ALT
1613      IGS27_CRYPT7
1614      IGS27_CRYPT8
1615
1616      x ^= amazonia_tab[(i>> 1) & 0xff] << 8;
1617
1618      src[i] = x;
16141619   }
16151620}
16161621
1617// not 100% verified
1622
1623/*FIXME: This is incorrect. Was simply copied from fruitpar as an initial boilerplate code: */
16181624static const UINT8 amazoni2_tab[0x100] = {
1619    0x49, 0x47, 0x53, 0x30, 0x30, 0x37, 0x37, 0x52, 0x44, 0x34, 0x30, 0x32, 0x31, 0x30, 0x31, 0x36,
1620    0xed, 0x3f, 0x77, 0xd0, 0xc4, 0x72, 0x77, 0xe1, 0x35, 0x15, 0x10, 0xc6, 0x1b, 0xee, 0x25, 0x4a,
1621    0x0d, 0x06, 0x37, 0x19, 0xfa, 0xf9, 0x29, 0xb0, 0x03, 0x7e, 0x32, 0x83, 0x99, 0x32, 0x23, 0x6e,
1622    0xd8, 0xa9, 0xdb, 0x5f, 0x23, 0xb7, 0x08, 0x41, 0x00, 0xfb, 0x20, 0x2b, 0x36, 0xae, 0x9f, 0xc9,
1623    0x24, 0xaa, 0x82, 0x0b, 0x64, 0xbe, 0x03, 0x0d, 0xa2, 0x31, 0x97, 0x47, 0xb6, 0x94, 0x26, 0xf6,
1624    0x09, 0xcd, 0x8a, 0xca, 0x26, 0x61, 0x4a, 0xd1, 0x9f, 0x01, 0x98, 0xa3, 0x23, 0x58, 0x88, 0xcf,
1625    0xdd, 0x14, 0x93, 0x86, 0x0f, 0x33, 0x4c, 0x86, 0xef, 0x8f, 0x61, 0x4a, 0xc2, 0xad, 0xd5, 0x70,
1626    0x37, 0xc2, 0x7b, 0x6a, 0x06, 0x07, 0xb7, 0x69, 0xc9, 0x3f, 0x71, 0x87, 0x1a, 0x85, 0x5a, 0x33,
1627    0xee, 0x5b, 0x63, 0xe2, 0x32, 0xf0, 0x7a, 0xf4, 0xa4, 0xb2, 0x87, 0xe4, 0xf3, 0x14, 0xa7, 0xb4,
1628    0x1a, 0xa1, 0xa8, 0x98, 0xf9, 0x42, 0xc5, 0xe1, 0x36, 0xcc, 0xa3, 0x2d, 0x54, 0xcd, 0x8b, 0xcd,
1629    0x11, 0x98, 0xe9, 0x77, 0x05, 0x8e, 0x06, 0x2d, 0x78, 0xb0, 0x02, 0x6d, 0x83, 0x62, 0x15, 0x9a,
1630    0x6b, 0x82, 0x07, 0xaa, 0x3a, 0xa9, 0xed, 0x12, 0x9f, 0xc0, 0x25, 0xee, 0x08, 0xc7, 0x94, 0x75,
1631    0xfd, 0xe2, 0x1f, 0x9d, 0xc0, 0xa5, 0x68, 0x0a, 0x23, 0xa1, 0xca, 0x3d, 0xa9, 0x2f, 0x97, 0xfa,
1632    0xe0, 0x7c, 0x91, 0xfa, 0xfe, 0xd5, 0xa6, 0xd2, 0xbb, 0x34, 0xf1, 0x23, 0x6e, 0x0c, 0xed, 0x03,
1633    0x6b, 0x52, 0xfb, 0xac, 0x9c, 0xcc, 0x17, 0x64, 0x5d, 0x9e, 0xd7, 0xac, 0x9e, 0x12, 0xa5, 0xac,
1634    0x34, 0xa7, 0x3e, 0xde, 0x7f, 0x5d, 0x6a, 0xfa, 0x42, 0x40, 0xfd, 0x23, 0xbf, 0x33, 0x0e, 0x50
1625   0xe9, 0x0b, 0x95, 0x7e, 0x0d, 0x7d, 0x5c, 0x1e, 0x81, 0x0e, 0xa6, 0xd4, 0x8e, 0x90, 0xd8, 0x54,
1626   0x27, 0x65, 0x51, 0x08, 0x1c, 0xa0, 0x3b, 0x51, 0x83, 0x60, 0x93, 0x02, 0x64, 0x69, 0x77, 0x1a,
1627   0xa4, 0x03, 0xb0, 0xc2, 0x34, 0x18, 0x80, 0x87, 0x7a, 0x88, 0xad, 0xd9, 0xff, 0xd0, 0xce, 0xc4,
1628   0x5b, 0xdc, 0xd5, 0xed, 0x5e, 0x29, 0xdd, 0xcf, 0x80, 0x1f, 0x36, 0x38, 0x8b, 0xae, 0xae, 0xfe,
1629   0x87, 0x27, 0x22, 0x07, 0xe6, 0x5d, 0x46, 0x79, 0xf1, 0xfc, 0xb1, 0x3d, 0x72, 0x29, 0x2c, 0xba,
1630   0xa3, 0x5b, 0x3c, 0xcf, 0x57, 0x79, 0xed, 0x12, 0x67, 0x34, 0xe1, 0x48, 0x5f, 0xa7, 0x9a, 0x24,
1631   0x6a, 0x2e, 0x04, 0x44, 0x7b, 0x84, 0x46, 0x6a, 0xbd, 0x20, 0xca, 0xf7, 0x3e, 0xd1, 0x8b, 0xad,
1632   0xd7, 0x98, 0x9e, 0xa6, 0x5e, 0xc6, 0x04, 0x90, 0x0f, 0x57, 0xae, 0x2b, 0x38, 0x8d, 0xd2, 0x0c,
1633   0x25, 0xd1, 0x6d, 0x73, 0x4b, 0xc6, 0x19, 0xd3, 0xb8, 0xae, 0x11, 0x01, 0xba, 0x02, 0x82, 0x17,
1634   0xcf, 0x4d, 0x14, 0x6a, 0xcd, 0x4a, 0xb9, 0xc1, 0x52, 0x3e, 0xb5, 0xd8, 0x6f, 0x98, 0xee, 0x16,
1635   0x90, 0xc6, 0x76, 0x8a, 0xaf, 0x5a, 0x56, 0x2b, 0xb9, 0x5e, 0x9e, 0x51, 0x40, 0xf4, 0xaa, 0x6e,
1636   0x63, 0x32, 0xb6, 0x12, 0xfb, 0x3c, 0xa5, 0x1f, 0x07, 0xa3, 0x0d, 0x49, 0x5a, 0xfe, 0x88, 0xd1,
1637   0x83, 0xc7, 0x37, 0x82, 0xfd, 0x78, 0x97, 0xec, 0x98, 0xe6, 0x88, 0xe0, 0x27, 0xde, 0x9a, 0x2c,
1638   0x6b, 0xfd, 0x9b, 0x98, 0x40, 0xd5, 0x5f, 0x20, 0x06, 0x3e, 0xcf, 0x74, 0x52, 0xf9, 0x35, 0xae,
1639   0xd6, 0x8c, 0xc7, 0x53, 0x8e, 0x59, 0x71, 0x8c, 0x2d, 0x00, 0xe7, 0xa5, 0xc7, 0xf8, 0xeb, 0xc7,
1640   0xbf, 0x68, 0xdc, 0xf2, 0xf4, 0x4c, 0x80, 0x3e, 0x27, 0xc5, 0x13, 0x52, 0xb0, 0xc0, 0x90, 0x2d
16351641};
16361642
1637
16381643void amazoni2_decrypt(running_machine &machine)
16391644{
1640    int i;
1641    UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
1645   int i;
1646   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
16421647
1643    int rom_size = 0x80000;
1648   int rom_size = 0x80000;
16441649
1645    for(i=0; i<rom_size/2; i++)
1646    {
1647        UINT16 x = src[i];
1650   // not 100% verified
1651   for(i=0; i<rom_size/2; i++)
1652   {
1653      UINT16 x = src[i];
16481654
1649        // should be correct
1650        IGS27_CRYPT1
1651        IGS27_CRYPT2_ALT
1652    //    IGS27_CRYPT3
1653        IGS27_CRYPT4
1654        IGS27_CRYPT5
1655        IGS27_CRYPT6_ALT // second half is junk, not sure...
1656        IGS27_CRYPT7
1657        IGS27_CRYPT8
1655      IGS27_CRYPT1
1656//      IGS27_CRYPT2
1657//      IGS27_CRYPT3
1658      IGS27_CRYPT4_ALT
1659      IGS27_CRYPT5
1660      IGS27_CRYPT6_ALT
1661      IGS27_CRYPT7
1662      IGS27_CRYPT8
16581663
1659        x ^= amazoni2_tab[(i >> 1) & 0xff] << 8;
1664      x ^= amazoni2_tab[(i>> 1) & 0xff] << 8;
16601665
1661        src[i] = x;
1662    }
1666      src[i] = x;
1667   }
16631668}
1669


Previous 199869 Revisions Next


© 1997-2024 The MAME Team