SpartaDOS X Reference Manual

Programming with SpartaDOS X




SpartaDOS User Accessible Data Table

Index


Several SpartaDOS variables have been made available to programmers to allow easy access to the command line for applications and utilities. This data table is referred to as COMTAB and is pointed to by the OS variable DOSVEC at memory location 10 ($0A). An assembly language example will follow as an aid. This table is valid with all versions of SpartaDOS except where noted. Locations COMTAB, ZCRNAME, BUFOFF, COMFNAM, and LBUF are also supported by OS/A+ and DOS XL.
 

DECOUT COMTAB-19
SpartaDOS X only. Contains the right justified, space padded output of the "misc_convdc" routine, an ASCII string representation of the three byte number at DIVEND (see Page Seven "Kernel" Values). (8 bytes)
 
LSIO COMTAB-10
This is a pointer to the SpartaDOS high speed SIO routine. You can use the address contained here instead of $E459, the OS SIOV, to perform high speed sector I/O with your programs.
 
DIVEND COMTAB-6
SpartaDOS X only. A three byte number here will be converted by the "misc_convdc" routine to a string at DECOUT (see Page Seven "Kernel" Values).
 
WRTCMD COMTAB-2
This location contains the SIO write command. A 'W' here indicates write with verify, while a 'P' indicates write without verify.
 
COMTAB COMTAB+0
This is a 6502 jump instruction followed by the address of the DOS entry routine. A jump here enters DOS.
 
ZCRNAME COMTAB+3
This is a 6502 jump instruction followed by the address of the file name crunch routine. This location is used to interpret the command line. A jump here will pull the next command from LBUF, translate the drive or device identifier if one is given (i.e., A: to D1:), add the default drive identifier if none is given, and place the result at COMFNAM. Each call will advance BUFOFF to point to the next entry on the command line, so that each call to the crunch routine will get the next entry on the line. If there are no entries remaining, the 6502 zero flag will be SET on return. Since the 6502 has no indirect jsr, it is necessary to use a few lines of code to access this routine. An example will follow this list.
 
BUFOFF COMTAB+10
The offset into LBUF where the next parameter to be read is located. This can be manipulated to reread the command line.
 
DATER COMTAB+13
The date in DD/MM/YY format (3 bytes). Updated by VGETTD. Updated continuously while the Time/Date line is on with SpartaDOS X.
 
TIMER COMTAB+16
The time in HH/MM/SS format (3 bytes). Updated by VGETTD. Updated continuously while the Time/Date line is on.
 
_800FLG COMTAB+27
SpartaDOS X only. $FF if the computer is an Atari 800. Zero otherwise.
 
NBANKS COMTAB+29
SpartaDOS X only. The number of expansion memory banks free. This is the same number shown with the MEM command.
 
BANKFLG COMTAB+30
SpartaDOS X only. $FF if USEing BANKED. Zero otherwise.
 
OSRMFLG COMTAB+31
SpartaDOS X only. $FF if USEing OSRAM. Zero otherwise.
Note: USE NONE is indicated by both BANKFLG and OSRMFLG being zero.
 
COMFNAM COMTAB+33
This is the destination buffer for the ZCRNAME routine. It will ALWAYS begin with a Dd: since the default drive is added if none is given. If you are looking for switches or other options, start looking at COMFNAM+3. This buffer is 28 bytes long.
 
LBUF COMTAB+63
This is the input buffer for the command processor. The entire command line is stored here. LBUF is 64 bytes long.
 
COPYBUF COMTAB+127
This is the main buffer used by the SpartaDOS X "kernel".
 
An Example The following assembly language program demonstrates one way to read the SpartaDOS command line. It simply echoes the command line with the drive specifications added or translated as necessary. It resets BUFOFF to 0 so that the name of the command is printed, too.

; CIO and IOCB equates
ciov .equ $E456
iccom .equ $0342
icbal .equ $0344
icbah .equ $0345
icbll .equ $0348
icblh .equ $0349
write .equ $09
; SpartaDOS equates
comtab .equ 10
zcrname .equ 3
bufoff .equ 10
comfnam .equ 33
; The program.
        *=$4000         ; or wherever.
init                    ; patches our crunch routine to
        ldy #zcrname+2  ; be the same as the COMTAB one.
        ldx #2
loop1
        lda (comtab),y
        sta crunch,x
        dey
        dex
        bpl loop1
; zero BUFOFF
        lda #0
        ldy #bufoff
        sta (comtab),y
mainloop
        jsr crunch      ; get next command line entry.
        beq exit        ; quit if there are no more.
; Set up for CIO print of data at COMFNAM
        ldx #0          ; IOCB #0 (E:)
        lda #63         ; set buffer length for max
        sta icbll,x
        lda #0
        sta icblh,x
        lda comtab      ; store COMTAB+33 at icba
        clc
        adc #comfnam
        sta icbal,x
        lda comtab+1
        adc #0
        sta icbah,x
        lda #write      ; 'print string' command
        sta iccom,x
        jsr ciov        ; print it.
        jmp mainloop
exit
        rts
crunch
        jmp $FFFF       ; will be changed by INIT routine
        *=$02E0
        .word init      ;run vector


Previous page

Next page