Programowanie: Jak stwierdzić obecność SpartaDOS X oraz jego konfigurację pamięci

From Atariki

Revision as of 06:20, 29 wrz 2006; view current revision
←Older revision | Newer revision→
Jump to: navigation, search
; sparta_detect.asm
; (c) idea by KMK, code: mikey
;
; $Id: sparta_detect.asm,v 1.2 2006/09/27 22:59:27 mikey Exp $
; 

p0                  equ $f0
                   
sparta_detect   equ *

; if peek($700) = 'S' and bit($701) sets V then we're SDX

                lda $700
                cmp #$53         ; 'S'
                bne no_sparta
                bit $701
                bvc no_sparta

; we're running SDX, find  (DOSVEC)-$150 


                lda $a
                sta p0
                lda $b
                sta p0+1

                sec
                lda p0
                sbc <$150
                sta p0
                bcs _nxt    
                dec p0+1
_nxt          dec p0+1              ; dirty hack, MSB of $150 is always 1 so we do a dec instead of sub

; ok, hopefully we have established the address. 
; now peek at it. return the value. 

                ldy #0
                lda (p0),y
                rts
no_sparta  lda #$ff 
                rts

; if A=$FF -> No SDX :(
; if A=$FE -> SDX is in OSROM mode
; if A=$00 -> SDX doesn't use any XMS banks
; if A=anything else -> BANKED mode, and A is the bank number 

Personal tools