From: Christian Groessler Date: Thu, 13 Sep 2018 20:33:54 +0000 (+0200) Subject: Atari: Make a good "default device" on AtariDOS (2.0 and 2.5) and MyDOS. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4691974466ff8e28dc635b0d13b089a54fbfe6b4;p=cc65 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:. --- diff --git a/asminc/atari.inc b/asminc/atari.inc index 7b16b528f..6b8c0dc30 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -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) diff --git a/libsrc/atari/getdefdev.s b/libsrc/atari/getdefdev.s index 480639b4a..cad768783 100644 --- a/libsrc/atari/getdefdev.s +++ b/libsrc/atari/getdefdev.s @@ -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: