mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +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)
|
require(target.datatype==expr.type)
|
||||||
val falseLabel = asmgen.makeLabel("ifexpr_false")
|
val falseLabel = asmgen.makeLabel("ifexpr_false")
|
||||||
val endLabel = asmgen.makeLabel("ifexpr_end")
|
val endLabel = asmgen.makeLabel("ifexpr_end")
|
||||||
evalConditonAndBranchWhenFalse(expr.condition, falseLabel)
|
evalIfExpressionConditonAndBranchWhenFalse(expr.condition, falseLabel)
|
||||||
when(expr.type) {
|
when(expr.type) {
|
||||||
in ByteDatatypesWithBoolean -> {
|
in ByteDatatypesWithBoolean -> {
|
||||||
asmgen.assignExpressionToRegister(expr.truevalue, RegisterOrPair.A, false)
|
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) {
|
if (condition is PtBinaryExpression) {
|
||||||
return when(condition.right.type) {
|
return when(condition.right.type) {
|
||||||
in ByteDatatypesWithBoolean -> translateIfByteConditionBranch(condition, falseLabel)
|
in ByteDatatypesWithBoolean -> translateIfExpressionByteConditionBranch(condition, falseLabel)
|
||||||
in WordDatatypes -> translateIfWordConditionBranch(condition, falseLabel)
|
in WordDatatypes -> translateIfExpressionWordConditionBranch(condition, falseLabel)
|
||||||
DataType.FLOAT -> translateFloatConditionBranch(condition, falseLabel)
|
DataType.FLOAT -> translateIfExpressionFloatConditionBranch(condition, falseLabel)
|
||||||
else -> throw AssemblyError("weird dt")
|
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 signed = condition.left.type in SignedDatatypes
|
||||||
val constValue = condition.right.asConstInteger()
|
val constValue = condition.right.asConstInteger()
|
||||||
if(constValue==0) {
|
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 ?
|
// TODO can we reuse this whole thing from IfElse ?
|
||||||
val constValue = condition.right.asConstInteger()
|
val constValue = condition.right.asConstInteger()
|
||||||
if(constValue!=null) {
|
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
|
val constValue = (condition.right as? PtNumber)?.number
|
||||||
if(constValue==0.0) {
|
if(constValue==0.0) {
|
||||||
if (condition.operator == "==") {
|
if (condition.operator == "==") {
|
||||||
|
@ -796,7 +796,7 @@ skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub fill_scanline_left() -> bool {
|
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
|
cx16.r9s = xx
|
||||||
while xx >= 0 {
|
while xx >= 0 {
|
||||||
if pgetset()
|
if pgetset()
|
||||||
@ -807,7 +807,7 @@ skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub fill_scanline_right() {
|
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
|
cx16.r9s = xx
|
||||||
while xx <= width-1 {
|
while xx <= width-1 {
|
||||||
if pgetset()
|
if pgetset()
|
||||||
|
@ -173,7 +173,6 @@ internal class NotExpressionAndIfComparisonExprChanger(val program: Program, val
|
|||||||
val prefix = ifElse.condition as? PrefixExpression
|
val prefix = ifElse.condition as? PrefixExpression
|
||||||
if(prefix?.operator=="not") {
|
if(prefix?.operator=="not") {
|
||||||
// if not x a else b -> if x b else a
|
// 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 = prefix.expression
|
||||||
ifElse.condition.parent = ifElse
|
ifElse.condition.parent = ifElse
|
||||||
val elsepart = ifElse.elsepart
|
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
|
- delete and rename files on the disk
|
||||||
- send arbitrary CbmDos command to disk drive
|
- 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:
|
Commander X16 additions:
|
||||||
Headerless load and save routines are available (load_raw, save_raw).
|
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.
|
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)
|
to see what's in there. (Note: slight variations for different compiler targets)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
For simplicity sake, this library is designed to work on a *single* open file
|
Opening a file using f_read() or f_read_w() doesn't set the default i/o channels to that file.
|
||||||
for reading, and a *single* open file for writing at any time only.
|
In fact, after calling routines in diskio, it resets the input and output channels to their
|
||||||
If you need to load or save to more than one file at a time, you'll have
|
defaults (keyboard and screen).
|
||||||
to write your own I/O routines (or supplement the ones found here)
|
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::
|
.. note::
|
||||||
If you are using the X16 emulator with HostFS, and are experiencing weird behavior with these
|
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.
|
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.
|
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::
|
.. attention::
|
||||||
Error handling is peculiar on CBM dos systems (C64, C128, cx16, PET). Read the
|
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.
|
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.
|
; 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 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 math
|
||||||
%import palette
|
%import palette
|
||||||
|
Loading…
Reference in New Issue
Block a user