mirror of
https://github.com/irmen/prog8.git
synced 2024-11-22 15:33:02 +00:00
Api change: drivenumber parameter removed from all routines in diskio and cx16diskio modules
This commit is contained in:
parent
92062d056d
commit
53e18a5387
@ -13,9 +13,9 @@ cx16diskio {
|
||||
; and the rest is loaded at the given location in memory.
|
||||
; Returns the end load address+1 if successful or 0 if a load error occurred.
|
||||
; You can use the load_size() function to calcuate the size of the file that was loaded.
|
||||
sub load(ubyte drivenumber, uword filenameptr, ubyte bank, uword address_override) -> uword {
|
||||
sub load(uword filenameptr, ubyte bank, uword address_override) -> uword {
|
||||
cx16.rambank(bank)
|
||||
return diskio.internal_load_routine(drivenumber, filenameptr, address_override, false)
|
||||
return diskio.internal_load_routine(filenameptr, address_override, false)
|
||||
}
|
||||
|
||||
; Same as diskio.load_raw() but with additional bank parameter to select the Ram bank to load into.
|
||||
@ -26,9 +26,9 @@ cx16diskio {
|
||||
; or alternatively make sure to reset the correct ram bank yourself after the load!
|
||||
; Returns the end load address+1 if successful or 0 if a load error occurred.
|
||||
; You can use the load_size() function to calcuate the size of the file that was loaded.
|
||||
sub load_raw(ubyte drivenumber, uword filenameptr, ubyte bank, uword address_override) -> uword {
|
||||
sub load_raw(uword filenameptr, ubyte bank, uword address_override) -> uword {
|
||||
cx16.rambank(bank)
|
||||
return diskio.internal_load_routine(drivenumber, filenameptr, address_override, true)
|
||||
return diskio.internal_load_routine(filenameptr, address_override, true)
|
||||
}
|
||||
|
||||
; For use directly after a load or load_raw call (don't mess with the ram bank yet):
|
||||
@ -37,7 +37,7 @@ cx16diskio {
|
||||
return $2000 * (cx16.getrambank() - startbank) + endaddress - startaddress
|
||||
}
|
||||
|
||||
asmsub vload(str name @R0, ubyte drivenumber @Y, ubyte bank @A, uword address @R1) -> ubyte @A {
|
||||
asmsub vload(str name @R0, ubyte bank @A, uword address @R1) -> ubyte @A {
|
||||
; -- like the basic command VLOAD "filename",drivenumber,bank,address
|
||||
; loads a file into Vera's video memory in the given bank:address, returns success in A
|
||||
; the file has to have the usual 2 byte header (which will be skipped)
|
||||
@ -46,8 +46,7 @@ cx16diskio {
|
||||
internal_vload:
|
||||
phx
|
||||
pha
|
||||
tya
|
||||
tax
|
||||
ldx diskio.drivenumber
|
||||
bcc +
|
||||
ldy #%00000010 ; headerless load mode
|
||||
bne ++
|
||||
@ -79,7 +78,7 @@ internal_vload:
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub vload_raw(str name @R0, ubyte drivenumber @Y, ubyte bank @A, uword address @R1) -> ubyte @A {
|
||||
asmsub vload_raw(str name @R0, ubyte bank @A, uword address @R1) -> ubyte @A {
|
||||
; -- like the basic command BVLOAD "filename",drivenumber,bank,address
|
||||
; loads a file into Vera's video memory in the given bank:address, returns success in A
|
||||
; the file is read fully including the first two bytes.
|
||||
@ -166,25 +165,25 @@ m_in_buffer sta $ffff
|
||||
}
|
||||
|
||||
|
||||
sub chdir(ubyte drivenumber, str path) {
|
||||
sub chdir(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)
|
||||
diskio.send_command(drivenumber, diskio.list_filename)
|
||||
diskio.send_command(diskio.list_filename)
|
||||
}
|
||||
|
||||
sub mkdir(ubyte drivenumber, str name) {
|
||||
sub mkdir(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)
|
||||
diskio.send_command(drivenumber, diskio.list_filename)
|
||||
diskio.send_command(diskio.list_filename)
|
||||
}
|
||||
|
||||
sub rmdir(ubyte drivenumber, str name) {
|
||||
sub rmdir(str name) {
|
||||
; -- remove a subdirectory.
|
||||
void string.find(name, '*')
|
||||
if_cs
|
||||
@ -193,17 +192,17 @@ m_in_buffer sta $ffff
|
||||
diskio.list_filename[1] = 'd'
|
||||
diskio.list_filename[2] = ':'
|
||||
void string.copy(name, &diskio.list_filename+3)
|
||||
diskio.send_command(drivenumber, diskio.list_filename)
|
||||
diskio.send_command(diskio.list_filename)
|
||||
}
|
||||
|
||||
sub relabel(ubyte drivenumber, str name) {
|
||||
sub relabel(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)
|
||||
diskio.send_command(drivenumber, diskio.list_filename)
|
||||
diskio.send_command(diskio.list_filename)
|
||||
}
|
||||
|
||||
sub f_seek(uword pos_hiword, uword pos_loword) {
|
||||
@ -216,7 +215,7 @@ m_in_buffer sta $ffff
|
||||
command[5] = msb(pos_hiword)
|
||||
send_command:
|
||||
cbm.SETNAM(sizeof(command), &command)
|
||||
cbm.SETLFS(15, diskio.last_drivenumber, 15)
|
||||
cbm.SETLFS(15, diskio.drivenumber, 15)
|
||||
void cbm.OPEN()
|
||||
cbm.CLOSE(15)
|
||||
}
|
||||
|
@ -6,8 +6,14 @@
|
||||
|
||||
diskio {
|
||||
|
||||
sub directory(ubyte drivenumber) -> bool {
|
||||
; -- Prints the directory contents of disk drive 8-11 to the screen. Returns success.
|
||||
ubyte drivenumber = 8
|
||||
|
||||
sub set_drive(ubyte number) {
|
||||
drivenumber = number
|
||||
}
|
||||
|
||||
sub directory() -> bool {
|
||||
; -- Prints the directory contents to the screen. Returns success.
|
||||
|
||||
cbm.SETNAM(1, "$")
|
||||
cbm.SETLFS(12, drivenumber, 0)
|
||||
@ -65,7 +71,7 @@ io_error:
|
||||
return true
|
||||
}
|
||||
|
||||
sub diskname(ubyte drivenumber) -> uword {
|
||||
sub diskname() -> uword {
|
||||
; -- Returns pointer to disk name string or 0 if failure.
|
||||
|
||||
cbm.SETNAM(1, "$")
|
||||
@ -106,13 +112,12 @@ io_error:
|
||||
uword list_pattern
|
||||
uword list_blocks
|
||||
bool iteration_in_progress = false
|
||||
ubyte last_drivenumber = 8 ; which drive was last used for a f_open operation?
|
||||
str list_filetype = "???" ; prg, seq, dir
|
||||
str list_filename = "?" * 50
|
||||
|
||||
; ----- get a list of files (uses iteration functions internally) -----
|
||||
|
||||
sub list_filenames(ubyte drivenumber, uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte {
|
||||
sub list_filenames(uword pattern_ptr, uword filenames_buffer, uword filenames_buf_size) -> ubyte {
|
||||
; -- fill the provided buffer with the names of the files on the disk (until buffer is full).
|
||||
; Files in the buffer are separeted by a 0 byte. You can provide an optional pattern to match against.
|
||||
; After the last filename one additional 0 byte is placed to indicate the end of the list.
|
||||
@ -120,7 +125,7 @@ io_error:
|
||||
; Also sets carry on exit: Carry clear = all files returned, Carry set = directory has more files that didn't fit in the buffer.
|
||||
uword buffer_start = filenames_buffer
|
||||
ubyte files_found = 0
|
||||
if lf_start_list(drivenumber, pattern_ptr) {
|
||||
if lf_start_list(pattern_ptr) {
|
||||
while lf_next_entry() {
|
||||
if list_filetype!="dir" {
|
||||
filenames_buffer += string.copy(diskio.list_filename, filenames_buffer) + 1
|
||||
@ -142,7 +147,7 @@ io_error:
|
||||
|
||||
; ----- iterative file lister functions (uses io channel 12) -----
|
||||
|
||||
sub lf_start_list(ubyte drivenumber, uword pattern_ptr) -> bool {
|
||||
sub lf_start_list(uword pattern_ptr) -> bool {
|
||||
; -- start an iterative file listing with optional pattern matching.
|
||||
; note: only a single iteration loop can be active at a time!
|
||||
lf_end_list()
|
||||
@ -249,14 +254,13 @@ close_end:
|
||||
|
||||
; ----- iterative file loader functions (uses io channel 12) -----
|
||||
|
||||
sub f_open(ubyte drivenumber, uword filenameptr) -> bool {
|
||||
sub f_open(uword filenameptr) -> bool {
|
||||
; -- open a file for iterative reading with f_read
|
||||
; note: only a single iteration loop can be active at a time!
|
||||
f_close()
|
||||
|
||||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||
cbm.SETLFS(12, drivenumber, 12) ; note: has to be 12,x,12 because otherwise f_seek doesn't work
|
||||
last_drivenumber = drivenumber
|
||||
void cbm.OPEN() ; open 12,8,12,"filename"
|
||||
if_cc {
|
||||
if cbm.READST()==0 {
|
||||
@ -357,7 +361,6 @@ _end rts
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
sub f_close() {
|
||||
; -- end an iterative file loading session (close channels).
|
||||
if iteration_in_progress {
|
||||
@ -370,7 +373,7 @@ _end rts
|
||||
|
||||
; ----- iterative file writing functions (uses io channel 13) -----
|
||||
|
||||
sub f_open_w(ubyte drivenumber, uword filenameptr) -> bool {
|
||||
sub f_open_w(uword filenameptr) -> bool {
|
||||
; -- open a file for iterative writing with f_write
|
||||
f_close_w()
|
||||
|
||||
@ -407,7 +410,7 @@ _end rts
|
||||
|
||||
; ---- other functions ----
|
||||
|
||||
sub status(ubyte drivenumber) -> uword {
|
||||
sub status() -> uword {
|
||||
; -- retrieve the disk drive's current status message
|
||||
uword messageptr = &list_filename
|
||||
cbm.SETNAM(0, list_filename)
|
||||
@ -438,7 +441,7 @@ io_error:
|
||||
goto done
|
||||
}
|
||||
|
||||
sub save(ubyte drivenumber, uword filenameptr, uword address, uword size) -> bool {
|
||||
sub save(uword filenameptr, uword address, uword size) -> bool {
|
||||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||
cbm.SETLFS(1, drivenumber, 0)
|
||||
uword @shared end_address = address + size
|
||||
@ -478,8 +481,8 @@ io_error:
|
||||
; (which is possible on the Commander X16), the returned size is not correct,
|
||||
; because it doesn't take the number of ram banks into account.
|
||||
; Also consider using cx16diskio.load() instead on the Commander X16.
|
||||
sub load(ubyte drivenumber, uword filenameptr, uword address_override) -> uword {
|
||||
return internal_load_routine(drivenumber, filenameptr, address_override, false)
|
||||
sub load(uword filenameptr, uword address_override) -> uword {
|
||||
return internal_load_routine(filenameptr, address_override, false)
|
||||
}
|
||||
|
||||
; Use kernal LOAD routine to load the given file in memory.
|
||||
@ -491,25 +494,25 @@ io_error:
|
||||
; (which is possible on the Commander X16), the returned size is not correct,
|
||||
; because it doesn't take the number of ram banks into account.
|
||||
; Also consider using cx16diskio.load_raw() instead on the Commander X16.
|
||||
sub load_raw(ubyte drivenumber, uword filenameptr, uword address) -> uword {
|
||||
sub load_raw(uword filenameptr, uword address) -> uword {
|
||||
if sys.target==16 ; are we on commander X16?
|
||||
return internal_load_routine(drivenumber, filenameptr, address, true)
|
||||
return internal_load_routine(filenameptr, address, true)
|
||||
; fallback to reading the 2 header bytes separately
|
||||
if not f_open(drivenumber, filenameptr)
|
||||
if not f_open(filenameptr)
|
||||
return 0
|
||||
cx16.r1 = f_read(address, 2)
|
||||
f_close()
|
||||
if cx16.r1!=2
|
||||
return 0
|
||||
address += 2
|
||||
return load(drivenumber, filenameptr, address)
|
||||
return load(filenameptr, address)
|
||||
}
|
||||
|
||||
|
||||
; Internal routine, only to be used on Commander X16 platform if headerless=true,
|
||||
; because this routine uses kernal support for that to load headerless files.
|
||||
; On C64 it will always be called with headerless=false.
|
||||
sub internal_load_routine(ubyte drivenumber, uword filenameptr, uword address_override, bool headerless) -> uword {
|
||||
sub internal_load_routine(uword filenameptr, uword address_override, bool headerless) -> uword {
|
||||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||
ubyte secondary = 1
|
||||
cx16.r1 = 0
|
||||
@ -535,7 +538,7 @@ io_error:
|
||||
return cx16.r1
|
||||
}
|
||||
|
||||
sub delete(ubyte drivenumber, uword filenameptr) {
|
||||
sub delete(uword filenameptr) {
|
||||
; -- delete a file on the drive
|
||||
list_filename[0] = 's'
|
||||
list_filename[1] = ':'
|
||||
@ -547,7 +550,7 @@ io_error:
|
||||
cbm.CLOSE(1)
|
||||
}
|
||||
|
||||
sub rename(ubyte drivenumber, uword oldfileptr, uword newfileptr) {
|
||||
sub rename(uword oldfileptr, uword newfileptr) {
|
||||
; -- rename a file on the drive
|
||||
list_filename[0] = 'r'
|
||||
list_filename[1] = ':'
|
||||
@ -561,7 +564,7 @@ io_error:
|
||||
cbm.CLOSE(1)
|
||||
}
|
||||
|
||||
sub send_command(ubyte drivenumber, uword commandptr) {
|
||||
sub send_command(uword commandptr) {
|
||||
; -- send a dos command to the drive
|
||||
cbm.SETNAM(string.length(commandptr), commandptr)
|
||||
cbm.SETLFS(15, drivenumber, 15)
|
||||
|
@ -8,15 +8,13 @@ For 9.0 major changes
|
||||
- DONE: rename sqrt16() to just sqrt(), make it accept multiple numeric types. Renamed floats.sqrt() to floats.sqrtf() but you can just use sqrt()
|
||||
- DONE: abs() now supports multiple datatypes including float. No need to use floats.fabs() anymore.
|
||||
- DONE: divmod() now supports multiple datatypes. divmodw() has been removed.
|
||||
- DONE: drivenumber parameter removed from all routines in diskio and cx16diskio modules. The drive to work on is now simply stored as a diskio.drivenumber variable, which defaults to 8.
|
||||
|
||||
- duplicate diskio for cx16 (get rid of cx16diskio, just copy diskio and tweak everything) + documentation
|
||||
- 6502 codegen: see if we can let for loops skip the loop if startvar>endvar, without adding a lot of code size/duplicating the loop condition.
|
||||
It is documented behavior to now loop 'around' $00 but it's too easy to forget about!
|
||||
Lot of work because of so many special cases in ForLoopsAsmgen.....
|
||||
(vm codegen already behaves like this!)
|
||||
- ?? get rid of the disknumber parameter everywhere in diskio, make it a configurable variable that defaults to 8.
|
||||
the large majority of users will only deal with a single disk drive so why not make it easier for them.
|
||||
But see complaint on github https://github.com/irmen/prog8/issues/106
|
||||
- duplicate diskio for cx16 (get rid of cx16diskio, just copy diskio and tweak everything) + documentation
|
||||
- get f_seek_w working like in the BASIC program - this needs the changes to diskio.f_open to use suffixes ,p,m
|
||||
- once 9.0 is stable, upgrade other programs (assem, shell, etc) to it. + add migration guide to the manual.
|
||||
- [much work:] add special (u)word array type (or modifier such as @fast? ) that puts the array into memory as 2 separate byte-arrays 1 for LSB 1 for MSB -> allows for word arrays of length 256 and faster indexing
|
||||
|
@ -23,7 +23,7 @@ main {
|
||||
}
|
||||
|
||||
sub start() {
|
||||
txt.print("\n\ndisk benchmark. repeats = ")
|
||||
txt.print("\n\ndisk benchmark. drive 8. repeats = ")
|
||||
txt.print_ub(REPEATS)
|
||||
|
||||
uword batchtotaltime
|
||||
@ -32,8 +32,8 @@ main {
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
cbm.SETTIM(0,0,0)
|
||||
void diskio.save(8, "@:benchmark.dat", $100, 32768)
|
||||
void diskio.save(8, "@:benchmark.dat", $100, 32768)
|
||||
void diskio.save("@:benchmark.dat", $100, 32768)
|
||||
void diskio.save("@:benchmark.dat", $100, 32768)
|
||||
batchtotaltime += cbm.RDTIM16()
|
||||
txt.chrout('.')
|
||||
}
|
||||
@ -42,7 +42,7 @@ main {
|
||||
txt.print("\nwriting 64kb sequentially")
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
if diskio.f_open_w(8, "@:benchmark.dat") {
|
||||
if diskio.f_open_w("@:benchmark.dat") {
|
||||
cbm.SETTIM(0,0,0)
|
||||
repeat 65536/256 {
|
||||
if not diskio.f_write(buffer, 256)
|
||||
@ -59,7 +59,7 @@ main {
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
cbm.SETTIM(0,0,0)
|
||||
if not cx16diskio.load(8, "benchmark.dat", 4, $a000)
|
||||
if not cx16diskio.load("benchmark.dat", 4, $a000)
|
||||
sys.exit(1)
|
||||
batchtotaltime += cbm.RDTIM16()
|
||||
txt.chrout('.')
|
||||
@ -70,7 +70,7 @@ main {
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
cbm.SETTIM(0,0,0)
|
||||
if not cx16diskio.vload("benchmark.dat", 8, 0, $0000)
|
||||
if not cx16diskio.vload("benchmark.dat", 0, $0000)
|
||||
sys.exit(1)
|
||||
batchtotaltime += cbm.RDTIM16()
|
||||
txt.chrout('.')
|
||||
@ -80,7 +80,7 @@ main {
|
||||
txt.print("\nreading 64kb sequentially")
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
if diskio.f_open(8, "benchmark.dat") {
|
||||
if diskio.f_open("benchmark.dat") {
|
||||
cbm.SETTIM(0,0,0)
|
||||
repeat 65536/255 {
|
||||
if not diskio.f_read(buffer, 255)
|
||||
@ -96,7 +96,7 @@ main {
|
||||
txt.print("\nreading 64kb sequentially (x16 optimized)")
|
||||
batchtotaltime = 0
|
||||
repeat REPEATS {
|
||||
if diskio.f_open(8, "benchmark.dat") {
|
||||
if diskio.f_open("benchmark.dat") {
|
||||
cbm.SETTIM(0,0,0)
|
||||
repeat 65536/255 {
|
||||
if not cx16diskio.f_read(buffer, 255)
|
||||
@ -110,7 +110,7 @@ main {
|
||||
print_speed(batchtotaltime)
|
||||
|
||||
txt.nl()
|
||||
txt.print(diskio.status(8))
|
||||
txt.print(diskio.status())
|
||||
txt.print("\ndone.\n")
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ main {
|
||||
|
||||
sub start() {
|
||||
|
||||
txt.print("writing data file...\n")
|
||||
txt.print("writing data file (drive 8)...\n")
|
||||
uword total=0
|
||||
if diskio.f_open_w(8, "@:seektestfile.bin") {
|
||||
if diskio.f_open_w("@:seektestfile.bin") {
|
||||
repeat 100 {
|
||||
str text = "hello world.\n"
|
||||
str text = "hello world.*"
|
||||
void diskio.f_write(text, string.length(text))
|
||||
total += string.length(text)
|
||||
}
|
||||
@ -26,7 +26,7 @@ main {
|
||||
txt.nl()
|
||||
} else {
|
||||
txt.print("error: ")
|
||||
txt.print(diskio.status(8))
|
||||
txt.print(diskio.status())
|
||||
sys.exit(1)
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@ main {
|
||||
|
||||
; NOTE: f_seek_w() doesn't work right now. It requires substantial changes to the diskio library that are not compatible with the C64/C128.
|
||||
; txt.print("\nseeking to 1292 and writing a few bytes...\n")
|
||||
; if diskio.f_open_w(8, "seektestfile.bin,p,m") {
|
||||
; if diskio.f_open_w("seektestfile.bin,p,m") {
|
||||
; cx16diskio.f_seek_w(0, 1292)
|
||||
; void diskio.f_write("123", 3)
|
||||
; diskio.f_close_w()
|
||||
; } else {
|
||||
; txt.print("error: ")
|
||||
; txt.print(diskio.status(8))
|
||||
; txt.print(diskio.status())
|
||||
; sys.exit(1)
|
||||
; }
|
||||
;
|
||||
@ -52,7 +52,7 @@ main {
|
||||
uword total = 0
|
||||
uword size
|
||||
txt.print("\nreading...\n")
|
||||
if diskio.f_open(8, "seektestfile.bin") {
|
||||
if diskio.f_open("seektestfile.bin") {
|
||||
size = diskio.f_read_all(megabuffer)
|
||||
diskio.f_close()
|
||||
txt.print("size read:")
|
||||
@ -64,7 +64,7 @@ main {
|
||||
}
|
||||
|
||||
txt.print("\nseeking to 1290 and reading...\n")
|
||||
if diskio.f_open(8, "seektestfile.bin") {
|
||||
if diskio.f_open("seektestfile.bin") {
|
||||
cx16diskio.f_seek(0, 1290)
|
||||
uword ptr = megabuffer
|
||||
do {
|
||||
@ -83,14 +83,12 @@ main {
|
||||
txt.print_ubhex(megabuffer[idx], false)
|
||||
txt.spc()
|
||||
}
|
||||
txt.spc()
|
||||
txt.chrout('{')
|
||||
txt.print("\nas text: \"")
|
||||
txt.print(megabuffer)
|
||||
txt.chrout('}')
|
||||
txt.nl()
|
||||
txt.print("\"\n")
|
||||
} else {
|
||||
txt.print("error: ")
|
||||
txt.print(diskio.status(8))
|
||||
txt.print(diskio.status())
|
||||
sys.exit(1)
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ main {
|
||||
uword buffer = memory("buffer", 1024, 256)
|
||||
str MUSIC_FILENAME = "?"*32
|
||||
|
||||
txt.print("name of .wav file to play: ")
|
||||
txt.print("name of .wav file to play on drive 8: ")
|
||||
while 0==txt.input_chars(MUSIC_FILENAME) {
|
||||
; until user types a name...
|
||||
}
|
||||
@ -40,7 +40,7 @@ main {
|
||||
txt.print("\nchecking ")
|
||||
txt.print(MUSIC_FILENAME)
|
||||
txt.nl()
|
||||
if diskio.f_open(8, MUSIC_FILENAME) {
|
||||
if diskio.f_open(MUSIC_FILENAME) {
|
||||
void cx16diskio.f_read(buffer, 128)
|
||||
wav_ok = wavfile.parse_header(buffer)
|
||||
diskio.f_close()
|
||||
@ -101,7 +101,7 @@ main {
|
||||
cx16.VERA_IEN = %00001000 ; enable AFLOW only for now
|
||||
sys.clear_irqd()
|
||||
|
||||
if diskio.f_open(8, MUSIC_FILENAME) {
|
||||
if diskio.f_open(MUSIC_FILENAME) {
|
||||
uword block_size = 1024
|
||||
if wavfile.wavefmt==wavfile.WAVE_FORMAT_DVI_ADPCM
|
||||
block_size = wavfile.block_align
|
||||
|
@ -50,14 +50,14 @@ zsound_lib:
|
||||
const ubyte zcm_DIGITAB_size = 8 ; header size
|
||||
|
||||
sub start() {
|
||||
txt.print("zsound demo program!\n")
|
||||
txt.print("zsound demo program (drive 8)!\n")
|
||||
|
||||
cbm.SETMSG(%10000000) ; enable kernal status messages for load
|
||||
if not cx16diskio.load_raw(8, "colony.zsm", song_bank, song_address) {
|
||||
if not cx16diskio.load_raw("colony.zsm", song_bank, song_address) {
|
||||
txt.print("?can't load\n")
|
||||
return
|
||||
}
|
||||
if not cx16diskio.load_raw(8, "terminator2.zcm", digi_bank, digi_address) {
|
||||
if not cx16diskio.load_raw("terminator2.zcm", digi_bank, digi_address) {
|
||||
txt.print("?can't load\n")
|
||||
return
|
||||
} else {
|
||||
|
@ -48,9 +48,9 @@ zsound_lib:
|
||||
}
|
||||
|
||||
sub start() {
|
||||
txt.print("\nzsound digi streaming!\n")
|
||||
txt.print("\nzsound digi streaming (drive 8)!\n")
|
||||
|
||||
if not diskio.f_open(8, "thriller.zcm") {
|
||||
if not diskio.f_open("thriller.zcm") {
|
||||
txt.print("?no file\n")
|
||||
return
|
||||
}
|
||||
|
@ -6,11 +6,14 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
txt.print("showing the full directory of drive 8:\n")
|
||||
void diskio.directory(8)
|
||||
diskio.set_drive(8)
|
||||
txt.print("showing the full directory of drive ")
|
||||
txt.print_ub(diskio.drivenumber)
|
||||
txt.print(":\n")
|
||||
void diskio.directory()
|
||||
txt.nl()
|
||||
|
||||
if diskio.lf_start_list(8, "cub*") {
|
||||
if diskio.lf_start_list("cub*") {
|
||||
txt.print("\nfiles starting with 'cub':\n")
|
||||
while diskio.lf_next_entry() {
|
||||
txt.print(diskio.list_filename)
|
||||
@ -23,7 +26,7 @@ main {
|
||||
txt.print("error\n")
|
||||
}
|
||||
|
||||
if diskio.lf_start_list(8, "*gfx") {
|
||||
if diskio.lf_start_list("*gfx") {
|
||||
txt.print("\nfiles ending with 'gfx':\n")
|
||||
while diskio.lf_next_entry() {
|
||||
txt.print(diskio.list_filename)
|
||||
@ -36,7 +39,7 @@ main {
|
||||
txt.print("error\n")
|
||||
}
|
||||
|
||||
if diskio.lf_start_list(8, 0) {
|
||||
if diskio.lf_start_list(0) {
|
||||
txt.print("\nfirst 10 files:\n")
|
||||
ubyte counter=0
|
||||
while counter < 10 and diskio.lf_next_entry() {
|
||||
|
@ -85,12 +85,12 @@ trader {
|
||||
; 22 ubyte fuel
|
||||
|
||||
sub do_load() {
|
||||
txt.print("\nLoading universe...")
|
||||
if diskio.load(8, Savegame, &savedata) {
|
||||
txt.print("\nLoading universe... (drive 8)")
|
||||
if diskio.load(Savegame, &savedata) {
|
||||
txt.print("ok\n")
|
||||
} else {
|
||||
txt.print("\ni/o error: ")
|
||||
txt.print(diskio.status(8))
|
||||
txt.print(diskio.status())
|
||||
txt.nl()
|
||||
return
|
||||
}
|
||||
@ -113,13 +113,13 @@ trader {
|
||||
savedata[22] = ship.fuel
|
||||
sys.memcopy(ship.cargohold, &savedata + 2, len(ship.cargohold))
|
||||
|
||||
txt.print("\nSaving universe...")
|
||||
diskio.delete(8, Savegame)
|
||||
if diskio.save(8, Savegame, &savedata, sizeof(savedata)) {
|
||||
txt.print("\nSaving universe... (drive 8)")
|
||||
diskio.delete(Savegame)
|
||||
if diskio.save(Savegame, &savedata, sizeof(savedata)) {
|
||||
txt.print("ok\n")
|
||||
} else {
|
||||
txt.print("\ni/o error: ")
|
||||
txt.print(diskio.status(8))
|
||||
txt.print(diskio.status())
|
||||
txt.nl()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user