add drivenumber to fileselector config

This commit is contained in:
Irmen de Jong
2025-02-02 23:09:27 +01:00
parent 5b58e5b158
commit 06ca68a625
8 changed files with 28 additions and 22 deletions
+1 -2
View File
@@ -612,12 +612,11 @@ return_status:
@(messageptr) = 0
done:
cbm.CLRCHN() ; restore default i/o devices
cbm.CLOSE(15)
cbm.CLRCHN() ; restore default i/o devices
return list_filename
io_error:
cbm.CLOSE(15)
list_filename = "io error"
goto done
}
+1 -2
View File
@@ -535,12 +535,11 @@ _end jsr cbm.READST
@(messageptr) = 0
done:
cbm.CLRCHN() ; restore default i/o devices
cbm.CLOSE(15)
cbm.CLRCHN() ; restore default i/o devices
return list_filename
io_error:
cbm.CLOSE(15)
list_filename = "io error"
goto done
}
+2
View File
@@ -1,6 +1,8 @@
TODO
====
- diskio diskname / fileselector hangs or crashes on X16 when using drive 9 instead of 8
- for creating libraries, something like %jmptable( block.func1, block.func2, ... ) could be useful to create a compact jump table, and possibly generating extsub definitions as well. Problem: directives cannot span multiple lines atm.
- Make neo and atari targets external via configs? They are very bare bones atm so easier to contribute to if they're configurable externally? What about the pet32 target
+3 -3
View File
@@ -4,7 +4,6 @@
%zeropage basicsafe
; A "TUI" for an interactive file selector, that scrolls the selection list if it doesn't fit on the screen.
; Depends a lot on diskio routines, and uses the drive set in the diskio.drivenumber variable (usually just 8)
; TODO sort entries alphabetically? Or not, because C64/C128 directories tend to be not very large.
@@ -12,7 +11,7 @@
main {
sub start() {
;; fileselector.configure(1, 5, 5)
;; fileselector.configure(1, 5, 5, 8)
uword chosen = fileselector.select("*")
txt.nl()
if chosen!=0 {
@@ -39,10 +38,11 @@ fileselector {
uword name_ptr
ubyte num_visible_files
sub configure(ubyte column, ubyte row, ubyte max_entries) {
sub configure(ubyte column, ubyte row, ubyte max_entries, ubyte drivenumber) {
dialog_topx = column
dialog_topy = row
max_lines = max_entries
diskio.drivenumber = drivenumber
}
sub select(str pattern) -> uword {
+1 -1
View File
@@ -1,6 +1,6 @@
.PHONY: all clean zip run
all: main.prg fselector.bin standalone.prg
all: main.prg fselector-a000.bin standalone.prg
clean:
rm -f main.asm main.vice* main.prg fselector.asm fselector.vice* fselector*.bin standalone.asm standalone.vice* standalone.prg
+5 -5
View File
@@ -9,8 +9,7 @@
; A "TUI" for an interactive file selector, that scrolls the selection list if it doesn't fit on the screen.
; Returns the name of the selected file. If it is a directory instead, the name will start and end with a slash '/'.
; Functions in PETSCII mode and in ISO mode as well (no case folding in ISO mode!)
; Depends a lot on diskio routines, and uses the drive set in the diskio.drivenumber variable (usually just 8)
; Works in PETSCII mode and in ISO mode as well (no case folding in ISO mode!)
; TODO joystick control? mouse control?
; TODO keyboard typing; jump to the first entry that starts with that character? (but 'q' for quit stops working then, plus scrolling with pageup/down is already pretty fast)
@@ -24,7 +23,7 @@ main {
; making the first jump neatly be the required initialization routine
; for the library (initializing variables and BSS region).
; Btw, $4c = opcode for JMP.
$4c00, &fileselector.configure_types,
$4c00, &fileselector.configure,
$4c00, &fileselector.configure_appearance,
$4c00, &fileselector.select,
]
@@ -36,7 +35,7 @@ main {
fileselector {
; these buffer sizes are chosen to fill up the rest of the hiram bank after the fileselector code
const uword filenamesbuf_size = $ea0
const uword filenamesbuf_size = $e90
const ubyte max_num_files = 128
uword @shared filenamesbuffer = memory("filenames_buffer", filenamesbuf_size, 0)
@@ -54,8 +53,9 @@ fileselector {
uword name_ptr
sub configure_types(ubyte show_types) {
sub configure(ubyte drivenumber, ubyte show_types) {
; show_types is a bit mask , bit 0 = include files in list, bit 1 = include dirs in list, 0 (or 3)=show everything.
diskio.drivenumber = drivenumber
show_what = show_types
if_z
show_what = 3
+11 -5
View File
@@ -7,11 +7,17 @@ main {
sub start() {
if diskio.load_raw("fselector-a000.bin", $a000) != 0 {
fselector.init()
;; fselector.config_types(fselector.TYPE_ALL)
fselector.config(8, fselector.TYPE_ALL)
uword filename = fselector.select("*")
txt.print("\n\n\n\n\nselected: ")
txt.print(filename)
txt.nl()
txt.print("\n\n\n\n\n")
if filename!=0 {
txt.print("selected: ")
txt.print(filename)
txt.nl()
} else {
txt.print("nothing selected or error.\n")
}
}
}
}
@@ -25,7 +31,7 @@ fselector {
extsub $a000 = init() clobbers(A)
; what entry types should be displayed (default=all)
extsub $a004 = config_types(ubyte types @A) clobbers(A)
extsub $a004 = config(ubyte drivenumber @A, ubyte types @Y) clobbers(A)
; configure the position and appearance of the dialog
extsub $a008 = config_appearance(ubyte column @R0, ubyte row @R1, ubyte max_entries @R2, ubyte normalcolors @R3, ubyte selectedcolors @R4) clobbers(A)
+4 -4
View File
@@ -9,8 +9,7 @@
; A "TUI" for an interactive file selector, that scrolls the selection list if it doesn't fit on the screen.
; Returns the name of the selected file. If it is a directory instead, the name will start and end with a slash '/'.
; Functions in PETSCII mode and in ISO mode as well (no case folding in ISO mode!)
; Depends a lot on diskio routines, and uses the drive set in the diskio.drivenumber variable (usually just 8)
; Works in PETSCII mode and in ISO mode as well (no case folding in ISO mode!)
; TODO joystick control? mouse control?
; TODO keyboard typing; jump to the first entry that starts with that character? (but 'q' for quit stops working then, plus scrolling with pageup/down is already pretty fast)
@@ -19,7 +18,7 @@
main {
sub start() {
; some configuration, optional
fileselector.configure_settings(3, 2)
fileselector.configure_settings(8, 3, 2)
fileselector.configure_appearance(10, 10, 20, $b3, $d0)
; show all files, using just the * wildcard
@@ -59,8 +58,9 @@ fileselector {
uword name_ptr
sub configure_settings(ubyte show_types, ubyte rambank) {
sub configure_settings(ubyte drivenumber, ubyte show_types, ubyte rambank) {
; show_types is a bit mask , bit 0 = include files in list, bit 1 = include dirs in list, 0 (or 3)=show everything.
diskio.drivenumber = drivenumber
buffer_rambank = rambank
show_what = show_types
if_z