|
37 | 37 | */ |
38 | 38 | public class X16Extensions implements BasicExtension { |
39 | 39 |
|
40 | | - private final static List<Command> COMMANDS = Collections.unmodifiableList(new ArrayList<Command>() { |
41 | | - private static final long serialVersionUID = 1L; |
42 | | - { |
43 | | - this.add(new Vpoke()); |
44 | | - this.add(new Dos()); |
45 | | - this.add(new Mon()); |
46 | | - this.add(new Vload()); |
47 | | - this.add(new Xload()); |
48 | | - this.add(new Geos()); |
49 | | - this.add(new Old()); |
50 | | - this.add(new Screen()); |
51 | | - this.add(new Mouse()); |
52 | | - this.add(new Pset()); |
53 | | - this.add(new Line()); |
54 | | - this.add(new Frame()); |
55 | | - this.add(new Rect()); |
56 | | - this.add(new Char()); |
57 | | - } |
58 | | - }); |
59 | | - |
60 | | - private final static List<Function> FUNCTIONS = Collections.unmodifiableList(new ArrayList<Function>() { |
61 | | - private static final long serialVersionUID = 1L; |
62 | | - { |
63 | | - this.add(new Vpeek()); |
64 | | - } |
65 | | - }); |
66 | | - |
67 | | - private final static List<Variable> VARS = Collections.unmodifiableList(new ArrayList<Variable>() { |
68 | | - private static final long serialVersionUID = 1L; |
69 | | - { |
70 | | - this.add(new Mx()); |
71 | | - this.add(new My()); |
72 | | - this.add(new Mb()); |
73 | | - } |
74 | | - }); |
75 | | - |
76 | | - @Override |
77 | | - public List<Command> getCommands() { |
78 | | - return COMMANDS; |
| 40 | + private final static List<Command> COMMANDS = Collections.unmodifiableList(new ArrayList<Command>() { |
| 41 | + private static final long serialVersionUID = 1L; |
| 42 | + { |
| 43 | + this.add(new Vpoke()); |
| 44 | + this.add(new Dos()); |
| 45 | + this.add(new Mon()); |
| 46 | + this.add(new Vload()); |
| 47 | + this.add(new Xload()); |
| 48 | + this.add(new Geos()); |
| 49 | + this.add(new Old()); |
| 50 | + this.add(new Screen()); |
| 51 | + this.add(new Mouse()); |
| 52 | + this.add(new Pset()); |
| 53 | + this.add(new Line()); |
| 54 | + this.add(new Frame()); |
| 55 | + this.add(new Rect()); |
| 56 | + this.add(new Char()); |
79 | 57 | } |
| 58 | + }); |
80 | 59 |
|
81 | | - @Override |
82 | | - public List<Function> getFunctions() { |
83 | | - return FUNCTIONS; |
| 60 | + private final static List<Function> FUNCTIONS = Collections.unmodifiableList(new ArrayList<Function>() { |
| 61 | + private static final long serialVersionUID = 1L; |
| 62 | + { |
| 63 | + this.add(new Vpeek()); |
84 | 64 | } |
| 65 | + }); |
85 | 66 |
|
86 | | - @Override |
87 | | - public void reset(Machine machine) { |
88 | | - // |
| 67 | + private final static List<Variable> VARS = Collections.unmodifiableList(new ArrayList<Variable>() { |
| 68 | + private static final long serialVersionUID = 1L; |
| 69 | + { |
| 70 | + this.add(new Mx()); |
| 71 | + this.add(new My()); |
| 72 | + this.add(new Mb()); |
89 | 73 | } |
| 74 | + }); |
90 | 75 |
|
91 | | - @Override |
92 | | - public List<String> getAdditionalIncludes() { |
93 | | - return new ArrayList<String>() { |
94 | | - private static final long serialVersionUID = 1L; |
95 | | - { |
96 | | - this.add("x16"); |
97 | | - } |
98 | | - }; |
99 | | - } |
| 76 | + @Override |
| 77 | + public List<Command> getCommands() { |
| 78 | + return COMMANDS; |
| 79 | + } |
100 | 80 |
|
101 | | - @Override |
102 | | - public Map<String, Integer> getLabel2Constant() { |
103 | | - return new HashMap<String, Integer>() { |
104 | | - private static final long serialVersionUID = 1L; |
105 | | - { |
106 | | - this.put("VERAREG", Integer.parseInt("9F20", 16)); |
107 | | - this.put("VERAHI", Integer.parseInt("9F22", 16)); |
108 | | - this.put("VERAMID", Integer.parseInt("9F21", 16)); |
109 | | - this.put("VERALO", Integer.parseInt("9F20", 16)); |
110 | | - this.put("VERADAT", Integer.parseInt("9F23", 16)); |
111 | | - this.put("VERABNK", Integer.parseInt("9F61", 16)); |
112 | | - this.put("ROMSELECT", Integer.parseInt("9F60", 16)); |
113 | | - } |
114 | | - }; |
115 | | - } |
| 81 | + @Override |
| 82 | + public List<Function> getFunctions() { |
| 83 | + return FUNCTIONS; |
| 84 | + } |
116 | 85 |
|
117 | | - @Override |
118 | | - public List<Variable> getSystemVariables() { |
119 | | - return VARS; |
120 | | - } |
| 86 | + @Override |
| 87 | + public void reset(Machine machine) { |
| 88 | + // |
| 89 | + } |
121 | 90 |
|
122 | | - @Override |
123 | | - public boolean adjustMemoryConfig(Machine machine, MemoryConfig config) { |
124 | | - if (config.getStringEnd() != -1) { |
125 | | - // if it has been set from the outside, then don't modify it |
126 | | - return false; |
127 | | - } |
128 | | - List<Command> coms = machine.getCommandList(); |
129 | | - for (Command com : coms) { |
130 | | - // GEOS graphics commands write into BASIC memory (at least in r34). So we have |
131 | | - // to limit it here. |
132 | | - if (com.isCommand("LINE") || com.isCommand("PSET") || com.isCommand("CHAR") || com.isCommand("RECT") |
133 | | - || com.isCommand("FRAME")) { |
134 | | - config.setStringEnd(0x8000); |
135 | | - return true; |
136 | | - } |
137 | | - } |
138 | | - return false; |
| 91 | + @Override |
| 92 | + public List<String> getAdditionalIncludes() { |
| 93 | + return new ArrayList<String>() { |
| 94 | + private static final long serialVersionUID = 1L; |
| 95 | + { |
| 96 | + this.add("x16"); |
| 97 | + } |
| 98 | + }; |
| 99 | + } |
| 100 | + |
| 101 | + @Override |
| 102 | + public Map<String, Integer> getLabel2Constant() { |
| 103 | + return new HashMap<String, Integer>() { |
| 104 | + private static final long serialVersionUID = 1L; |
| 105 | + { |
| 106 | + this.put("VERAREG", Integer.parseInt("9F20", 16)); |
| 107 | + this.put("VERAHI", Integer.parseInt("9F22", 16)); |
| 108 | + this.put("VERAMID", Integer.parseInt("9F21", 16)); |
| 109 | + this.put("VERALO", Integer.parseInt("9F20", 16)); |
| 110 | + this.put("VERADAT", Integer.parseInt("9F23", 16)); |
| 111 | + this.put("VERABNK", Integer.parseInt("9F61", 16)); |
| 112 | + this.put("ROMSELECT", Integer.parseInt("9F60", 16)); |
| 113 | + } |
| 114 | + }; |
| 115 | + } |
| 116 | + |
| 117 | + @Override |
| 118 | + public List<Variable> getSystemVariables() { |
| 119 | + return VARS; |
| 120 | + } |
| 121 | + |
| 122 | + @Override |
| 123 | + public boolean adjustMemoryConfig(Machine machine, MemoryConfig config) { |
| 124 | + if (config.getStringEnd() != -1) { |
| 125 | + // if it has been set from the outside, then don't modify it |
| 126 | + return false; |
139 | 127 | } |
| 128 | + List<Command> coms = machine.getCommandList(); |
| 129 | + for (Command com : coms) { |
| 130 | + // GEOS graphics commands write into BASIC memory (at least in r34). |
| 131 | + // So we have |
| 132 | + // to limit it here. |
| 133 | + if (com.isCommand("LINE") || com.isCommand("PSET") || com.isCommand("CHAR") || com.isCommand("RECT") |
| 134 | + || com.isCommand("FRAME")) { |
| 135 | + config.setStringEnd(0x8000); |
| 136 | + return true; |
| 137 | + } |
| 138 | + } |
| 139 | + return false; |
| 140 | + } |
| 141 | + |
| 142 | + public static Map<Integer, String> getTokens() { |
| 143 | + return new HashMap<Integer, String>() { |
| 144 | + private static final long serialVersionUID = 1L; |
| 145 | + { |
| 146 | + this.put(0xCE86, "SCREEN"); |
| 147 | + this.put(0xCE87, "PSET"); |
| 148 | + this.put(0xCE8A, "RECT"); |
| 149 | + this.put(0xCE88, "LINE"); |
| 150 | + this.put(0xCE89, "FRAME"); |
| 151 | + this.put(0xCE8B, "CHAR"); |
| 152 | + this.put(0xCE8C, "MOUSE"); |
| 153 | + this.put(0xCE8E, "MX"); |
| 154 | + this.put(0xCE8F, "MY"); |
| 155 | + this.put(0xCE90, "MB"); |
| 156 | + this.put(0xCE84, "VPOKE"); |
| 157 | + this.put(0xCE8D, "VPEEK"); |
| 158 | + this.put(0xCE81, "DOS"); |
| 159 | + this.put(0xCE80, "MON"); |
| 160 | + this.put(0xCE82, "OLD"); |
| 161 | + this.put(0xCE83, "GEOS"); |
| 162 | + } |
| 163 | + }; |
| 164 | + } |
140 | 165 | } |
0 commit comments