2003-08-12 19:56:55 +00:00
|
|
|
;
|
2004-12-16 22:46:28 +00:00
|
|
|
; Freddy Offenga & Christian Groessler, December 2004
|
2003-08-12 19:56:55 +00:00
|
|
|
;
|
2004-06-03 19:43:11 +00:00
|
|
|
; function to get default device: char *_getdefdev(void);
|
2003-08-12 19:56:55 +00:00
|
|
|
;
|
|
|
|
; SpartaDOS:
|
|
|
|
; the ZCRNAME routine is only used to get the default drive because
|
|
|
|
; ZCRNAME has two disadvantages:
|
|
|
|
; 1. It will convert D: into D1: instead of Dn: (n = default drive)
|
|
|
|
; 2. It will give a 'no arguments' status if it detects something
|
|
|
|
; like Dn: (without filename).
|
|
|
|
;
|
|
|
|
; OS/A+ DOS:
|
|
|
|
; ZCRNAME is slightly different from SpartaDOS. It will convert D:
|
|
|
|
; into Dn: where n is the default drive.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
.import __dos_type
|
|
|
|
.export __getdefdev ; get default device
|
|
|
|
.export __defdev ; this is the default device string (e.g. "D1:")
|
|
|
|
.ifdef DYNAMIC_DD
|
2015-10-09 20:18:51 +00:00
|
|
|
.constructor __getdefdev, 24
|
2004-12-16 22:46:28 +00:00
|
|
|
.endif
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
; Get default device (LBUF will be destroyed!!)
|
|
|
|
|
2004-06-03 19:43:11 +00:00
|
|
|
__getdefdev:
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda __dos_type ; which DOS?
|
2016-05-31 05:37:58 +00:00
|
|
|
cmp #XDOS
|
|
|
|
beq xdos ; only supported on XDOS ...
|
|
|
|
; cmp #OSADOS+1 ; (redundant: #OSADOS+1 = #XDOS)
|
|
|
|
bcs finish ; ... and on OS/A+ and SpartaDOS
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #BUFOFF
|
|
|
|
lda #0
|
|
|
|
sta (DOSVEC),y ; reset buffer offset
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
; Store dummy argument
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #LBUF
|
|
|
|
lda #'X'
|
|
|
|
sta (DOSVEC),y
|
|
|
|
iny
|
|
|
|
lda #ATEOL
|
|
|
|
sta (DOSVEC),y
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
; One extra store to avoid the buggy sequence from OS/A+ DOS:
|
|
|
|
; <D><RETURN><:> => drive number = <RETURN>
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
iny
|
|
|
|
sta (DOSVEC),y
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
; Create crunch vector
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #ZCRNAME+1
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta crvec+1
|
|
|
|
iny
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta crvec+2
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2016-05-31 07:28:53 +00:00
|
|
|
jsr crvec
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
; Get default device
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #COMFNAM ; COMFNAM is always "Dn:"
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta __defdev
|
|
|
|
iny
|
|
|
|
lda (DOSVEC),y
|
2016-05-31 05:37:58 +00:00
|
|
|
done: sta __defdev+1
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2004-09-15 19:33:52 +00:00
|
|
|
; Return pointer to default device
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
finish: lda #<__defdev
|
|
|
|
ldx #>__defdev
|
|
|
|
rts
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2016-05-31 05:37:58 +00:00
|
|
|
; XDOS version
|
|
|
|
|
|
|
|
xdos: lda XDEFDEV
|
|
|
|
bne done
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.data
|
2003-08-12 19:56:55 +00:00
|
|
|
|
2016-05-31 10:24:21 +00:00
|
|
|
crvec: jmp $FFFF ; target address will be set to crunch vector
|
2016-05-31 07:28:53 +00:00
|
|
|
|
2003-08-12 19:56:55 +00:00
|
|
|
; Default device
|
|
|
|
|
2004-12-16 22:46:28 +00:00
|
|
|
__defdev:
|
2013-05-09 11:56:54 +00:00
|
|
|
.ifdef DEFAULT_DEVICE
|
|
|
|
.byte 'D', '0'+DEFAULT_DEVICE, ':', 0
|
2009-12-07 18:58:32 +00:00
|
|
|
.else
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte "D1:", 0
|
2009-12-07 18:58:32 +00:00
|
|
|
.endif
|
2003-08-12 19:56:55 +00:00
|
|
|
|