From ba8c3d14f75f5ad744fc21ed6b947ad908cf3d6e Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 5 Dec 2024 03:59:39 +0100 Subject: [PATCH] diskio docs, remove super harmless warning message --- .../src/prog8/codegen/cpu6502/IfElseAsmGen.kt | 16 +++++++------- compiler/res/prog8lib/cx16/monogfx.p8 | 4 ++-- ...NotExpressionAndIfComparisonExprChanger.kt | 1 - docs/source/libraries.rst | 22 ++++++++++++------- examples/cx16/starszoom.p8 | 1 - 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/IfElseAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/IfElseAsmGen.kt index 6944db153..ec3130397 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/IfElseAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/IfElseAsmGen.kt @@ -63,7 +63,7 @@ internal class IfElseAsmGen(private val program: PtProgram, require(target.datatype==expr.type) val falseLabel = asmgen.makeLabel("ifexpr_false") val endLabel = asmgen.makeLabel("ifexpr_end") - evalConditonAndBranchWhenFalse(expr.condition, falseLabel) + evalIfExpressionConditonAndBranchWhenFalse(expr.condition, falseLabel) when(expr.type) { in ByteDatatypesWithBoolean -> { asmgen.assignExpressionToRegister(expr.truevalue, RegisterOrPair.A, false) @@ -93,12 +93,12 @@ internal class IfElseAsmGen(private val program: PtProgram, } } - private fun evalConditonAndBranchWhenFalse(condition: PtExpression, falseLabel: String) { + private fun evalIfExpressionConditonAndBranchWhenFalse(condition: PtExpression, falseLabel: String) { if (condition is PtBinaryExpression) { return when(condition.right.type) { - in ByteDatatypesWithBoolean -> translateIfByteConditionBranch(condition, falseLabel) - in WordDatatypes -> translateIfWordConditionBranch(condition, falseLabel) - DataType.FLOAT -> translateFloatConditionBranch(condition, falseLabel) + in ByteDatatypesWithBoolean -> translateIfExpressionByteConditionBranch(condition, falseLabel) + in WordDatatypes -> translateIfExpressionWordConditionBranch(condition, falseLabel) + DataType.FLOAT -> translateIfExpressionFloatConditionBranch(condition, falseLabel) else -> throw AssemblyError("weird dt") } } @@ -359,7 +359,7 @@ internal class IfElseAsmGen(private val program: PtProgram, } } - private fun translateIfByteConditionBranch(condition: PtBinaryExpression, falseLabel: String) { + private fun translateIfExpressionByteConditionBranch(condition: PtBinaryExpression, falseLabel: String) { val signed = condition.left.type in SignedDatatypes val constValue = condition.right.asConstInteger() if(constValue==0) { @@ -398,7 +398,7 @@ internal class IfElseAsmGen(private val program: PtProgram, } } - private fun translateIfWordConditionBranch(condition: PtBinaryExpression, falseLabel: String) { + private fun translateIfExpressionWordConditionBranch(condition: PtBinaryExpression, falseLabel: String) { // TODO can we reuse this whole thing from IfElse ? val constValue = condition.right.asConstInteger() if(constValue!=null) { @@ -2048,7 +2048,7 @@ _jump jmp ($asmLabel) } } - private fun translateFloatConditionBranch(condition: PtBinaryExpression, elseLabel: String) { + private fun translateIfExpressionFloatConditionBranch(condition: PtBinaryExpression, elseLabel: String) { val constValue = (condition.right as? PtNumber)?.number if(constValue==0.0) { if (condition.operator == "==") { diff --git a/compiler/res/prog8lib/cx16/monogfx.p8 b/compiler/res/prog8lib/cx16/monogfx.p8 index 2fcfc9daf..0f2b9b550 100644 --- a/compiler/res/prog8lib/cx16/monogfx.p8 +++ b/compiler/res/prog8lib/cx16/monogfx.p8 @@ -796,7 +796,7 @@ skip: } sub fill_scanline_left() -> bool { - ; TODO maybe this could use vera auto decrement, but that would require some clever masking calculations + ; TODO maybe this could use vera auto decrement, but that requires some clever masking calculations cx16.r9s = xx while xx >= 0 { if pgetset() @@ -807,7 +807,7 @@ skip: } sub fill_scanline_right() { - ; TODO maybe this could use vera auto increment, but that would require some clever masking calculations + ; TODO maybe this could use vera auto increment, but that requires some clever masking calculations cx16.r9s = xx while xx <= width-1 { if pgetset() diff --git a/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt b/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt index c0c7bbdc9..942f8ea6d 100644 --- a/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt +++ b/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt @@ -173,7 +173,6 @@ internal class NotExpressionAndIfComparisonExprChanger(val program: Program, val val prefix = ifElse.condition as? PrefixExpression if(prefix?.operator=="not") { // if not x a else b -> if x b else a - errors.info("invert condition and swap if/else blocks", ifElse.condition.position) ifElse.condition = prefix.expression ifElse.condition.parent = ifElse val elsepart = ifElse.elsepart diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 873f212f6..5c124e313 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -498,6 +498,14 @@ Provides several routines that deal with disk drive I/O, such as: - delete and rename files on the disk - send arbitrary CbmDos command to disk drive +For simplicity sake, this library is designed to work on a *single* open file +for reading, and a *single* open file for writing at any time only. +If you need to load or save to more than one file at a time, you'll have +to write your own I/O routines (or supplement the ones found here) + +You can set the active *disk drive number*, so it supports multiple drives, just one at a time. +It does not support reading from more than one file or writing to more than one file at a time. + Commander X16 additions: Headerless load and save routines are available (load_raw, save_raw). On the Commander X16 it tries to use that machine's fast Kernal loading routines if possible. @@ -511,20 +519,18 @@ Read the `diskio source code