mirror of
https://github.com/irmen/prog8.git
synced 2024-11-19 11:32:17 +00:00
restructuring vm
This commit is contained in:
parent
5a27b035b0
commit
ade7a4c398
@ -7,17 +7,18 @@ import prog8.ast.base.checkRecursion
|
|||||||
import prog8.ast.base.checkValid
|
import prog8.ast.base.checkValid
|
||||||
import prog8.ast.base.reorderStatements
|
import prog8.ast.base.reorderStatements
|
||||||
import prog8.ast.statements.Directive
|
import prog8.ast.statements.Directive
|
||||||
import prog8.astvm.AstVm
|
import prog8.vm.astvm.AstVm
|
||||||
import prog8.compiler.*
|
import prog8.compiler.*
|
||||||
import prog8.compiler.target.c64.AsmGen
|
import prog8.compiler.target.c64.AsmGen
|
||||||
import prog8.compiler.target.c64.C64Zeropage
|
import prog8.compiler.target.c64.C64Zeropage
|
||||||
import prog8.optimizing.constantFold
|
import prog8.optimizer.constantFold
|
||||||
import prog8.optimizing.optimizeStatements
|
import prog8.optimizer.optimizeStatements
|
||||||
import prog8.optimizing.simplifyExpressions
|
import prog8.optimizer.simplifyExpressions
|
||||||
import prog8.parser.ParsingFailedError
|
import prog8.parser.ParsingFailedError
|
||||||
import prog8.parser.importLibraryModule
|
import prog8.parser.importLibraryModule
|
||||||
import prog8.parser.importModule
|
import prog8.parser.importModule
|
||||||
import prog8.parser.moduleName
|
import prog8.parser.moduleName
|
||||||
|
import prog8.vm.stackvm.stackVmMain
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
|
@ -11,7 +11,7 @@ import prog8.compiler.intermediate.Opcode
|
|||||||
import prog8.compiler.intermediate.branchOpcodes
|
import prog8.compiler.intermediate.branchOpcodes
|
||||||
import prog8.functions.BuiltinFunctions
|
import prog8.functions.BuiltinFunctions
|
||||||
import prog8.parser.tryGetEmbeddedResource
|
import prog8.parser.tryGetEmbeddedResource
|
||||||
import prog8.stackvm.Syscall
|
import prog8.vm.stackvm.Syscall
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package prog8.compiler.intermediate
|
package prog8.compiler.intermediate
|
||||||
|
|
||||||
import prog8.compiler.RuntimeValue
|
import prog8.compiler.RuntimeValue
|
||||||
import prog8.stackvm.Syscall
|
import prog8.vm.stackvm.Syscall
|
||||||
|
|
||||||
open class Instruction(val opcode: Opcode,
|
open class Instruction(val opcode: Opcode,
|
||||||
val arg: RuntimeValue? = null,
|
val arg: RuntimeValue? = null,
|
||||||
|
@ -10,8 +10,8 @@ import prog8.ast.base.printWarning
|
|||||||
import prog8.compiler.RuntimeValue
|
import prog8.compiler.RuntimeValue
|
||||||
import prog8.compiler.*
|
import prog8.compiler.*
|
||||||
import prog8.compiler.intermediate.*
|
import prog8.compiler.intermediate.*
|
||||||
import prog8.stackvm.Syscall
|
import prog8.vm.stackvm.Syscall
|
||||||
import prog8.stackvm.syscallsForStackVm
|
import prog8.vm.stackvm.syscallsForStackVm
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.ParentSentinel
|
import prog8.ast.base.ParentSentinel
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.DataType
|
import prog8.ast.base.DataType
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.*
|
import prog8.ast.base.*
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.AstException
|
import prog8.ast.base.AstException
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.AstException
|
import prog8.ast.base.AstException
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.optimizing
|
package prog8.optimizer
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.*
|
import prog8.ast.base.*
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.*
|
import prog8.ast.base.*
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.ast.base.DataType
|
import prog8.ast.base.DataType
|
||||||
import prog8.compiler.RuntimeValue
|
import prog8.compiler.RuntimeValue
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.ast.INameScope
|
import prog8.ast.INameScope
|
||||||
import java.util.*
|
import java.util.*
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.ArrayElementTypes
|
import prog8.ast.base.ArrayElementTypes
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.compiler.target.c64.Mflpt5
|
import prog8.compiler.target.c64.Mflpt5
|
||||||
import prog8.compiler.target.c64.Petscii
|
import prog8.compiler.target.c64.Petscii
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.compiler.target.c64.Charset
|
import prog8.compiler.target.c64.Charset
|
||||||
import prog8.compiler.target.c64.Colors
|
import prog8.compiler.target.c64.Colors
|
||||||
@ -79,7 +79,7 @@ class BitmapScreenPanel : KeyListener, JPanel() {
|
|||||||
for(sc in Petscii.encodeScreencode(text, lowercase)) {
|
for(sc in Petscii.encodeScreencode(text, lowercase)) {
|
||||||
setChar(cursorX, cursorY, sc, color)
|
setChar(cursorX, cursorY, sc, color)
|
||||||
cursorX++
|
cursorX++
|
||||||
if(cursorX>=(SCREENWIDTH/8)) {
|
if(cursorX>=(SCREENWIDTH /8)) {
|
||||||
cursorY++
|
cursorY++
|
||||||
cursorX=0
|
cursorX=0
|
||||||
}
|
}
|
||||||
@ -149,11 +149,11 @@ class ScreenDialog(title: String) : JFrame(title) {
|
|||||||
|
|
||||||
// the borders (top, left, right, bottom)
|
// the borders (top, left, right, bottom)
|
||||||
val borderTop = JPanel().apply {
|
val borderTop = JPanel().apply {
|
||||||
preferredSize = Dimension(BitmapScreenPanel.SCALING * (BitmapScreenPanel.SCREENWIDTH+2*borderWidth), BitmapScreenPanel.SCALING * borderWidth)
|
preferredSize = Dimension(BitmapScreenPanel.SCALING * (BitmapScreenPanel.SCREENWIDTH +2*borderWidth), BitmapScreenPanel.SCALING * borderWidth)
|
||||||
background = Colors.palette[14]
|
background = Colors.palette[14]
|
||||||
}
|
}
|
||||||
val borderBottom = JPanel().apply {
|
val borderBottom = JPanel().apply {
|
||||||
preferredSize =Dimension(BitmapScreenPanel.SCALING * (BitmapScreenPanel.SCREENWIDTH+2*borderWidth), BitmapScreenPanel.SCALING * borderWidth)
|
preferredSize =Dimension(BitmapScreenPanel.SCALING * (BitmapScreenPanel.SCREENWIDTH +2*borderWidth), BitmapScreenPanel.SCALING * borderWidth)
|
||||||
background = Colors.palette[14]
|
background = Colors.palette[14]
|
||||||
}
|
}
|
||||||
val borderLeft = JPanel().apply {
|
val borderLeft = JPanel().apply {
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.astvm
|
package prog8.vm.astvm
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.*
|
||||||
import prog8.ast.base.*
|
import prog8.ast.base.*
|
@ -1,7 +1,7 @@
|
|||||||
package prog8
|
package prog8.vm.stackvm
|
||||||
|
|
||||||
import prog8.astvm.ScreenDialog
|
import prog8.printSoftwareHeader
|
||||||
import prog8.stackvm.*
|
import prog8.vm.astvm.ScreenDialog
|
||||||
import java.awt.EventQueue
|
import java.awt.EventQueue
|
||||||
import javax.swing.Timer
|
import javax.swing.Timer
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
@ -1,4 +1,4 @@
|
|||||||
package prog8.stackvm
|
package prog8.vm.stackvm
|
||||||
|
|
||||||
import prog8.ast.antlr.unescape
|
import prog8.ast.antlr.unescape
|
||||||
import prog8.ast.base.*
|
import prog8.ast.base.*
|
@ -1,12 +1,12 @@
|
|||||||
package prog8.stackvm
|
package prog8.vm.stackvm
|
||||||
|
|
||||||
import prog8.ast.base.DataType
|
import prog8.ast.base.DataType
|
||||||
import prog8.ast.base.IterableDatatypes
|
import prog8.ast.base.IterableDatatypes
|
||||||
import prog8.ast.base.NumericDatatypes
|
import prog8.ast.base.NumericDatatypes
|
||||||
import prog8.ast.base.Register
|
import prog8.ast.base.Register
|
||||||
import prog8.ast.base.initvarsSubName
|
import prog8.ast.base.initvarsSubName
|
||||||
import prog8.astvm.BitmapScreenPanel
|
import prog8.vm.astvm.BitmapScreenPanel
|
||||||
import prog8.astvm.Memory
|
import prog8.vm.astvm.Memory
|
||||||
import prog8.compiler.RuntimeValue
|
import prog8.compiler.RuntimeValue
|
||||||
import prog8.compiler.HeapValues
|
import prog8.compiler.HeapValues
|
||||||
import prog8.compiler.IntegerOrAddressOf
|
import prog8.compiler.IntegerOrAddressOf
|
@ -12,7 +12,7 @@ import prog8.compiler.RuntimeValue
|
|||||||
import prog8.compiler.HeapValues
|
import prog8.compiler.HeapValues
|
||||||
import prog8.compiler.intermediate.Instruction
|
import prog8.compiler.intermediate.Instruction
|
||||||
import prog8.compiler.intermediate.Opcode
|
import prog8.compiler.intermediate.Opcode
|
||||||
import prog8.stackvm.*
|
import prog8.vm.stackvm.*
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,8 @@ class TestStackVmOpcodes {
|
|||||||
labels: Map<String, Int>?=null,
|
labels: Map<String, Int>?=null,
|
||||||
mem: Map<Int, List<RuntimeValue>>?=null) : Program {
|
mem: Map<Int, List<RuntimeValue>>?=null) : Program {
|
||||||
val heap = HeapValues()
|
val heap = HeapValues()
|
||||||
return Program("test", ins, vars ?: mapOf(), memoryPointers ?: mapOf(), labels ?: mapOf(), mem ?: mapOf(), heap)
|
return Program("test", ins, vars ?: mapOf(), memoryPointers ?: mapOf(), labels ?: mapOf(), mem
|
||||||
|
?: mapOf(), heap)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user