]> git.sur5r.net Git - cc65/blob - libsrc/atari/dosdetect.s
Merge pull request #305 from silverdr/target_goodies
[cc65] / libsrc / atari / dosdetect.s
1 ;
2 ; Freddy Offenga, Stefan Haubenthal, Christian Groessler, March 2007
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 ; ------------------------------------------------------------------------
12 ; DOS type detection
13
14 .segment        "ONCE"
15
16 detect: lda     DOS
17         cmp     #'S'            ; SpartaDOS
18         beq     spdos
19         cmp     #'M'            ; MyDOS
20         beq     mydos
21         cmp     #'X'            ; XDOS
22         beq     xdos
23
24         lda     #$4C            ; probably default
25         ldy     #COMTAB
26         cmp     (DOSVEC),y
27         bne     done
28         ldy     #ZCRNAME
29         cmp     (DOSVEC),y
30         bne     done
31
32         ldy     #6              ; OS/A+ has a jmp here
33         cmp     (DOSVEC),y
34         beq     done
35         lda     #OSADOS
36         .byte   $2C             ; BIT <abs>
37
38 spdos:  lda     #SPARTADOS
39         .byte   $2C             ; BIT <abs>
40
41 mydos:  lda     #MYDOS
42         .byte   $2C             ; BIT <abs>
43
44 xdos:   lda     #XDOS
45         sta     __dos_type
46 done:   rts
47
48 ; ------------------------------------------------------------------------
49 ; Data
50
51         .data
52
53 __dos_type:     .byte   ATARIDOS; default to ATARIDOS