HP700RXMachine.cc Source File

Back to the index.

HP700RXMachine.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * HP 700/RX X-terminal with an i960CA CPU.
29  *
30  * Bogus skeleton so far.
31  *
32  * My machine says:
33  *
34  * 2048 KB Base RAM
35  * 8192 KB Expansion RAM
36  * 2048 KB Video RAM
37  */
38 
40 #include "ComponentFactory.h"
41 #include "GXemul.h"
42 
43 
45 {
46  // Defaults:
48  settings["cpu"] = "i960CA";
49  settings["ram"] = "0x00200000";
50 
52  return NULL;
53 
54 
56  if (machine.IsNULL())
57  return NULL;
58 
59  machine->SetVariableValue("template", "\"hp700rx\"");
60 
61 
62  refcount_ptr<Component> mainbus =
64  if (mainbus.IsNULL())
65  return NULL;
66 
67  machine->AddChild(mainbus);
68 
69 
71  ComponentFactory::CreateComponent("i960_cpu(model=" + settings["cpu"] + ")");
72  if (cpu.IsNULL())
73  return NULL;
74 
75  mainbus->AddChild(cpu);
76 
77 
79  if (ram.IsNULL())
80  return NULL;
81 
82  // DRAM (guess)
83  ram->SetVariableValue("memoryMappedBase", "0x3fe00000");
84  ram->SetVariableValue("memoryMappedSize", settings["ram"]);
85  mainbus->AddChild(ram);
86 
87  return machine;
88 }
89 
90 
91 string HP700RXMachine::GetAttribute(const string& attributeName)
92 {
93  if (attributeName == "template")
94  return "yes";
95 
96  if (attributeName == "machine")
97  return "yes";
98 
99  if (attributeName == "stable")
100  return "yes";
101 
102  if (attributeName == "description")
103  return "HP 700/RX X-terminal (i960).";
104 
105  if (attributeName == "comments")
106  return "For experiments that could eventually lead up to "
107  "running custom code on the HP 700/RX.";
108 
109  return "";
110 }
111 
refcount_ptr::IsNULL
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.
Definition: refcount_ptr.h:216
ComponentFactory::GetCreationArgOverrides
static bool GetCreationArgOverrides(ComponentCreationSettings &settings, const ComponentCreateArgs &createArgs)
Get override arguments for component creation.
Definition: ComponentFactory.cc:156
Component::AddChild
void AddChild(refcount_ptr< Component > childComponent, size_t insertPosition=(size_t) -1)
Adds a reference to a child component.
Definition: Component.cc:595
ComponentFactory.h
refcount_ptr< Component >
HP700RXMachine::GetAttribute
static string GetAttribute(const string &attributeName)
Gets a Component attribute value.
Definition: HP700RXMachine.cc:91
machine
Definition: machine.h:97
ComponentFactory::CreateComponent
static refcount_ptr< Component > CreateComponent(const string &componentNameAndOptionalArgs, GXemul *gxemul=NULL)
Creates a component given a short component name.
Definition: ComponentFactory.cc:87
Component::SetVariableValue
bool SetVariableValue(const string &name, const string &expression)
Sets a variable to a new value.
Definition: Component.cc:1030
settings
Definition: settings.cc:57
ComponentCreationSettings
map< string, string > ComponentCreationSettings
Definition: Component.h:46
HP700RXMachine.h
cpu
Definition: cpu.h:326
HP700RXMachine::Create
static refcount_ptr< Component > Create(const ComponentCreateArgs &args)
Creates a "hp700rx" Component tree.
Definition: HP700RXMachine.cc:44
ComponentCreateArgs
Definition: Component.h:48
GXemul.h

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17