prog8/examples/dirlist.p8

57 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-12-08 01:16:41 +00:00
%import textio
%import diskio
%zeropage basicsafe
%import test_stack
%option no_sysinit
main {
sub start() {
txt.print("showing the full directory of drive 8:\n")
void diskio.directory(8)
txt.chrout('\n')
2020-12-08 01:16:41 +00:00
2020-12-08 02:28:29 +00:00
if diskio.lf_start_list(8, "cub", false) {
txt.print("\nfiles starting with 'cub':\n")
while diskio.lf_next_entry() {
txt.print(diskio.list_filename)
txt.print(" ")
txt.print_uw(diskio.list_blocks)
txt.print(" blocks\n")
}
diskio.lf_end_list()
} else {
txt.print("error\n")
}
2020-12-08 01:16:41 +00:00
2020-12-08 02:28:29 +00:00
if diskio.lf_start_list(8, "gfx", true) {
txt.print("\nfiles ending with 'gfx':\n")
while diskio.lf_next_entry() {
txt.print(diskio.list_filename)
txt.print(" ")
txt.print_uw(diskio.list_blocks)
txt.print(" blocks\n")
}
diskio.lf_end_list()
} else {
txt.print("error\n")
}
2020-12-08 01:16:41 +00:00
2020-12-08 02:28:29 +00:00
if diskio.lf_start_list(8, 0, false) {
txt.print("\nfirst 10 files:\n")
ubyte counter=0
while counter < 10 and diskio.lf_next_entry() {
txt.print(diskio.list_filename)
txt.print(" ")
txt.print_uw(diskio.list_blocks)
txt.print(" blocks\n")
counter++
2020-12-08 01:16:41 +00:00
}
2020-12-08 02:28:29 +00:00
diskio.lf_end_list()
} else {
txt.print("error\n")
2020-12-08 01:16:41 +00:00
}
2020-12-08 02:28:29 +00:00
; test_stack.test()
2020-12-08 01:16:41 +00:00
}
}