Apple2: Provide a way to get directory file count

The information is available in the directory key block.
Providing it to the user as soon as opendir() is done
can save them costly code.
This commit is contained in:
Colin Leroy-Mira
2024-11-10 13:38:35 +01:00
committed by Oliver Schmidt
parent 36132a437b
commit 40d9f3eed5
9 changed files with 64 additions and 14 deletions

View File

@@ -0,0 +1,24 @@
;
; Colin Leroy-Mira <colin@colino.net>, 2024
;
; unsigned int __fastcall__ dir_file_count(DIR *dir);
;
.export _dir_file_count
.importzp ptr1
.include "apple2.inc"
.include "dir.inc"
.proc _dir_file_count
sta ptr1
stx ptr1+1
ldy #DIR::FILE_COUNT + 1
lda (ptr1),y
tax
dey
lda (ptr1),y
rts
.endproc