2003-08-12 19:56:55 +00:00
|
|
|
;
|
2004-06-03 19:43:11 +00:00
|
|
|
; Freddy Offenga & Christian Groessler, June 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.
|
|
|
|
|
|
|
|
.include "atari.inc"
|
|
|
|
.import __dos_type
|
2004-06-03 19:43:11 +00:00
|
|
|
.export __getdefdev ; get default device (e.g. "D1:")
|
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
|
|
|
|
|
|
|
lda __dos_type ; which DOS?
|
|
|
|
cmp #ATARIDOS
|
|
|
|
beq finish
|
2004-03-16 22:48:20 +00:00
|
|
|
cmp #MYDOS
|
|
|
|
beq finish
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
ldy #BUFOFF
|
|
|
|
lda #0
|
|
|
|
sta (DOSVEC),y ; reset buffer offset
|
|
|
|
|
|
|
|
; Store dummy argument
|
|
|
|
|
|
|
|
ldy #LBUF
|
|
|
|
lda #'X'
|
|
|
|
sta (DOSVEC),y
|
|
|
|
iny
|
|
|
|
lda #ATEOL
|
|
|
|
sta (DOSVEC),y
|
|
|
|
|
|
|
|
; One extra store to avoid the buggy sequence from OS/A+ DOS:
|
|
|
|
; <D><RETURN><:> => drive number = <RETURN>
|
|
|
|
|
|
|
|
iny
|
|
|
|
sta (DOSVEC),y
|
|
|
|
|
|
|
|
; Create crunch vector
|
|
|
|
|
|
|
|
ldy #ZCRNAME+1
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta crvec+1
|
|
|
|
iny
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta crvec+2
|
|
|
|
|
|
|
|
crvec: jsr $FFFF ; will be set to crunch vector
|
|
|
|
|
|
|
|
; Get default device
|
|
|
|
|
|
|
|
ldy #COMFNAM ; COMFNAM is always "Dn:"
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta defdev
|
|
|
|
iny
|
|
|
|
lda (DOSVEC),y
|
|
|
|
sta defdev+1
|
|
|
|
|
2004-09-15 19:33:52 +00:00
|
|
|
; Return pointer to default device
|
2003-08-12 19:56:55 +00:00
|
|
|
|
|
|
|
finish: lda #<defdev
|
|
|
|
ldx #>defdev
|
|
|
|
rts
|
|
|
|
|
|
|
|
.data
|
|
|
|
|
|
|
|
; Default device
|
|
|
|
|
|
|
|
defdev:
|
|
|
|
.byte "D1:", 0
|
|
|
|
|