HP700RXMachine.cc Source File

Back to the index.

HP700RXMachine.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2019 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  * The ROM seems to be 512 KB at 0xfff80000.
39  */
40 
42 #include "ComponentFactory.h"
43 #include "GXemul.h"
44 
45 
47 {
48  // Defaults:
50  settings["cpu"] = "i960CA";
51  settings["ram"] = "0x00200000";
52 
54  return NULL;
55 
56 
58  if (machine.IsNULL())
59  return NULL;
60 
61  machine->SetVariableValue("template", "\"hp700rx\"");
62 
63 
64  refcount_ptr<Component> mainbus =
66  if (mainbus.IsNULL())
67  return NULL;
68 
69  machine->AddChild(mainbus);
70 
71 
73  ComponentFactory::CreateComponent("i960_cpu(model=" + settings["cpu"] + ")");
74  if (cpu.IsNULL())
75  return NULL;
76 
77  mainbus->AddChild(cpu);
78 
79 
80  // DRAM (guess)
82  if (ram.IsNULL())
83  return NULL;
84  ram->SetVariableValue("memoryMappedBase", "0x3fe00000");
85  ram->SetVariableValue("memoryMappedSize", settings["ram"]);
86  mainbus->AddChild(ram);
87 
88  // ROM
90  if (rom.IsNULL())
91  return NULL;
92  rom->SetVariableValue("name", "\"rom0\"");
93  rom->SetVariableValue("memoryMappedBase", "0xfff80000");
94  rom->SetVariableValue("memoryMappedSize", "524288");
95  // rom->SetVariableValue("writeProtect", "true");
96  mainbus->AddChild(rom);
97 
98  return machine;
99 }
100 
101 
102 string HP700RXMachine::GetAttribute(const string& attributeName)
103 {
104  if (attributeName == "template")
105  return "yes";
106 
107  if (attributeName == "machine")
108  return "yes";
109 
110  if (attributeName == "description")
111  return "HP 700/RX X-terminal (i960).";
112 
113  if (attributeName == "comments")
114  return "For experiments that could eventually lead up to "
115  "running custom code on the HP 700/RX.";
116 
117  return "";
118 }
119 
refcount_ptr::IsNULL
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.
Definition: refcount_ptr.h:218
ComponentFactory::GetCreationArgOverrides
static bool GetCreationArgOverrides(ComponentCreationSettings &settings, const ComponentCreateArgs &createArgs)
Get override arguments for component creation.
Definition: ComponentFactory.cc:151
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:102
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:46
ComponentCreateArgs
Definition: Component.h:49
GXemul.h

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18