1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-04-20 16:16:34 +00:00

FileIO library for Apple 1 and ///, divmod function in cmdsys

This commit is contained in:
David Schmenk
2017-12-05 19:22:35 -08:00
parent 40ae932940
commit f5ea22af02
15 changed files with 302 additions and 49 deletions
+7 -7
View File
@@ -126,9 +126,9 @@ def fatCopyFrom(src, dst, type, aux)
//
// Check if dst already exists
//
ref = open(dst, sysbuf)
ref = fileio:open(dst, sysbuf)
if ref
close(ref)
fileio:close(ref)
puts("Overwrite "); puts(dst)
if not getYN("(Y/N)?")
heaprelease(freeAddr)
@@ -140,10 +140,10 @@ def fatCopyFrom(src, dst, type, aux)
//
// Create dst file
//
if create(dst, $C3, type, aux)
if fileio:create(dst, $C3, type, aux)
puts("Create file error: "); putByte(perr); putln
fin
ref = open(dst, sysbuf)
ref = fileio:open(dst, sysbuf)
if not ref
puts("Error opening file: "); puts(dst); putln
puts("Open file error: "); putByte(perr); putln
@@ -156,7 +156,7 @@ def fatCopyFrom(src, dst, type, aux)
repeat
copyLen = bigFatRead(copyBuf, COPY_BUF_SIZE)
if copyLen
if write(ref, copyBuf, copyLen) <> copyLen
if fileio:write(ref, copyBuf, copyLen) <> copyLen
puts("Error writing file:"); puts(dst); putln
puts("Write file error: "); putByte(perr); putln
copyLen = 0 // Force end of copy
@@ -167,7 +167,7 @@ def fatCopyFrom(src, dst, type, aux)
else
puts("Error opening FAT file:"); puts(src); putln
fin
close(ref)
fileio:close(ref)
heaprelease(freeAddr)
end
@@ -180,4 +180,4 @@ if ^arg
else
puts("Usage: +FATGET <FAT filename>"); putln
fin
done
done
+5 -5
View File
@@ -43,7 +43,7 @@ def mkFatName(proName, fatName)
word l, n
byte fileinfo[t_fileinfo]
if !getfileinfo(proName, @fileinfo)
if !fileio:getfileinfo(proName, @fileinfo)
//
// Scan backward looking for dir seperator
//
@@ -110,7 +110,7 @@ def fatCopyTo(src, dst)
puts("Not enough free memory!\n"); putln
return -1
fin
ref = open(src, sysbuf)
ref = fileio:open(src, sysbuf)
if not ref
puts("Error opening file: "); puts(src); putln
puts("Open file error: "); putByte(perr); putln
@@ -121,7 +121,7 @@ def fatCopyTo(src, dst)
//
if sdFAT:fileOpen(dst, O_READ | O_WRITE | O_CREAT)
repeat
copyLen = read(ref, copyBuf, COPY_BUF_SIZE)
copyLen = fileio:read(ref, copyBuf, COPY_BUF_SIZE)
if copyLen
copyLen = bigFatWrite(copyBuf, copyLen)
if !copyLen
@@ -132,7 +132,7 @@ def fatCopyTo(src, dst)
else
puts("Error opening FAT file:"); puts(dst); putln
fin
close(ref)
fileio:close(ref)
heaprelease(freeAddr)
end
@@ -144,4 +144,4 @@ if ^arg
else
puts("Usage: +FATPUT <filename>"); putln
fin
done
done
+1 -1
View File
@@ -107,7 +107,7 @@ def fatReadImage(src, drv, order)
^$24=^$20 // Move cursor to left edge
puts("Reading blocks: "); puti(blocknum)
for bufblk = 0 to COPY_BLK_CNT
if readblock(drv, inBuf + (bufblk << 9), blocknum + bufblk)
if fileio:readblock(drv, inBuf + (bufblk << 9), blocknum + bufblk)
puts("Read disk error: $"); putb(perr); putln
break
fin
+1 -1
View File
@@ -113,7 +113,7 @@ def fatWriteImage(src, drv, order)
trkSecToBlk(inBuf, outBuf)
fin
for bufblk = 0 to COPY_BLK_CNT
if writeblock(drv, outBuf + (bufblk << 9), blocknum + bufblk)
if fileio:writeblock(drv, outBuf + (bufblk << 9), blocknum + bufblk)
puts("Write disk error: $"); putb(perr); putln
break
fin
+1 -1
View File
@@ -263,7 +263,7 @@ when MACHID & $C8
gotoxy = @a3gotoxy
grmode = @a3grmode
textmode = @a3textmode
if modaddr(@cmdsys):0 == $0010
if modaddr(@cmdsys):0 == $0099
devcons = modaddr(@cmdsys).5 // devcons variable from cmdsys
else
puts(@a3err)