2003-08-12 17:48:31 +00:00
|
|
|
;
|
|
|
|
; Stefan Haubenthal, Jul 12 2003
|
|
|
|
;
|
|
|
|
; unsigned char get_ostype(void)
|
|
|
|
;
|
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
.constructor initostype
|
|
|
|
.export _get_ostype, ostype
|
|
|
|
|
|
|
|
; Identify machine according to:
|
|
|
|
; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
|
|
|
|
|
|
|
|
initostype:
|
|
|
|
ldx #$01 ; Start out with a plain Apple ][
|
|
|
|
lda $FBB3
|
|
|
|
cmp #$38
|
|
|
|
beq identified
|
|
|
|
inx ; It's at least an Apple ][+
|
|
|
|
cmp #$EA
|
|
|
|
bne apple2e
|
|
|
|
lda $FB1E
|
|
|
|
cmp #$AD
|
|
|
|
beq identified
|
|
|
|
inx ; It's an Apple /// in emulation mode
|
|
|
|
bne identified ; Branch always
|
|
|
|
apple2e:
|
|
|
|
ldx #$04 ; It's at least an Apple //e
|
|
|
|
lda $FBC0
|
|
|
|
cmp #$EA
|
|
|
|
beq identified
|
|
|
|
inx ; It's at least an enhanced Apple //e
|
|
|
|
cmp #$E0
|
|
|
|
bne apple2c
|
|
|
|
lda $FBDD
|
|
|
|
cmp #$02
|
|
|
|
bne identified
|
|
|
|
inx ; It's an Apple //e Option Card
|
|
|
|
bne identified ; Branch always
|
|
|
|
apple2c:
|
|
|
|
ldx #$07 ; It's an Apple //c
|
|
|
|
identified:
|
|
|
|
stx ostype
|
|
|
|
rts
|
2003-08-12 17:48:31 +00:00
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
_get_ostype:
|
|
|
|
lda ostype
|
|
|
|
ldx #$00
|
|
|
|
rts
|
2003-08-12 17:48:31 +00:00
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
.bss
|
2003-08-12 17:48:31 +00:00
|
|
|
|
2004-03-11 21:54:22 +00:00
|
|
|
ostype: .res 1
|