Add the .s files (may be broken)

I would not swear these dumped correctly using the procedure described in the
README files.
This commit is contained in:
T. Joseph Carter 2017-07-20 15:10:56 -07:00
parent 27bcf5f79c
commit 93dd3e1ecd
5 changed files with 1057 additions and 0 deletions

393
D2S1/COPY.S#040000.s Normal file
View File

@ -0,0 +1,393 @@
SBTL 'C O P Y -- CONVERT FILES'
ORG $800
SKP 1
***********************************************************
* *
* COPY:THIS PROGRAM DEMONSTRATES THE USE OF THE DOS FILE *
* MANAGER BY COPYING A BINARY FILE TO A TEXT FILE. *
* *
* INPUT: INPUT FILE NAME IS "INPUT" *
* OUTPUT FILE NAME IS "OUTPUT" *
* *
* ENTRY POINT: $800 *
* *
* PROGRAMMER: DON D WORTH 2/19/81 *
* *
***********************************************************
SKP 2
BELL EQU $87 BELL CHARACTER
SKP 1
* ZPAGE DEFINITIONS
SKP 1
PTR EQU $0 WORK POINTER
BUFP EQU $2 BUFFER POINTER
EBYTE EQU $4
A1L EQU $3C MONITOR POINTER
A2L EQU $3E MONITOR POINTER
SKP 1
* OTHER ADDRESSES
SKP 1
BUFFER EQU $1000 DATA BUFFER
DOSWRM EQU $3D0 DOS WARMSTART ADDRESS
LOCRPL EQU $3E3 LOCATE RWTS PARMLIST SUBRTN
LOCFPL EQU $3DC LOCATE FILE MGR PARMLIST SUB
FM EQU $3D6 FILE MANAGER ENTRY POINT
COUT EQU $FDED PRINT ONE CHAR SUBROUTINE
PRBYTE EQU $FDDA PRINT ONE HEX BYTE SUBRTN
SKP 1
* FILE MANAGER PARMLIST DEFINITION
SKP 1
DSECT
FMOCOD DS 1 OPERATION CODE
FMOCOP EQU $01 OPEN
FMOCCL EQU $02 CLOSE
FMOCRD EQU $03 READ
FMOCWR EQU $04 WRITE
FMOCDE EQU $05 DELETE
FMOCCA EQU $06 CATALOG
FMOCLO EQU $07 LOCK
FMOCUN EQU $08 UNLOCK
FMOCRE EQU $09 RENAME
FMOCPO EQU $0A POSITION
FMOCIN EQU $0B INIT
FMOCVE EQU $0C VERIFY
FMSBCD DS 1 SUBCODE
FMSBNO EQU $00 NO OPERATION
FMSBON EQU $01 READ/WRITE ONE BYTE
FMSBRA EQU $02 READ/WRITE RANGE OF BYTES
FMSBPO EQU $03 POSITION AND DO ONE BYTE
FMSBPR EQU $04 POSITION AND DO RANGE
FMPRMS DS 8 SPECIFIC PARAMETERS
SKP 1
* OPEN PARMS
ORG FMPRMS
FMRCLN DS 2 RECORD LENGTH
FMVOL DS 1 VOLUME
FMDRV DS 1 DRIVE
FMSLT DS 1 SLOT
FMTYPE DS 1 TYPE
FMTYPT EQU 0 TEXT
FMTYPI EQU 1 INTEGER
FMTYPA EQU 2 APPLESOFT
FMTYPB EQU 4 BINARY
FMNAME DS 2 ADDRESS OF FILE NAME
SKP 1
* READ/WRITE PARMS
ORG FMPRMS
FMRCNM DS 2 RECORD NUMBER
FMOFFS DS 2 BYTE OFFSET
FMRALN DS 2 RANGE LENGTH
FMRAAD DS 2 RANGE ADDRESS
FMDATA EQU FMRAAD DATA BYTE READ/WRITTEN
SKP 1
* RENAME PARMS
ORG FMPRMS
FMNNAM DS 2 ADDRESS OF NEW NAME
SKP 1
* INIT PARMS
ORG FMPRMS
FMPAGE EQU FMSBCD FIRST PAGE OF DOS IMAGE
SKP 1
* COMMON PARMS
ORG FMPRMS+8
FMRC DS 1 RETURN CODE
FMRCOK EQU 0 NO ERRORS
FMRCBO EQU 2 BAD OPCODE
FMRCBS EQU 3 BAD SUBCODE
FMRCWP EQU 4 WRITE PROTECTED
FMRCED EQU 5 END OF DATA
FMRCNF EQU 6 FILE NOT FOUND
FMRCBV EQU 7 BAD VOLUME
FMRCIO EQU 8 I/O ERROR
FMRCDF EQU 9 DISK FULL
FMRCLK EQU 10 FILE LOCKED
DS 1 NOT USED
FMFMWA DS 2 FILE MANAGER WORKAREA PTR
FMTSL DS 2 T/S LIST PTR
FMBUFF DS 2 DATA BUFFER PTR
DEND
PAGE
* LOCATE FM PARMLIST
SKP 1
COPY JSR LOCFPL FIND PARMLIST
STY PTR SET UP POINTER TO IT
STA PTR+1
SKP 1
* OPEN INPUT FILE
SKP 1
LDY #FMNAME STORE INPUT FILE NAME
LDA #>INAME PTR IN LIST
STA (PTR),Y
INY
LDA #<INAME
STA (PTR),Y
LDY #FMTYPE BINARY FILE AS INPUT
LDA #FMTYPB
STA (PTR),Y
LDX #1 OLD FILE EXPECTED
JSR OPEN AND OPEN THE FILE
BCC INOP
JMP ERROR ANY ERROR IS FATAL
SKP 1
INOP LDA BUFP
STA IBUFF SAVE OPEN FILE BUFFER
LDA BUFP+1
STA IBUFF+1
JSR REWIND POSITION TO START OF FILE
SKP 1
* OPEN OUTPUT FILE
SKP 1
LDY #FMNAME STORE OUTPUT FILE NAME
LDA #>ONAME PTR IN LIST
STA (PTR),Y
INY
LDA #<ONAME
STA (PTR),Y
LDY #FMTYPE TEXT FILE AS OUTPUT
LDA #FMTYPT
STA (PTR),Y
LDX #0 NEW FILE IS OK
JSR OPEN
BCC OUTOP
LDY #FMRC
LDA (PTR),Y
CMP #FMRCNF FILE NOT FOUND?
BEQ OUTOP YES, WAS ALLOCATED THEN
JMP ERROR
SKP 1
OUTOP LDA BUFP SAVE OPEN OUTPUT FILE BUFFER
STA OBUFF
LDA BUFP+1
STA OBUFF+1
JSR REWIND POSITION TO START OF FILE
SKP 1
* READ ADDRESS/LENGTH FROM BINARY FILE
SKP 1
LDA #4 READ 4 BYTES FIRST
LDY #FMRALN
STA (PTR),Y
LDA #0
INY
STA (PTR),Y
JSR READ
SKP 1
* READ ENTIRE BINARY FILE INTO MEMORY AT $1000
SKP 1
LDA BUFFER+2 COPY DATA LENGTH TO LIST
LDY #FMRALN
STA (PTR),Y
LDA BUFFER+3
INY
STA (PTR),Y
CLC
LDA BUFFER+2 COMPUTE ENDING BYTE
PHA
ADC #>BUFFER
STA EBYTE
LDA BUFFER+3
PHA
ADC #<BUFFER
STA EBYTE+1
JSR READ READ BLOB INTO MEMORY
SKP 1
* WRITE ENTIRE BLOB OUT INTO TEXT FILE
SKP 1
LDY #0
TYA
STA (EBYTE),Y MARK END OF FILE
PLA
LDY #FMRALN+1 SET RANGE LENGTH
STA (PTR),Y
DEY
PLA
STA (PTR),Y
JSR WRITE WRITE BLOB FROM MEMORY
SKP 1
* WHEN FINISHED, CLOSE FILES
SKP 1
EXIT LDA OBUFF
STA BUFP
LDA OBUFF+1
STA BUFP+1
JSR CLOSE CLOSE OUTPUT FILE
LDA IBUFF
STA BUFP
LDA IBUFF+1
STA BUFP+1
JSR CLOSE CLOSE INPUT FILE
JMP DOSWRM BACK TO DOS
SKP 1
* ERROR, PRINT "ERRXX"
SKP 1
ERROR LDY #FMRC FIND RETURN CODE
LDA (PTR),Y
PHA
ERR LDA #'E PRINT "ERR"
JSR COUT
LDA #'R
JSR COUT
JSR COUT
PLA
JSR PRBYTE PRINT HEX CODE
BRK DIE HORRIBLY
SKP 1
* OPEN: COMPLETE PARMLIST AND OPEN FILE
SKP 1
OPEN LDA DOSWRM+2 FIND DOS ENTRY
STA BUFP+1
LDY #0
STY BUFP POINT AT BUFFER CHAIN
SKP 1
* SCAN DOS BUFFERS FOR A FREE ONE
SKP 1
GBUF0 LDA (BUFP),Y LOCATE NEXT DOS BUFFER
PHA
INY
LDA (BUFP),Y
STA BUFP+1
PLA
STA BUFP
BNE GBUF GOT ONE
LDA BUFP+1
BNE GBUF GOT ONE
SKP 1
LDA #12 NO FILE BUFFERS RETURN CODE
PHA
JMP ERR GO PRINT MESSAGE
SKP 1
GBUF LDY #0 LOOK AT FILENAME
LDA (BUFP),Y
BEQ GOTBUF NONE THERE, FREE BUFFER
LDY #36 IT'S NOT FREE
BNE GBUF0 GO GET NEXT ONE
SKP 1
GOTBUF LDA #1
STA (BUFP),Y MARK BUFFER IN USE
SKP 1
* FINISH COMPLETING OPEN LIST
SKP 1
LDY #FMOCOD
LDA #FMOCOP
STA (PTR),Y SET OPCODE TO OPEN
LDA #0
LDY #FMRCLN
STA (PTR),Y SET RECORD LENGTH TO 0
INY
STA (PTR),Y
LDY #FMVOL
STA (PTR),Y AND VOLUME (ANY VOL)
SKP 1
JSR LOCRPL FIND RWTS PARMS
STY A1L
STA A1L+1
LDY #1
LDA (A1L),Y GET SLOT*16
LSR A
LSR A
LSR A
LSR A SLOT=SLOT/16
LDY #FMSLT
STA (PTR),Y STORE IN LIST
LDY #2
LDA (A1L),Y GET DRIVE
LDY #FMDRV
STA (PTR),Y AND SLOT
SKP 1
* COMMON INTERFACE TO FILE MANAGER
SKP 1
CALLFM LDY #30
CFMLP1 LDA (BUFP),Y GET THREE BUFFER PTRS
PHA
INY
CPY #36
BCC CFMLP1
SKP 1
LDY #FMBUFF+1
CFMLP2 PLA
STA (PTR),Y COPY THEM TO FM LIST
DEY
CPY #FMFMWA
BCS CFMLP2
SKP 1
JMP FM EXIT THRU FILE MANAGER
SKP 1
* CLOSE: CLOSE DOS FILE
SKP 1
CLOSE LDY #FMOCOD
LDA #FMOCCL
STA (PTR),Y
JSR CALLFM CLOSE FILE
BCC CLOK
JMP ERROR
CLOK LDY #0 FREE BUFFER
TYA
STA (BUFP),Y
RTS
SKP 1
* REWIND: POSITION TO START OF FILE
SKP 1
REWIND LDY #FMRCNM
LDA #0
REWLP STA (PTR),Y ZERO RECORD NUMBER AND..
INY
CPY #FMOFFS+2 BYTE OFFSET.
BCC REWLP
LDY #FMOCOD
LDA #FMOCPO POSITION OPCODE
STA (PTR),Y
JSR CALLFM EXIT VIA FILE MANAGER
BCC REWRTS CHECK FOR ERRORS
JMP ERROR
REWRTS RTS
SKP 1
* READ: READ A RANGE OF BYTES TO $1000
SKP 1
READ LDA IBUFF FIND PROPER BUFFER
STA BUFP
LDA IBUFF+1
STA BUFP+1
LDA #FMOCRD READ OPCODE
BNE DOIO GO DO COMMON CODE
SKP 1
* WRITE: WRITE A RANGE OF BYTES FROM $1000
SKP 1
WRITE LDA OBUFF FIND PROPER BUFFER
STA BUFP
LDA OBUFF+1
STA BUFP+1
LDA #FMOCWR WRITE OPCODE
* BNE DOIO
SKP 1
* DOIO: READ/WRITE A RANGE OF BYTES
SKP 1
DOIO LDY #FMOCOD
STA (PTR),Y SET OPCODE
LDY #FMSBCD
LDA #FMSBRA
STA (PTR),Y DO RANGE OF BYTES
LDY #FMRAAD
LDA #>BUFFER
STA (PTR),Y RANGE ADDRESS=$1000
INY
LDA #<BUFFER
STA (PTR),Y
JSR CALLFM CALL FM TO DO I/O OPERATION
BCC DOIORT
JMP ERROR
DOIORT RTS
PAGE
* DATA
SKP 1
INAME ASC 'INPUT '
ONAME ASC 'OUTPUT '
SKP 1
OBUFF DS 2
IBUFF DS 2
\x00 '
SKP 1
OBUFF DS 2
IBUFF DS 2
\x00 '
SKP 1
OBUFF DS 2
IBUFF DS 2

159
D2S1/DUMP.S#040000.s Normal file
View File

@ -0,0 +1,159 @@
SBTL 'D U M P -- TRACK DUMP UTILITY'
ORG $800
SKP 1
***********************************************************
* *
* DUMP:THIS PROGRAM WILL ALLOW ITS USER TO DUMP AN ENTIRE *
* TRACK IN ITS RAW FORM INTO MEMORY FOR EXAMINATION. *
* *
* INPUT: $02 = TRACK TO BE READ *
* *
* OUTPUT:$1000 = ADDRESS OF TRACK IMAGE *
* *
* ENTRY POINT: $800 *
* *
* PROGRAMMER: DON D WORTH 2/19/81 *
* *
***********************************************************
SKP 1
* ZPAGE DEFINITIONS
SKP 1
PTR EQU $0 WORK POINTER
TRACK EQU $2 TRACK TO BE READ/WRITTEN
A1L EQU $3C MONITOR POINTER
A2L EQU $3E MONITOR POINTER
PREG EQU $48 MONITOR STATUS REGISTER
SKP 1
* OTHER ADDRESSES
SKP 1
BUFFER EQU $1000 TRACK IMAGE AREA
LOCRPL EQU $3E3 LOCATE RWTS PARMLIST SUBRTN
RWTS EQU $3D9 RWTS SUBROUTINE
COUT EQU $FDED PRINT ONE CHAR SUBROUTINE
XAM EQU $FDB3 MONITOR HEX DUMP SUBRTN
SKP 1
* DISK I/O SELECTS
SKP 1
DRVSM0 EQU $C080 STEP MOTOR POSITIONS
DRVSM1 EQU $C081
DRVSM2 EQU $C082
DRVSM3 EQU $C083
DRVSM4 EQU $C084
DRVSM5 EQU $C085
DRVSM6 EQU $C086
DRVSM7 EQU $C087
DRVOFF EQU $C088 TURN DRIVE OFF AFTER 6 REVS
DRVON EQU $C089 TURN DRIVE ON
DRVSL1 EQU $C08A SELECT DRIVE 1
DRVSL2 EQU $C08B SELECT DRIVE 2
DRVRD EQU $C08C READ DATA LATCH
DRVWR EQU $C08D WRITE DATA LATCH
DRVRDM EQU $C08E SET READ MODE
DRVWRM EQU $C08F SET WRITE MODE
SKP 1
* RWTS PARMLIST DEFINITION
SKP 1
DSECT
RPLIOB DS 1 IOB TYPE ($01)
RPLSLT DS 1 SLOT*16
RPLDRV DS 1 DRIVE
RPLVOL DS 1 VOLUME
RPLTRK DS 1 TRACK
RPLSEC DS 1 SECTOR
RPLDCT DS 2 ADDRESS OF DCT
RPLBUF DS 2 ADDRESS OF BUFFER
RPLSIZ DS 2 SECTOR SIZE
RPLCMD DS 1 COMMAND CODE
RPLCNL EQU $00 NULL COMMAND
RPLCRD EQU $01 READ COMMAND
RPLCWR EQU $02 WRITE COMMAND
RPLCFM EQU $04 FORMAT COMMAND
RPLRCD DS 1 RETURN CODE
RPLRWP EQU $10 WRITE PROTECTED
RPLRVM EQU $20 VOLUME MISMATCH
RPLRDE EQU $40 DRIVE ERROR
RPLRRE EQU $80 READ ERROR
RPLTVL DS 1 TRUE VOLUME
RPLPSL DS 1 PREVIOUS SLOT
RPLPDR DS 1 PREVIOUS DRIVE
DEND
SKP 2
* USE RWTS TO POSITION THE ARM TO THE DESIRED TRACK
SKP 1
DUMP JSR LOCRPL LOCATE RWTS PARMLIST
STY PTR AND SAVE POINTER
STA PTR+1
SKP 1
LDA TRACK GET TRACK TO READ/WRITE
LDY #RPLTRK STORE IN RWTS LIST
STA (PTR),Y
SKP 1
LDA #RPLCNL NULL OPERATION
LDY #RPLCMD AND STORE IN LIST
STA (PTR),Y
SKP 1
LDA #0 ANY VOLUME WILL DO
LDY #RPLVOL
STA (PTR),Y
JSR LOCRPL RELOAD POINTER TO PARMS
JSR RWTS CALL RWTS
LDA #0
STA PREG FIX P REG SO DOS IS HAPPY
SKP 1
* PREPARE TO DUMP TRACK TO MEMORY
SKP 1
LDY #RPLSLT GET SLOT*16
LDA (PTR),Y
TAX
LDA DRVON,X KEEP DRIVE ON
LDA DRVRDM,X INSURE READ MODE
SKP 1
LDA #>BUFFER POINT AT DATA
STA PTR
LDA #<BUFFER
STA PTR+1
LDY #0
SKP 1
* START DUMPING AT THE BEGINNING OF A SECTOR ADDRESS
* FIELD OR A SECTOR DATA FIELD
SKP 1
LOOP1 LDA DRVRD,X WAIT FOR NEXT BYTE
BPL LOOP1
CMP #$FF AUTOSYNC?
BNE LOOP1 NO, DON'T START IN MIDDLE
LOOP2 LDA DRVRD,X WAIT FOR NEXT BYTE
BPL LOOP2
CMP #$FF TWO AUTOSYNCS?
BNE LOOP1 NOT YET
LOOP3 LDA DRVRD,X
BPL LOOP3
CMP #$FF STILL AUTOSYNCS?
BEQ LOOP3 YES, WAIT FOR DATA BYTE
BNE LOOP4 ELSE, START STORING DATA
SKP 1
* ONCE ALIGNED, BEGIN COPYING THE TRACK TO MEMORY.
* COPY AT LEAST TWICE ITS LENGTH TO INSURE WE GET IT
* ALL.
SKP 1
LOOPD LDA DRVRD,X WAIT FOR NEXT DATA BYTE
BPL LOOPD
LOOP4 STA (PTR),Y STORE IN MEMORY
INC PTR BUMP POINTER
BNE LOOPD
INC PTR+1
LDA PTR+1
CMP #$40 DONE AT LEAST A TRACK?
BCC LOOPD NO, CONTINUE
LDA DRVOFF,X TURN DRIVE OFF
SKP 1
* WHEN FINISHED, DUMP SOME OF TRACK IN HEX ON SCREEN
SKP 1
EXIT LDA #>BUFFER DUMP 800.8AF
STA A1L
LDA #<BUFFER
STA A1L+1
LDA #>BUFFER+$AF
STA A2L
LDA #<BUFFER+$AF
STA A2L+1
JMP XAM EXIT VIA HEX DISPLAY

195
D2S1/FTS.S#040000.s Normal file
View File

@ -0,0 +1,195 @@
SBTL 'F T S -- FIND T/S LISTS UTILITY'
ORG $900
SKP 1
***********************************************************
* *
* FTS: THIS PROGRAM SCANS THE ENTIRE DISKETTE FOR WHAT *
* APPEAR TO BE TRACK/SECTOR LISTS AND PRINTS THE *
* TRACK AND SECTOR OF EACH ONE IT FINDS. *
* *
* INPUT: NONE *
* *
* ENTRY POINT: $900 *
* *
* PROGRAMMER: DON D WORTH 2/15/81 *
* *
***********************************************************
SKP 2
BELL EQU $87 BELL CHARACTER
RETURN EQU $8D CARRIAGE RETURN
SKP 1
* ZPAGE DEFINITIONS
SKP 1
PTR EQU $0 WORK POINTER
A1L EQU $3C MONITOR POINTER
A2L EQU $3E MONITOR POINTER
PREG EQU $48 MONITOR STATUS REGISTER
SKP 1
* OTHER ADDRESSES
SKP 1
BUFFER EQU $800 SECTOR DATA BUFFER
LOCRPL EQU $3E3 LOCATE RWTS PARMLIST SUBRTN
RWTS EQU $3D9 RWTS SUBROUTINE
COUT EQU $FDED PRINT ONE CHAR SUBROUTINE
PRBYTE EQU $FDDA PRINT ONE HEX BYTE SUBRTN
SKP 1
* RWTS PARMLIST DEFINITION
SKP 1
DSECT
RPLIOB DS 1 IOB TYPE ($01)
RPLSLT DS 1 SLOT*16
RPLDRV DS 1 DRIVE
RPLVOL DS 1 VOLUME
RPLTRK DS 1 TRACK
RPLSEC DS 1 SECTOR
RPLDCT DS 2 ADDRESS OF DCT
RPLBUF DS 2 ADDRESS OF BUFFER
RPLSIZ DS 2 SECTOR SIZE
RPLCMD DS 1 COMMAND CODE
RPLCNL EQU $00 NULL COMMAND
RPLCRD EQU $01 READ COMMAND
RPLCWR EQU $02 WRITE COMMAND
RPLCFM EQU $04 FORMAT COMMAND
RPLRCD DS 1 RETURN CODE
RPLRWP EQU $10 WRITE PROTECTED
RPLRVM EQU $20 VOLUME MISMATCH
RPLRDE EQU $40 DRIVE ERROR
RPLRRE EQU $80 READ ERROR
RPLTVL DS 1 TRUE VOLUME
RPLPSL DS 1 PREVIOUS SLOT
RPLPDR DS 1 PREVIOUS DRIVE
DEND
SKP 2
* START TRACK/SECTOR JUST PAST DOS (TRACK 3)
SKP 1
FTS JSR LOCRPL LOCATE RWTS PARMLIST
STY PTR AND SAVE POINTER
STA PTR+1
SKP 1
LDA #3 FIRST NON-DOS TRACK
LDY #RPLTRK STORE IN RWTS LIST
STA (PTR),Y
SKP 1
LDY #RPLBUF
LDA #>BUFFER STORE BUFFER PTR IN LIST
STA (PTR),Y
INY
LDA #<BUFFER
STA (PTR),Y
SKP 1
LDA #RPLCRD GET COMMAND CODE FOR READ
LDY #RPLCMD AND STORE IN LIST
STA (PTR),Y
SKP 1
LDA #0 ANY VOLUME WILL DO
LDY #RPLVOL
STA (PTR),Y
SKP 1
* NEW TRACK, START SECTOR AT ZERO
SKP 1
NEWTRK LDY #RPLSEC
LDA #0
STA (PTR),Y
SKP 1
* NOW CALL RWTS TO READ THE SECTOR
SKP 1
NEWSEC JSR LOCRPL RELOAD POINTER TO PARMS
JSR RWTS CALL RWTS
LDA #0
STA PREG FIX P REG SO DOS IS HAPPY
BCC SCAN ALL IS WELL
SKP 1
* ERROR OCCURED, PRINT "RC=XX"
SKP 1
JSR PRTTS PRINT TRACK/SECTOR
LDA #BELL BEEP THE SPEAKER
JSR COUT
LDA #'R PRINT THE "RC="
JSR COUT
LDA #'C
JSR COUT
LDA #'=
JSR COUT
LDY #RPLRCD
LDA (PTR),Y GET RWTS RETURN CODE
JSR PRBYTE PRINT RETURN CODE IN HEX
LDA #RETURN
JSR COUT
JMP NXTSEC GO ON
SKP 1
* NO ERROR, SEE IF SECTOR LOOKS LIKE A T/S LIST
SKP 1
SCAN LDX #0
SCLP0 LDA BUFFER,X MAKE SURE ITS NOT ALL ZERO
BNE SCAN1
INX
BNE SCLP0
BEQ NXTSEC IF IT IS, SKIP IT
SKP 1
SCAN1 LDX #5 START AT OFFSET 5
SCLP1 LDA BUFFER,X
BNE NXTSEC HEADER OF T/S MUST BE ZERO
INX
CPX #12 AT THE T/S PAIRS YET?
BCC SCLP1 NO, KEEP CHECKING
SKP 1
SCLP2 LDA BUFFER,X GET TRK
CMP #35 MUST BE 0-34
BCS NXTSEC
INX
LDA BUFFER,X GET SECTOR
CMP #16 MUST BE 0-15
BCS NXTSEC
INX
BNE SCLP2
SKP 1
JSR PRTTS ALL CONDITIONS MET
LDA #RETURN
JSR COUT
SKP 1
* BUMP SECTOR NUMBER OR TRACK AND CONTINUE
SKP 1
NXTSEC LDY #RPLSEC
LDA (PTR),Y GET LAST SECTOR
CLC
ADC #1 BUMP BY ONE
STA (PTR),Y AND PUT IT BACK IN LIST
CMP #16 TOO BIG?
BCS NXTTRK
JMP NEWSEC NO, GO READ IT
SKP 1
NXTTRK LDY #RPLTRK
LDA (PTR),Y GET LAST TRACK
CLC
ADC #1 BUMP BY ONE
STA (PTR),Y AND PUT IT BACK IN LIST
CMP #$11 CATALOG TRACK?
BEQ NXTTRK YES, SKIP OVER THAT ONE
CMP #35 DONE ALL 35 TRACKS?
BCS EXIT YES, LEAVE
JMP NEWTRK NO, GO READ FIRST SECTOR
EXIT RTS
SKP 2
* PRTTS: PRINT "T=XX S=XX"
SKP 1
PRTTS LDA #'T PRINT "T"
JSR COUT
LDY #RPLTRK
LDA (PTR),Y
JSR PRTEQ PRINT "=XX "
SKP 1
LDA #'S PRINT "S"
JSR COUT
LDY #RPLSEC
LDA (PTR),Y
JSR PRTEQ PRINT "=XX "
RTS
SKP 1
PRTEQ PHA
LDA #'=
JSR COUT
PLA
JSR PRBYTE
LDA #'
JSR COUT
RTS

172
D2S1/INIT.S#040000.s Normal file
View File

@ -0,0 +1,172 @@
SBTL 'I N I T -- REFORMAT A SINGLE TRACK'
ORG $800
SKP 1
***********************************************************
* *
* INIT: THIS PROGRAM WILL ALLOW ITS USER TO INITIALIZE A *
* SINGLE TRACK WITH ANY VOLUME NUMBER DESIRED. *
* *
* INPUT: $02 = TRACK TO BE INITIALIZED *
* *
* $03 = VOLUME NUMBER *
* *
* ENTRY POINT: $800 *
* *
* PROGRAMMER: PIETER LECHNER 2/19/81 *
* *
***********************************************************
SKP 1
* ZPAGE DEFINITIONS
SKP 1
PTR EQU $0 WORK POINTER
TRACK EQU $2 TRACK TO BE READ/WRITTEN
VOLUME EQU $3 VOLUME NUMBER
SECFND EQU $2D SECTOR FOUND BY RDADR16
AA EQU $3E ZPAGE CONSTANT FOR TIMING
VOL EQU $41 VOLUME USED BY WRADR16
TRK EQU $44 TRACK USED BY WRADR16
SYNCNT EQU $45 SYNC COUNT USED BY DSKF2
PREG EQU $48 MONITOR P REGISTER SAVEAREA
BELL EQU $87 ASCII BELL
SKP 1
* OTHER ADDRESSES
SKP 1
LOCRPL EQU $3E3 LOCATE RWTS PARMLIST SUBRTN
RWTS EQU $3D9 RWTS SUBROUTINE
RTRYCNT EQU $578 RETRY COUNT FOR DSKF2
NBUF1 EQU $BB00 PRIMARY SECTOR BUFFER
NBUF2 EQU $BC00 SECONDARY SECTOR BUFFER
READ16 EQU $B8DC READ DATA FIELD ROUTINE
RDADR16 EQU $B944 READ ADDRESS FIELD ROUTINE
DSKF2 EQU $BF0D FORMAT ONE TRACK ROUTINE
COUT EQU $FDED MONITOR CHARACTER OUTPUT
PRBYTE EQU $FDDA MONITOR HEX OUTPUT
SKP 1
* DISK I/O SELECTS
SKP 1
DRVSM0 EQU $C080 STEP MOTOR POSITIONS
DRVSM1 EQU $C081
DRVSM2 EQU $C082
DRVSM3 EQU $C083
DRVSM4 EQU $C084
DRVSM5 EQU $C085
DRVSM6 EQU $C086
DRVSM7 EQU $C087
DRVOFF EQU $C088 TURN DRIVE OFF AFTER 6 REVS
DRVON EQU $C089 TURN DRIVE ON
DRVSL1 EQU $C08A SELECT DRIVE 1
DRVSL2 EQU $C08B SELECT DRIVE 2
DRVRD EQU $C08C READ DATA LATCH
DRVWR EQU $C08D WRITE DATA LATCH
DRVRDM EQU $C08E SET READ MODE
DRVWRM EQU $C08F SET WRITE MODE
SKP 1
* RWTS PARMLIST DEFINITION
SKP 1
DSECT
RPLIOB DS 1 IOB TYPE ($01)
RPLSLT DS 1 SLOT*16
RPLDRV DS 1 DRIVE
RPLVOL DS 1 VOLUME
RPLTRK DS 1 TRACK
RPLSEC DS 1 SECTOR
RPLDCT DS 2 ADDRESS OF DCT
RPLBUF DS 2 ADDRESS OF BUFFER
RPLSIZ DS 2 SECTOR SIZE
RPLCMD DS 1 COMMAND CODE
RPLCNL EQU $00 NULL COMMAND
RPLCRD EQU $01 READ COMMAND
RPLCWR EQU $02 WRITE COMMAND
RPLCFM EQU $04 FORMAT COMMAND
RPLRCD DS 1 RETURN CODE
RPLRWP EQU $10 WRITE PROTECTED
RPLRVM EQU $20 VOLUME MISMATCH
RPLRDE EQU $40 DRIVE ERROR
RPLRRE EQU $80 READ ERROR
RPLTVL DS 1 TRUE VOLUME
RPLPSL DS 1 PREVIOUS SLOT
RPLPDR DS 1 PREVIOUS DRIVE
DEND
SKP 2
* USE RWTS TO POSITION THE ARM TO THE DESIRED TRACK
SKP 1
DUMP JSR LOCRPL LOCATE RWTS PARMLIST
STY PTR AND SAVE POINTER
STA PTR+1
SKP 1
LDA TRACK GET TRACK TO READ/WRITE
LDY #RPLTRK STORE IN RWTS LIST
STA (PTR),Y
SKP 1
LDA #RPLCNL NULL OPERATION
LDY #RPLCMD AND STORE IN LIST
STA (PTR),Y
SKP 1
LDA #0 ANY VOLUME WILL DO
LDY #RPLVOL
STA (PTR),Y
JSR LOCRPL RELOAD POINTER TO PARMS
JSR RWTS CALL RWTS
LDA DRVON,X LEAVE DRIVE ON
SKP 1
* ESTABLISH ENVIRONMENT FOR DSKF2 ROUTINE
SKP 1
LDA TRACK PASS TRACK TO DSKF2
STA TRK
LDA VOLUME AND VOLUME
STA VOL
LDA #$AA STORE CONSTANT FOR ZPAGE..
STA AA TIMING
LDA #$28 START WITH 40 SYNCS..
STA SYNCNT BETWEEN SECTORS
LDY #$56
LDA #$00
ZNBUF2 STA NBUF2-1,Y ZERO SECONDARY BUFFER
DEY
BNE ZNBUF2
ZNBUF1 STA NBUF1,Y AND PRIMARY BUFFER
DEY
BNE ZNBUF1
SKP 1
* INITIALIZE TRACK
SKP 1
JSR DSKF2 FORMAT TRACK AND VERIFY
LDA #$08 IN CASE OF ERROR...
BCS HNDERR ERROR?
SKP 1
* READ SECTOR ZERO TO VERIFY FORMATTING
SKP 1
LDA #$30 NO, DOUBLE CHECK TRACK
STA RTRYCNT ALLOW 48 RETRIES
NOGOOD SEC
DEC RTRYCNT COUNT RETRIES
BEQ HNDERR
JSR RDADR16 READ AN ADDRESS FIELD
BCS NOGOOD ERROR, TRY AGAIN
LDA SECFND IS THIS SECTOR ZERO?
BNE NOGOOD NO, TRY AGAIN
JSR READ16 YES, READ DATA FIELD
BCC DONETRK ALL IS WELL, DONE.
HNDERR LDY #RPLRCD ELSE, PHONEY UP A RC
STA (PTR),Y
SKP 1
* ERROR OCCURED, PRINT "RC=XX"
SKP 1
LDA #BELL BEEP THE SPEAKER
JSR COUT
LDA #'R PRINT THE "RC="
JSR COUT
LDA #'C
JSR COUT
LDA #'=
JSR COUT
LDY #RPLRCD
LDA (PTR),Y GET RWTS RETURN CODE
JSR PRBYTE PRINT RETURN CODE IN HEX
SKP 1
* WHEN DONE, EXIT TO CALLER
SKP 1
DONETRK LDA DRVOFF,X TURN DRIVE OFF
LDA #$00
STA PREG CLEAR P REGISTER FOR DOS
RTS ; RETURN TO CALLER

138
D2S1/ZAP.S#040000.s Normal file
View File

@ -0,0 +1,138 @@
SBTL 'Z A P -- DISK UPDATE UTILITY'
ORG $900
SKP 1
***********************************************************
* *
* ZAP: THIS PROGRAM WILL ALLOW ITS USER TO READ/WRITE *
* INDIVIDUAL SECTORS FROM/TO THE DISKETTE *
* *
* INPUT: $02 = TRACK TO BE READ *
* $03 = SECTOR TO BE READ/WRITTEN *
* $04 = $01 - READ SECTOR *
* $02 - WRITE SECTOR *
* $800 = ADDRESS OF SECTOR DATA BUFFER *
* *
* ENTRY POINT: $900 *
* *
* PROGRAMMER: DON D WORTH 2/15/81 *
* *
***********************************************************
SKP 2
BELL EQU $87 BELL CHARACTER
SKP 1
* ZPAGE DEFINITIONS
SKP 1
PTR EQU $0 WORK POINTER
TRACK EQU $2 TRACK TO BE READ/WRITTEN
SECTOR EQU $3 SECTOR TO BE READ/WRITTEN
OPER EQU $4 OPERATION TO BE PERFORMED
READ EQU 1 READ OPERATION
WRITE EQU 2 WRITE OPERATION
A1L EQU $3C MONITOR POINTER
A2L EQU $3E MONITOR POINTER
PREG EQU $48 MONITOR STATUS REGISTER
SKP 1
* OTHER ADDRESSES
SKP 1
BUFFER EQU $800 SECTOR DATA BUFFER
LOCRPL EQU $3E3 LOCATE RWTS PARMLIST SUBRTN
RWTS EQU $3D9 RWTS SUBROUTINE
COUT EQU $FDED PRINT ONE CHAR SUBROUTINE
PRBYTE EQU $FDDA PRINT ONE HEX BYTE SUBRTN
XAM EQU $FDB3 MONITOR HEX DUMP SUBRTN
SKP 1
* RWTS PARMLIST DEFINITION
SKP 1
DSECT
RPLIOB DS 1 IOB TYPE ($01)
RPLSLT DS 1 SLOT*16
RPLDRV DS 1 DRIVE
RPLVOL DS 1 VOLUME
RPLTRK DS 1 TRACK
RPLSEC DS 1 SECTOR
RPLDCT DS 2 ADDRESS OF DCT
RPLBUF DS 2 ADDRESS OF BUFFER
RPLSIZ DS 2 SECTOR SIZE
RPLCMD DS 1 COMMAND CODE
RPLCNL EQU $00 NULL COMMAND
RPLCRD EQU $01 READ COMMAND
RPLCWR EQU $02 WRITE COMMAND
RPLCFM EQU $04 FORMAT COMMAND
RPLRCD DS 1 RETURN CODE
RPLRWP EQU $10 WRITE PROTECTED
RPLRVM EQU $20 VOLUME MISMATCH
RPLRDE EQU $40 DRIVE ERROR
RPLRRE EQU $80 READ ERROR
RPLTVL DS 1 TRUE VOLUME
RPLPSL DS 1 PREVIOUS SLOT
RPLPDR DS 1 PREVIOUS DRIVE
DEND
SKP 2
* FILL IN RWTS LIST
SKP 1
ZAP JSR LOCRPL LOCATE RWTS PARMLIST
STY PTR AND SAVE POINTER
STA PTR+1
SKP 1
LDA TRACK GET TRACK TO READ/WRITE
LDY #RPLTRK STORE IN RWTS LIST
STA (PTR),Y
SKP 1
LDA SECTOR GET SECTOR TO READ/WRITE
CMP #16 BIGGER THAN 16 SECTORS?
BCC SOK NO
LDA #0
STA SECTOR YES, PUT IT BACK TO ZERO
SOK LDY #RPLSEC
STA (PTR),Y STORE IN RWTS LIST
SKP 1
LDY #RPLBUF
LDA #>BUFFER STORE BUFFER PTR IN LIST
STA (PTR),Y
INY
LDA #<BUFFER
STA (PTR),Y
SKP 1
LDA OPER GET COMMAND CODE
LDY #RPLCMD AND STORE IN LIST
STA (PTR),Y
SKP 1
LDA #0 ANY VOLUME WILL DO
LDY #RPLVOL
STA (PTR),Y
SKP 1
* NOW CALL RWTS TO READ/WRITE THE SECTOR
SKP 1
JSR LOCRPL RELOAD POINTER TO PARMS
JSR RWTS CALL RWTS
LDA #0
STA PREG FIX P REG SO DOS IS HAPPY
BCC EXIT ALL IS WELL
PAGE
* ERROR OCCURED, PRINT "RC=XX"
SKP 1
LDA #BELL BEEP THE SPEAKER
JSR COUT
LDA #'R PRINT THE "RC="
JSR COUT
LDA #'C
JSR COUT
LDA #'=
JSR COUT
LDY #RPLRCD
LDA (PTR),Y GET RWTS RETURN CODE
JSR PRBYTE PRINT RETURN CODE IN HEX
SKP 1
* WHEN FINISHED, DUMP SOME OF SECTOR IN HEX
SKP 1
EXIT LDA #>BUFFER DUMP 800.8B7
STA A1L
LDA #<BUFFER
STA A1L+1
LDA #>BUFFER+$AF
STA A2L
LDA #<BUFFER+$AF
STA A2L+1
JMP XAM EXIT VIA HEX DISPLAY
\x00\x00
JMP XAM EXIT VIA HEX DISPLAY