mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
diskio docs, remove super harmless warning message
This commit is contained in:
parent
617ea15c3a
commit
ba8c3d14f7
@ -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 == "==") {
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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 <https://github.com/irmen/prog8/tree/master/compile
|
||||
to see what's in there. (Note: slight variations for different compiler targets)
|
||||
|
||||
.. note::
|
||||
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)
|
||||
Opening a file using f_read() or f_read_w() doesn't set the default i/o channels to that file.
|
||||
In fact, after calling routines in diskio, it resets the input and output channels to their
|
||||
defaults (keyboard and screen).
|
||||
If you are going to do kernal I/O calls like CHRIN/CHROUT/(M)ACPTR yourself on the files opened via diskio,
|
||||
you must use reset_read_channel() or reset_write_channel() before doing so. This makes
|
||||
the correct file channel active. The diskio routines themselves do this as well internally.
|
||||
|
||||
.. note::
|
||||
If you are using the X16 emulator with HostFS, and are experiencing weird behavior with these
|
||||
routines, please first try again with an SD-card image instead of HostFs.
|
||||
It is possible that there are still small differences between HostFS and actual CBM DOS in the X16 emulator.
|
||||
|
||||
.. note::
|
||||
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.
|
||||
|
||||
.. attention::
|
||||
Error handling is peculiar on CBM dos systems (C64, C128, cx16, PET). Read the
|
||||
descriptions for the various methods in this library for details and tips.
|
||||
|
@ -4,7 +4,6 @@
|
||||
; Movement is dictated by a random accelleration, which increases the speed, which increases the radius.
|
||||
|
||||
; TODO extend the radius to a larger maximum (0-319 or perhaps 0-511, instead of 0-255) so that we can fill the whole screen.
|
||||
; TODO do something with the colors palette: make stars darker in the distance
|
||||
|
||||
%import math
|
||||
%import palette
|
||||
|
Loading…
Reference in New Issue
Block a user