Skip to content

Commit

Permalink
Merge pull request #582 from paulscottrobson/openbug
Browse files Browse the repository at this point in the history
Fixed open.
  • Loading branch information
paulscottrobson authored Aug 11, 2024
2 parents efe9643 + 5fe24b9 commit 9d55e1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
25 changes: 8 additions & 17 deletions basic/test.bsc
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
sound 0,100,100,14
end
if exists("test.txt") then mos "del test.txt"

call snd(0,660,50,0,0,100)
call snd(0,440,50,0,0,30)
end

proc snd(ch,fq,ms,sl,ty,v)
while peek($FF00):wend
poke $FF04,ch
doke $FF05,fq
doke $FF07,ms
doke $FF09,sl
poke $FF0B,ty
poke $FF0C,v
poke $FF01,7
poke $FF00,8
endproc
open output 1,"test.txt"
print #1,"Hello world"
close 1
cat
open output 1,"test.txt"
close 1
cat
3 changes: 2 additions & 1 deletion firmware/common/sources/interface/fileinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ uint8_t FIOSetFileAttributes(const std::string& filename, uint8_t attribs) {
uint8_t FIOOpenFileHandle(uint8_t fileno, const std::string& filename, uint8_t mode) {
if (mode == FIOMODE_RDWR_CREATE) { // If open truncate
uint8_t exists;
if (FIOExistsFile(filename,&exists) == 0) { // If file exists
FIOExistsFile(filename,&exists);
if (exists) { // If file exists
uint8_t error = FIODeleteFile(filename); // try to delete it, as we truncate it anyway !
if (error) return error;
}
Expand Down

0 comments on commit 9d55e1c

Please sign in to comment.