Skip to content

Commit 976274a

Browse files
committed
Do not display hidden files (super messy with SD cards used in Macs)
1 parent 236e34e commit 976274a

4 files changed

Lines changed: 37 additions & 6 deletions

File tree

f256/jr.asm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,16 @@ hw_rti
327327

328328
puts jmp platform.console.puts
329329

330-
board .struct id, codec
330+
board .struct id, codec, k
331331
mid .byte \id
332332
codec_init .byte \codec
333+
k .byte \k
333334
size .ends
334335

335-
boards .dstruct board, $02,%00000011 ; jr/mmu
336-
_2 .dstruct board, $12,%00010011 ; k/mmu
337-
_3 .dstruct board, $22,%00011101 ; jr2/mmu
338-
_4 .dstruct board, $11,%00011111 ; k2/mmu
336+
boards .dstruct board, $02,%00000011,$00 ; jr/mmu
337+
_2 .dstruct board, $12,%00010011,$01 ; k/mmu
338+
_3 .dstruct board, $22,%00011101,$00 ; jr2/mmu
339+
_4 .dstruct board, $11,%00011111,$01 ; k2/mmu
339340
boards_end = * - boards
340341

341342
get_board

fat32/f256jr.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ used: .res 1
5353

5454
jmp fat32_open_dir
5555
jmp fat32_get_vollabel
56-
jmp fat32_read_dirent
56+
jmp fat32_read_dirent_filter_hidden
5757
jmp fat32_get_free_space
5858
jmp fat32_close
5959

fat32/fat32.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
.global fat32_open_dir ; Open directory with path in fat32_ptr
2727
.global fat32_read_dirent ; Read directory entry, result in fat32_dirent
2828
.global fat32_read_dirent_filtered ; Same as above, but only matching names (fat32_ptr)
29+
.global fat32_read_dirent_filter_hidden ; Same as above, but only non-hidden files
2930
.global fat32_find_dirent ; Find file with path in fat32_ptr in current directory
3031

3132
.global fat32_chdir ; Change to directory with path in fat32_ptr

fat32/fat32.s

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,35 @@ fat32_read_dirent_filtered:
21072107
clc
21082108
rts
21092109

2110+
;-----------------------------------------------------------------------------
2111+
; fat32_read_dirent_filter_hidden
2112+
;
2113+
; Returns next dirent that is not a hidden file
2114+
;
2115+
; * c=0: failure; sets errno
2116+
;-----------------------------------------------------------------------------
2117+
fat32_read_dirent_filter_hidden:
2118+
stz fat32_errno
2119+
2120+
jsr fat32_read_dirent
2121+
bcc @error
2122+
2123+
cmp16_z fat32_ptr, @ok
2124+
2125+
; Check for hidden attribute (bit 1), but only for non-directories
2126+
lda fat32_dirent + dirent::attributes
2127+
bit #$10 ; Is it a directory?
2128+
bne @ok ; Don't filter directories
2129+
and #$02 ; Check hidden bit
2130+
bne fat32_read_dirent_filter_hidden ; Skip hidden files
2131+
@ok:
2132+
sec
2133+
rts
2134+
2135+
@error:
2136+
clc
2137+
rts
2138+
21102139
;-----------------------------------------------------------------------------
21112140
; fat32_chdir
21122141
;

0 commit comments

Comments
 (0)