Compare commits

...

3 Commits

Author SHA1 Message Date
Irmen de Jong 53df0eb707 cleanups 2024-04-10 22:04:03 +02:00
Irmen de Jong 8babad9c7c sphinx config 2024-04-10 20:04:09 +02:00
Irmen de Jong 8db7aa07bd added (autogenerated) symbol skeleton files to the docs 2024-04-10 19:58:15 +02:00
24 changed files with 3649 additions and 127 deletions

View File

@ -139,13 +139,9 @@ class PtAddressOf(position: Position) : PtExpression(DataType.UWORD, position) {
class PtArrayIndexer(elementType: DataType, position: Position): PtExpression(elementType, position) {
val variable: PtIdentifier
get() {
require((children[0] as? PtIdentifier)?.type in ArrayDatatypes+DataType.STR) // TODO remove
return children[0] as PtIdentifier
}
get() = children[0] as PtIdentifier
val index: PtExpression
get() = children[1] as PtExpression
val splitWords: Boolean
get() = variable.type in SplitWordArrayTypes

View File

@ -65,8 +65,6 @@ internal fun optimizeAssembly(lines: MutableList<String>, machine: IMachineDefin
numberOfOptimizations++
}
// TODO more assembly peephole optimizations
return numberOfOptimizations
}

View File

@ -193,7 +193,7 @@ internal class IfElseAsmGen(private val program: PtProgram,
else
translateIfElseBodies("beq", stmt)
} else {
errors.warn("SLOW FALLBACK FOR 'IF' CODEGEN - ask for support", stmt.position) // TODO should have no more of these at all
errors.warn("SLOW FALLBACK FOR 'IF' CODEGEN - ask for support", stmt.position) // should not occur ;-)
assignConditionValueToRegisterAndTest(stmt.condition)
if(jumpAfterIf!=null)
translateJumpElseBodies("bne", "beq", jumpAfterIf, stmt.elseScope)

View File

@ -635,8 +635,7 @@ internal class ProgramAndVarsGen(
} else 0
when (variable.dt) {
DataType.BOOL -> TODO("bool var to asm")
DataType.UBYTE -> asmgen.out("${variable.name}\t.byte ${initialValue.toHex()}")
DataType.BOOL, DataType.UBYTE -> asmgen.out("${variable.name}\t.byte ${initialValue.toHex()}")
DataType.BYTE -> asmgen.out("${variable.name}\t.char $initialValue")
DataType.UWORD -> asmgen.out("${variable.name}\t.word ${initialValue.toHex()}")
DataType.WORD -> asmgen.out("${variable.name}\t.sint $initialValue")

View File

@ -35,7 +35,7 @@ internal class AnyExprAsmGen(
require(expr.left.type in WordDatatypes && expr.right.type in WordDatatypes) {
"both operands must be words"
}
return assignWordBinExpr(expr)
throw AssemblyError("expression should have been handled otherwise: word ${expr.operator} at ${expr.position}")
}
DataType.FLOAT -> {
require(expr.left.type==DataType.FLOAT && expr.right.type==DataType.FLOAT) {
@ -47,30 +47,6 @@ internal class AnyExprAsmGen(
}
}
private fun assignWordBinExpr(expr: PtBinaryExpression): Boolean {
when(expr.operator) {
"+" -> TODO("word + at ${expr.position}")
"-" -> TODO("word - at ${expr.position}")
"*" -> TODO("word * at ${expr.position}")
"/" -> TODO("word / at ${expr.position}")
"<<" -> TODO("word << at ${expr.position}")
">>" -> TODO("word >> at ${expr.position}")
"%" -> TODO("word % at ${expr.position}")
"and" -> TODO("word logical and (with optional shortcircuit) ${expr.position}")
"or" -> TODO("word logical or (with optional shortcircuit) ${expr.position}")
"&" -> TODO("word and at ${expr.position}")
"|" -> TODO("word or at ${expr.position}")
"^", "xor" -> TODO("word xor at ${expr.position}")
"==" -> TODO("word == at ${expr.position}")
"!=" -> TODO("word != at ${expr.position}")
"<" -> TODO("word < at ${expr.position}")
"<=" -> TODO("word <= at ${expr.position}")
">" -> TODO("word > at ${expr.position}")
">=" -> TODO("word >= at ${expr.position}")
else -> return false
}
}
private fun assignByteBinExpr(expr: PtBinaryExpression, assign: AsmAssignment): Boolean {
when(expr.operator) {
"+" -> {
@ -89,21 +65,11 @@ internal class AnyExprAsmGen(
asmgen.assignRegister(RegisterOrPair.A, assign.target)
return true
}
"*" -> {
TODO("byte * at ${expr.position}")
}
"/" -> {
TODO("byte / at ${expr.position}")
}
"<<" -> {
TODO("byte << at ${expr.position}")
}
">>" -> {
TODO("byte >> at ${expr.position}")
}
"%" -> {
TODO("byte % at ${expr.position}")
}
"*" -> TODO("byte * at ${expr.position}")
"/" -> TODO("byte / at ${expr.position}")
"<<" -> TODO("byte << at ${expr.position}")
">>" -> TODO("byte >> at ${expr.position}")
"%" -> TODO("byte % at ${expr.position}")
"and" -> TODO("logical and (with optional shortcircuit) ${expr.position}")
"or" -> TODO("logical or (with optional shortcircuit) ${expr.position}")
"&" -> {
@ -130,24 +96,12 @@ internal class AnyExprAsmGen(
asmgen.assignRegister(RegisterOrPair.A, assign.target)
return true
}
"==" -> {
TODO("byte == at ${expr.position}")
}
"!=" -> {
TODO("byte != at ${expr.position}")
}
"<" -> {
TODO("byte < at ${expr.position}")
}
"<=" -> {
TODO("byte <= at ${expr.position}")
}
">" -> {
TODO("byte > at ${expr.position}")
}
">=" -> {
TODO("byte >= at ${expr.position}")
}
"==" -> TODO("byte == at ${expr.position}")
"!=" -> TODO("byte != at ${expr.position}")
"<" -> TODO("byte < at ${expr.position}")
"<=" -> TODO("byte <= at ${expr.position}")
">" -> TODO("byte > at ${expr.position}")
">=" -> TODO("byte >= at ${expr.position}")
else -> return false
}
}

View File

@ -52,15 +52,12 @@ class IRPeepholeOptimizer(private val irprog: IRProgram) {
|| removeWeirdBranches(chunk1, chunk2, indexedInstructions)
|| removeDoubleSecClc(chunk1, indexedInstructions)
|| cleanupPushPop(chunk1, indexedInstructions)
// TODO other optimizations
} while (changed)
}
}
removeEmptyChunks(sub)
}
// TODO also do register optimization step here at the end?
irprog.linkChunks() // re-link
}
@ -451,12 +448,13 @@ class IRPeepholeOptimizer(private val irprog: IRProgram) {
}
/*
// TODO: detect multiple loads to the same target registers, only keep first (if source is not I/O memory)
// TODO: detect multiple stores to the same target, only keep first (if target is not I/O memory)
// TODO: detect multiple float ffrom/fto to the same target, only keep first
// TODO: detect subsequent same xors/nots/negs, remove the pairs completely as they cancel out
// TODO: detect multiple same ands, ors; only keep first
// TODO: (hard) detect multiple registers being assigned the same value (and not changed) - use only 1 of them
Possible other optimizations:
// detect multiple loads to the same target registers, only keep first (if source is not I/O memory)
// detect multiple stores to the same target, only keep first (if target is not I/O memory)
// detect multiple float ffrom/fto to the same target, only keep first
// detect subsequent same xors/nots/negs, remove the pairs completely as they cancel out
// detect multiple same ands, ors; only keep first
// detect multiple registers being assigned the same value (and not changed) - use only 1 of them (hard!)
// ...
*/
}

View File

@ -435,7 +435,6 @@ class ConstantFoldingOptimizer(private val program: Program, private val errors:
subrightIsConst: Boolean): IAstModification?
{
// NOTE: THESE REORDERINGS ARE ONLY VALID FOR FLOATING POINT CONSTANTS
// TODO: this implements only a small set of possible reorderings at this time, we could perhaps add more
if(expr.operator==subExpr.operator) {
// both operators are the same.

View File

@ -13,8 +13,6 @@ import kotlin.math.abs
import kotlin.math.log2
import kotlin.math.pow
// TODO add more peephole expression optimizations? Investigate what optimizations binaryen has?
class ExpressionSimplifier(private val program: Program, private val options: CompilationOptions, private val errors: IErrorReporter) : AstWalker() {
private val powersOfTwo = (1..16).map { (2.0).pow(it) }.toSet()
private val negativePowersOfTwo = powersOfTwo.map { -it }.toSet()
@ -740,7 +738,7 @@ class ExpressionSimplifier(private val program: Program, private val options: Co
in powersOfTwo -> {
if (leftDt==DataType.UBYTE || leftDt==DataType.UWORD) {
// Unsigned number divided by a power of two => shift right
// Signed number can't simply be bitshifted in this case (due to rounding issues for negative values), TODO is this correct???
// Signed number can't simply be bitshifted in this case (due to rounding issues for negative values),
// so we leave that as is and let the code generator deal with it.
val numshifts = log2(cv).toInt()
return BinaryExpression(expr.left, ">>", NumericLiteral.optimalInteger(numshifts, expr.position), expr.position)

View File

@ -156,28 +156,6 @@ internal class VariousCleanups(val program: Program, val errors: IErrorReporter,
}
}
/* TODO: is this really no longer needed in boolean branch?
if(expr.operator in LogicalOperators) {
// remove redundant !=0 comparisons from logical expressions such as: a!=0 xor b --> a xor b (only for byte operands!)
val leftExpr = expr.left as? BinaryExpression
if(leftExpr != null &&
leftExpr.operator == "!=" &&
!leftExpr.left.isSimple &&
leftExpr.left.inferType(program).isBytes &&
leftExpr.right.constValue(program)?.number == 0.0) {
return listOf(IAstModification.ReplaceNode(leftExpr, leftExpr.left, expr))
}
val rightExpr = expr.right as? BinaryExpression
if(rightExpr != null &&
rightExpr.operator == "!=" &&
!rightExpr.left.isSimple &&
rightExpr.left.inferType(program).isBytes &&
rightExpr.right.constValue(program)?.number == 0.0) {
return listOf(IAstModification.ReplaceNode(rightExpr, rightExpr.left, expr))
}
}
*/
return noModifications
}

View File

@ -21,7 +21,9 @@ class SymbolPrinter(val output: (text: String) -> Unit, val program: Program, va
override fun visit(module: Module) {
if(!module.isLibrary || !skipLibraries) {
if(module.source.isFromFilesystem || module.source.isFromResources) {
outputln("MODULE FILE: ${module.source.origin}")
val moduleName = "LIBRARY MODULE NAME: ${module.source.name}"
outputln(moduleName)
outputln("-".repeat(moduleName.length))
super.visit(module)
output("\n")
}
@ -31,7 +33,7 @@ class SymbolPrinter(val output: (text: String) -> Unit, val program: Program, va
override fun visit(block: Block) {
val (vars, subs) = block.statements.filter{ it is Subroutine || it is VarDecl }.partition { it is VarDecl }
if(vars.isNotEmpty() || subs.isNotEmpty()) {
outputln("${block.name} {")
outputln("${block.name} {")
for (variable in vars.sortedBy { (it as VarDecl).name }) {
output(" ")
variable.accept(this)

View File

@ -97,7 +97,7 @@ private fun StatementContext.toAst() : Statement {
val operator = it.operator.text
val pos = it.toPosition()
// print("\u001b[92mINFO\u001B[0m ") // bright green
// println("${pos}: ++ and -- will be removed in a future version, please use +=1 or -=1 instead.") // TODO
// println("${pos}: ++ and -- will be removed in a future version, please use +=1 or -=1 instead.") // .... if we decode to remove them one day
val addSubOne = BinaryExpression(tgt.toExpression(), if(operator=="++") "+" else "-", NumericLiteral.optimalInteger(1, pos), pos, false)
return Assignment(tgt, addSubOne, AssignmentOrigin.USERCODE, pos)
}

View File

@ -538,8 +538,7 @@ data class AssignTarget(var identifier: IdentifierReference?,
if (memoryAddress != null)
return InferredTypes.knownFor(DataType.UBYTE)
// a multi-assign has no 1 type... TODO although it could perhaps be the type of the first target?
// a multi-target has no 1 particular type
return InferredTypes.unknown()
}

View File

@ -16,12 +16,13 @@ help:
symboldumps:
p8compile -target atari import-all-atari.p8 -dumpsymbols > skeletons-atari.txt
p8compile -target c64 import-all-c64.p8 -dumpsymbols > skeletons-c64.txt
p8compile -target c128 import-all-c128.p8 -dumpsymbols > skeletons-c128.txt
p8compile -target cx16 import-all-cx16.p8 -dumpsymbols > skeletons-cx16.txt
p8compile -target pet32 import-all-pet32.p8 -dumpsymbols > skeletons-pet32.txt
p8compile -target virtual import-all-virtual.p8 -dumpsymbols > skeletons-virtual.txt
mkdir -p source/_static/symboldumps
p8compile -target atari import-all-atari.p8 -dumpsymbols > source/_static/symboldumps/skeletons-atari.txt
p8compile -target c64 import-all-c64.p8 -dumpsymbols > source/_static/symboldumps/skeletons-c64.txt
p8compile -target c128 import-all-c128.p8 -dumpsymbols > source/_static/symboldumps/skeletons-c128.txt
p8compile -target cx16 import-all-cx16.p8 -dumpsymbols > source/_static/symboldumps/skeletons-cx16.txt
p8compile -target pet32 import-all-pet32.p8 -dumpsymbols > source/_static/symboldumps/skeletons-pet32.txt
p8compile -target virtual import-all-virtual.p8 -dumpsymbols > source/_static/symboldumps/skeletons-virtual.txt
# Catch-all target: route all unknown targets to Sphinx using the new

View File

@ -0,0 +1,363 @@
Prog8 compiler v10.3-SNAPSHOT by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit 42f4b06a in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-atari.p8
Compiler target: atari
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
const ubyte DEFAULT_HEIGHT
const ubyte DEFAULT_WIDTH
bell ()
chrout (ubyte character @A)
clear_screen ()
clear_screenchars (ubyte character @A) -> clobbers (Y)
clear_screencolors (ubyte color @A) -> clobbers (Y)
cls ()
color (ubyte txtcol)
column (ubyte col)
fill_screen (ubyte character @A, ubyte color @Y) -> clobbers (A)
get_column () -> ubyte
get_cursor (uword colptr, uword rowptr)
get_row () -> ubyte
getchr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
getclr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
height () -> clobbers (X,Y) -> ubyte @A
input_chars (uword buffer @AY) -> clobbers (A) -> ubyte @Y
lowercase ()
nl ()
plot (ubyte col, ubyte rownum)
print (str text @AY) -> clobbers (A,Y)
print_b (byte value @A) -> clobbers (A,X,Y)
print_ub (ubyte value @A) -> clobbers (A,X,Y)
print_ub0 (ubyte value @A) -> clobbers (A,X,Y)
print_ubbin (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_ubhex (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_uw (uword value @AY) -> clobbers (A,X,Y)
print_uw0 (uword value @AY) -> clobbers (A,X,Y)
print_uwbin (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_uwhex (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_w (word value @AY) -> clobbers (A,X,Y)
row (ubyte rownum)
scroll_down (bool alsocolors @Pc) -> clobbers (A)
scroll_left (bool alsocolors @Pc) -> clobbers (A,Y)
scroll_right (bool alsocolors @Pc) -> clobbers (A)
scroll_up (bool alsocolors @Pc) -> clobbers (A)
setcc (ubyte col, ubyte row, ubyte char, ubyte charcolor)
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) -> clobbers (A,Y)
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) -> clobbers (A,Y)
spc ()
uppercase ()
waitkey () -> ubyte @A
width () -> clobbers (X,Y) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
atari {
&uword COLCRS
&uword IRQ_VEC
&uword NMI_VEC
&uword RESET_VEC
&ubyte ROWCRS
getchar () -> ubyte @A = $f24a
outchar (ubyte character @A) = $f2b0
waitkey () -> ubyte @A = $f2fd
}
sys {
const ubyte target
clear_carry ()
clear_irqd ()
disable_caseswitch ()
enable_caseswitch ()
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
init_system ()
init_system_phase2 ()
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
push (ubyte value @A)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irqd ()
wait (uword jiffies)
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
LIBRARY MODULE NAME: diskio
---------------------------
diskio {
const ubyte READ_IO_CHANNEL
const ubyte WRITE_IO_CHANNEL
ubyte @shared drivenumber
bool iteration_in_progress
uword list_blocks
str list_filename
str list_filetype
uword list_pattern
bool list_skip_disk_name
delete (uword filenameptr)
directory () -> bool
diskname () -> uword
f_close ()
f_close_w ()
f_open (uword filenameptr) -> bool
f_open_w (uword filenameptr) -> bool
f_read (uword bufferpointer, uword num_bytes) -> uword
f_read_all (uword bufferpointer) -> uword
f_readline (uword bufptr @AY) -> clobbers (X) -> ubyte @Y
f_write (uword bufferpointer, uword num_bytes) -> bool
lf_end_list ()
lf_next_entry () -> bool
lf_start_list (uword pattern_ptr) -> bool
list_filenames (uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte
load (uword filenameptr, uword address_override) -> uword
load_raw (uword filenameptr, uword start_address) -> uword
rename (uword oldfileptr, uword newfileptr)
reset_read_channel ()
reset_write_channel ()
save (uword filenameptr, uword start_address, uword savesize) -> bool
send_command (uword commandptr)
status () -> uword
status_code () -> ubyte
}
LIBRARY MODULE NAME: string
---------------------------
string {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_start ()
crc32_update (ubyte value @A)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}

View File

@ -0,0 +1,592 @@
Prog8 compiler v10.3-SNAPSHOT by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit 42f4b06a in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-c128.p8
Compiler target: c128
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
const ubyte DEFAULT_HEIGHT
const ubyte DEFAULT_WIDTH
bell ()
chrout (ubyte character @A) = $ffd2
clear_screen ()
clear_screenchars (ubyte char @A) -> clobbers (Y)
clear_screencolors (ubyte color @A) -> clobbers (Y)
cls ()
color (ubyte txtcol)
column (ubyte col @A) -> clobbers (A,X,Y)
fill_screen (ubyte char @A, ubyte color @Y) -> clobbers (A)
get_column () -> ubyte @Y
get_cursor (uword colptr, uword rowptr)
get_row () -> ubyte @X
getchr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
getclr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
height () -> clobbers (X,Y) -> ubyte @A
home ()
input_chars (uword buffer @AY) -> clobbers (A) -> ubyte @Y
lowercase ()
nl ()
petscii2scr (ubyte petscii_char @A) -> ubyte @A
petscii2scr_str (str petscii_string @AY)
plot (ubyte col @Y, ubyte row @X)
print (str text @AY) -> clobbers (A,Y)
print_b (byte value @A) -> clobbers (A,X,Y)
print_bool (bool value)
print_ub (ubyte value @A) -> clobbers (A,X,Y)
print_ub0 (ubyte value @A) -> clobbers (A,X,Y)
print_ubbin (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_ubhex (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_uw (uword value @AY) -> clobbers (A,X,Y)
print_uw0 (uword value @AY) -> clobbers (A,X,Y)
print_uwbin (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_uwhex (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_w (word value @AY) -> clobbers (A,X,Y)
row (ubyte rownum @A) -> clobbers (A,X,Y)
scroll_down (bool alsocolors @Pc) -> clobbers (A,X)
scroll_left (bool alsocolors @Pc) -> clobbers (A,X,Y)
scroll_right (bool alsocolors @Pc) -> clobbers (A,X)
scroll_up (bool alsocolors @Pc) -> clobbers (A,X)
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor)
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) -> clobbers (A,Y)
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) -> clobbers (A,Y)
spc ()
uppercase ()
waitkey () -> ubyte @A
width () -> clobbers (X,Y) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
cbm {
&uword CBINV
&uword CINV
&ubyte COLOR
const uword Colors
&uword IBASIN
&uword IBSOUT
&uword ICHKIN
&uword ICKOUT
&uword ICLALL
&uword ICLOSE
&uword ICLRCH
&uword ICRNCH
&uword ICRNCH2
&uword IERROR
&uword IEVAL
&uword IEXMON
&uword IGETIN
&uword IGONE
&uword IGONE2
&uword ILOAD
&uword IMAIN
&uword IOPEN
&uword IQPLOP
&uword IQPLOP2
&uword IRQ_VEC
&uword ISAVE
&uword ISTOP
&uword NMINV
&uword NMI_VEC
&uword RESET_VEC
&ubyte SFDX
&ubyte SHFLAG
&ubyte STATUS
&ubyte STKEY
const uword Screen
&ubyte TIME_HI
&ubyte TIME_LO
&ubyte TIME_MID
ACPTR () -> ubyte @A = $ffa5
CHKIN (ubyte logical @X) -> clobbers (A,X) -> bool @Pc = $ffc6
CHKOUT (ubyte logical @X) -> clobbers (A,X) = $ffc9
CHRIN () -> clobbers (X,Y) -> ubyte @A = $ffcf
CHROUT (ubyte character @A) = $ffd2
CINT () -> clobbers (A,X,Y) = $ff81
CIOUT (ubyte databyte @A) = $ffa8
CLALL () -> clobbers (A,X) = $ffe7
CLEARST ()
CLOSE (ubyte logical @A) -> clobbers (A,X,Y) = $ffc3
CLRCHN () -> clobbers (A,X) = $ffcc
GETIN () -> clobbers (X,Y) -> bool @Pc, ubyte @A = $ffe4
GETIN2 () -> clobbers (X,Y) -> ubyte @A
IOBASE () -> uword @XY = $fff3
IOINIT () -> clobbers (A,X) = $ff84
IRQDFEND () -> clobbers (A,X,Y) = $ff33
IRQDFRT () -> clobbers (A,X,Y) = $fa65
LISTEN (ubyte device @A) -> clobbers (A) = $ffb1
LOAD (ubyte verify @A, uword address @XY) -> bool @Pc, ubyte @A, uword @XY = $ffd5
MEMBOT (uword address @XY, bool dir @Pc) -> uword @XY = $ff9c
MEMTOP (uword address @XY, bool dir @Pc) -> uword @XY = $ff99
OPEN () -> clobbers (X,Y) -> bool @Pc, ubyte @A = $ffc0
PLOT (ubyte col @Y, ubyte row @X, bool dir @Pc) -> clobbers (A) -> ubyte @X, ubyte @Y = $fff0
RAMTAS () -> clobbers (A,X,Y) = $ff87
RDTIM () -> ubyte @A, ubyte @X, ubyte @Y = $ffde
RDTIM16 () -> clobbers (X) -> uword @AY
READST () -> ubyte @A = $ffb7
RESTOR () -> clobbers (A,X,Y) = $ff8a
SAVE (ubyte zp_startaddr @A, uword endaddr @XY) -> bool @Pc, ubyte @A = $ffd8
SCNKEY () -> clobbers (A,X,Y) = $ff9f
SCREEN () -> ubyte @X, ubyte @Y = $ffed
SCRORG () -> ubyte @X, ubyte @Y = $ffed
SECOND (ubyte address @A) -> clobbers (A) = $ff93
SETLFS (ubyte logical @A, ubyte device @X, ubyte secondary @Y) = $ffba
SETMSG (ubyte value @A) = $ff90
SETNAM (ubyte namelen @A, str filename @XY) = $ffbd
SETTIM (ubyte low @A, ubyte middle @X, ubyte high @Y) = $ffdb
SETTMO (ubyte timeout @A) = $ffa2
STOP () -> clobbers (X) -> bool @Pz, ubyte @A = $ffe1
STOP2 () -> clobbers (A,X) -> bool @Pz
TALK (ubyte device @A) -> clobbers (A) = $ffb4
TKSA (ubyte address @A) -> clobbers (A) = $ff96
UDTIM () -> clobbers (A,X) = $ffea
UNLSN () -> clobbers (A) = $ffae
UNTLK () -> clobbers (A) = $ffab
VECTOR (uword userptr @XY, bool dir @Pc) -> clobbers (A,Y) = $ff8d
kbdbuf_clear ()
}
c64 {
&ubyte AD1
&ubyte AD2
&ubyte AD3
&ubyte BGCOL0
&ubyte BGCOL1
&ubyte BGCOL2
&ubyte BGCOL4
&ubyte CIA1CRA
&ubyte CIA1CRB
&ubyte CIA1DDRA
&ubyte CIA1DDRB
&ubyte CIA1ICR
&ubyte CIA1PRA
&ubyte CIA1PRB
&ubyte CIA1SDR
&ubyte CIA1TAH
&ubyte CIA1TAL
&ubyte CIA1TBH
&ubyte CIA1TBL
&ubyte CIA1TOD10
&ubyte CIA1TODHR
&ubyte CIA1TODMMIN
&ubyte CIA1TODSEC
&ubyte CIA2CRA
&ubyte CIA2CRB
&ubyte CIA2DDRA
&ubyte CIA2DDRB
&ubyte CIA2ICR
&ubyte CIA2PRA
&ubyte CIA2PRB
&ubyte CIA2SDR
&ubyte CIA2TAH
&ubyte CIA2TAL
&ubyte CIA2TBH
&ubyte CIA2TBL
&ubyte CIA2TOD10
&ubyte CIA2TODHR
&ubyte CIA2TODMIN
&ubyte CIA2TODSEC
&ubyte CR1
&ubyte CR2
&ubyte CR3
&ubyte ENV3
&ubyte EXTCOL
&uword FC
&ubyte FCHI
&ubyte FCLO
&uword FREQ1
&uword FREQ2
&uword FREQ3
&ubyte FREQHI1
&ubyte FREQHI2
&ubyte FREQHI3
&ubyte FREQLO1
&ubyte FREQLO2
&ubyte FREQLO3
&ubyte IREQMASK
&ubyte LPENX
&ubyte LPENY
&ubyte MSIGX
&ubyte MVOL
&ubyte OSC3
&ubyte POTX
&ubyte POTY
&uword PW1
&uword PW2
&uword PW3
&ubyte PWHI1
&ubyte PWHI2
&ubyte PWHI3
&ubyte PWLO1
&ubyte PWLO2
&ubyte PWLO3
&ubyte RASTER
&ubyte RESFILT
&ubyte SCROLX
&ubyte SCROLY
&ubyte SP0COL
&ubyte SP0X
&ubyte SP0Y
&ubyte SP1COL
&ubyte SP1X
&ubyte SP1Y
&ubyte SP2COL
&ubyte SP2X
&ubyte SP2Y
&ubyte SP3COL
&ubyte SP3X
&ubyte SP3Y
&ubyte SP4COL
&ubyte SP4X
&ubyte SP4Y
&ubyte SP5COL
&ubyte SP5X
&ubyte SP5Y
&ubyte SP6COL
&ubyte SP6X
&ubyte SP6Y
&ubyte SP7COL
&ubyte SP7X
&ubyte SP7Y
&ubyte SPBGCL
&ubyte SPBGPR
&ubyte[] SPCOL
&ubyte SPENA
&ubyte SPMC
&ubyte SPMC0
&ubyte SPMC1
&ubyte[] SPRPTR
&ubyte SPRPTR0
&ubyte SPRPTR1
&ubyte SPRPTR2
&ubyte SPRPTR3
&ubyte SPRPTR4
&ubyte SPRPTR5
&ubyte SPRPTR6
&ubyte SPRPTR7
&ubyte SPSPCL
&ubyte[] SPXY
&uword[] SPXYW
&ubyte SR1
&ubyte SR2
&ubyte SR3
&ubyte VICIRQ
&ubyte VMCSB
&ubyte XXPAND
&ubyte YXPAND
}
c128 {
&ubyte VM1
&ubyte VM2
&ubyte VM3
&ubyte VM4
disable_basic () -> clobbers (A)
}
sys {
const ubyte target
cleanup_at_exit ()
clear_carry ()
clear_irqd ()
disable_caseswitch ()
disable_runstop_and_charsetswitch () -> clobbers (A)
enable_caseswitch ()
enable_runstop_and_charsetswitch () -> clobbers (A)
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
init_system ()
init_system_phase2 ()
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
push (ubyte value @A)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_irq () -> clobbers (A)
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irq (uword handler @AY) -> clobbers (A)
set_irqd ()
set_rasterirq (uword handler @AY, uword rasterpos @R0) -> clobbers (A)
wait (uword jiffies @AY)
waitrastborder ()
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
LIBRARY MODULE NAME: diskio
---------------------------
diskio {
const ubyte READ_IO_CHANNEL
const ubyte WRITE_IO_CHANNEL
ubyte @shared drivenumber
bool iteration_in_progress
uword list_blocks
str list_filename
str list_filetype
uword list_pattern
bool list_skip_disk_name
delete (uword filenameptr)
directory () -> bool
diskname () -> uword
f_close ()
f_close_w ()
f_open (uword filenameptr) -> bool
f_open_w (uword filenameptr) -> bool
f_read (uword bufferpointer, uword num_bytes) -> uword
f_read_all (uword bufferpointer) -> uword
f_readline (uword bufptr @AY) -> clobbers (X) -> ubyte @Y
f_write (uword bufferpointer, uword num_bytes) -> bool
lf_end_list ()
lf_next_entry () -> bool
lf_start_list (uword pattern_ptr) -> bool
list_filenames (uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte
load (uword filenameptr, uword address_override) -> uword
load_raw (uword filenameptr, uword start_address) -> uword
rename (uword oldfileptr, uword newfileptr)
reset_read_channel ()
reset_write_channel ()
save (uword filenameptr, uword start_address, uword savesize) -> bool
send_command (uword commandptr)
status () -> uword
status_code () -> ubyte
}
LIBRARY MODULE NAME: string
---------------------------
string {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_start ()
crc32_update (ubyte value @A)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}

View File

@ -0,0 +1,704 @@
Prog8 compiler v10.3-SNAPSHOT by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit 42f4b06a in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-c64.p8
Compiler target: c64
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
const ubyte DEFAULT_HEIGHT
const ubyte DEFAULT_WIDTH
bell ()
chrout (ubyte character @A) = $ffd2
clear_screen ()
clear_screenchars (ubyte character @A) -> clobbers (Y)
clear_screencolors (ubyte color @A) -> clobbers (Y)
cls ()
color (ubyte txtcol)
column (ubyte col @A) -> clobbers (A,X,Y)
fill_screen (ubyte character @A, ubyte color @Y) -> clobbers (A)
get_column () -> ubyte @Y
get_cursor (uword colptr, uword rowptr)
get_row () -> ubyte @X
getchr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
getclr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
height () -> clobbers (X,Y) -> ubyte @A
home ()
input_chars (uword buffer @AY) -> clobbers (A) -> ubyte @Y
lowercase ()
nl ()
petscii2scr (ubyte petscii_char @A) -> ubyte @A
petscii2scr_str (str petscii_string @AY)
plot (ubyte col @Y, ubyte row @X)
print (str text @AY) -> clobbers (A,Y)
print_b (byte value @A) -> clobbers (A,X,Y)
print_bool (bool value)
print_ub (ubyte value @A) -> clobbers (A,X,Y)
print_ub0 (ubyte value @A) -> clobbers (A,X,Y)
print_ubbin (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_ubhex (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_uw (uword value @AY) -> clobbers (A,X,Y)
print_uw0 (uword value @AY) -> clobbers (A,X,Y)
print_uwbin (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_uwhex (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_w (word value @AY) -> clobbers (A,X,Y)
row (ubyte rownum @A) -> clobbers (A,X,Y)
scroll_down (bool alsocolors @Pc) -> clobbers (A,X)
scroll_left (bool alsocolors @Pc) -> clobbers (A,X,Y)
scroll_right (bool alsocolors @Pc) -> clobbers (A,X)
scroll_up (bool alsocolors @Pc) -> clobbers (A,X)
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor)
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) -> clobbers (A,Y)
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) -> clobbers (A,Y)
spc ()
uppercase ()
waitkey () -> ubyte @A
width () -> clobbers (X,Y) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
cbm {
&uword CBINV
&uword CINV
&ubyte COLOR
const uword Colors
&ubyte HIBASE
&uword IBASIN
&uword IBSOUT
&uword ICHKIN
&uword ICKOUT
&uword ICLALL
&uword ICLOSE
&uword ICLRCH
&uword ICRNCH
&uword IERROR
&uword IEVAL
&uword IGETIN
&uword IGONE
&uword ILOAD
&uword IMAIN
&uword IOPEN
&uword IQPLOP
&uword IRQ_VEC
&uword ISAVE
&uword ISTOP
&uword NMINV
&uword NMI_VEC
&uword RESET_VEC
&ubyte SAREG
&ubyte SFDX
&ubyte SHFLAG
&ubyte SPREG
&ubyte STATUS
&ubyte STKEY
&ubyte SXREG
&ubyte SYREG
const uword Screen
&ubyte TIME_HI
&ubyte TIME_LO
&ubyte TIME_MID
&uword USERCMD
&uword USRADD
ACPTR () -> ubyte @A = $ffa5
CHKIN (ubyte logical @X) -> clobbers (A,X) -> bool @Pc = $ffc6
CHKOUT (ubyte logical @X) -> clobbers (A,X) = $ffc9
CHRIN () -> clobbers (X,Y) -> ubyte @A = $ffcf
CHROUT (ubyte character @A) = $ffd2
CINT () -> clobbers (A,X,Y) = $ff81
CIOUT (ubyte databyte @A) = $ffa8
CLALL () -> clobbers (A,X) = $ffe7
CLEARSCR () -> clobbers (A,X,Y) = $e544
CLEARST ()
CLOSE (ubyte logical @A) -> clobbers (A,X,Y) = $ffc3
CLRCHN () -> clobbers (A,X) = $ffcc
GETIN () -> clobbers (X,Y) -> bool @Pc, ubyte @A = $ffe4
GETIN2 () -> clobbers (X,Y) -> ubyte @A
HOMECRSR () -> clobbers (A,X,Y) = $e566
IOBASE () -> uword @XY = $fff3
IOINIT () -> clobbers (A,X) = $ff84
IRQDFEND () -> clobbers (A,X,Y) = $ea81
IRQDFRT () -> clobbers (A,X,Y) = $ea31
LISTEN (ubyte device @A) -> clobbers (A) = $ffb1
LOAD (ubyte verify @A, uword address @XY) -> bool @Pc, ubyte @A, uword @XY = $ffd5
MEMBOT (uword address @XY, bool dir @Pc) -> uword @XY = $ff9c
MEMTOP (uword address @XY, bool dir @Pc) -> uword @XY = $ff99
OPEN () -> clobbers (X,Y) -> bool @Pc, ubyte @A = $ffc0
PLOT (ubyte col @Y, ubyte row @X, bool dir @Pc) -> clobbers (A) -> ubyte @X, ubyte @Y = $fff0
RAMTAS () -> clobbers (A,X,Y) = $ff87
RDTIM () -> ubyte @A, ubyte @X, ubyte @Y = $ffde
RDTIM16 () -> clobbers (X) -> uword @AY
READST () -> ubyte @A = $ffb7
RESTOR () -> clobbers (A,X,Y) = $ff8a
SAVE (ubyte zp_startaddr @A, uword endaddr @XY) -> bool @Pc, ubyte @A = $ffd8
SCNKEY () -> clobbers (A,X,Y) = $ff9f
SCREEN () -> ubyte @X, ubyte @Y = $ffed
SECOND (ubyte address @A) -> clobbers (A) = $ff93
SETLFS (ubyte logical @A, ubyte device @X, ubyte secondary @Y) = $ffba
SETMSG (ubyte value @A) = $ff90
SETNAM (ubyte namelen @A, str filename @XY) = $ffbd
SETTIM (ubyte low @A, ubyte middle @X, ubyte high @Y) = $ffdb
SETTMO (ubyte timeout @A) = $ffa2
STOP () -> clobbers (X) -> bool @Pz, ubyte @A = $ffe1
STOP2 () -> clobbers (A,X) -> bool @Pz
STROUT (uword strptr @AY) -> clobbers (A,X,Y) = $ab1e
TALK (ubyte device @A) -> clobbers (A) = $ffb4
TKSA (ubyte address @A) -> clobbers (A) = $ff96
UDTIM () -> clobbers (A,X) = $ffea
UNLSN () -> clobbers (A) = $ffae
UNTLK () -> clobbers (A) = $ffab
VECTOR (uword userptr @XY, bool dir @Pc) -> clobbers (A,Y) = $ff8d
kbdbuf_clear ()
}
c64 {
&ubyte AD1
&ubyte AD2
&ubyte AD3
&ubyte BGCOL0
&ubyte BGCOL1
&ubyte BGCOL2
&ubyte BGCOL4
&ubyte CIA1CRA
&ubyte CIA1CRB
&ubyte CIA1DDRA
&ubyte CIA1DDRB
&ubyte CIA1ICR
&ubyte CIA1PRA
&ubyte CIA1PRB
&ubyte CIA1SDR
&ubyte CIA1TAH
&ubyte CIA1TAL
&ubyte CIA1TBH
&ubyte CIA1TBL
&ubyte CIA1TOD10
&ubyte CIA1TODHR
&ubyte CIA1TODMMIN
&ubyte CIA1TODSEC
&ubyte CIA2CRA
&ubyte CIA2CRB
&ubyte CIA2DDRA
&ubyte CIA2DDRB
&ubyte CIA2ICR
&ubyte CIA2PRA
&ubyte CIA2PRB
&ubyte CIA2SDR
&ubyte CIA2TAH
&ubyte CIA2TAL
&ubyte CIA2TBH
&ubyte CIA2TBL
&ubyte CIA2TOD10
&ubyte CIA2TODHR
&ubyte CIA2TODMIN
&ubyte CIA2TODSEC
&ubyte CR1
&ubyte CR2
&ubyte CR3
&ubyte ENV3
&ubyte EXTCOL
&uword FC
&ubyte FCHI
&ubyte FCLO
&uword FREQ1
&uword FREQ2
&uword FREQ3
&ubyte FREQHI1
&ubyte FREQHI2
&ubyte FREQHI3
&ubyte FREQLO1
&ubyte FREQLO2
&ubyte FREQLO3
&ubyte IREQMASK
&ubyte LPENX
&ubyte LPENY
&ubyte MSIGX
&ubyte MVOL
&ubyte OSC3
&ubyte POTX
&ubyte POTY
&uword PW1
&uword PW2
&uword PW3
&ubyte PWHI1
&ubyte PWHI2
&ubyte PWHI3
&ubyte PWLO1
&ubyte PWLO2
&ubyte PWLO3
&ubyte RASTER
&ubyte RESFILT
&ubyte SCROLX
&ubyte SCROLY
&ubyte SP0COL
&ubyte SP0X
&ubyte SP0Y
&ubyte SP1COL
&ubyte SP1X
&ubyte SP1Y
&ubyte SP2COL
&ubyte SP2X
&ubyte SP2Y
&ubyte SP3COL
&ubyte SP3X
&ubyte SP3Y
&ubyte SP4COL
&ubyte SP4X
&ubyte SP4Y
&ubyte SP5COL
&ubyte SP5X
&ubyte SP5Y
&ubyte SP6COL
&ubyte SP6X
&ubyte SP6Y
&ubyte SP7COL
&ubyte SP7X
&ubyte SP7Y
&ubyte SPBGCL
&ubyte SPBGPR
&ubyte[] SPCOL
&ubyte SPENA
&ubyte SPMC
&ubyte SPMC0
&ubyte SPMC1
&ubyte[] SPRPTR
&ubyte SPRPTR0
&ubyte SPRPTR1
&ubyte SPRPTR2
&ubyte SPRPTR3
&ubyte SPRPTR4
&ubyte SPRPTR5
&ubyte SPRPTR6
&ubyte SPRPTR7
&ubyte SPSPCL
&ubyte[] SPXY
&uword[] SPXYW
&ubyte SR1
&ubyte SR2
&ubyte SR3
&ubyte VICIRQ
&ubyte VMCSB
&ubyte XXPAND
&ubyte YXPAND
get_bitmap_ptr () -> uword
get_char_matrix_ptr () -> uword
get_sprite_addr_ptrs () -> uword
get_vic_memory_base () -> uword
set_sprite_ptr (ubyte sprite_num, uword sprite_data_address)
}
sys {
const ubyte target
cleanup_at_exit ()
clear_carry ()
clear_irqd ()
disable_caseswitch ()
disable_runstop_and_charsetswitch () -> clobbers (A)
enable_caseswitch ()
enable_runstop_and_charsetswitch () -> clobbers (A)
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
init_system ()
init_system_phase2 ()
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
push (ubyte value @A)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_irq () -> clobbers (A)
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irq (uword handler @AY) -> clobbers (A)
set_irqd ()
set_rasterirq (uword handler @AY, uword rasterpos @R0) -> clobbers (A)
wait (uword jiffies @AY)
waitrastborder ()
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
LIBRARY MODULE NAME: diskio
---------------------------
diskio {
const ubyte READ_IO_CHANNEL
const ubyte WRITE_IO_CHANNEL
ubyte @shared drivenumber
bool iteration_in_progress
uword list_blocks
str list_filename
str list_filetype
uword list_pattern
bool list_skip_disk_name
delete (uword filenameptr)
directory () -> bool
diskname () -> uword
f_close ()
f_close_w ()
f_open (uword filenameptr) -> bool
f_open_w (uword filenameptr) -> bool
f_read (uword bufferpointer, uword num_bytes) -> uword
f_read_all (uword bufferpointer) -> uword
f_readline (uword bufptr @AY) -> clobbers (X) -> ubyte @Y
f_write (uword bufferpointer, uword num_bytes) -> bool
lf_end_list ()
lf_next_entry () -> bool
lf_start_list (uword pattern_ptr) -> bool
list_filenames (uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte
load (uword filenameptr, uword address_override) -> uword
load_raw (uword filenameptr, uword start_address) -> uword
rename (uword oldfileptr, uword newfileptr)
reset_read_channel ()
reset_write_channel ()
save (uword filenameptr, uword start_address, uword savesize) -> bool
send_command (uword commandptr)
status () -> uword
status_code () -> ubyte
}
LIBRARY MODULE NAME: string
---------------------------
string {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: floats
---------------------------
floats {
&uword AYINT_facmo
const float PI
const float TWOPI
const float π
ABS () = $bc58
ATN () -> clobbers (A,X,Y) = $e30e
AYINT () -> clobbers (A,X,Y) = $b1bf
CONUPK (uword mflpt @AY) -> clobbers (A,Y) = $ba8c
COS () -> clobbers (A,X,Y) = $e264
DIV10 () -> clobbers (A,X,Y) = $bafe
EXP () -> clobbers (A,X,Y) = $bfed
FADD (uword mflpt @AY) -> clobbers (A,X,Y) = $b867
FADDH () -> clobbers (A,X,Y) = $b849
FADDT () -> clobbers (A,X,Y) = $b86a
FAREADMEM () -> clobbers (A,Y) = $ba90
FCOMP (uword mflpt @AY) -> clobbers (X,Y) -> ubyte @A = $bc5b
FDIV (uword mflpt @AY) -> clobbers (A,X,Y) = $bb0f
FDIVT () -> clobbers (A,X,Y) = $bb12
FINLOG (byte value @A) -> clobbers (A,X,Y) = $bd7e
FMULT (uword mflpt @AY) -> clobbers (A,X,Y) = $ba28
FMULTT () -> clobbers (A,X,Y) = $ba2b
FOUT () -> clobbers (X) -> uword @AY = $bddd
FPRINTLN () -> clobbers (A,X,Y) = $aabc
FPWR (uword mflpt @AY) -> clobbers (A,X,Y) = $bf78
FPWRT () -> clobbers (A,X,Y) = $bf7b
FREADMEM () -> clobbers (A,Y) = $bba6
FREADS24AXY (ubyte lo @A, ubyte mid @X, ubyte hi @Y) -> clobbers (A,X,Y)
FREADS32 () -> clobbers (A,X,Y)
FREADSA (byte value @A) -> clobbers (A,X,Y) = $bc3c
FREADSTR (ubyte length @A) -> clobbers (A,X,Y) = $b7b5
FREADUS32 () -> clobbers (A,X,Y)
FREADUY (ubyte value @Y) -> clobbers (A,X,Y) = $b3a2
FSUB (uword mflpt @AY) -> clobbers (A,X,Y) = $b850
FSUBT () -> clobbers (A,X,Y) = $b853
GETADR () -> clobbers (X) -> ubyte @Y, ubyte @A = $b7f7
GETADRAY () -> clobbers (X) -> uword @AY
GIVAYF (ubyte lo @Y, ubyte hi @A) -> clobbers (A,X,Y) = $b391
GIVAYFAY (uword value @AY) -> clobbers (A,X,Y)
GIVUAYFAY (uword value @AY) -> clobbers (A,X,Y)
INT () -> clobbers (A,X,Y) = $bccc
LOG () -> clobbers (A,X,Y) = $b9ea
MOVAF () -> clobbers (A,X) = $bc0c
MOVEF () -> clobbers (A,X) = $bc0f
MOVFA () -> clobbers (A,X) = $bbfc
MOVFM (uword mflpt @AY) -> clobbers (A,Y) = $bba2
MOVMF (uword mflpt @XY) -> clobbers (A,Y) = $bbd4
MUL10 () -> clobbers (A,X,Y) = $bae2
NEGOP () -> clobbers (A) = $bfb4
NORMAL () -> clobbers (A) = $b8d7
NOTOP () -> clobbers (A,X,Y) = $aed4
QINT () -> clobbers (A,X,Y) = $bc9b
RND () -> clobbers (A,X,Y) = $e097
SGN () -> clobbers (A,X,Y) = $bc39
SIGN () -> ubyte @A = $bc2b
SIN () -> clobbers (A,X,Y) = $e26b
SQR () -> clobbers (A,X,Y) = $bf71
SQRA () -> clobbers (A,X,Y) = $bf74
TAN () -> clobbers (A,X,Y) = $e2b4
atan (float value) -> float
ceil (float value) -> float
clampf (float value, float minimum, float maximum) -> float
cos (float angle) -> float
deg (float angle) -> float
floor (float value) -> float
ln (float value) -> float
log2 (float value) -> float
maxf (float f1, float f2) -> float
minf (float f1, float f2) -> float
normalize (float value @FAC1) -> float @FAC1
parse (str value @AY) -> float @FAC1
pop () -> float @FAC1
pow (float value, float power) -> float
print (float value @FAC1) -> clobbers (A,X,Y)
push (float value @FAC1)
rad (float angle) -> float
rnd () -> float
rndseed (float seed)
round (float value) -> float
sin (float angle) -> float
tan (float value) -> float
tostr (float value @FAC1) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: graphics
-----------------------------
graphics {
const uword BITMAP_ADDRESS
const uword CHARS_ADDRESS
const ubyte HEIGHT
const uword WIDTH
uword @zp internal_plotx
circle (uword xcenter, ubyte ycenter, ubyte radius)
clear_screen (ubyte pixelcolor, ubyte bgcolor)
disable_bitmap_mode ()
disc (uword xcenter, ubyte ycenter, ubyte radius)
enable_bitmap_mode ()
fillrect (uword xx, ubyte yy, uword width, ubyte height)
get_y_lookup (ubyte yy @Y) -> uword @AY
horizontal_line (uword xx, ubyte yy, uword length)
internal_plot (ubyte ploty @A) -> clobbers (A,X,Y)
line (uword x1, ubyte y1, uword x2, ubyte y2)
plot (uword plotx @XY, ubyte ploty @A) -> clobbers (A,X,Y)
rect (uword xx, ubyte yy, uword width, ubyte height)
vertical_line (uword xx, ubyte yy, ubyte height)
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_start ()
crc32_update (ubyte value @A)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,383 @@
Prog8 compiler v10.3-SNAPSHOT by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit 42f4b06a in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-pet32.p8
Compiler target: pet32
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
const ubyte DEFAULT_HEIGHT
const ubyte DEFAULT_WIDTH
bell ()
chrout (ubyte character @A) = $ffd2
clear_screen ()
clear_screenchars (ubyte character @A) -> clobbers (Y)
clear_screencolors (ubyte color)
cls ()
color (ubyte txtcol)
fill_screen (ubyte character @A, ubyte color @Y) -> clobbers (A)
getchr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
height () -> clobbers (X,Y) -> ubyte @A
home ()
input_chars (uword buffer @AY) -> clobbers (A) -> ubyte @Y
lowercase ()
nl ()
petscii2scr (ubyte petscii_char @A) -> ubyte @A
petscii2scr_str (str petscii_string @AY)
plot (ubyte col @Y, ubyte row @X)
print (str text @AY) -> clobbers (A,Y)
print_b (byte value @A) -> clobbers (A,X,Y)
print_bool (bool value)
print_ub (ubyte value @A) -> clobbers (A,X,Y)
print_ub0 (ubyte value @A) -> clobbers (A,X,Y)
print_ubbin (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_ubhex (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_uw (uword value @AY) -> clobbers (A,X,Y)
print_uw0 (uword value @AY) -> clobbers (A,X,Y)
print_uwbin (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_uwhex (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_w (word value @AY) -> clobbers (A,X,Y)
scroll_down () -> clobbers (A,X)
scroll_left () -> clobbers (A,X,Y)
scroll_right () -> clobbers (A,X)
scroll_up () -> clobbers (A,X)
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor)
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) -> clobbers (A,Y)
setclr (ubyte col, ubyte row, ubyte color)
spc ()
uppercase ()
waitkey () -> ubyte @A
width () -> clobbers (X,Y) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
cbm {
&uword CBINV
&uword CINV
&uword IRQ_VEC
&uword NMINV
&uword NMI_VEC
&uword RESET_VEC
&ubyte STATUS
const uword Screen
&ubyte TIME_HI
&ubyte TIME_LO
&ubyte TIME_MID
CHKIN (ubyte logical @X) -> clobbers (A,X) -> bool @Pc = $ffc6
CHKOUT (ubyte logical @X) -> clobbers (A,X) = $ffc9
CHRIN () -> clobbers (X,Y) -> ubyte @A = $ffcf
CHROUT (ubyte character @A) = $ffd2
CLALL () -> clobbers (A,X) = $ffe7
CLRCHN () -> clobbers (A,X) = $ffcc
GETIN () -> clobbers (X,Y) -> bool @Pc, ubyte @A = $ffe4
GETIN2 () -> clobbers (X,Y) -> ubyte @A
RDTIM () -> ubyte @A, ubyte @X, ubyte @Y
RDTIM16 () -> clobbers (X) -> uword @AY
SETTIM (ubyte low @A, ubyte middle @X, ubyte high @Y)
STOP () -> clobbers (X) -> bool @Pz, ubyte @A = $ffe1
STOP2 () -> clobbers (A,X) -> bool @Pz
UDTIM () -> clobbers (A,X) = $ffea
kbdbuf_clear ()
}
sys {
const ubyte target
cleanup_at_exit ()
clear_carry ()
clear_irqd ()
disable_caseswitch ()
enable_caseswitch ()
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
init_system ()
init_system_phase2 ()
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
push (ubyte value @A)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irqd ()
wait (uword jiffies @AY)
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
LIBRARY MODULE NAME: diskio
---------------------------
diskio {
const ubyte READ_IO_CHANNEL
const ubyte WRITE_IO_CHANNEL
ubyte @shared drivenumber
bool iteration_in_progress
uword list_blocks
str list_filename
str list_filetype
uword list_pattern
bool list_skip_disk_name
delete (uword filenameptr)
directory () -> bool
diskname () -> uword
f_close ()
f_close_w ()
f_open (uword filenameptr) -> bool
f_open_w (uword filenameptr) -> bool
f_read (uword bufferpointer, uword num_bytes) -> uword
f_read_all (uword bufferpointer) -> uword
f_readline (uword bufptr @AY) -> clobbers (X) -> ubyte @Y
f_write (uword bufferpointer, uword num_bytes) -> bool
lf_end_list ()
lf_next_entry () -> bool
lf_start_list (uword pattern_ptr) -> bool
list_filenames (uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte
load (uword filenameptr, uword address_override) -> uword
load_raw (uword filenameptr, uword start_address) -> uword
rename (uword oldfileptr, uword newfileptr)
reset_read_channel ()
reset_write_channel ()
save (uword filenameptr, uword start_address, uword savesize) -> bool
send_command (uword commandptr)
status () -> uword
status_code () -> ubyte
}
LIBRARY MODULE NAME: string
---------------------------
string {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_start ()
crc32_update (ubyte value @A)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}

View File

@ -0,0 +1,399 @@
Prog8 compiler v10.3-SNAPSHOT by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit 42f4b06a in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-virtual.p8
Compiler target: virtual
LIBRARY MODULE NAME: conv
-------------------------
conv {
str hex_digits
str string_out
any2uword (str string) -> uword
bin2uword (str string) -> uword
hex2uword (str string) -> uword
internal_str_ub (ubyte value, uword out_ptr)
internal_str_uw (uword value, uword out_ptr)
str2byte (str string) -> byte
str2ubyte (str string) -> ubyte
str2uword (str string) -> uword
str2word (str string) -> word
str_b (byte value) -> str
str_ub (ubyte value) -> str
str_ub0 (ubyte value) -> str
str_ubbin (ubyte value) -> str
str_ubhex (ubyte value) -> str
str_uw (uword value) -> str
str_uw0 (uword value) -> str
str_uwbin (uword value) -> str
str_uwhex (uword value) -> str
str_w (word value) -> str
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
bell ()
chrout (ubyte char)
clear_screen ()
cls ()
column (ubyte col)
height () -> ubyte
home ()
input_chars (uword buffer) -> ubyte
lowercase ()
nl ()
petscii2scr (ubyte petscii_char) -> ubyte
petscii2scr_str (str petscii_string)
plot (ubyte col, ubyte row)
print (str text)
print_b (byte value)
print_bool (bool value)
print_ub (ubyte value)
print_ub0 (ubyte value)
print_ubbin (ubyte value, bool prefix)
print_ubhex (ubyte value, bool prefix)
print_uw (uword value)
print_uw0 (uword value)
print_uwbin (uword value, bool prefix)
print_uwhex (uword value, bool prefix)
print_w (word value)
setchr (ubyte col, ubyte row, ubyte char)
spc ()
uppercase ()
width () -> ubyte
}
LIBRARY MODULE NAME: diskio
---------------------------
diskio {
chdir (str path)
curdir () -> uword
delete (uword filenameptr)
directory () -> bool
f_close ()
f_close_w ()
f_open (uword filenameptr) -> bool
f_open_w (uword filenameptr) -> bool
f_read (uword bufferpointer, uword num_bytes) -> uword
f_read_all (uword bufferpointer) -> uword
f_readline (uword bufptr) -> ubyte
f_write (uword bufferpointer, uword num_bytes) -> bool
lf_end_list ()
lf_next_entry () -> bool
lf_start_list (uword pattern_ptr) -> bool
list_filenames (uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte
load (uword filenameptr, uword address_override) -> uword
load_raw (uword filenameptr, uword start_address) -> uword
mkdir (str name)
rename (uword oldfileptr, uword newfileptr)
rmdir (str name)
save (uword filenameptr, uword start_address, uword savesize) -> bool
save_raw (uword filenameptr, uword startaddress, uword savesize) -> bool
status () -> str
status_code () -> ubyte
}
LIBRARY MODULE NAME: syslib
---------------------------
sys {
const ubyte target
clear_carry ()
disable_caseswitch ()
enable_caseswitch ()
exit (ubyte returnvalue)
gfx_clear (ubyte color)
gfx_enable (ubyte mode)
gfx_getpixel (uword xx, uword yy) -> ubyte
gfx_plot (uword xx, uword yy, ubyte color)
internal_stringcopy (uword source, uword tgt)
memcopy (uword source, uword tgt, uword count)
memset (uword mem, uword numbytes, ubyte value)
memsetw (uword mem, uword numwords, uword value)
pop () -> ubyte
popw () -> uword
push (ubyte b)
pushw (uword w)
read_flags () -> ubyte
reset_system ()
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
wait (uword jiffies)
waitvsync ()
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
restore_virtual_registers ()
save_virtual_registers ()
}
LIBRARY MODULE NAME: emudbg
---------------------------
emudbg {
console_chrout (ubyte char)
console_value1 (ubyte value)
console_value2 (ubyte value)
console_write (str message)
is_emulator () -> bool
}
LIBRARY MODULE NAME: floats
---------------------------
floats {
const float PI
const float TWOPI
const float π
atan (float value) -> float
ceil (float value) -> float
clampf (float value, float minimum, float maximum) -> float
cos (float angle) -> float
deg (float angle) -> float
floor (float value) -> float
ln (float value) -> float
log2 (float value) -> float
maxf (float f1, float f2) -> float
minf (float f1, float f2) -> float
normalize (float value) -> float
parse (str value) -> float
pop () -> float
pow (float value, float power) -> float
print (float value)
push (float value)
rad (float angle) -> float
rnd () -> float
rndseed (float seed)
round (float value) -> float
sin (float angle) -> float
tan (float value) -> float
tostr (float value) -> str
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
cos8 (ubyte angle) -> byte
cos8u (ubyte angle) -> ubyte
cosr8 (ubyte radians) -> byte
cosr8u (ubyte radians) -> ubyte
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value)
crc32 (uword data, uword length)
crc32_end ()
crc32_start ()
crc32_update (ubyte value)
diff (ubyte b1, ubyte b2) -> ubyte
diffw (uword w1, uword w2) -> uword
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant, ubyte xdelta, ubyte ydelta) -> ubyte
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
log2 (ubyte value) -> ubyte
log2w (uword value) -> ubyte
mul16_last_upper () -> uword
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> ubyte
rndseed (uword seed1, uword seed2)
rndw () -> uword
sin8 (ubyte angle) -> byte
sin8u (ubyte angle) -> ubyte
sinr8 (ubyte radians) -> byte
sinr8u (ubyte radians) -> ubyte
}
LIBRARY MODULE NAME: monogfx
----------------------------
monogfx {
const ubyte MODE_INVERT
const ubyte MODE_NORMAL
const ubyte MODE_STIPPLE
uword height
ubyte mode
uword width
circle (uword xcenter, uword ycenter, ubyte radius, bool draw)
clear_screen (ubyte color)
disc (uword xcenter, uword ycenter, ubyte radius, bool draw)
drawmode (ubyte dm)
fill (uword x, uword y, bool draw)
fillrect (uword xx, uword yy, uword rwidth, uword rheight, bool draw)
hires ()
horizontal_line (uword xx, uword yy, uword length, bool draw)
line (uword x1, uword y1, uword x2, uword y2, bool draw)
lores ()
pget (uword xx, uword yy) -> bool
plot (uword xx, uword yy, bool draw)
rect (uword xx, uword yy, uword rwidth, uword rheight, bool draw)
safe_circle (uword xcenter, uword ycenter, ubyte radius, bool draw)
safe_disc (uword xcenter, uword ycenter, ubyte radius, bool draw)
safe_horizontal_line (uword xx, uword yy, uword length, bool draw)
safe_plot (uword xx, uword yy, bool draw)
text (uword xx, uword yy, bool draw, str sctextptr)
text_charset (ubyte charset)
textmode ()
vertical_line (uword xx, uword yy, uword lheight, bool draw)
}
LIBRARY MODULE NAME: string
---------------------------
string {
append (str target, str suffix) -> ubyte
compare (str st1, str st2) -> byte
contains (str st, ubyte character) -> bool
copy (str source, str target) -> ubyte
endswith (str st, str suffix) -> bool
find (str st, ubyte character) -> ubyte
findstr (str haystack, str needle) -> ubyte
hash (str st) -> ubyte
isdigit (ubyte character) -> bool
isletter (ubyte character) -> bool
islower (ubyte character) -> bool
isprint (ubyte character) -> bool
isspace (ubyte character) -> bool
isupper (ubyte character) -> bool
left (str source, ubyte slen, str target)
length (str st) -> ubyte
lower (str st) -> ubyte
lowerchar (ubyte char) -> ubyte
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
right (str source, ubyte slen, str target)
rstrip (str s)
rtrim (str s)
slice (str source, ubyte start, ubyte slen, str target)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (str st) -> ubyte
upperchar (ubyte char) -> ubyte
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}

View File

@ -177,3 +177,5 @@ texinfo_documents = [
# -- Options for to do extension ----------------------------------------------
# todo_include_todos = True
suppress_warnings = ['epub.unknown_project_files', 'html.unknown_project_files']

View File

@ -25,6 +25,19 @@ of these library modules automatically as required.
You must recompile the program for every target you want to run it on.
Low-fi variable and subroutine definitions in all available library modules
---------------------------------------------------------------------------
These are auto generated and contain no documentation, but provide a view into what's available.
Grouped per compilation target.
* `atari <_static/symboldumps/skeletons-atari.txt>`_
* `c64 <_static/symboldumps/skeletons-c64.txt>`_
* `c128 <_static/symboldumps/skeletons-c128.txt>`_
* `cx16 <_static/symboldumps/skeletons-cx16.txt>`_
* `pet32 <_static/symboldumps/skeletons-pet32.txt>`_
* `virtual <_static/symboldumps/skeletons-virtual.txt>`_
syslib
------
@ -722,3 +735,4 @@ the emulators already support it).
Read the `verafx source code <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib/cx16/verafx.p8>`_
to see what's in there.

View File

@ -3,18 +3,47 @@
%option no_sysinit
main {
sub start() {
sys.clear_carry()
cx16.r0s=-42
ubyte[255] array1
ubyte[255] array2
uword block1 = memory("b1", 6000 ,0)
uword block2 = memory("b2", 6000 ,0)
if_z
txt.print("zero")
else if_cs
txt.print("carry")
else if_neg
txt.print("negative")
else
txt.print("nothing")
sub start() {
cbm.SETTIM(0,0,0)
repeat 2000 {
sys.memcopy(array1, array2, sizeof(array1))
}
txt.print_uw(cbm.RDTIM16())
txt.nl()
cbm.SETTIM(0,0,0)
repeat 2000 {
cx16.memory_copy(array1, array2, sizeof(array1))
}
txt.print_uw(cbm.RDTIM16())
txt.nl()
cbm.SETTIM(0,0,0)
repeat 100 {
sys.memcopy(block1, block2, 6000)
}
txt.print_uw(cbm.RDTIM16())
txt.nl()
cbm.SETTIM(0,0,0)
repeat 100 {
cx16.memory_copy(block1, block2, 6000)
}
txt.print_uw(cbm.RDTIM16())
txt.nl()
}
}

View File

@ -202,7 +202,7 @@ class IRFileReader {
var initNumeric: Double? = null
var initArray: StArray? = null
when(dt) {
DataType.BOOL -> TODO("parse boolean $value")
DataType.BOOL -> initNumeric = if(value.lowercase()=="false") 0.0 else 1.0
in NumericDatatypes -> initNumeric = parseIRValue(value)
in ArrayDatatypes -> {
initArray = value.split(',').map {

View File

@ -235,7 +235,6 @@ class IRStArrayElement(val number: Double?, val addressOfSymbol: String?) {
}
init {
// TODO TEMPORARY
require(number!=null || addressOfSymbol!=null)
}
}