blob: 71edec1b8c1bfe950be989bc1627dd88817c0222 [file] [log] [blame]
kthacker6de67752006-04-17 15:02:26 +00001;; This example shows how to perform a directory of a disc
2;; and extract the filenames.
3;;
4;; This code is public domain and can freely be used in your
5;; own programs.
6;;
7;; Written by Kevin Thacker. 2002
8
9
10
11;;------------------------------------------------------------------
12
13;; firmware function to catalog a disc or cassette
14cas_catalog == 0xbc9b
15;; firmware function to disable text output
16txt_vdu_enable == 0xbb54
17;; firmware function to enable text output
18txt_vdu_disable == 0xbb57
19;; firmware function to find a RSX
20kl_find_command == 0xbcd4
21
22 .globl __readdir
23 .area _CODE
24
PulkoMandy3783e422023-05-02 17:40:17 +020025;; void _readdir(void*)
26;; Input: pointer to buffer in HL
kthacker6de67752006-04-17 15:02:26 +000027__readdir::
28
PulkoMandyc0f22c72023-05-04 23:02:20 +020029 ; The AMSDOS call corrupts IX, which must be saved for SDCC code to work
30 PUSH IX
kthacker6de67752006-04-17 15:02:26 +000031
PulkoMandyc0f22c72023-05-04 23:02:20 +020032 ; The parameter is passed in HL but we need it in DE
33 EX DE,HL
kthacker6de67752006-04-17 15:02:26 +000034
kthacker6de67752006-04-17 15:02:26 +000035;; disable disc messages. Error messages will not be displayed.
36ld a,#0xff
37rst 0x018 ;; KL FAR CALL
38.dw bios_set_message
39
40;; disable text output
41call txt_vdu_disable
42
PulkoMandyc0f22c72023-05-04 23:02:20 +020043 ; Make sure to return an empty buffer if getting the catalog fails
44 xor a
45 ld (DE),a
kthacker6de67752006-04-17 15:02:26 +000046
47;; do catalog
PulkoMandyc0f22c72023-05-04 23:02:20 +020048 call cas_catalog
kthacker6de67752006-04-17 15:02:26 +000049
50;; enable text output
51call txt_vdu_enable
52
53;; enable disc messages. Error messages will be displayed
PulkoMandy5523de42014-06-29 20:28:00 +020054xor a
kthacker6de67752006-04-17 15:02:26 +000055rst 0x018 ;; KL FAR CALL
56.dw bios_set_message
PulkoMandyc0f22c72023-05-04 23:02:20 +020057
58 POP IX
kthacker6de67752006-04-17 15:02:26 +000059ret
60
61
62;;------------------------------------------------------------------
63
64;; this is initialised when the "BIOS SET MESSAGE" RSX has been found.
65bios_set_message:
PulkoMandy5523de42014-06-29 20:28:00 +020066.dw 0xc033 ;; address of function
67.db 7 ;; "rom select" for function
kthacker6de67752006-04-17 15:02:26 +000068