]> git.sur5r.net Git - cc65/blob - libsrc/atari/dosdetect.s
Added SER_ prefix. Whitespace cleanup
[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         cmp     #'R'            ; RealDOS
24         beq     rdos
25
26         lda     #$4C            ; probably default
27         ldy     #COMTAB
28         cmp     (DOSVEC),y
29         bne     done
30         ldy     #ZCRNAME
31         cmp     (DOSVEC),y
32         bne     done
33
34         ldy     #6              ; OS/A+ has a jmp here
35         cmp     (DOSVEC),y
36         beq     done
37         lda     #OSADOS
38         bne     set
39
40 spdos:  lda     DOS+3           ; 'B' in BW-DOS
41         cmp     #'B'
42         bne     spdos_real
43         lda     DOS+4           ; 'W' in BW-DOS
44         cmp     #'W'
45         bne     spdos_real
46
47         lda     #BWDOS
48         .byte   $2C             ; BIT <abs>
49
50 spdos_real:
51         lda     #SPARTADOS
52         .byte   $2C             ; BIT <abs>
53
54 mydos:  lda     #MYDOS
55         .byte   $2C             ; BIT <abs>
56
57 rdos:   lda     #REALDOS
58         .byte   $2C             ; BIT <abs>
59
60 xdos:   lda     #XDOS
61 set:    sta     __dos_type
62 done:   rts
63
64 ; ------------------------------------------------------------------------
65 ; Data
66
67         .data
68
69 __dos_type:     .byte   ATARIDOS; default to ATARIDOS