1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

add support for XDOS command lines

This commit is contained in:
Christian Groessler 2016-05-24 02:57:21 +02:00
parent 03cb0bd2fd
commit 6d7dfad80b
3 changed files with 29 additions and 16 deletions

View File

@ -997,12 +997,15 @@ diopp_size = 5 ; size of structure
; VALUES for dos_type ; VALUES for dos_type
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
ATARIDOS = 0 SPARTADOS = 0
SPARTADOS = 1 OSADOS = 1 ; OS/A+
OSADOS = 2 ; OS/A+ XDOS = 2
MYDOS = 3 ATARIDOS = 3
XDOS = 4 MYDOS = 4
NODOS = 255 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) ; XDOS defines (version 2.4, taken from xdos24.pdf)

View File

@ -50,4 +50,4 @@ done: rts
.data .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 ; startup code but is nevertheless included in the compiled program when
; needed. ; needed.
; XDOS support added 05/2016 by Christian Groessler
MAXARGS = 16 ; max. amount of arguments in arg. table MAXARGS = 16 ; max. amount of arguments in arg. table
CL_SIZE = 64 ; command line buffer size CL_SIZE = 64 ; command line buffer size
SPACE = 32 ; SPACE char. SPACE = 32 ; SPACE char.
@ -22,22 +24,30 @@ SPACE = 32 ; SPACE char.
.segment "ONCE" .segment "ONCE"
nargdos:rts
initmainargs: initmainargs:
lda __dos_type ; which DOS? lda __dos_type ; which DOS?
cmp #ATARIDOS cmp #MAX_DOS_WITH_CMDLINE + 1
beq nargdos ; DOS does not support arguments bcs nargdos
cmp #MYDOS
bne argdos ; DOS supports arguments
nargdos:rts
; Initialize ourcl buffer ; Initialize ourcl buffer
argdos: lda #ATEOL argdos: ldy #ATEOL
sta ourcl+CL_SIZE 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 clc
adc #<LBUF adc #<LBUF
sta ptr1 sta ptr1
@ -45,7 +55,7 @@ argdos: lda #ATEOL
adc #>LBUF adc #>LBUF
sta ptr1+1 sta ptr1+1
ldy #0 cpcl0: ldy #0
cpcl: lda (ptr1),y cpcl: lda (ptr1),y
sta ourcl,y sta ourcl,y
iny iny