Previous 15994 Revisions Next

r13665 Thursday 22nd December, 2011 at 07:03:53 UTC by Barry Rodewald
alphatro: Made most areas proper RAM, allowing BASIC to boot. (no whatsnew)
[src/mess/drivers]alphatro.c

src/mess/drivers/alphatro.c
r13664r13665
2222#include "emu.h"
2323#include "cpu/z80/z80.h"
2424#include "video/mc6845.h"
25#include "machine/ram.h"
2526
2627#define MAIN_CLOCK XTAL_4MHz
2728
r13664r13665
4142   required_device<mc6845_device> m_crtc;
4243   DECLARE_READ8_MEMBER(random_r);
4344   DECLARE_WRITE8_MEMBER(video_w);
45   DECLARE_READ8_MEMBER(vblank_r);
46
47   emu_timer* m_sys_timer;
4448   UINT8 *m_p_videoram;
4549   UINT8 *m_p_chargen;
4650   virtual void video_start();
51   virtual void machine_start();
52   virtual void machine_reset();
4753   virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect);
54    virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
55private:
56    static const device_timer_id SYSTEM_TIMER = 0;
57
4858};
4959
60void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
61{
62   switch(id)
63   {
64   case SYSTEM_TIMER:
65      device_set_input_line(m_maincpu,INPUT_LINE_IRQ0,HOLD_LINE);
66      break;
67   }
68}
69
70READ8_MEMBER( alphatro_state::vblank_r)
71{
72   return (space.machine().device<screen_device>("screen")->vblank() ? 0x80 : 0x00);
73}
74
5075READ8_MEMBER( alphatro_state::random_r )
5176{
5277   return space.machine().rand();
r13664r13665
106131}
107132
108133static ADDRESS_MAP_START( alphatro_map, AS_PROGRAM, 8, alphatro_state )
109   AM_RANGE(0x0000, 0x5fff) AM_ROM // this is really ram, basic gets copied to here when it is needed
110   AM_RANGE(0x6000, 0xdfff) AM_RAM
111   AM_RANGE(0xe000, 0xe46f) AM_ROM
112   AM_RANGE(0xe470, 0xe4cf) AM_RAM // keyboard out?
113   AM_RANGE(0xe4d0, 0xefff) AM_ROM
134   AM_RANGE(0x0000, 0xefff) AM_RAMBANK("bank1") // this is really ram, basic gets copied to here when it is needed
135//   AM_RANGE(0x6000, 0xdfff) AM_RAM
136//   AM_RANGE(0xe000, 0xe46f) AM_RAM
137//   AM_RANGE(0xe470, 0xe4cf) AM_RAM // keyboard out?
138//   AM_RANGE(0xe4d0, 0xefff) AM_RAM
114139   AM_RANGE(0xf000, 0xfdff) AM_ROM AM_WRITE(video_w)
115140   AM_RANGE(0xfe00, 0xffff) AM_RAM // for the stack
116141ADDRESS_MAP_END
r13664r13665
118143static ADDRESS_MAP_START( alphatro_io, AS_IO, 8, alphatro_state )
119144   ADDRESS_MAP_GLOBAL_MASK(0xff)
120145   ADDRESS_MAP_UNMAP_HIGH
121   AM_RANGE(0x10, 0x10) AM_READ(random_r)
146   AM_RANGE(0x10, 0x10) AM_READ(vblank_r)
122147   //AM_RANGE(0x20, 0x2f) AM_READ(random_r) // keyboard in?
123148   AM_RANGE(0x50, 0x50) AM_DEVWRITE("crtc", mc6845_device, address_w)
124149   AM_RANGE(0x51, 0x51) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
r13664r13665
142167   GFXDECODE_ENTRY( "chargen", 0, charlayout,     0, 1 )
143168GFXDECODE_END
144169
145static MACHINE_START( alphatro )
170void alphatro_state::machine_start()
146171{
147//  alphatro_state *state = machine.driver_data<alphatro_state>();
148
172   m_sys_timer = timer_alloc(SYSTEM_TIMER);
149173}
150174
151static MACHINE_RESET( alphatro )
175void alphatro_state::machine_reset()
152176{
153   cpu_set_reg(machine.device("maincpu"), STATE_GENPC, 0xe000);
177   UINT8* RAM = machine().device<ram_device>("ram")->pointer();
178   UINT8* ROM = machine().region("maincpu")->base();
179   cpu_set_reg(machine().device("maincpu"), STATE_GENPC, 0xe000);
180   memcpy(RAM,ROM,0x10000); // copy BASIC to RAM, which the undumped IPL is supposed to do.
181   memory_set_bankptr(machine(), "bank1",RAM);
182   // m_sys_timer->adjust(attotime::zero,0,attotime::from_msec(10));  // interrupts aren't enabled yet, so not much point in setting this
154183}
155184
156185//static PALETTE_INIT( alphatro )
r13664r13665
178207   MCFG_CPU_PROGRAM_MAP(alphatro_map)
179208   MCFG_CPU_IO_MAP(alphatro_io)
180209
181   MCFG_MACHINE_START(alphatro)
182   MCFG_MACHINE_RESET(alphatro)
210//   MCFG_MACHINE_START(alphatro)
211//   MCFG_MACHINE_RESET(alphatro)
183212
184213   /* video hardware */
185214   MCFG_SCREEN_ADD("screen", RASTER)
186215   MCFG_SCREEN_REFRESH_RATE(60)
187   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
216   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct
188217   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
189218   MCFG_SCREEN_SIZE(32*8, 32*8)
190219   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
r13664r13665
201230
202231   /* Devices */
203232   MCFG_MC6845_ADD("crtc", MC6845, XTAL_12_288MHz / 8, h19_crtc6845_interface) // clk unknown
233
234   MCFG_RAM_ADD("ram")
235   MCFG_RAM_DEFAULT_SIZE("64K")
204236MACHINE_CONFIG_END
205237
206238
r13664r13665
225257*/
226258
227259ROM_START( alphatro )
228   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
260   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00)
229261   ROM_LOAD( "rom1.bin",     0x0000, 0x2000, BAD_DUMP CRC(1509b15a) SHA1(225c36411de680eb8f4d6b58869460a58e60c0cf) )
230262   ROM_LOAD( "rom2.bin",     0x2000, 0x2000, BAD_DUMP CRC(998a865d) SHA1(294fe64e839ae6c4032d5db1f431c35e0d80d367) )
231263   ROM_LOAD( "rom3.bin",     0x4000, 0x2000, BAD_DUMP CRC(55cbafef) SHA1(e3376b92f80d5a698cdcb2afaa0f3ef4341dd624) )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team