]> git.sur5r.net Git - cc65/blob - libsrc/apple2/get_ostype.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / apple2 / get_ostype.s
1 ;
2 ; Oliver Schmidt, 04.01.2005
3 ;
4 ; unsigned char get_ostype (void)
5 ;
6
7         .constructor    initostype
8         .export         _get_ostype
9
10 ; Identify machine according to:
11 ; Apple II Miscellaneous TechNote #7, Apple II Family Identification
12
13         .segment        "INIT"
14
15 initostype:
16         sec
17         jsr     $FE1F
18         bcs     nogs
19         tya
20         ora     #$80
21 done:   sta     ostype
22         rts
23 nogs:   ldx     #$FF
24 next:   inx
25         lda     value,x
26         ldy     index,x
27         beq     done            ; $00 is no valid index
28         cmp     $FB00,y
29         beq     next
30 :       inx
31         ldy     index,x
32         bne     :-
33         beq     next            ; Branch always
34
35 index:  .byte   $B3, $00                ; Apple ][
36         .byte   $B3, $1E, $00           ; Apple ][+
37         .byte   $B3, $1E, $00           ; Apple /// (emulation)
38         .byte   $B3, $C0, $00           ; Apple //e
39         .byte   $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card
40         .byte   $B3, $C0, $00           ; Apple //e (enhanced)
41         .byte   $B3, $C0, $BF, $00      ; Apple //c
42         .byte   $B3, $C0, $BF, $00      ; Apple //c (3.5 ROM)
43         .byte   $B3, $C0, $BF, $00      ; Apple //c (Mem. Exp.)
44         .byte   $B3, $C0, $BF, $00      ; Apple //c (Rev. Mem. Exp.)
45         .byte   $B3, $C0, $BF, $00      ; Apple //c Plus
46         .byte   $00
47
48 value:  .byte   $38, $10                ; Apple ][
49         .byte   $EA, $AD, $11           ; Apple ][+
50         .byte   $EA, $8A, $20           ; Apple /// (emulation)
51         .byte   $06, $EA, $30           ; Apple //e
52         .byte   $06, $E0, $02, $00, $40 ; Apple //e Option Card
53         .byte   $06, $E0, $31           ; Apple //e (enhanced)
54         .byte   $06, $00, $FF, $50      ; Apple //c
55         .byte   $06, $00, $00, $51      ; Apple //c (3.5 ROM)
56         .byte   $06, $00, $03, $53      ; Apple //c (Mem. Exp.)
57         .byte   $06, $00, $04, $54      ; Apple //c (Rev. Mem. Exp.)
58         .byte   $06, $00, $05, $55      ; Apple //c Plus
59         .byte   $00
60
61         .code
62
63 _get_ostype:
64         lda     ostype
65         ldx     #$00
66         rts
67
68         .bss
69
70 ostype: .res    1