Atari: Make a good "default device" on AtariDOS (2.0 and 2.5) and MyDOS.

The default device will be the one the program was loaded from instead of
always D1:.
This commit is contained in:
Christian Groessler 2018-09-13 22:33:54 +02:00
parent 08d164a811
commit 4691974466
2 changed files with 21 additions and 6 deletions

View File

@ -1003,15 +1003,15 @@ diopp_size = 5 ; size of structure
;-------------------------------------------------------------------------
SPARTADOS = 0
OSADOS = 1 ; OS/A+
XDOS = 2
REALDOS = 3
REALDOS = 1
OSADOS = 2 ; OS/A+
XDOS = 3
ATARIDOS = 4
MYDOS = 5
NODOS = 255
; The DOSes with dos_type below or equal MAX_DOS_WITH_CMDLINE do support
; command line arguments.
MAX_DOS_WITH_CMDLINE = REALDOS
MAX_DOS_WITH_CMDLINE = XDOS
;-------------------------------------------------------------------------
; XDOS defines (version 2.4, taken from xdos24.pdf)

View File

@ -3,7 +3,11 @@
;
; function to get default device: char *_getdefdev(void);
;
; SpartaDOS:
; AtariDOS/MyDOS:
; Default device number is derived from DUNIT. Therefore "default
; device" is the one the program was loaded from.
;
; SpartaDOS/RealDOS:
; the ZCRNAME routine is only used to get the default drive because
; ZCRNAME has two disadvantages:
; 1. It will convert D: into D1: instead of Dn: (n = default drive)
@ -30,7 +34,7 @@ __getdefdev:
cmp #XDOS
beq xdos ; only supported on XDOS ...
; cmp #OSADOS+1 ; (redundant: #OSADOS+1 = #XDOS)
bcs finish ; ... and on OS/A+ and SpartaDOS
bcs use_DUNIT ; ... and on OS/A+ and SpartaDOS
ldy #BUFOFF
lda #0
@ -77,6 +81,17 @@ finish: lda #<__defdev
ldx #>__defdev
rts
; On AtariDOS or MyDOS, use the DUNIT variable to setuo the default
; device. The default device will then be the one the program was
; loaded from.
use_DUNIT:
lda DUNIT
clc
adc #'0'
sta __defdev + 1
bne finish ; jump always
; XDOS default device retrieval
xdos: