1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

Merge pull request #295 from groessler/something_to_pull

Atari: add command line support for XDOS
This commit is contained in:
Oliver Schmidt 2016-05-24 16:18:36 +02:00
commit a76153cb9f
4 changed files with 53 additions and 25 deletions

View File

@ -997,12 +997,30 @@ 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)
;-------------------------------------------------------------------------
XOPT = $070B ; XDOS options
XCAR = $070C ; XDOS cartridge address (+ $70D)
XPAT = $086F ; XDOS bugfix and patch number
XVER = $0870 ; XDOS version number
XFILE = $087D ; XDOS filename buffer
XLINE = $0880 ; XDOS DUP input line
XGLIN = $0871 ; get line
XSKIP = $0874 ; skip parameter
XMOVE = $0877 ; move filename
XGNUM = $087A ; get number
;-------------------------------------------------------------------------
; End of atari.inc

View File

@ -261,11 +261,11 @@ extern void atrx15p2_tgi[];
#define AT_PAL 1
/* valid _dos_type values */
#define ATARIDOS 0
#define SPARTADOS 1
#define OSADOS 2
#define MYDOS 3
#define XDOS 4
#define SPARTADOS 0
#define OSADOS 1
#define XDOS 2
#define ATARIDOS 3
#define MYDOS 4
#define NODOS 255
/* Define hardware */

View File

@ -50,4 +50,4 @@ done: rts
.data
__dos_type: .byte 0 ; default to ATARIDOS
__dos_type: .byte ATARIDOS; default to ATARIDOS

View File

@ -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
lda DOSVEC
cmp #XDOS
bne sparta
lda #<XLINE
sta ptr1
lda #>XLINE
sta ptr1+1
bne cpcl0
sparta: lda DOSVEC
clc
adc #<LBUF
sta ptr1
@ -45,7 +55,7 @@ argdos: lda #ATEOL
adc #>LBUF
sta ptr1+1
ldy #0
cpcl0: ldy #0
cpcl: lda (ptr1),y
sta ourcl,y
iny