From: cpg Date: Tue, 12 Aug 2003 19:56:55 +0000 (+0000) Subject: moved into its own module from getargs.s X-Git-Tag: V2.12.0~1430 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=645413f4311c00a146aa43bb6adef4be3a761414;p=cc65 moved into its own module from getargs.s git-svn-id: svn://svn.cc65.org/cc65/trunk@2296 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atari/dosdetect.s b/libsrc/atari/dosdetect.s new file mode 100644 index 000000000..d7c455f98 --- /dev/null +++ b/libsrc/atari/dosdetect.s @@ -0,0 +1,43 @@ +; +; Freddy Offenga & Christian Groessler, August 2003 +; +; detect the DOS version we're running on +; + + .include "atari.inc" + .constructor detect,26 + .export __dos_type + +; DOS type detection + +detect: lda #ATARIDOS + sta __dos_type ; set default + + lda DOS + cmp #$53 ; "S" (SpartaDOS) + beq spdos + + ldy #COMTAB + lda #$4C + cmp (DOSVEC),y + bne done + + ldy #ZCRNAME + cmp (DOSVEC),y + bne done + + ldy #6 ; OS/A+ has a jmp here + cmp (DOSVEC),y + beq done + lda #OSADOS + sta __dos_type + bne done + +spdos: lda #SPARTADOS + sta __dos_type +done: rts + + .bss + +__dos_type: .res 1 + diff --git a/libsrc/atari/getdefdev.s b/libsrc/atari/getdefdev.s new file mode 100644 index 000000000..249aeda60 --- /dev/null +++ b/libsrc/atari/getdefdev.s @@ -0,0 +1,80 @@ +; +; Freddy Offenga & Christian Groessler, August 2003 +; +; function to get default device: char *getdefdev(void); +; +; 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 + .export _getdefdev ; get default device (e.g. "D1:") + +; Get default device (LBUF will be destroyed!!) + +_getdefdev: + + lda __dos_type ; which DOS? + cmp #ATARIDOS + beq finish + + 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: +; <:> => drive number = + + 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 + +; return ointer to default device + +finish: lda #defdev + rts + + .data + +; Default device + +defdev: + .byte "D1:", 0 +