2020-09-20 21:49:36 +00:00
|
|
|
%import textio
|
2020-12-07 22:29:34 +00:00
|
|
|
%import diskio
|
2020-11-15 16:44:47 +00:00
|
|
|
%import floats
|
2020-11-15 14:04:23 +00:00
|
|
|
%zeropage basicsafe
|
2020-11-20 21:15:14 +00:00
|
|
|
%import test_stack
|
2020-12-08 00:02:38 +00:00
|
|
|
%option no_sysinit
|
|
|
|
|
|
|
|
errors {
|
|
|
|
sub tofix() {
|
|
|
|
|
|
|
|
while c64.CHRIN() {
|
|
|
|
; TODO: the loop condition isn't properly tested because a ldx is in the way before the beq
|
|
|
|
}
|
|
|
|
|
|
|
|
repeat {
|
|
|
|
ubyte char2 = c64.CHRIN()
|
|
|
|
if char2==0 ; TODO condition not properly tested after optimizing because there's only a sta char2 before it (works without optimizing)
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
repeat {
|
|
|
|
ubyte char3 = c64.CHRIN()
|
|
|
|
if_z
|
|
|
|
break ; TODO wrong jump asm generated, works fine if you use a label instead to jump to
|
|
|
|
}
|
|
|
|
|
|
|
|
; TODO fix undefined symbol:
|
|
|
|
repeat {
|
|
|
|
ubyte char = c64.CHRIN()
|
|
|
|
; ...
|
|
|
|
}
|
|
|
|
; do {
|
|
|
|
; char = c64.CHRIN() ; TODO fix undefined symbol error, should refer to 'char' above in the subroutine's scope
|
|
|
|
; } until char==0
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2020-08-27 17:47:50 +00:00
|
|
|
|
2020-09-24 17:26:07 +00:00
|
|
|
main {
|
2020-10-09 20:47:42 +00:00
|
|
|
sub start() {
|
2020-12-06 16:02:56 +00:00
|
|
|
|
2020-12-08 00:34:08 +00:00
|
|
|
; ubyte result = diskio.directory(8)
|
|
|
|
; txt.print("result: ")
|
|
|
|
; txt.print_ub(result)
|
|
|
|
; txt.chrout('\n')
|
|
|
|
; test_stack.test()
|
|
|
|
;
|
|
|
|
; diskio.status(8)
|
|
|
|
; txt.chrout('\n')
|
|
|
|
; txt.chrout('\n')
|
|
|
|
; txt.chrout('\n')
|
|
|
|
; test_stack.test()
|
2020-12-07 21:55:16 +00:00
|
|
|
|
2020-12-07 22:29:34 +00:00
|
|
|
const ubyte max_files = 10
|
|
|
|
uword[max_files] blocks
|
|
|
|
str filenames = "?????????????????" * max_files
|
2020-12-07 21:55:16 +00:00
|
|
|
|
2020-12-08 00:02:38 +00:00
|
|
|
ubyte num_files=0
|
2020-12-08 00:34:08 +00:00
|
|
|
txt.print("files starting with 'cub':\n")
|
|
|
|
num_files = diskio.listfiles(8, "cub", false, filenames, blocks, max_files)
|
|
|
|
print_listing()
|
2020-12-07 21:55:16 +00:00
|
|
|
txt.chrout('\n')
|
2020-12-08 00:34:08 +00:00
|
|
|
txt.print("files ending with 'gfx':\n")
|
|
|
|
num_files = diskio.listfiles(8, "gfx", true, filenames, blocks, max_files)
|
|
|
|
print_listing()
|
|
|
|
;test_stack.test()
|
2020-12-08 00:02:38 +00:00
|
|
|
|
2020-12-08 00:34:08 +00:00
|
|
|
sub print_listing() {
|
|
|
|
if num_files==0
|
|
|
|
txt.print("no files found.")
|
|
|
|
else {
|
|
|
|
ubyte i
|
|
|
|
uword filenameptr = &filenames
|
|
|
|
for i in 0 to num_files-1 {
|
|
|
|
txt.print_ub(i+1)
|
|
|
|
txt.print(": ")
|
|
|
|
txt.print(filenameptr)
|
|
|
|
txt.print(" = ")
|
|
|
|
txt.print_uw(blocks[i])
|
|
|
|
txt.print(" blocks\n")
|
|
|
|
filenameptr += strlen(filenameptr) + 1
|
|
|
|
}
|
2020-12-07 22:29:34 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-03 17:39:32 +00:00
|
|
|
}
|
2020-08-27 17:47:50 +00:00
|
|
|
}
|