Skip to content

Commit 1c10791

Browse files
author
EgonOlsen
committed
SYS buffer modified
1 parent 19e9122 commit 1c10791

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

MOSPEED native compiler.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Make sure that the memory is readable, i.e. that it isn't shadowed by the ROM. D
114114
If nothing is given, it will follow the actual program's memory. This is also the default.
115115

116116
- /sysbuffer=xxxxx|$yyyy: Sets the start address of the buffer used to execute SYS commands with parameters.
117-
Default is 820 for the CBM machines and 1024 for the X16.
117+
Default is 820 for the CBM machines and 1024 for the X16. If set to 0, the runtime will reserve its own buffer in BASIC memory.
118118

119119
- /alloff=true|false: If true, all optimizations which are enabled by default will be turned off. Default is false.
120120

dist/basicv2.jar

146 Bytes
Binary file not shown.

src/main/java/com/sixtyfour/cbmnative/mos6502/AbstractTransformer.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,21 @@ protected void addLabels(List<String> res, String[] labels) {
7777
}
7878

7979
protected void addBasicBuffer(List<String> res, PlatformProvider platform, MemoryConfig memConfig) {
80-
if (memConfig.getBasicBufferStart()==-1) {
81-
res.add("BASICBUFFER="+platform.getBasicBufferAddress());
80+
if (memConfig.getBasicBufferStart() == -1) {
81+
res.add("BASICBUFFER=" + platform.getBasicBufferAddress());
8282
} else {
83-
res.add("BASICBUFFER="+memConfig.getBasicBufferStart());
83+
if (memConfig.getBasicBufferStart() != 0) {
84+
res.add("BASICBUFFER=" + memConfig.getBasicBufferStart());
85+
}
8486
}
8587
}
8688

89+
protected void addInternalBasicBuffer(List<String> res, PlatformProvider platform, MemoryConfig memConfig) {
90+
if (memConfig.getBasicBufferStart() == 0) {
91+
res.add("BASICBUFFER .ARRAY 256");
92+
}
93+
}
94+
8795
protected void addMemoryLocations(List<String> res) {
8896
String[] labels = Loader.loadProgram(TransformerX16.class.getResourceAsStream("/rommap/memloc-c64.map"));
8997
addLabels(res, labels);
@@ -334,12 +342,12 @@ protected int extractData(CompilerConfig config, PlatformProvider platform, Mach
334342
return cnt;
335343
}
336344

337-
protected void addStructures(CompilerConfig config, Machine machine, PlatformProvider platform, List<String> code,
345+
protected void addStructures(CompilerConfig config, MemoryConfig memConfig, Machine machine, PlatformProvider platform, List<String> code,
338346
List<String> res, List<String> consts, List<String> vars, List<String> mnems, List<String> subs) {
339-
addStructures(config, machine, platform, code, res, consts, vars, mnems, subs, null, null);
347+
addStructures(config, memConfig, machine, platform, code, res, consts, vars, mnems, subs, null, null);
340348
}
341349

342-
protected void addStructures(CompilerConfig config, Machine machine, PlatformProvider platform, List<String> code,
350+
protected void addStructures(CompilerConfig config, MemoryConfig memConfig, Machine machine, PlatformProvider platform, List<String> code,
343351
List<String> res, List<String> consts, List<String> vars, List<String> mnems, List<String> subs,
344352
List<String> addOns, StringAdder adder) {
345353
Map<String, String> name2label = new HashMap<String, String>();
@@ -462,13 +470,15 @@ protected void addStructures(CompilerConfig config, Machine machine, PlatformPro
462470
res.add("LASTVARP\t.WORD 0");
463471
res.add("HIGHP\t.WORD STRBUF");
464472
res.add("STRBUFP\t.WORD STRBUF");
465-
res.add("ENDSTRBUF\t.WORD " + this.stringMemoryEnd);
473+
res.add("ENDSTRBUF\t.WORD " + this.stringMemoryEnd);
466474
res.add("INPUTQUEUEP\t.BYTE 0");
467475
res.add("PROGRAMEND");
476+
addInternalBasicBuffer(res, platform, memConfig);
468477
res.add("INPUTQUEUE\t.ARRAY $0F");
469478
res.add("FPSTACK .ARRAY " + Math.min(256, platform.getStackSize() * 5));
470479
res.add("FORSTACK .ARRAY " + Math.min(1024, platform.getForStackSize() * 17));
471480
res.add("STRBUF\t.BYTE 0");
481+
472482
}
473483

474484
@Override

src/main/java/com/sixtyfour/cbmnative/mos6502/c64/Transformer64.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public List<String> transform(CompilerConfig config, MemoryConfig memConfig, Mac
135135
res.add("TSX");
136136
res.add("STX SP_SAVE");
137137

138-
addStructures(config, machine, platform, code, res, consts, vars, mnems, subs);
138+
addStructures(config, memConfig, machine, platform, code, res, consts, vars, mnems, subs);
139139
return res;
140140
}
141141

src/main/java/com/sixtyfour/cbmnative/mos6502/vic20/Transformer20.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public List<String> transform(CompilerConfig config, MemoryConfig memConfig, Mac
139139
res.add("TSX");
140140
res.add("STX SP_SAVE");
141141

142-
addStructures(config, machine, platform, code, res, consts, vars, mnems, subs);
142+
addStructures(config, memConfig, machine, platform, code, res, consts, vars, mnems, subs);
143143
return res;
144144
}
145145
}

src/main/java/com/sixtyfour/cbmnative/mos6502/x16/TransformerX16.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public List<String> transform(CompilerConfig config, MemoryConfig memConfig, Mac
8484
res.add("TSX");
8585
res.add("STX SP_SAVE");
8686

87-
addStructures(config, machine, platform, code, res, consts, vars, mnems, subs, mapping.getFarCalls(),
87+
addStructures(config, memConfig, machine, platform, code, res, consts, vars, mnems, subs, mapping.getFarCalls(),
8888
new StringAdder() {
8989
@Override
9090
public void addStringVars(List<String> strVars) {

src/main/java/com/sixtyfour/cbmnative/shell/MoSpeedCL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ private static void printOutHelp() {
537537
System.out.println(
538538
"/runtimestart=xxxxx|$yyyy - the start address of the runtime's code. If none is given, it follows the program's code.");
539539
System.out.println(
540-
"/sysbuffer=xxxxx|$yyyy - the start address of the buffer used to execute SYS commands with parameters. Default is 820 for the CBM machines and 1024 for the X16.");
540+
"/sysbuffer=xxxxx|$yyyy - the start address of the buffer used to execute SYS commands with parameters. Default is 820 for the CBM machines and 1024 for the X16. If set to 0, the runtime will reserve its own buffer in BASIC memory.");
541541
System.out.println("/alloff=true|false - if specified, all optimizations will be turned off");
542542
System.out.println(
543543
"/vice=<path> - sets a path to the VICE executable. If specified, the compiled prg file will be started in VICE right away.");

0 commit comments

Comments
 (0)