2 ; Freddy Offenga & Christian Groessler, December 2004
4 ; function to get default device: char *_getdefdev(void);
7 ; the ZCRNAME routine is only used to get the default drive because
8 ; ZCRNAME has two disadvantages:
9 ; 1. It will convert D: into D1: instead of Dn: (n = default drive)
10 ; 2. It will give a 'no arguments' status if it detects something
11 ; like Dn: (without filename).
14 ; ZCRNAME is slightly different from SpartaDOS. It will convert D:
15 ; into Dn: where n is the default drive.
19 .export __getdefdev ; get default device
20 .export __defdev ; this is the default device string (e.g. "D1:")
22 .constructor __getdefdev, 24
25 ; Get default device (LBUF will be destroyed!!)
29 lda __dos_type ; which DOS?
31 bcs finish ; only supported on OS/A+ and SpartaDOS
32 ; (TODO: add XDOS support)
36 sta (DOSVEC),y ; reset buffer offset
38 ; Store dummy argument
47 ; One extra store to avoid the buggy sequence from OS/A+ DOS:
48 ; <D><RETURN><:> => drive number = <RETURN>
53 ; Create crunch vector
62 crvec: jsr $FFFF ; will be set to crunch vector
66 ldy #COMFNAM ; COMFNAM is always "Dn:"
73 ; Return pointer to default device
75 finish: lda #<__defdev
85 .byte 'D', '0'+DEFAULT_DEVICE, ':', 0