kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 1 | ;; 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 |
| 14 | cas_catalog == 0xbc9b |
| 15 | ;; firmware function to disable text output |
| 16 | txt_vdu_enable == 0xbb54 |
| 17 | ;; firmware function to enable text output |
| 18 | txt_vdu_disable == 0xbb57 |
| 19 | ;; firmware function to find a RSX |
| 20 | kl_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 | |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 31 | ;ld hl,#cmd_bios_set_message |
| 32 | ;call kl_find_command |
| 33 | ;ret nc |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 34 | |
| 35 | ;; command found |
| 36 | |
| 37 | ;; store address of command |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 38 | ;ld (bios_set_message),hl |
| 39 | ;ld a,c |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 40 | ;; store "rom select" of command |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 41 | ;ld (bios_set_message+2),a |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 42 | |
| 43 | ;;------------------------------------------------------------------ |
| 44 | |
| 45 | ;; do CAT |
| 46 | ld hl,#2 |
| 47 | add hl,sp |
| 48 | ld e,(hl) |
| 49 | inc hl |
| 50 | ld d,(hl) |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 51 | |
| 52 | ;;------------------------------------------------------------------ |
| 53 | ;; display files from data generated by CAS CATALOG function |
| 54 | |
| 55 | ;; perform a CAT command |
| 56 | |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 57 | ;; disable disc messages. Error messages will not be displayed. |
| 58 | ld a,#0xff |
| 59 | rst 0x018 ;; KL FAR CALL |
| 60 | .dw bios_set_message |
| 61 | |
| 62 | ;; disable text output |
| 63 | call txt_vdu_disable |
| 64 | |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 65 | xor a |
| 66 | ld (de),a |
| 67 | |
| 68 | ;; do catalog |
| 69 | call cas_catalog |
| 70 | |
| 71 | ;; enable text output |
| 72 | call txt_vdu_enable |
| 73 | |
| 74 | ;; enable disc messages. Error messages will be displayed |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 75 | xor a |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 76 | rst 0x018 ;; KL FAR CALL |
| 77 | .dw bios_set_message |
| 78 | ret |
| 79 | |
| 80 | |
| 81 | ;;------------------------------------------------------------------ |
| 82 | |
| 83 | ;; this is initialised when the "BIOS SET MESSAGE" RSX has been found. |
| 84 | bios_set_message: |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 85 | .dw 0xc033 ;; address of function |
| 86 | .db 7 ;; "rom select" for function |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 87 | |
| 88 | |
PulkoMandy | 5523de4 | 2014-06-29 20:28:00 +0200 | [diff] [blame^] | 89 | ;cmd_bios_set_message: |
| 90 | ;.db #0x01+#0x80 ;; this is the "BIOS SET MESSAGE" RSX |
kthacker | 6de6775 | 2006-04-17 15:02:26 +0000 | [diff] [blame] | 91 | |