Previous 15994 Revisions Next

r5831 Monday 21st September, 2009 at 13:51:33 UTC by Roberto Zandonà
[jr200] code clean up
[src/mess/drivers]jr200.c

src/mess/drivers/jr200.c
r5830r5831
2020#include "cpu/m6800/m6800.h"
2121
2222static UINT8 *textram;
23static UINT8 io_reg[0x20] = {    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0   };
2325
2426static const UINT8 jr200_keycodes[4][9][8] =
2527{
r5830r5831
7678   }
7779};
7880
81/*
7982static READ8_HANDLER( test_r )
8083{
8184   return 0x00;
8285}
86*/
8387
84static WRITE8_HANDLER( test_w )
88static WRITE8_HANDLER( io_reg_w )
8589{
86   ;
90   io_reg[offset] = data;
8791}
8892
89static READ8_HANDLER( test01_r )
93static READ8_HANDLER( io_reg_r )
9094{
91   // hack
92   int row, col, keydata = 0, table = 0;
93   static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" };
95   UINT8 value = 0x00;
9496
95   /* scan keyboard */
96   for (row = 0; row < 9; row++)
97   switch (offset)
9798   {
98      UINT8 data = input_port_read(space->machine, keynames[row]);
99
100      for (col = 0; col < 8; col++)
99   case 0x01:
101100      {
102         if (!BIT(data, col))
101         // hack
102         int row, col, keydata = 0, table = 0;
103         static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" };
104
105         /* scan keyboard */
106         for (row = 0; row < 9; row++)
103107         {
104            /* latch key data */
105            keydata = jr200_keycodes[table][row][col];
108            UINT8 data = input_port_read(space->machine, keynames[row]);
109
110            for (col = 0; col < 8; col++)
111            {
112               if (!BIT(data, col))
113               {
114                  /* latch key data */
115                  keydata = jr200_keycodes[table][row][col];
116               }
117            }
106118         }
119     
120         value = keydata;
107121      }
122      break;
123   case 0x07:
124      value = 0x80;
125      break;
126   case 0x1c:
127      value = 0x01;
128      break;
129   default:
130      value = io_reg[offset];
131      break;
108132   }
109133
110   return keydata;
134   return value;
111135}
112136
113static READ8_HANDLER( test07_r )
114{
115   return 0x80;
116}
117
118static READ8_HANDLER( test1c_r )
119{
120   return 0x01;
121}
122
123static READ8_HANDLER( test1d_r )
124{
125   return 0x00;
126}
127
128137/*
129138   0000-3fff RAM
130139   4000-4fff RAM ( 4k expansion)
r5830r5831
141150   AM_RANGE(0x000e, 0x3fff) AM_RAM
142151   AM_RANGE(0xa000, 0xbfff) AM_ROM
143152   AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_BASE(&textram)
144   AM_RANGE(0xc800, 0xc800) AM_RAM AM_READWRITE(test_r, test_w)
145   AM_RANGE(0xc801, 0xc801) AM_RAM AM_READWRITE(test01_r, test_w)
146   AM_RANGE(0xc802, 0xc802) AM_RAM AM_READWRITE(test_r, test_w)
147   AM_RANGE(0xc803, 0xc803) AM_RAM AM_READWRITE(test_r, test_w)
148   AM_RANGE(0xc804, 0xc804) AM_RAM AM_READWRITE(test_r, test_w)
149   AM_RANGE(0xc805, 0xc805) AM_RAM AM_READWRITE(test_r, test_w)
150   AM_RANGE(0xc806, 0xc806) AM_RAM AM_READWRITE(test_r, test_w)
151   AM_RANGE(0xc807, 0xc807) AM_RAM AM_READWRITE(test07_r, test_w)
152   AM_RANGE(0xc808, 0xc808) AM_RAM AM_READWRITE(test_r, test_w)
153   AM_RANGE(0xc809, 0xc809) AM_RAM AM_READWRITE(test_r, test_w)
154   AM_RANGE(0xc80a, 0xc80a) AM_RAM AM_READWRITE(test_r, test_w)
155   AM_RANGE(0xc80b, 0xc80b) AM_RAM AM_READWRITE(test_r, test_w)
156   AM_RANGE(0xc80c, 0xc80c) AM_RAM AM_READWRITE(test_r, test_w)
157   AM_RANGE(0xc80d, 0xc80d) AM_RAM AM_READWRITE(test_r, test_w)
158   AM_RANGE(0xc80e, 0xc80e) AM_RAM AM_READWRITE(test_r, test_w)
159   AM_RANGE(0xc80f, 0xc80f) AM_RAM AM_READWRITE(test_r, test_w)
160   AM_RANGE(0xc810, 0xc810) AM_RAM AM_READWRITE(test_r, test_w)
161   AM_RANGE(0xc811, 0xc811) AM_RAM AM_READWRITE(test_r, test_w)
162   AM_RANGE(0xc812, 0xc812) AM_RAM AM_READWRITE(test_r, test_w)
163   AM_RANGE(0xc813, 0xc813) AM_RAM AM_READWRITE(test_r, test_w)
164   AM_RANGE(0xc814, 0xc814) AM_RAM AM_READWRITE(test_r, test_w)
165   AM_RANGE(0xc815, 0xc815) AM_RAM AM_READWRITE(test_r, test_w)
166   AM_RANGE(0xc816, 0xc816) AM_RAM AM_READWRITE(test_r, test_w)
167   AM_RANGE(0xc817, 0xc817) AM_RAM AM_READWRITE(test_r, test_w)
168   AM_RANGE(0xc818, 0xc818) AM_RAM AM_READWRITE(test_r, test_w)
169   AM_RANGE(0xc819, 0xc819) AM_RAM AM_READWRITE(test_r, test_w)
170   AM_RANGE(0xc81a, 0xc81a) AM_RAM AM_READWRITE(test_r, test_w)
171   AM_RANGE(0xc81b, 0xc81b) AM_RAM AM_READWRITE(test_r, test_w)
172   AM_RANGE(0xc81c, 0xc81c) AM_RAM AM_READWRITE(test1c_r, test_w)
173   AM_RANGE(0xc81d, 0xc81d) AM_RAM AM_READWRITE(test1d_r, test_w)
174   AM_RANGE(0xc81e, 0xc81e) AM_RAM AM_READWRITE(test_r, test_w)
175   AM_RANGE(0xc81f, 0xc81f) AM_RAM AM_READWRITE(test_r, test_w)
153   AM_RANGE(0xc800, 0xc81f) AM_READWRITE(io_reg_r, io_reg_w)
176154   AM_RANGE(0xe000, 0xffff) AM_ROM
177155ADDRESS_MAP_END
178156
r5830r5831
344322   GFXDECODE_ENTRY( "char", 0, tiles8x8_layout, 0, 0x100 )
345323GFXDECODE_END
346324
347/*
325
348326static INTERRUPT_GEN( jr200_nmi )
349327{
350328   cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
351329}
352*/
353330
354331static INTERRUPT_GEN( jr200_irq )
355332{
r5830r5831
362339   MDRV_CPU_PROGRAM_MAP(jr200_mem)
363340   MDRV_CPU_IO_MAP(jr200_io)
364341// MDRV_CPU_VBLANK_INT("screen", jr200_irq)
365// MDRV_CPU_PERIODIC_INT(jr200_nmi,60)
342MDRV_CPU_PERIODIC_INT(jr200_nmi,60)
366343MDRV_CPU_PERIODIC_INT(jr200_irq,10)
367344/*
368345   MDRV_CPU_ADD("mn1544", MN1544, ?)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team