Previous 15994 Revisions Next

r8536 Sunday 18th July, 2010 at 14:26:35 UTC by Angelo Salese
[PASOPIA]: Added a cheap kludge for the keyboard input, and added color attribute wrapping
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8535r8536
2222static UINT8 bank_reg;
2323static UINT16 cursor_addr;
2424static UINT8 cursor_blink;
25static UINT8 plane_reg,attr_data;
25static UINT8 plane_reg,attr_data,attr_wrap,attr_latch;
2626
2727static VIDEO_START( paso7 )
2828{
2929   p7_vram = auto_alloc_array(machine, UINT8, 0x10000);
3030}
3131
32#define keyb_press(_val_,_charset_) \
33   if(input_code_pressed(machine, _val_)) \
34   { \
35      memory_write_byte(ram_space,0xfda4,0x01); \
36      memory_write_byte(ram_space,0xfce1,_charset_); \
37   } \
38
39#define keyb_shift_press(_val_,_charset_) \
40   if(input_code_pressed(machine, _val_) && input_code_pressed(machine, KEYCODE_LSHIFT)) \
41   { \
42      memory_write_byte(ram_space,0xfda4,0x01); \
43      memory_write_byte(ram_space,0xfce1,_charset_); \
44   } \
45
46/* cheap kludge to use the keyboard without going nuts with the debugger ... */
47static void fake_keyboard_data(running_machine *machine)
48{
49   const address_space *ram_space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
50
51   memory_write_byte(ram_space,0xfda4,0x00); //clear flag
52
53   keyb_press(KEYCODE_Z, 'z');
54   keyb_press(KEYCODE_X, 'x');
55   keyb_press(KEYCODE_C, 'c');
56   keyb_press(KEYCODE_V, 'v');
57   keyb_press(KEYCODE_B, 'b');
58   keyb_press(KEYCODE_N, 'n');
59   keyb_press(KEYCODE_M, 'm');
60
61   keyb_press(KEYCODE_A, 'a');
62   keyb_press(KEYCODE_S, 's');
63   keyb_press(KEYCODE_D, 'd');
64   keyb_press(KEYCODE_F, 'f');
65   keyb_press(KEYCODE_G, 'g');
66   keyb_press(KEYCODE_H, 'h');
67   keyb_press(KEYCODE_J, 'j');
68   keyb_press(KEYCODE_K, 'k');
69   keyb_press(KEYCODE_L, 'l');
70
71   keyb_press(KEYCODE_Q, 'q');
72   keyb_press(KEYCODE_W, 'w');
73   keyb_press(KEYCODE_E, 'e');
74   keyb_press(KEYCODE_R, 'r');
75   keyb_press(KEYCODE_T, 't');
76   keyb_press(KEYCODE_Y, 'y');
77   keyb_press(KEYCODE_U, 'u');
78   keyb_press(KEYCODE_I, 'i');
79   keyb_press(KEYCODE_O, 'o');
80   keyb_press(KEYCODE_P, 'p');
81
82   keyb_press(KEYCODE_0, '0');
83   keyb_press(KEYCODE_1, '1');
84   keyb_press(KEYCODE_2, '2');
85   keyb_press(KEYCODE_3, '3');
86   keyb_press(KEYCODE_4, '4');
87   keyb_press(KEYCODE_5, '5');
88   keyb_press(KEYCODE_6, '6');
89   keyb_press(KEYCODE_7, '7');
90   keyb_press(KEYCODE_8, '8');
91   keyb_press(KEYCODE_9, '9');
92
93   keyb_shift_press(KEYCODE_0, '=');
94   keyb_shift_press(KEYCODE_1, '!');
95   keyb_shift_press(KEYCODE_2, '"');
96   keyb_shift_press(KEYCODE_3, '£');
97   keyb_shift_press(KEYCODE_4, '$');
98   keyb_shift_press(KEYCODE_5, '%');
99   keyb_shift_press(KEYCODE_6, '&');
100   keyb_shift_press(KEYCODE_7, '/');
101   keyb_shift_press(KEYCODE_8, '(');
102   keyb_shift_press(KEYCODE_9, ')');
103
104   keyb_press(KEYCODE_ENTER, 0x0d);
105   keyb_press(KEYCODE_SPACE, ' ');
106   keyb_press(KEYCODE_STOP, '.');
107   keyb_shift_press(KEYCODE_STOP, ':');
108   keyb_press(KEYCODE_BACKSPACE, 0x08);
109
110}
111
32112static VIDEO_UPDATE( paso7 )
33113{
34114   int x,y;
r8535r8536
36116
37117   count = 0x0000;
38118
119   fake_keyboard_data(screen->machine);
120
39121   for(y=0;y<25;y++)
40122   {
41123      for(x=0;x<40;x++)
r8535r8536
57139
58140static READ8_HANDLER( vram_r )
59141{
60//   if(!vram_sel)
61//      return 0xff;
142   //if(!vram_sel)
143   //   return 0xff;
62144
145   attr_latch = p7_vram[offset | 0xc000];
146   i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
147
63148   return p7_vram[offset | 0x8000]; //TODO
64149}
65150
66151static WRITE8_HANDLER( vram_w )
67152{
68//   if(vram_sel)
69
70   if((plane_reg & 0x44) == 0x44)
153   //if(vram_sel)
71154   {
72      p7_vram[offset | 0x8000] = data;
73      p7_vram[offset | 0xc000] = attr_data;
155      if((plane_reg & 0x44) == 0x44)
156      {
157         p7_vram[offset | 0x8000] = data;
158         attr_latch = attr_wrap ? attr_latch : attr_data;
159         p7_vram[offset | 0xc000] = attr_latch;
160         i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7));
161      }
74162   }
75163}
76164
r8535r8536
195283   {
196284      const address_space *ram_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
197285      mio_sel = 0;
198      printf("%08x\n",offset);
286      //printf("%08x\n",offset);
199287      //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4)
200288      return memory_read_byte(ram_space, offset);
201289   }
r8535r8536
378466   */
379467//   printf("VIDEO MISC REG %02x\n",data);
380468   cursor_blink = data & 0x20;
469   attr_wrap = data & 0x10;
381470
382471}
383472
r8535r8536
474563
475564      if(((i & 0x11) == 0x01) || ((i & 0x11) == 0x10))
476565      {
477         r = ((i >> 3) & 1) ? 0xff : 0x00;
478         g = ((i >> 2) & 1) ? 0xff : 0x00;
566         r = ((i >> 2) & 1) ? 0xff : 0x00;
567         g = ((i >> 3) & 1) ? 0xff : 0x00;
479568         b = ((i >> 1) & 1) ? 0xff : 0x00;
480569      }
481570      else { r = g = b = 0x00; }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team