Previous 15994 Revisions Next

r11991 Sunday 19th June, 2011 at 05:19:31 UTC by Robbbert
(nw) OKEAN240 - Added scroll register. Cleaned and documented the terminal functions.
[src/mess/drivers]okean240.c

src/mess/drivers/okean240.c
r11990r11991
2727  portC=vid.scroll.x
2828
2929
30NOTES ABOUT THE TEST ROM:
31The test rom tests various things including video memory. The test results
30NOTES ABOUT THE TEST ROM (-bios 1):
31- The test rom tests various things including video memory. The test results
3232are sent to the comport (for us, the generic terminal). Therefore it would
3333be useful to have the 2 screens side-by-side. Unfortunately they will not
3434co-exist, instead causing a crash at start ("Mandatory artwork is missing").
3535So, if you want to see the test rom results, you'll have to compile a modified
3636driver (change the below line to 1).
37- All 'rand()' returns are only there to allow the tests to proceed.
3738
3839
3940ToDo:
r11990r11991
4344- Add disks
4445- Add cassette
4546
47Usage of terminal:
48- okean240 bios 0 - the keyboard
49- okean240a bios 0 - not used
50- (either) bios 1 - the screen if compiled specially
51 
4652****************************************************************************/
4753#define OKEAN240_USING_TESTROM 0
4854
r11990r11991
6066public:
6167   okean240_state(const machine_config &mconfig, device_type type, const char *tag)
6268      : driver_device(mconfig, type, tag),
63   m_p_videoram(0),
6469   m_term_data(0),
65   m_j(0)
70   m_j(0),
71   m_scroll(0)
6672   { }
6773
68   DECLARE_READ8_MEMBER(okean240_rand_r);
74   DECLARE_READ8_MEMBER(okean240_kbd_status_r);
75   DECLARE_READ8_MEMBER(okean240a_kbd_status_r);
76   DECLARE_READ8_MEMBER(term_status_r);
6977   DECLARE_READ8_MEMBER(okean240_keyboard_r);
7078   DECLARE_WRITE8_MEMBER(okean240_keyboard_w);
7179   DECLARE_READ8_MEMBER(okean240a_keyboard_r);
7280   DECLARE_WRITE8_MEMBER(kbd_put);
81   DECLARE_WRITE8_MEMBER(scroll_w);
7382   UINT8 *m_p_videoram;
7483   UINT8 m_term_data;
7584   UINT8 m_j;
85   UINT8 m_scroll;
7686   virtual void machine_reset();
7787   virtual void video_start();
7888};
7989
8090
81READ8_MEMBER( okean240_state::okean240_rand_r )
91READ8_MEMBER( okean240_state::okean240_kbd_status_r )
8292{
83   offset += 0x80;
84   if (offset == 0xa1)
85      return 1 | (machine().rand() & 2);
93   if (m_term_data)
94      return (machine().rand() & 0x10) | 2;
8695   else
87   if (offset == 0x80)
96      return machine().rand() & 0x10;
97}
98
99// see if a key is pressed and indicate status
100READ8_MEMBER( okean240_state::okean240a_kbd_status_r )
101{
102   char kbdrow[6];
103   UINT8 i,j;
104
105   for (i = 0; i < 11; i++)
88106   {
89      if (m_term_data)
107      sprintf(kbdrow,"X%X",i);
108      j = input_port_read(machine(), kbdrow);
109      if (j)
90110         return (machine().rand() & 0x10) | 2;
91      else
92         return machine().rand() & 0x10;
93111   }
94   else
95      return 0;
112   m_j = 0;
113   return machine().rand() & 0x10;
96114}
97115
116READ8_MEMBER( okean240_state::term_status_r )
117{
118   return 1 | (machine().rand() & 2);
119}
120
98121READ8_MEMBER( okean240_state::okean240_keyboard_r )
99122{
100123   if (offset == 0) // port 40 (get ascii key value)
r11990r11991
127150         {
128151            if (j==m_j) return 0;
129152            m_j=j;
130            m_term_data = 1;
131153            return j;
132154         }
133155      }
r11990r11991
159181// okean240a: port 42 bit 4
160182}
161183
184WRITE8_MEMBER( okean240_state::scroll_w )
185{
186   m_scroll = data;
187}
188
162189static ADDRESS_MAP_START(okean240_mem, AS_PROGRAM, 8, okean240_state)
163190   ADDRESS_MAP_UNMAP_HIGH
164191   AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot")
r11990r11991
169196ADDRESS_MAP_END
170197
171198static ADDRESS_MAP_START(okean240_io, AS_IO, 8, okean240_state)
172   ADDRESS_MAP_UNMAP_HIGH
173199   ADDRESS_MAP_GLOBAL_MASK(0xff)
174   AM_RANGE(0x80, 0xff) AM_READ(okean240_rand_r)
200   AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w)
201   AM_RANGE(0x80, 0x80) AM_READ(okean240_kbd_status_r)
202#if OKEAN240_USING_TESTROM
175203   AM_RANGE(0xa0, 0xa0) AM_DEVWRITE_LEGACY(TERMINAL_TAG, terminal_write)
176   AM_RANGE(0x40, 0x42) AM_READWRITE(okean240_keyboard_r,okean240_keyboard_w)
204   AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r)
205#endif
206   AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w)
177207ADDRESS_MAP_END
178208
179209static ADDRESS_MAP_START(okean240a_io, AS_IO, 8, okean240_state)
180   ADDRESS_MAP_UNMAP_HIGH
181210   ADDRESS_MAP_GLOBAL_MASK(0xff)
182   AM_RANGE(0x80, 0xff) AM_READ(okean240_rand_r)
211   AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w)
212   AM_RANGE(0x80, 0x80) AM_READ(okean240a_kbd_status_r)
213#if OKEAN240_USING_TESTROM
183214   AM_RANGE(0xa0, 0xa0) AM_DEVWRITE_LEGACY(TERMINAL_TAG, terminal_write)
184   AM_RANGE(0x40, 0x42) AM_READWRITE(okean240a_keyboard_r,okean240_keyboard_w)
215   AM_RANGE(0xa1, 0xa1) AM_READ(term_status_r)
216#endif
217   AM_RANGE(0xc0, 0xc0) AM_WRITE(scroll_w)
185218   // AM_RANGE(0x00, 0x1f)=ppa00.data
186219   // AM_RANGE(0x20, 0x23)=dsk.data
187220   // AM_RANGE(0x24, 0x24)=dsk.wait
r11990r11991
327360   machine().scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot));
328361   memory_set_bank(machine(), "boot", 1);
329362   m_term_data = 0;
330   m_j=0;
363   m_j = 0;
364   m_scroll = 0;
331365}
332366
333367WRITE8_MEMBER( okean240_state::kbd_put )
r11990r11991
335369   m_term_data = data;
336370}
337371
338static GENERIC_TERMINAL_INTERFACE( terminal_intf )
372static GENERIC_TERMINAL_INTERFACE( okean240_terminal_intf )
339373{
340374   DEVCB_DRIVER_MEMBER(okean240_state, kbd_put)
341375};
342376
377static GENERIC_TERMINAL_INTERFACE( okean240a_terminal_intf )
378{
379   DEVCB_NULL
380};
381
343382DRIVER_INIT( okean240 )
344383{
345384   UINT8 *RAM = machine.region("maincpu")->base();
r11990r11991
350389{
351390}
352391
353// need to add colour
354SCREEN_UPDATE( okean240 )
392static SCREEN_UPDATE( okean240 )
355393{
356394   okean240_state *state = screen->machine().driver_data<okean240_state>();
357   UINT8 gfx,a;
395   UINT8 gfx,ma; // ma must be 8bit
358396   UINT16 x,y;
359397
360398   for (y = 0; y < 256; y++)
361399   {
400      ma = y + state->m_scroll;
362401      UINT16 *p = BITMAP_ADDR16(bitmap, y, 0);
363402
364403      for (x = 0; x < 0x4000; x+=0x200)
365404      {
366         gfx = state->m_p_videoram[x|y];
367         a = state->m_p_videoram[x|0x100|y];
368         gfx |= a;
405         gfx = state->m_p_videoram[x|ma] | state->m_p_videoram[x|ma|0x100];
369406
370407         /* Display a scanline of a character */
371408         *p++ = BIT(gfx, 0);
r11990r11991
425462#endif
426463   MCFG_GFXDECODE(okean240)
427464
428   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
465   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, okean240_terminal_intf)
429466MACHINE_CONFIG_END
430467
431468static MACHINE_CONFIG_DERIVED( okean240a, okean240 )
432469   MCFG_CPU_MODIFY("maincpu")
433470   MCFG_CPU_IO_MAP(okean240a_io)
434471   MCFG_GFXDECODE(okean240a)
472   MCFG_GENERIC_TERMINAL_REMOVE(TERMINAL_TAG)
473   //MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, okean240a_terminal_intf)
435474MACHINE_CONFIG_END
436475
437476/* ROM definition */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team