]> git.sur5r.net Git - cc65/blob - libsrc/atari/dosdetect.s
a9014fe93ab541c0612a954a1495fe9f65116524
[cc65] / libsrc / atari / dosdetect.s
1 ;
2 ; Freddy Offenga & Christian Groessler, June 2004
3 ;
4 ; detect the DOS version we're running on
5 ;
6
7         .include        "atari.inc"
8         .constructor    detect,26
9         .export         __dos_type
10
11 ; DOS type detection
12
13 detect: lda     #ATARIDOS
14         sta     __dos_type      ; set default
15
16         lda     DOS
17         cmp     #'S'            ; SpartaDOS
18         beq     spdos
19         cmp     #'M'            ; MyDOS
20         beq     mydos
21
22         ldy     #COMTAB
23         lda     #$4C
24         cmp     (DOSVEC),y
25         bne     done
26
27         ldy     #ZCRNAME
28         cmp     (DOSVEC),y
29         bne     done
30
31         ldy     #6              ; OS/A+ has a jmp here
32         cmp     (DOSVEC),y
33         beq     done
34         lda     #OSADOS
35         sta     __dos_type
36         rts
37
38 spdos:  lda     #SPARTADOS
39         sta     __dos_type
40 done:   rts
41
42 mydos:  lda     #MYDOS
43         sta     __dos_type
44         rts
45
46         .bss
47
48 __dos_type:     .res    1
49