added chdir/mkdir/rmdir/relabel to cx16diskio

This commit is contained in:
Irmen de Jong 2022-11-20 22:59:44 +01:00
parent 2931e1b87b
commit 08275c406a
2 changed files with 41 additions and 1 deletions

View File

@ -1,6 +1,7 @@
; Cx16 specific disk drive I/O routines.
%import diskio
%import string
cx16diskio {
@ -183,4 +184,44 @@ m_in_buffer sta $ffff
return total_read
}
sub chdir(ubyte drivenumber, str path) {
; -- change current directory.
diskio.list_filename[0] = 'c'
diskio.list_filename[1] = 'd'
diskio.list_filename[2] = ':'
void string.copy(path, &diskio.list_filename+3)
void diskio.send_command(drivenumber, diskio.list_filename)
}
sub mkdir(ubyte drivenumber, str name) {
; -- make a new subdirectory.
diskio.list_filename[0] = 'm'
diskio.list_filename[1] = 'd'
diskio.list_filename[2] = ':'
void string.copy(name, &diskio.list_filename+3)
void diskio.send_command(drivenumber, diskio.list_filename)
}
sub rmdir(ubyte drivenumber, str name) {
; -- remove a subdirectory.
void string.find(name, '*')
if_cs
return ; refuse to act on a wildcard *
diskio.list_filename[0] = 'r'
diskio.list_filename[1] = 'd'
diskio.list_filename[2] = ':'
void string.copy(name, &diskio.list_filename+3)
void diskio.send_command(drivenumber, diskio.list_filename)
}
sub relabel(ubyte drivenumber, str name) {
; -- change the disk label.
diskio.list_filename[0] = 'r'
diskio.list_filename[1] = '-'
diskio.list_filename[2] = 'h'
diskio.list_filename[3] = ':'
void string.copy(name, &diskio.list_filename+4)
void diskio.send_command(drivenumber, diskio.list_filename)
}
}

View File

@ -3,7 +3,6 @@ TODO
For next release
^^^^^^^^^^^^^^^^
- add cd/mkdir/rmdir/relabel to cx16diskio
- make diskio.list_files not use an internal buffer itself but change names_ptr meaning to user supplied buffer.
- ir/vm: allow label in block scope (correct order of block nodes!)
- regression test the various projects