From 6d7dfad80b8d17f7342cdcc38d90441b5c0b22ff Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 24 May 2016 02:57:21 +0200 Subject: [PATCH] add support for XDOS command lines --- asminc/atari.inc | 13 ++++++++----- libsrc/atari/dosdetect.s | 2 +- libsrc/atari/getargs.s | 30 ++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/asminc/atari.inc b/asminc/atari.inc index e6d165524..183564f1f 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -997,12 +997,15 @@ diopp_size = 5 ; size of structure ; VALUES for dos_type ;------------------------------------------------------------------------- -ATARIDOS = 0 -SPARTADOS = 1 -OSADOS = 2 ; OS/A+ -MYDOS = 3 -XDOS = 4 +SPARTADOS = 0 +OSADOS = 1 ; OS/A+ +XDOS = 2 +ATARIDOS = 3 +MYDOS = 4 NODOS = 255 +; The DOSes with dos_type below or equal MAX_DOS_WITH_CMDLINE do support +; command line arguments. +MAX_DOS_WITH_CMDLINE = XDOS ;------------------------------------------------------------------------- ; XDOS defines (version 2.4, taken from xdos24.pdf) diff --git a/libsrc/atari/dosdetect.s b/libsrc/atari/dosdetect.s index c2888d888..68f4aefb2 100644 --- a/libsrc/atari/dosdetect.s +++ b/libsrc/atari/dosdetect.s @@ -50,4 +50,4 @@ done: rts .data -__dos_type: .byte 0 ; default to ATARIDOS +__dos_type: .byte ATARIDOS; default to ATARIDOS diff --git a/libsrc/atari/getargs.s b/libsrc/atari/getargs.s index e3b18b2f9..b1b5d258d 100644 --- a/libsrc/atari/getargs.s +++ b/libsrc/atari/getargs.s @@ -7,6 +7,8 @@ ; startup code but is nevertheless included in the compiled program when ; needed. +; XDOS support added 05/2016 by Christian Groessler + MAXARGS = 16 ; max. amount of arguments in arg. table CL_SIZE = 64 ; command line buffer size SPACE = 32 ; SPACE char. @@ -22,22 +24,30 @@ SPACE = 32 ; SPACE char. .segment "ONCE" +nargdos:rts + initmainargs: lda __dos_type ; which DOS? - cmp #ATARIDOS - beq nargdos ; DOS does not support arguments - cmp #MYDOS - bne argdos ; DOS supports arguments -nargdos:rts + cmp #MAX_DOS_WITH_CMDLINE + 1 + bcs nargdos ; Initialize ourcl buffer -argdos: lda #ATEOL - sta ourcl+CL_SIZE +argdos: ldy #ATEOL + sty ourcl+CL_SIZE -; Move SpartaDOS command line to our own buffer +; Move SpartaDOS/XDOS command line to our own buffer + + cmp #XDOS + bne sparta + + lda #XLINE + sta ptr1+1 + bne cpcl0 - lda DOSVEC +sparta: lda DOSVEC clc adc #LBUF sta ptr1+1 - ldy #0 +cpcl0: ldy #0 cpcl: lda (ptr1),y sta ourcl,y iny -- 2.39.5