fix diskio rename() and delete()

This commit is contained in:
Irmen de Jong 2021-01-23 17:57:30 +01:00
parent f9fd426843
commit 4a81406262
2 changed files with 11 additions and 32 deletions

View File

@ -427,7 +427,7 @@ io_error:
ubyte flen = string.length(filenameptr) ubyte flen = string.length(filenameptr)
filename[0] = 's' filename[0] = 's'
filename[1] = ':' filename[1] = ':'
sys.memcopy(filenameptr, &filename+2, flen+1) string.copy(filenameptr, &filename+2)
c64.SETNAM(flen+2, filename) c64.SETNAM(flen+2, filename)
c64.SETLFS(1, drivenumber, 15) c64.SETLFS(1, drivenumber, 15)
void c64.OPEN() void c64.OPEN()
@ -441,9 +441,9 @@ io_error:
ubyte flen_new = string.length(newfileptr) ubyte flen_new = string.length(newfileptr)
filename[0] = 'r' filename[0] = 'r'
filename[1] = ':' filename[1] = ':'
sys.memcopy(newfileptr, &filename+2, flen_new) string.copy(newfileptr, &filename+2)
filename[flen_new+2] = '=' filename[flen_new+2] = '='
sys.memcopy(oldfileptr, &filename+3+flen_new, flen_old+1) string.copy(oldfileptr, &filename+3+flen_new)
c64.SETNAM(3+flen_new+flen_old, filename) c64.SETNAM(3+flen_new+flen_old, filename)
c64.SETLFS(1, drivenumber, 15) c64.SETLFS(1, drivenumber, 15)
void c64.OPEN() void c64.OPEN()

View File

@ -1,4 +1,5 @@
%import textio %import textio
%import diskio
%import string %import string
%zeropage basicsafe %zeropage basicsafe
%option no_sysinit %option no_sysinit
@ -7,35 +8,13 @@ main {
sub start() { sub start() {
uword screen=$0400 diskio.directory(8)
ubyte[256] xbuf = 1 diskio.save(8, "blabla", $2000, 1024)
ubyte[256] ybuf = 3 diskio.directory(8)
diskio.rename(8, "blabla", "newname")
diskio.directory(8)
ubyte ix = 0 diskio.delete(8, "newname")
ubyte cc = 0 diskio.directory(8)
repeat 20 {
cc++
}
@(screen) = 1
@(screen+1) = 2
swap(@(screen), @(screen+1))
; cc = @(screen+2)
; cc++
; @(screen+2) = cc
; cc = @(screen+ix)
; cc++
; @(screen+ix) = cc
; for ii in 24 downto 0 {
; for i in 39 downto 0 {
; @(screen+i) = xbuf[i] + ybuf[ii]
; }
; screen+=40
; }
} }
} }