blob: e1f5ee9c4c66ce0013d0cfa9afa40ea49f10d878 [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
PulkoMandy5523de42014-06-29 20:28:00 +020031;ld hl,#cmd_bios_set_message
32;call kl_find_command
33;ret nc
kthacker6de67752006-04-17 15:02:26 +000034
35;; command found
36
37;; store address of command
PulkoMandy5523de42014-06-29 20:28:00 +020038;ld (bios_set_message),hl
39;ld a,c
kthacker6de67752006-04-17 15:02:26 +000040;; store "rom select" of command
PulkoMandy5523de42014-06-29 20:28:00 +020041;ld (bios_set_message+2),a
kthacker6de67752006-04-17 15:02:26 +000042
43;;------------------------------------------------------------------
44
45;; do CAT
46ld hl,#2
47add hl,sp
48ld e,(hl)
49inc hl
50ld d,(hl)
kthacker6de67752006-04-17 15:02:26 +000051
52;;------------------------------------------------------------------
53;; display files from data generated by CAS CATALOG function
54
55;; perform a CAT command
56
kthacker6de67752006-04-17 15:02:26 +000057;; disable disc messages. Error messages will not be displayed.
58ld a,#0xff
59rst 0x018 ;; KL FAR CALL
60.dw bios_set_message
61
62;; disable text output
63call txt_vdu_disable
64
kthacker6de67752006-04-17 15:02:26 +000065xor a
66ld (de),a
67
68;; do catalog
69call cas_catalog
70
71;; enable text output
72call txt_vdu_enable
73
74;; enable disc messages. Error messages will be displayed
PulkoMandy5523de42014-06-29 20:28:00 +020075xor a
kthacker6de67752006-04-17 15:02:26 +000076rst 0x018 ;; KL FAR CALL
77.dw bios_set_message
78ret
79
80
81;;------------------------------------------------------------------
82
83;; this is initialised when the "BIOS SET MESSAGE" RSX has been found.
84bios_set_message:
PulkoMandy5523de42014-06-29 20:28:00 +020085.dw 0xc033 ;; address of function
86.db 7 ;; "rom select" for function
kthacker6de67752006-04-17 15:02:26 +000087
88
PulkoMandy5523de42014-06-29 20:28:00 +020089;cmd_bios_set_message:
90;.db #0x01+#0x80 ;; this is the "BIOS SET MESSAGE" RSX
kthacker6de67752006-04-17 15:02:26 +000091