blob: e2b97fa4b6444aebc535991ebf1b6be58ff27829 [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
PulkoMandy3783e422023-05-02 17:40:17 +020029;; void _readdir(void*)
30;; Input: pointer to buffer in HL
kthacker6de67752006-04-17 15:02:26 +000031__readdir::
32
PulkoMandy5523de42014-06-29 20:28:00 +020033;ld hl,#cmd_bios_set_message
34;call kl_find_command
35;ret nc
kthacker6de67752006-04-17 15:02:26 +000036
37;; command found
38
39;; store address of command
PulkoMandy5523de42014-06-29 20:28:00 +020040;ld (bios_set_message),hl
41;ld a,c
kthacker6de67752006-04-17 15:02:26 +000042;; store "rom select" of command
PulkoMandy5523de42014-06-29 20:28:00 +020043;ld (bios_set_message+2),a
kthacker6de67752006-04-17 15:02:26 +000044
45;;------------------------------------------------------------------
46
47;; do CAT
PulkoMandy3783e422023-05-02 17:40:17 +020048EX DE,HL ;; Put pointer to buffer in DE instead
kthacker6de67752006-04-17 15:02:26 +000049
50;;------------------------------------------------------------------
51;; display files from data generated by CAS CATALOG function
52
53;; perform a CAT command
54
kthacker6de67752006-04-17 15:02:26 +000055;; disable disc messages. Error messages will not be displayed.
56ld a,#0xff
57rst 0x018 ;; KL FAR CALL
58.dw bios_set_message
59
60;; disable text output
61call txt_vdu_disable
62
kthacker6de67752006-04-17 15:02:26 +000063xor a
64ld (de),a
65
66;; do catalog
67call cas_catalog
68
69;; enable text output
70call txt_vdu_enable
71
72;; enable disc messages. Error messages will be displayed
PulkoMandy5523de42014-06-29 20:28:00 +020073xor a
kthacker6de67752006-04-17 15:02:26 +000074rst 0x018 ;; KL FAR CALL
75.dw bios_set_message
76ret
77
78
79;;------------------------------------------------------------------
80
81;; this is initialised when the "BIOS SET MESSAGE" RSX has been found.
82bios_set_message:
PulkoMandy5523de42014-06-29 20:28:00 +020083.dw 0xc033 ;; address of function
84.db 7 ;; "rom select" for function
kthacker6de67752006-04-17 15:02:26 +000085
86
PulkoMandy5523de42014-06-29 20:28:00 +020087;cmd_bios_set_message:
88;.db #0x01+#0x80 ;; this is the "BIOS SET MESSAGE" RSX
kthacker6de67752006-04-17 15:02:26 +000089