blob: 2de266a90d4bf6720256b2750fc164e0bde4ab7d [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
25;;------------------------------------------------------------------
26;; find BIOS SET MESSAGE command
27;; this is used to disable disc messages.
28;; this is compatible with other DOSs that also provide this command
29__readdir::
30
31ld hl,#cmd_bios_set_message
32call kl_find_command
33ret nc
34
35;; command found
36
37;; store address of command
38ld (bios_set_message),hl
39ld a,c
40;; store "rom select" of command
41ld (bios_set_message+2),a
42
43;;------------------------------------------------------------------
44
45;; do CAT
46ld hl,#2
47add hl,sp
48ld e,(hl)
49inc hl
50ld d,(hl)
51call fetch_directory
52ret
53
54
55;;------------------------------------------------------------------
56;; display files from data generated by CAS CATALOG function
57
58;; perform a CAT command
59
60fetch_directory::
61push de
62;; disable disc messages. Error messages will not be displayed.
63ld a,#0xff
64rst 0x018 ;; KL FAR CALL
65.dw bios_set_message
66
67;; disable text output
68call txt_vdu_disable
69
70pop de
71
72;; initialise in case of an error
73xor a
74ld (de),a
75
76;; do catalog
77call cas_catalog
78
79;; enable text output
80call txt_vdu_enable
81
82;; enable disc messages. Error messages will be displayed
83ld a,#0x0
84rst 0x018 ;; KL FAR CALL
85.dw bios_set_message
86ret
87
88
89;;------------------------------------------------------------------
90
91;; this is initialised when the "BIOS SET MESSAGE" RSX has been found.
92bios_set_message:
93.dw 0 ;; address of function
94.db 0 ;; "rom select" for function
95
96
97cmd_bios_set_message:
98.db #0x01+#0x80 ;; this is the "BIOS SET MESSAGE" RSX
99