Skip to content

Commit

Permalink
[#201] ramc-ram, ram-cpu, ram-mem, abstract-tape: rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
vbmacher committed May 9, 2022
1 parent 4b7fd78 commit 5e040f4
Show file tree
Hide file tree
Showing 89 changed files with 2,350 additions and 2,102 deletions.
8 changes: 4 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All issues for the milestone are listed [here](https://github.com/emustudio/emuS
## main-module:
- removed configuration editor popup in the schema editor
- reimplemented source code editor using [RSyntaxTextArea](https://github.com/bobbylight/RSyntaxTextArea)
- reimplemented emulation automation (`--input` is not required anymore, introduced more command line options)
- reimplemented emulation automation (`--value` is not required anymore, introduced more command line options)
- introduced configuration file for the main module
- be able to configure Look and Feel in the configuration
- make debug table responsive
Expand All @@ -42,14 +42,14 @@ All issues for the milestone are listed [here](https://github.com/emustudio/emuS

## RASP:
- rewritten raspc-rasp grammar and compiler
- raspc-rasp: implemented `<input>` directive
- raspc-rasp: implemented `<value>` directive

## SSEM:
- fix: SSEM noodle-timer doesn't work

## adm3A-terminal:
- fix: load cursor from software
- fix: keyboard does not read input
- fix: keyboard does not read value
- fix: "here is" does not work (in GUI) - throws some hidden exception
- fix: "always on top" doesn't work

Expand Down Expand Up @@ -105,7 +105,7 @@ All issues for the milestone are listed [here](https://github.com/emustudio/emuS
- "previous instruction" just decrements program counter
- fixed syntax highlighting
- fixed: on breakpoint, instruction list was not pointing at current (next) instruction
- fixed: on 'pages backwards' button when the input window is cancelled, NullPointerException appeared in log
- fixed: on 'pages backwards' button when the value window is cancelled, NullPointerException appeared in log
- fixed: when file was not saved before compilation, on most compilers NullPointerException appeared in log
- fixed: in source code editor, when open file is cancelled, compiler output window was cleared
- find/replace dialog is now possible to be cancelled with ESC key
Expand Down
16 changes: 8 additions & 8 deletions application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ dependencies {
providedRuntime project(":plugins:compiler:as-ssem")
providedRuntime project(":plugins:compiler:as-z80")
providedRuntime project(":plugins:compiler:brainc-brainduck")
// providedRuntime project(":plugins:compiler:ramc-ram")
providedRuntime project(":plugins:compiler:ramc-ram")
// providedRuntime project(":plugins:compiler:raspc-rasp")

// providedRuntime project(":plugins:memory:ram-mem")
providedRuntime project(":plugins:memory:ram-mem")
// providedRuntime project(":plugins:memory:rasp-mem")
providedRuntime project(":plugins:memory:ssem-mem")
providedRuntime project(":plugins:memory:byte-mem")

providedRuntime project(":plugins:cpu:8080-cpu")
providedRuntime project(":plugins:cpu:brainduck-cpu")
// providedRuntime project(":plugins:cpu:ram-cpu")
providedRuntime project(":plugins:cpu:ram-cpu")
// providedRuntime project(":plugins:cpu:rasp-cpu")
providedRuntime project(":plugins:cpu:z80-cpu")
providedRuntime project(":plugins:cpu:ssem-cpu")
Expand Down Expand Up @@ -179,13 +179,13 @@ distributions {
from(output(":plugins:compiler:as-z80"))
from(output(":plugins:compiler:as-ssem"))
from(output(":plugins:compiler:brainc-brainduck"))
// from(output(":plugins:compiler:ramc-ram"))
from(output(":plugins:compiler:ramc-ram"))
//from(output(":plugins:compiler:raspc-rasp"))
}

into('memory') {
include '*.jar'
// from(output(":plugins:memory:ram-mem"))
from(output(":plugins:memory:ram-mem"))
// from(output(":plugins:memory:rasp-mem"))
from(output(":plugins:memory:ssem-mem"))
from(output(":plugins:memory:byte-mem"))
Expand All @@ -195,7 +195,7 @@ distributions {
include '*.jar'
from(output(":plugins:cpu:8080-cpu"))
from(output(":plugins:cpu:brainduck-cpu"))
// from(output(":plugins:cpu:ram-cpu"))
from(output(":plugins:cpu:ram-cpu"))
// from(output(":plugins:cpu:rasp-cpu"))
from(output(":plugins:cpu:z80-cpu"))
from(output(":plugins:cpu:ssem-cpu"))
Expand All @@ -214,15 +214,15 @@ distributions {

// Examples
//["as-8080", "as-z80", "as-ssem", "brainc-brainduck", "ramc-ram", "raspc-rasp"]
["as-8080", "as-z80", "as-ssem", "brainc-brainduck"].collect { compiler ->
["as-8080", "as-z80", "as-ssem", "brainc-brainduck", "ramc-ram"].collect { compiler ->
from(examples(":plugins:compiler:$compiler")) {
into "examples/$compiler"
}
}

// Scripts
// ["as-8080", "as-z80", "as-ssem", "brainc-brainduck", "ramc-ram", "raspc-rasp"]
["as-8080", "as-z80", "as-ssem", "brainc-brainduck"].collect { compiler ->
["as-8080", "as-z80", "as-ssem", "brainc-brainduck", "ramc-ram"].collect { compiler ->
from(scripts(":plugins:compiler:$compiler")) {
into "bin"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mvi d,0 ; char with maximum ASCII code

char_loop:
call getchar
cpi 10 ; end of input?
cpi 10 ; end of value?
jz char_end
cpi 13
jz char_end
Expand Down
10 changes: 5 additions & 5 deletions plugins/compiler/as-8080/src/main/examples/numbers_count.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ dcx sp ; stack initialization (0FFFFh)
lxi h,text1
call putstr ; print text1

lxi d,input ; address for string input
lxi d,value ; address for string value
call getline ; read from keyboard

lxi b,input
lxi b,value
mvi d,0 ; numbers counter

char_loop:
ldax b
inx b
cpi 10 ; end of input?
cpi 10 ; end of value?
jz char_end
cpi 13
jz char_end
Expand All @@ -41,6 +41,6 @@ include 'include\putstr.inc'
include 'include\putchar.inc'
include 'include\newline.inc'

text1: db 'Count of numbers on input ...',10,13,'Enter text: ',0
text1: db 'Count of numbers on value ...',10,13,'Enter text: ',0
text2: db 10,13,'Count: ',0
input: ds 30
value: ds 30
8 changes: 4 additions & 4 deletions plugins/compiler/as-8080/src/main/examples/reverse.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ dcx sp ; stack initialization (0FFFFh)

lxi h,text1
call putstr ; print text1
lxi d,input ; address for string input
lxi d,value ; address for string value
call getline ; read from keyboard

lxi b,input
lxi b,value

mvi d,0 ; chars counter

char_loop:
ldax b
inx b ; bc = bc+1
cpi 10 ; end of input?
cpi 10 ; end of value?
jz char_end
cpi 13
jz char_end
Expand Down Expand Up @@ -53,4 +53,4 @@ include 'include\newline.inc'

text1: db 'Reversed text ...',10,13,'Enter text: ',0
text2: db 10,13,'Reversed: ',0
input: ds 30
value: ds 30
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public boolean compile(String inputFileName) {
String outputFileName = Objects.requireNonNull(inputFileName);
SourceFileExtension srcExtension = SOURCE_FILE_EXTENSIONS.get(0);

int i = inputFileName.lastIndexOf("." + srcExtension.getExtension());
int i = inputFileName.toLowerCase(Locale.ENGLISH).lastIndexOf("." + srcExtension.getExtension());
if (i >= 0) {
outputFileName = outputFileName.substring(0, i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public void onStart() {

@Override
public void onMessage(CompilerMessage message) {
System.out.println(message);
if (message.getMessageType() != CompilerMessage.MessageType.TYPE_INFO) {
System.out.println(message);
}
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions plugins/compiler/as-z80/src/main/examples/reverse.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ dec sp ; stack initialization (0FFFFh)

ld hl,text1
call putstr ; print text1
ld de,input ; address for string input
ld de,value ; address for string value
call getline ; read from keyboard

ld bc,input
ld bc,value

ld d,0 ; chars counter

char_loop:
ld a, (bc)
inc bc ; bc = bc+1
cp 10 ; end of input?
cp 10 ; end of value?
jp z, char_end
cp 13
jp z, char_end
Expand Down Expand Up @@ -52,4 +52,4 @@ include "include\newline.inc"

text1: db "Reversed text ...",10,13,"Enter text: ",0
text2: db 10,13,"Reversed: ",0
input: ds 30
value: ds 30
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public boolean compile(String inputFileName) {
String outputFileName = Objects.requireNonNull(inputFileName);
SourceFileExtension srcExtension = SOURCE_FILE_EXTENSIONS.get(0);

int i = inputFileName.lastIndexOf("." + srcExtension.getExtension());
int i = inputFileName.toLowerCase(Locale.ENGLISH).lastIndexOf("." + srcExtension.getExtension());
if (i >= 0) {
outputFileName = outputFileName.substring(0, i);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.emustudio.plugins.compiler.asZ80.visitors;

import net.emustudio.plugins.compiler.asZ80.CompileError;
import net.emustudio.plugins.compiler.asZ80.ast.Evaluated;
import net.emustudio.plugins.compiler.asZ80.ast.instr.Instr;
import net.emustudio.plugins.compiler.asZ80.ast.instr.InstrCB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void onStart() {

@Override
public void onMessage(CompilerMessage message) {
System.out.println(message);
if (message.getMessageType() != CompilerMessage.MessageType.TYPE_INFO) {
System.out.println(message);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
of course any function char f(char) can be made easily on the same principle
My pathological program rot13.b is good for testing the response to deep
brackets; the input "~mlk zyx" should produce the output "~zyx mlk".
brackets; the value "~mlk zyx" should produce the output "~zyx mlk".
Daniel B Cristofani (cristofdathevanetdotcom)
http://www.hevanet.com/cristofd/brainfuck/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import net.emustudio.emulib.runtime.InvalidContextException;
import net.emustudio.emulib.runtime.PluginSettings;
import net.emustudio.emulib.runtime.io.IntelHEX;
import net.emustudio.plugins.compiler.brainduck.tree.Program;
import net.emustudio.plugins.compiler.brainduck.tree.ProgramParser;
import net.emustudio.plugins.compiler.brainduck.ast.Program;
import net.emustudio.plugins.compiler.brainduck.ast.ProgramParser;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.emustudio.plugins.compiler.brainduck.tree;
package net.emustudio.plugins.compiler.brainduck.ast;

import net.emustudio.emulib.runtime.io.IntelHEX;
import net.emustudio.plugins.compiler.brainduck.BraincParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.emustudio.plugins.compiler.brainduck.tree;
package net.emustudio.plugins.compiler.brainduck.ast;

import net.emustudio.emulib.runtime.io.IntelHEX;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.emustudio.plugins.compiler.brainduck.tree;
package net.emustudio.plugins.compiler.brainduck.ast;

import net.emustudio.plugins.compiler.brainduck.BraincParser;
import net.emustudio.plugins.compiler.brainduck.BraincParserBaseVisitor;
Expand Down
4 changes: 3 additions & 1 deletion plugins/compiler/ramc-ram/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
src/main/java/net/emustudio/plugins/compiler/ramc/LexerImpl.java
/src/main/antlr/gen/
/src/main/gen/
*.tokens
40 changes: 25 additions & 15 deletions plugins/compiler/ramc-ram/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,52 @@ import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id 'java'
id 'org.xbib.gradle.plugin.jflex' version "1.5.0"
id "com.github.andrescv.jcup" version "1.0"
id 'idea'
id 'antlr'
id 'com.adarshr.test-logger' version '3.1.0'
}

dependencies {
antlr "org.antlr:antlr4:4.9.2"
implementation "org.antlr:antlr4-runtime:4.9.2"
implementation libs.emuLib
implementation project.rootProject.project(":plugins:memory:ram-mem")
implementation libs.javaCupRuntime
implementation libs.slf4JApi

testImplementation libs.junit
testImplementation libs.easyMock
testImplementation libs.slf4JSimple
}

sourceSets.main.java.srcDirs = [
"${buildDir}/generated-sources/jflex", "${buildDir}/generated-sources/cup", 'src/main/java'
]
generateGrammarSource {
maxHeapSize = "128m"
arguments += ['-package', 'net.emustudio.plugins.compiler.ram', '-visitor', '-no-listener']
outputDirectory = file("${buildDir}/generated-src/antlr/main/net/emustudio/plugins/compiler/ram")
}
compileJava.dependsOn generateGrammarSource

jflex {
no_backup = true
sourceSets {
generated {
java.srcDir "${buildDir}/generated-src/antlr/main"
}
main {
java.srcDirs = [
'src/main/java', "${buildDir}/generated-src/antlr/main"
]
}
}
compileJava.source sourceSets.generated.java, sourceSets.main.java

jcup {
input = file('src/main/cup/parser.cup')
destdir = file("${buildDir}/generated-sources/cup/net/emustudio/plugins/compiler/ramc")
parser = 'ParserImpl'
symbols = 'Symbols'
iface = true
idea {
module {
sourceDirs += file("build/generated-src/antlr")
}
}

jar {
archiveVersion = ''
manifest {
attributes manifestAttributes('net.emustudio.plugins.compiler.ramc.Runner')
attributes manifestAttributes('net.emustudio.plugins.compiler.ram.Runner')
}
}

Expand Down
Loading

0 comments on commit 5e040f4

Please sign in to comment.