mirror of
https://github.com/irmen/prog8.git
synced 2024-09-30 15:57:06 +00:00
fix compiler crash, rasterbars alignment, docs.
This commit is contained in:
parent
163c6bc628
commit
1ff68b06da
1
compiler/res/version.txt
Normal file
1
compiler/res/version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0 (beta)
|
@ -25,17 +25,21 @@ fun main(args: Array<String>) {
|
|||||||
return stackVmMain(newArgs.toTypedArray())
|
return stackVmMain(newArgs.toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printSoftwareHeader("compiler")
|
||||||
println("\nProg8 compiler by Irmen de Jong (irmen@razorvine.net)")
|
|
||||||
// @todo software license string
|
|
||||||
// println("This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html\n")
|
|
||||||
println("**** This is a prerelease version. Please do not distribute! ****\n")
|
|
||||||
|
|
||||||
if (args.isEmpty())
|
if (args.isEmpty())
|
||||||
usage()
|
usage()
|
||||||
compileMain(args)
|
compileMain(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun printSoftwareHeader(what: String) {
|
||||||
|
val buildVersion = object {}.javaClass.getResource("/version.txt").readText().trim()
|
||||||
|
println("\nProg8 $what by Irmen de Jong (irmen@razorvine.net)")
|
||||||
|
println("Version: $buildVersion")
|
||||||
|
println("This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun compileMain(args: Array<String>) {
|
private fun compileMain(args: Array<String>) {
|
||||||
var emulatorToStart = ""
|
var emulatorToStart = ""
|
||||||
var moduleFile = ""
|
var moduleFile = ""
|
||||||
|
@ -10,10 +10,7 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun stackVmMain(args: Array<String>) {
|
fun stackVmMain(args: Array<String>) {
|
||||||
println("\nProg8 StackVM by Irmen de Jong (irmen@razorvine.net)")
|
printSoftwareHeader("StackVM")
|
||||||
// @todo decide on software license
|
|
||||||
// println("This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html\n")
|
|
||||||
println("**** This is a prerelease version. Please do not distribute! ****\n")
|
|
||||||
|
|
||||||
if(args.size != 1) {
|
if(args.size != 1) {
|
||||||
System.err.println("requires one argument: name of stackvm sourcecode file")
|
System.err.println("requires one argument: name of stackvm sourcecode file")
|
||||||
|
@ -78,7 +78,7 @@ private class StatementReorderer(private val namespace: INameScope, private val
|
|||||||
&& stmtBeforeFirstSub !is Subroutine
|
&& stmtBeforeFirstSub !is Subroutine
|
||||||
&& stmtBeforeFirstSub !is BuiltinFunctionStatementPlaceholder) {
|
&& stmtBeforeFirstSub !is BuiltinFunctionStatementPlaceholder) {
|
||||||
val ret = Return(emptyList(), stmtBeforeFirstSub.position)
|
val ret = Return(emptyList(), stmtBeforeFirstSub.position)
|
||||||
ret.linkParents(stmtBeforeFirstSub.parent)
|
ret.linkParents(block)
|
||||||
block.statements.add(block.statements.size - numSubroutinesAtEnd, ret)
|
block.statements.add(block.statements.size - numSubroutinesAtEnd, ret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ that can be loaded into memory anywhere.
|
|||||||
Compiling program code
|
Compiling program code
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
Make sure you have installed the :ref:`requirements`.
|
||||||
|
|
||||||
Compilation of program code is done by telling the Prog8 compiler to compile a main source code module file.
|
Compilation of program code is done by telling the Prog8 compiler to compile a main source code module file.
|
||||||
Other modules that this code needs will be loaded and processed via imports from within that file.
|
Other modules that this code needs will be loaded and processed via imports from within that file.
|
||||||
The compiler will link everything together into one output program at the end.
|
The compiler will link everything together into one output program at the end.
|
||||||
@ -94,3 +96,12 @@ Examples
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
A couple of example programs can be found in the 'examples' directory of the source tree.
|
A couple of example programs can be found in the 'examples' directory of the source tree.
|
||||||
|
Make sure you have installed the :ref:`requirements`. Then, for instance,
|
||||||
|
to compile and run the rasterbars example program, use this command::
|
||||||
|
|
||||||
|
$ java -jar prog8compiler.jar -emu examples/rasterbars.p8
|
||||||
|
|
||||||
|
or::
|
||||||
|
|
||||||
|
$ ./p8compile.sh -emu examples/rasterbars.p8
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
#
|
#
|
||||||
# import os
|
import os
|
||||||
# import sys
|
# import sys
|
||||||
# sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
@ -20,13 +20,14 @@
|
|||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
project = 'Prog8'
|
project = 'Prog8'
|
||||||
copyright = '2018, Irmen de Jong'
|
copyright = '2019, Irmen de Jong'
|
||||||
author = 'Irmen de Jong'
|
author = 'Irmen de Jong'
|
||||||
|
|
||||||
|
|
||||||
# The short X.Y version
|
# The short X.Y version
|
||||||
version = 'x.y'
|
version = open("../../compiler/res/version.txt").readline()
|
||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = 'x.y alpha'
|
release = version
|
||||||
|
|
||||||
# -- extensions
|
# -- extensions
|
||||||
|
|
||||||
|
@ -106,6 +106,8 @@ Design principles and features
|
|||||||
the ability to easily write embedded assembly code directly in the program source code.
|
the ability to easily write embedded assembly code directly in the program source code.
|
||||||
|
|
||||||
|
|
||||||
|
.. _requirements:
|
||||||
|
|
||||||
Required tools
|
Required tools
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@ -19,24 +19,26 @@
|
|||||||
|
|
||||||
const ubyte barheight = 4
|
const ubyte barheight = 4
|
||||||
ubyte[13] colors = [6,2,4,5,15,7,1,13,3,12,8,11,9]
|
ubyte[13] colors = [6,2,4,5,15,7,1,13,3,12,8,11,9]
|
||||||
ubyte color =0
|
ubyte color = 0
|
||||||
ubyte ypos = 0
|
ubyte ypos = 0
|
||||||
|
|
||||||
sub irq() {
|
sub irq() {
|
||||||
ubyte rasterpos=c64.RASTER
|
Y++ ; delay for alignment
|
||||||
A*=2 ; delay for align
|
Y++ ; delay for alignment
|
||||||
A*=2 ; delay for align
|
Y++ ; delay for alignment
|
||||||
A*=2 ; delay for align
|
ubyte rasterpos = c64.RASTER
|
||||||
if color!=len(colors) {
|
if color!=len(colors) {
|
||||||
c64.EXTCOL = colors[color]
|
c64.EXTCOL = colors[color]
|
||||||
c64.RASTER = rasterpos+barheight
|
c64.RASTER = rasterpos+barheight
|
||||||
color++
|
color++
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ypos+=2
|
Y++ ; delay for alignment
|
||||||
|
Y++ ; delay for alignment
|
||||||
|
ypos += 2
|
||||||
c64.EXTCOL = 0
|
c64.EXTCOL = 0
|
||||||
c64.RASTER=sin8u(ypos)/2+40
|
c64.RASTER = sin8u(ypos)/2+40
|
||||||
color=0
|
color = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user