1 //
2 // Copyright (c) 2004 K. Wilkins
3 //
4 // This software is provided 'as-is', without any express or implied warranty.
5 // In no event will the authors be held liable for any damages arising from
6 // the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 //    claim that you wrote the original software. If you use this software
14 //    in a product, an acknowledgment in the product documentation would be
15 //    appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 //    be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source distribution.
21 //
22 
23 //////////////////////////////////////////////////////////////////////////////
24 //                       Handy - An Atari Lynx Emulator                     //
25 //                          Copyright (c) 1996,1997                         //
26 //                                 K. Wilkins                               //
27 //////////////////////////////////////////////////////////////////////////////
28 // ROM emulation class                                                      //
29 //////////////////////////////////////////////////////////////////////////////
30 //                                                                          //
31 // This class emulates the system ROM (512B), the interface is pretty       //
32 // simple: constructor, reset, peek, poke.                                  //
33 //                                                                          //
34 //    K. Wilkins                                                            //
35 // August 1997                                                              //
36 //                                                                          //
37 //////////////////////////////////////////////////////////////////////////////
38 // Revision History:                                                        //
39 // -----------------                                                        //
40 //                                                                          //
41 // 01Aug1997 KW Document header added & class documented.                   //
42 //                                                                          //
43 //////////////////////////////////////////////////////////////////////////////
44 
45 #define ROM_CPP
46 
47 //#include <crtdbg.h>
48 //#define   TRACE_ROM
49 
50 #include "system.h"
51 #include "rom.h"
52 
53 #include <mednafen/FileStream.h>
54 
CRom(const char * romfile)55 CRom::CRom(const char *romfile)
56 {
57 	mWriteEnable=false;
58 	Reset();
59 
60 	// Initialise ROM
61 	for(int loop=0;loop<ROM_SIZE;loop++) mRomData[loop]=DEFAULT_ROM_CONTENTS;
62 
63 	// Load up the file
64 	{
65 	 FileStream BIOSFile(romfile, FileStream::MODE_READ);
66 
67 	 if(BIOSFile.size() < 512)
68 	 {
69 	  throw MDFN_Error(0, _("The Lynx Boot ROM Image is an incorrect size."));
70 	 }
71 
72 	 BIOSFile.read(mRomData, 512);
73 	}
74 }
75 
Reset(void)76 void CRom::Reset(void)
77 {
78 	// Nothing to do here
79 }
80 
81 
82 //END OF FILE
83