.TITLE "PERCOM QUICK SET 05-27-85" ; ;SAVE#D:QSET.M65 ; ; This program switches the density for ; PERCOM compatible drives. ; Drive numbers allowed are 1 through 8. ; Allowed settings are: ; S = single ; E = enhanced (1050) ; D = double ; DD = double sided, double density ; Command format example: ; ; QSET 1D 7E 3DD ; ; At least one space after QSET is ; required. The rest of the command line ; ignores anything other than a number ; in the range 1 through 8 followed by ; an upper case D, E, or S. Thus, ; equivalent examples are: ; ; QSET 1D7E3DD ; QSET 31DXYZ7E 3DD ; ; When the program terminates, it echoes ; to the screen the valid portions of ; the command line. The last example ; would echo: ; ; 1D 7E 3DD ; ; If a drive cannot be configured, the ; last letter is replaced with a ; question mark. ; ; NOTES: ; 1. Enhanced (1050) allows ; you to read or write 1050 ; density disks, but does ; not allow you to format ; disks in that density. ; 2. As with any other SIO ; use, the 28 second timeout ; may occasionally occur. ; ; I wish to credit DANIEL L. MOORE ; for his SET.ASM, from which the ; central routine of this program was ; adapted. ; ****************************** * * * Josef W. Segur 05/27/85 * * * ****************************** ; DOSVEC = $0A DOSINIT = $07E0 FMS v. 2 FR0 = $D4 FP register 0 DENSITY = FR0+2 ; ; OS/A+ equates CPBUFP = $0A next char. CPCMDB = $3F command buff. ; SIO equates DDEVIC = $0300 DUNIT = $0301 DCOMND = $0302 DSTATS = $0303 DBUFLO = $0304 DBYTLO = $0308 ; Data direction control IN = $40 OUT = $80 ; CIO equates ICHID = $0340 ICCOM = $0342 ICBAL = $0344 ICBAH = $0345 ICBLL = $0348 ICBLH = $0349 ; PUTBYTS = $0B ; PERCOM drive table READ = $4E WRITE = $4F LENGTH = 12 FM = 0 FM recording MFM = 4 MFM recording SID1 = 0 One side SID2 = 1 Two sides ; CIO = $E456 SIO = $E459 ; EOL = $9B End of line char. ; *= $4000 ; START CLC LDY #CPBUFP LDA (DOSVEC),Y ADC #CPCMDB+1 ;skip 1st space STA CMDBIX STA FIRSTX SEC LDA # EBUF SBC #0 STA FR0+1 LDA #EOL STA EBUF LOOP LDY CMDBIX INC CMDBIX BMI DOS ;out if too long LDA (DOSVEC),Y ;Get char CMP #EOL BEQ DOS ;out if end STA (FR0),Y ;save for echo? ; Test for drive 1 to 8. EOR #'0 CMP #$09 BCC NUM ;BR if 1 - 8 SPLP LDA #32 ;Else space STA (FR0),Y JMP LOOP ;and check next NUM STA DUNIT LDA #$31 STA DDEVIC ; Test for S(0), E(1), D(2), DD(3) LDX #0 INY LDA (DOSVEC),Y CMP #EOL BEQ DOS ;out if end CMP #'S BEQ SETIT INX CMP #'E BEQ SETIT INX CMP #'D BEQ SECD ;Chk 2nd D DEY ;letter bad BNE SPLP ;clr number & next SECD STA (FR0),Y INY LDA (DOSVEC),Y CMP #'D BEQ DDYS DEY ;whoops LDA #'D BNE SETIT DDYS INX BNE SETIT ; DOS LDA #EOL STA (FR0),Y STY CMDBIX JSR DOSINIT ;reinit for all changes LDA ICHID BMI DRTS ;BR IOCB#0 not open LDA #PUTBYTS STA ICCOM ;Else echo cmds LDA # EBUF STA ICBAH LDX #0 SEC LDA CMDBIX SBC FIRSTX STA ICBLL ;len end - start STX ICBLH JSR CIO DRTS RTS ; SETIT STX DENSITY STA (FR0),Y ;save letter INY STY CMDBIX ;& index past it ; First read in the current ; control table. LDA #IN STA DSTATS LDA #READ STA DCOMND LDA #LENGTH STA DBYTLO LDA #0 STA DBYTLO+1 LDA # TABLE STA DBUFLO+1 JSR SIO BPL DENS cont if no error LDY CMDBIX DEY LDA #'? STA (FR0),Y else insert ? JMP LOOP and loop for more ; ; Modify the control bytes ; First recording technique DENS LDA DENSITY BNE SET.MFM LDX #FM BEQ SET SET.MFM LDX #MFM SET STX TABLE+5 ; Then set the sector length CMP #2 BCS S.256 LDX #$80 128 bytes LDY #$00 BEQ SETLEN S.256 LDX #$00 256 bytes LDY #$01 SETLEN STY TABLE+6 High byte STX TABLE+7 Low byte ; Then set the number of ; sectors per track. CMP #1 BEQ S.26 LDX #18 18 sectors BNE SETSECT S.26 LDX #26 26 sectors SETSECT STX TABLE+3 ; Set the number of sides CMP #3 BEQ S.DBL LDX #SID1 BEQ SETSID S.DBL LDX #SID2 SETSID STX TABLE+4 ; Then write the table out. LDA #OUT STA DSTATS LDA #WRITE STA DCOMND JSR SIO ; Loop for any more requests JMP LOOP ; CMDBIX = * ;reserve index byte store *= *+1 ; FIRSTX = * ;reserve start index store *= *+1 ; ; DRIVE table. TABLE = * *= *+LENGTH ; EBUF = * *= *+128 ;reserve ; END .OPT LIST ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^