cmp (DOSVEC),y
beq done
lda #OSADOS
+ bne set
+
+spdos: lda DOS+3 ; 'B' in BW-DOS
+ cmp #'B'
+ bne spdos_real
+ lda DOS+4 ; 'W' in BW-DOS
+ cmp #'W'
+ bne spdos_real
+
+ lda #BWDOS
.byte $2C ; BIT <abs>
-spdos: lda #SPARTADOS
+spdos_real:
+ lda #SPARTADOS
.byte $2C ; BIT <abs>
mydos: lda #MYDOS
.byte $2C ; BIT <abs>
xdos: lda #XDOS
- sta __dos_type
+set: sta __dos_type
done: rts
; ------------------------------------------------------------------------
sdcheck:lda DOS
cmp #'S'
bne sdcrts0 ; not SpartaDOS, assume RAM is not used
- lda DOS+1 ; SD version
+
+; check for BW-DOS, which always reports itself as SpartaDOS, but doesn't use memory under the ROM
+ lda DOS+3 ; 'B' in BW-DOS
+ cmp #'B'
+ bne sdnobw
+ lda DOS+4 ; 'W' in BW-DOS
+ cmp #'W'
+ beq sdcrts0 ; BW-DOS does not use RAM below ROM
+
+sdnobw: lda DOS+1 ; SD version
cmp #$40 ; SD-X has $40 or higher
bcc sdcrts1 ; older versions (except maybe 1.x) always use the RAM under the ROM
ldy #31 ; offset for OSRMFLG