From 6dc7309e50c59ca114dfb6500ca786c2a84d13e9 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 27 Sep 2018 17:37:59 +0200 Subject: [PATCH] Atari: add support for BW-DOS. Initially contributed by Daniel Serpell. --- asminc/atari.inc | 9 +++++---- include/atari.h | 11 ++++++----- libsrc/atari/dosdetect.s | 15 +++++++++++++-- libsrc/atari/lseek.s | 2 ++ libsrc/atari/syschdir.s | 2 ++ libsrc/atari/system_check.s | 11 ++++++++++- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/asminc/atari.inc b/asminc/atari.inc index 4e2958fbc..98c721296 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -1033,10 +1033,11 @@ diopp_size = 5 ; size of structure SPARTADOS = 0 REALDOS = 1 -OSADOS = 2 ; OS/A+ -XDOS = 3 -ATARIDOS = 4 -MYDOS = 5 +BWDOS = 2 +OSADOS = 3 ; OS/A+ +XDOS = 4 +ATARIDOS = 5 +MYDOS = 6 NODOS = 255 ; The DOSes with dos_type below or equal MAX_DOS_WITH_CMDLINE do support ; command line arguments. diff --git a/include/atari.h b/include/atari.h index d9463904c..ca6bd424c 100644 --- a/include/atari.h +++ b/include/atari.h @@ -261,11 +261,12 @@ extern void atrx15p2_tgi[]; /* valid _dos_type values */ #define SPARTADOS 0 -#define OSADOS 1 -#define XDOS 2 -#define REALDOS 3 -#define ATARIDOS 4 -#define MYDOS 5 +#define REALDOS 1 +#define BWDOS 2 +#define OSADOS 3 +#define XDOS 4 +#define ATARIDOS 5 +#define MYDOS 6 #define NODOS 255 /* Define hardware */ diff --git a/libsrc/atari/dosdetect.s b/libsrc/atari/dosdetect.s index 7e6088d97..1dd6a87f5 100644 --- a/libsrc/atari/dosdetect.s +++ b/libsrc/atari/dosdetect.s @@ -35,9 +35,20 @@ detect: lda DOS 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 -spdos: lda #SPARTADOS +spdos_real: + lda #SPARTADOS .byte $2C ; BIT mydos: lda #MYDOS @@ -47,7 +58,7 @@ rdos: lda #REALDOS .byte $2C ; BIT xdos: lda #XDOS - sta __dos_type +set: sta __dos_type done: rts ; ------------------------------------------------------------------------ diff --git a/libsrc/atari/lseek.s b/libsrc/atari/lseek.s index 462f2f90b..b6a766361 100644 --- a/libsrc/atari/lseek.s +++ b/libsrc/atari/lseek.s @@ -195,6 +195,8 @@ chk_supp: lda __dos_type cmp #SPARTADOS beq :+ + cmp #BWDOS + beq :+ cmp #REALDOS bne ns1 : txa diff --git a/libsrc/atari/syschdir.s b/libsrc/atari/syschdir.s index 9e4c33a19..f493fea54 100644 --- a/libsrc/atari/syschdir.s +++ b/libsrc/atari/syschdir.s @@ -67,6 +67,8 @@ ucok1: beq :+ cmp #REALDOS beq :+ + cmp #BWDOS + beq :+ lda #CHDIR_MYDOS .byte $2C ; BIT : lda #CHDIR_SPDOS diff --git a/libsrc/atari/system_check.s b/libsrc/atari/system_check.s index ec0d60513..19efaf2e2 100644 --- a/libsrc/atari/system_check.s +++ b/libsrc/atari/system_check.s @@ -77,7 +77,16 @@ cont: ldx #0 ; channel 0 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 -- 2.39.5