home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
C64
/
GFX
/
64HDPRO.ARC
/
C64HDBIO.SRC
< prev
next >
Wrap
Text File
|
2000-06-30
|
17KB
|
657 lines
;BPUT"HARDISKBIOS.SRC
;RPUT"HARDISKBIOS.SRC
;
;+++++++++++++++++++++++++++++++++
;+ THE DRIVE COMMAND BLOCK (DCB) +
;+ IS USED TO PASS THE COMMAND, +
;+ CYLINDER, SECTOR, HEAD, BLOCK +
;+ COUNT, AND STEP RATE TO THE +
;+ CONTROLLER. THE LAYOUT OF THE+
;+ DCB FOLLOWS: +
;+ +
;+ BYTE DESCRIPTION +
;+ 0 OPERATION CODE +
;+ 1 BITS 4,6,7 NOT USED, 0 +
;+ BIT 5 DRIVE NUMBER 0 OR 1+
;+ BITS 0-3 HEAD NUMBER +
;+ 2 BITS 6,7 CLINDER # MSB +
;+ BIT 5 NOT USED 0 +
;+ BITS 0-4 SECTOR NUMBER +
;+ 3 CYLINDER NUMBER LSB +
;+ 4 BLOCK COUNT OR INTERLEAVE+
;+ 5 BITS 6,7 USED FOR ERROR +
;+ RECOVERY OPTIONS, BEST TO+
;+ TO KEEP THEM BOTH 0. +
;+ BITS 3,4,5 NOT USED 0 +
;+ BITS 0-2 STEP RATE. SEE +
;+ CONTROLLER DOC FOR VALUES+
;+ +
;+ COMMAND CODES ARE AS FOLLOWS: +
;+ +
;+ 00 - TEST DRIVE READY +
;+ 01 - RECALIBRATE +
;+ 03 - READ STATUS OF LAST OP +
;+ 04 - FORMAT DRIVE +
;+ 05 - VERIFY SECTORS +
;+ 06 - FORMAT A TRACK +
;+ 07 - FORMAT A BAD TRACK (FLAG)+
;+ 08 - READ SECTORS +
;+ 0A - WRITE SECTORS +
;+ 0B - SEEK +
;+ 0C - INITIALIZE DRIVE PARMS +
;+ 0D - READ ECC BURST ERROR LEN +
;+ 0E - READ SECTOR BUFFER +
;+ 0F - WRITE SECTOR BUFFER +
;+ E0 - RUN SECTOR BUFFER DIAGS +
;+ E3 - RUN DRIVE DIAGNOSTICS +
;+ E4 - RUN CONTROLLER DIAGS +
;+ E5 - READ LONG +
;+ E6 - WRITE LONG +
;+++++++++++++++++++++++++++++++++
;
;* = $7000
;+++++++++++++++++++++++++++++++++
;+ THIS CODE IS TARGETED FOR USE +
;+ WITH A HARD DISK DRIVE AND A +
;+ WESTERN DIGITAL PC CONTOLLER +
;+ CARD. +
;+++++++++++++++++++++++++++++++++
;
;+++++++++++++++++++++++++++++++++
;+ EQUATES +
;+++++++++++++++++++++++++++++++++
;
;+++++++++++++++++++++++++++++++++
;+ THE FOLLOWING DEFINE THE WD +
;+ CONTROLLER PORTS. THERE ARE +
;+ FOUR PORTS 0 THRU 3. THE +
;+ FUNCTION OF EACH IS: +
;+ PORT0 - DATA IN AND OUT +
;+ PORT1 - READ - STATUS +
;+ WRITE - RESET CONTROL +
;+ PORT2 - READ - READ JUMPERS +
;+ PORT2 - READ - READ JUMPERS +
;+ - WRITE - PREPARE FOR +
;+ CONTROLER COMMAND. +
;+ PORT3 - READ - NO FUNCTION +
;+ WRITE - SET DMA FLAGS +
;+ (SET TO 00, ALWAYS) +
;+++++++++++++++++++++++++++++++++
;
PORT0 = $DE20 ;USING I/O1 ADDRESS
PORT1 = $DE21 ;RESET AND STATUS REG
;+ BIT DEFINITONS FOR READ PORT1 +
;
;+ BIT DEFINITION +
;+ 7 UNDEFINED, IGNORE +
;+ 6 UNDEFINED, IGNORE +
;+ 5 IRQ - NOT USED ON C64 +
;+ 4 DRQ - NOT USED ON C64 +
;+ 3 BUSY BIT +
;+ 2 C/D - COMMAND/DATA BIT +
;+ 0 - DATA +
;+ 1 - COMMAND +
;+ 1 I/O - DIRECTION OF DATA +
;+ 1 - INPUT TO HOST +
;+ 0 - OUTPUT FROM HOST+
;+ 0 REQ - REQUEST BIT, MUST BE+
;+ 1 FOR DATA TRANSFERS+
;
PORT2 = $DE22 ;SET COMMAND MODE AND JUMPERS
;
;+ THERE ARE EIGHT JUMPERS WHICH+
;+ CAN BE READ FROM THIS PORT. +
;+ DRIVE OPTIONS CAN BE MADE BY +
;+ DEFINING THESE BITS TO REPRE-+
;+ SENT A TABLE ENTRY, ETC. +
;+ +
;+ WRITING TO THIS PORT SETS THE+
;+ CONTORLER IN COMMAND MODE. +
;
PORT3 = $DE23 ;ENSURE ALLWAYS ZERO
;
ZERO = 0
TWO = 2
;
;+++++++++++++++++++++++++++++++++
;+ COMMAND EQUTATES +
;+++++++++++++++++++++++++++++++++
;
TDRCMD = $00 ;TEST DRIVE READY
RCACMD = $01 ;RECALIBRATE COMMAND
STCMD = $03 ;SENSE STATUS COMMAND
FORCMD = $04 ;FORMAT DRIVE COMMAND
VERCMD = $05 ;VERIFY SECTORS COMMAND
RDCMD = $08 ;READ COMMAND
FRTCMD = $06 ;FORMAT TRACK COMMAND
FBTCMD = $07 ;FORMAT BAD TRACK COMMAND
WRTCMD = $0A ;WRITE COMMAND
SKCMD = $0B ;SEEK COMMAND
PRMCMD = $0C ;SEND PARM COMMAND
ECCCMD = $0D ;READ ECC BURST LENGTH COMMAND
RSBCMD = $0E ;READ SECTOR BUFFER COMMAND
WSBCMD = $0F ;WRITE SECTOR BUFFER COMMAND
BDGCMD = $E0 ;BUFFER DIAG COMMAND
DDGCMD = $E3 ;DRIVE DIAG COMMAND
CDGCMD = $E4 ;CONTROLLER DIAG COMMAND
RDLCMD = $E5 ;READ LONG COMMAND
WRLCMD = $E6 ;WRITE LONG COMMAND
;
RDCHK = $0B ;STATUS FOR OK READ
WRTCHK = $09 ;STATUS FOR WRITE OK
;
;+++++++++++++++++++++++++++++++++
;+ VECTORS TO ROUTINES +
;+++++++++++++++++++++++++++++++++
;
* = $F72C
READX JMP READ
WRITEX JMP WRITE
RESETX JMP RESET
SETPRX JMP SETPRM
RECALX JMP RECAL ;GO RECALIBRATE
SEEKX JMP SEEK ;GO DO SEEK
TDREDX JMP TDREDY ;TEST DRIVE READY
;SBDIAX JMP SBDIAG ;SECTOR BUFFER DIAGS
;DRDIAX JMP DRDIAG ;DRIVE DIAGS
CTDIAX JMP CTDIAG ;CONTROLLER DIAG
;FORBTX JMP FORBTK ;FORMAT BAD TRACK
;FORTRX JMP FORTRK ;FORMAT TRACK
;FORMAX JMP FORMAT ;FORMAT DRIVE
RETPRX JMP RETPRM ;RETURN DRIVE PARMS
;RDLONX JMP RDLONG ;READ LONG
;READSX JMP READSB ;READ SECTOR BUFFER
;WRLONX JMP WRLONG ;WRITE LONG
;WRTSBX JMP WRITSB ;WRITE SECTOR BUFFER
VERIFX JMP VERIFY ;VERIFY SECTOR
;
;+++++++++++++++++++++++++++++++++
;+ SUBROUTINES +
;+++++++++++++++++++++++++++++++++
;
;+++++++++++++++++++++++++++++++++
;+ READ BLOCKS +
;+ READ THE NUMBER OF BLOCKS IN +
;+ THE DCB INTO THE BUFFER. THIS +
;+ ROUTINE HANDLES THE READ LONG +
;+ AND READ SECTOR BUFFER ALSO. +
;+ +
;+ INPUT: DCB +
;+ OUTPUT: DATA READ INTO BUFFER +
;+ REGS ALL DESTROYED. +
;+++++++++++++++++++++++++++++++++
;
READSB LDA #RSBCMD ;READ SECTOR BUFFER
.BYT $2C ;JUST A BIT
RDLONG LDA #RDLCMD ;READ LONG DIAGNOSTIC
.BYT $2C ;AND A BIT
READ = * ;READ BLOCKS
LDA #RDCMD ;GET COMMAND
JSR SETUP ;GO DO HOUSEKEEPING
BCC RCMDOK ;GO IF WELL
ERJMP1 SEC
JMP TCOMP
RCMDOK JSR RDREDY ;READY TO READ
BCS ERJMP1 ;GO IF BAD
LDY #ZERO
LDX #TWO ;# PAGES PER SECTOR
SEI ;DISABLE FOR A BIT
RDLOOP LDA PORT0 ;READ A BYTE
STA (BUFPTR),Y ;PUT IN BUFFER
INY
BNE RDLOOP
INC BUFPTR+1 ;BUMP PAGE POINTER
DEX
BNE RDLOOP ;CONTINUE READING
LDA CMDBYT ;CHECK COMMAND
CMP #RDLCMD ;READ LONG?
BNE READON
JSR RDREDY ;CHECK IF READY TO READ
BCS ERJMP1
RDLLUP LDA PORT0 ;GET ECC FOR LONG
STA (BUFPTR),Y
INC BUFPTR ;BUMP PTR
BNE RDLX1
INC BUFPTR+1
RDLX1 INX
CPX #4
BNE RDLLUP
READON DEC BLKCTR ;SEE IF MORE BLOCKS
BNE RCMDOK
CLI ;ENABLE
;
TCOMP = * ;CHECK COMPLETION
LDA PORT1 ;OF OPERATION
AND #$0F ;CLEAR UNUSED
CMP #$0F ;WHAT WE WAITING FOR?
BEQ TCOMP1 ;GO FORWARD
DEC TIMER0 ;STEP DOWN ONE
BNE TCOMP ;GO IF NOT ZERO
DEC TIMER1 ;KNOCK OFF ANOTHER BIT
BNE TCOMP
DEC TIMER2 ;THIS IS THE BIG ONE
BNE TCOMP ;DON'T QUIT YET?
LDA #TIMOTU ;SET TIMEOUT STATUS
SEC
RTS ;GO BACK WITH ERROR
;
TCOMP1 = * ;READ ERROR STATUS
LDA PORT0 ;CHECK FOR ERROR
AND #$02 ;BIT ON
BEQ TCOMP4
LDA CMDBYT ;CHECK IF THIS IS SENSE
CMP #STCMD ;IF SO FAIL SENSE
BEQ SFAIL
STA ERRCMD ;SAVE THE FAILING CMD
LDA #STCMD ;ISSUE SENSE COMMAND
STA CMDBYT ;PUT IN DCB
JSR SNDCMD ;
BCC TCOMP2 ;GO ON IF OK
SFAIL LDA #SNFAIL ;SET SENSE FAILED
BNE RETERX
RETERR LDA ERRCMD ;GET FAILING CMD
RETERX SEC
RTS
TCOMP2 JSR RDREDY ;SEE IF READY
BCS SFAIL
LDY #0
TCOMP3 LDA PORT0 ;READ SENSE
STA SENSE,Y
INY
CPY #4 ;GOT IT ALL?
BNE TCOMP3
LDA SENSE ;CHECK SENSE
CMP #$98 ;CORRECTABLE ECC?
BNE TCOMPB
LDA #$0D ;READ THE ECC INFO
JSR SNDCMD
BCS SFAIL
JSR RDREDY
BCS SFAIL
LDA PORT0 ;GET ECC INFO
STA ECCINF
TCOMPB JMP TCOMP ;TEST COMPLETION
TCOMP4 LDA CMDBYT ;CHECK IF SENSE
CMP #STCMD
BEQ RETERR
CLC
RTS
;
;+++++++++++++++++++++++++++++++++
;+ THE WRITE ROUTINE SENDS THE +
;+ NUMBER OF BLOCKS SPECIFIED IN +
;+ THE DCB TO THE DISK CONTROLER.+
;+ WRITE SECTOR BUFFER AND WRITE +
;+ LONG ARE BOTH HANDLED HERE. +
;+ +
;+ INPUT: DCB +
;+ OUTPUT: DATA WRITTEN +
;+++++++++++++++++++++++++++++++++
;
WRLONG LDA #WRLCMD ;WRITE LONG DIAGNOSTIC
.BYT $2C ;BIT IT
WRITSB LDA #WSBCMD ;WRITE SECTOR BUFFER
.BYT $2C ;BIT AGAIN
WRITE = * ;WRITE BLOCKS
LDA #WRTCMD ;GET COMMAND
JSR SETUP ;GO DO HOUSEKEEPING
BCC WCMDOK ;GO IF WELL
ERJMP2 JMP ERJMP1
WCMDOK JSR WRREDY ;READY TO WRITE
BCS ERJMP2 ;GO IF BAD
LDY #ZERO
LDX #TWO ;# PAGES PER SECTOR
SEI ;DISABLE
WRLOOP LDA (BUFPTR),Y ;GET A BYTE
STA PORT0 ;WRITE TO CONTROLLER
INY
BNE WRLOOP
INC BUFPTR+1 ;BUMP PAGE POINTER
DEX
BNE WRLOOP ;CONTINUE READING
LDA CMDBYT ;CHECK FOR WRITE LONG
CMP #WRLCMD
BNE WRON ;GO ON IF NOT
JSR WRREDY ;READY TO WRITE?
BCS ERJMP2
WRLLUP LDA (BUFPTR),Y
STA PORT0
INC BUFPTR
BNE WRLX1
INC BUFPTR+1
WRLX1 INX
CPX #4
BNE WRLLUP
WRON DEC BLKCTR ;ANY MORE BLOCKS?
BNE WCMDOK ;YES THEN GETEM
CLI ;ENABLE
JMP TCOMP ;GO CHECK FOR COMPLETION
;
;+++++++++++++++++++++++++++++++++
;+ MISCELLANEOUS COMMANDS +
;+++++++++++++++++++++++++++++++++
;
FORBTK LDA #FBTCMD ;FORMAT BAD TRACK
.BYT $2C ;BIT
FORTRK LDA #FRTCMD ;FORMAT TRACK
.BYT $2C ;BIT
FORMAT LDA #FORCMD ;FORMAT DRIVE
CPX #'6' ;CHECK CODE IN X
BNE NOFRMT ;BYPASS IF NOT
CPY #'4' ;AND CHECK Y
BNE NOFRMT ;BYPASS NOT 4
PHA
LDA SECADR ;CLEAR SECTOR NUMBER
AND #$C0 ;SAVE CYL MSB
STA SECADR
PLA
.BYT $2C ;BIT
VERIFY LDA #VERCMD ;VERIFY
.BYT $2C ;BIT
RECAL = * ;RECALIBRATE THE DRIVE
LDA #RCACMD ;GET COMMAND BYTE
.BYT $2C ;BIT
SEEK LDA #SKCMD
.BYT $2C ;BIT
TDREDY LDA #TDRCMD ;TEST DRIVE READY
.BYT $2C ;BIT
SBDIAG LDA #BDGCMD ;SECTOR BUFFER DIAG
.BYT $2C ;BIT
DRDIAG LDA #DDGCMD ;DRIVE DIAG
.BYT $2C ;BIT
CTDIAG LDA #CDGCMD ;CONTOLLER DIAG
CMDOUT STA CMDBYT ;PUT IN COMMAND
CMP #FORCMD ;IS IT FORMAT?
BNE CMDOU1
JSR PRIMEF ;PRIME THE TIMERF
JMP CMDOU3
CMDOU1 CMP #DDGCMD ;DRIVE DIAG?
BNE CMDOU2
JSR PRIMEC ;PRIME TIMER FOR DIAG
JMP CMDOU3
CMDOU2 JSR PRIMEN ;SET NORMAL TIMER
CMDOU3 JSR SNDCMD ;SEND THE COMMAND
BCC CMDOU4 ;GO IF NO ERROR
NOFRMT SEC ;ENSURE CARRY SET
RTS ;RETURN IF ERROR
CMDOU4 JMP TCOMP ;GO TEST FOR COMPLETION
;+++++++++++++++++++++++++++++++++
;+ SETUP THE DCB, TIMERS, ETC. +
;+ FOR THE READ AND WRITE +
;+ ROUTINES. +
;+++++++++++++++++++++++++++++++++
;
SETUP = * ;SET UP PARMS FOR READ AND WRITE
STA CMDBYT ;PUT COMMAND IN DCB
LDA BUFADR ;GET BUFFER ADDRESS
STA BUFPTR ;SET UP LOW MEMORY
LDA BUFADR+1
STA BUFPTR+1
LDA BLKCNT ;GET NUMBER OF BLOCKS
STA BLKCTR ;PUT IN WORK AREA
JSR DEFSET ;SET STEP RATE IN DCB
SNDCMD = * ;SEND COMMAND
LDY #00 ;PRIME POINTER TO BEGIN
STA PORT2 ;SET COMMAND MODE
STY PORT3 ;ENSURE DMA STUFF OFF
JSR CMDRDY ;GO CHECK FOR READY
BCC SNDCOK ;GO IF WELL
LDA #SNDERR ;SET ERROR CODE
SEC
RTS
SNDCOK = * ;READY TO SEND DCB NOW
LDA DCB,Y
STA PORT0
INY
CPY #6 ;ALL OF IT?
BNE SNDCOK
CHKSOK CLC ;CLEAR CODE FOR NOW
RTS
;
;+ CHECK FOR READY TO READ OR WRITE
CMDRDY LDA #$0D ;CODE FOR CMD READY
.BYT $2C
RDREDY LDA #RDCHK ;GET CHECK BYTE
.BYT $2C ;ADD A BIT
WRREDY LDA #WRTCHK ;GET CHECK BYTE
STA CHKBYT ;SAVE BYTE TO COMPARE
LDY #0 ;CLEAR COUNTERS
STY TIMER0
STY TIMER1
WDLOOP LDA PORT1 ;GET STATUS BYTE
AND #$0F ;CLEAR GARBAGE
CMP CHKBYT ;IS WHAT WE WANT?
BEQ CHKSOK ;GO ON IF SO
DEC TIMER0 ;WAIT SOME
BNE WDLOOP
DEC TIMER1 ;AND SOME MORE DELAY
BNE WDLOOP
LDA #WATERR ;LOAD ERROR CODE
SEC ;SET ERROR
RTS ;RETURN WITH ERROR
;
;+++++++++++++++++++++++++++++++++
;+ GET THE DRIVE PARMS BY READ- +
;+ ING SECTOR 0 AND EXTRACTING +
;+ THE PARMS FROM A FORMATED +
;+ DRIVE INTO THE PARM TABLE +
;+ OF DRIVE CHARACTERISTICS. +
;+++++++++++++++++++++++++++++++++
;
GETPRM = * ;SET UP PTR TO PARM TAB
LDA PTFORM
BNE DEFSET ;EXIT IF FORMATTING
LDA #1
STA BLKCNT
LDA HDNUM
AND #$20 ;CLEAR ALL BUT DRIVE
STA HDNUM
LDA #0 ;SEC 0, CYL 0 ALSO
STA CYLNUM
STA SECADR
JSR DEFSET ;DEFAULT STEP RATE
JSR TDREDY ;CHECK IF EXISTS
BCS DEXITT ;GO IF NOT HERE
LDA #RDCMD ;SET UP FOR READ
JSR SETUP ;GET READY TO READ
BCS DEFSET ;RETURN IF BAD
JSR RDREDY
BCS DEFSET
LDY #0 ;PRIME COUNTER
LDX HDNUM ;GET DRIVE TABLE OFFSET
LDA PORT0 ;CHECK IF FORMATED
CMP #'C' ;IS IT C?
BNE NOINIT
INY
LDA PORT0
CMP #'6' ;IS IT SIX
BNE NOINIT
INY
LDA PORT0
CMP #'4' ;IS IT FOUR FOR C64?
BNE NOINIT
MVEPRM LDA PORT0
STA PT1,X
INX
INY
CPY #34 ;GOT EM ALL?
BNE MVEPRM
NOINIT LDX #2 ;FLUSH THE REST
NOINIL LDA PORT0
INY
BNE NOINIL
DEX
BNE NOINIL
JSR TCOMP ;CLEAR STATUS
DEFSET = *
LDA HDNUM
GETPRA = *
AND #$20 ;SEE IF 0 OR 1
TAX
DZEROX = *
LDA PTSTEP,X ;GET STEP RATE
STA SRATE ;IN DCB
CLC
DEXITT = * ;RETURN NO DRIVE
RTS ;RETURN OFFSET IN X
;
;+++++++++++++++++++++++++++++++++
;+ PERFORM THE RESET FUNCTION. +
;+ FALL THRU AND SET DRIVE PARMS.+
;+++++++++++++++++++++++++++++++++
;
RESET = * ;RESET THE CONTROLLER
STA PORT1 ;ISSUE RESET
LDY #0
LDX #0
RESET1 DEY
BNE RESET1
RESET2 DEX
BNE RESET2
LDA PORT1 ;CHECK IF RESET OK
AND #$3F ;MUST ALL BE OFF FOR OK
BEQ RESET3
LDA #$FE ;SET RESET ERROR
SEC
RTS
RESET3 = * ;FALL THRU TO SET PARMS
;+++++++++++++++++++++++++++++++++
;+ SET DRIVE PARMS FROM TABLE +
;+++++++++++++++++++++++++++++++++
;
SETPRM = * ;SET DRIVE PARMS
LDA #ZERO ;SET DRIVE 0 PARMS
STA HDNUM ;DRIVE NUMBER IN DCB
JSR SETPR1 ;GO DOIT
LDA #$20 ;DRIVE 1 PARM
SETPR1 STA HDNUM ;PUT IN DCB
JSR GETPRM ;GET PT POINTER
LDA #PRMCMD ;GET PARM COMMAND (0C)
STA CMDBYT ;PUT IN DCB
JSR SNDCMD ;GO SEND THE COMMAND
JSR WRREDY ;GO CHECK FOR READY
BCC SETPR2 ;IF NO ERROR GO
NODRIV LDA #$FF
RTS
SETPR2 LDY #8
JSR DEFSET ;SET POINTER TO TABLE
SETPR3 LDA PT1,X ;SEND OUT THE PARMS
STA PORT0
INX
DEY
BNE SETPR3
JMP TCOMP ;RETURN THRU CHECKER
;
;+++++++++++++++++++++++++++++++++
;+ RETURN THE PARMS TO THE CALLER+
;+ +
;+ INPUT: A - DRIVE # (0 OR 1) +
;+ +
;+ OUTPUT: A - NUMBER OF HEADS +
;+ X - MSB OF #CYLINDERS +
;+ Y - LSB OF #CYLINDERS +
;+++++++++++++++++++++++++++++++++
;
RETPRM ASL A ;SHIFT DRIVE NUMBER
ASL A
ASL A
ASL A
ASL A ;TO BIT 5
JSR GETPRA ;GET PARMS
LDA PTHEAD,X ;GET NUMBER OF HEADS
PHA ;SAVE IT
LDA PTCYLS+1,X ;GET LSB OF CYLINDERS
TAY
LDA PTCYLS,X ;GET MSB OF CYLINDERS
TAX
PLA ;RESTORE NUMBER HEADS
RTS ;RETURN TO CALLER
;
;
;+++++++++++++++++++++++++++++++++
;+ PRIME THE COUNTDOWN TIMER +
;+++++++++++++++++++++++++++++++++
;
PRIMEN LDA 1 ;NORMAL TIMEOUT
BNE PRIMET
PRIMEF LDA 255 ;FORMAT WAIT
BNE PRIMET
PRIMEC LDA 10 ;DIAG TIME
PRIMET STA TIMER2 ;TUCK AWAY
LDA #0 ;CLEAR THE OTHERS
STA TIMER0
STA TIMER1
RTS
;
HDINIT LDY #58 ;INIT PTABS AND DCB
LDA #0 ;ZERO THE AREAS
HDILUP STA PTFORM,Y
DEY
BPL HDILUP ;ZERO ALL
LDY #21 ;LENGTH OF DEFAULT PTAB
HDPLUP LDA DEFPT,Y ;GET A BYTE
STA PT1,Y
STA PT2,Y
DEY
BPL HDPLUP ;MOVE ALL
RTS ;END INIT
;
;+-------------------------------+
;+ THE DRIVE PARAMETER TABLE IS +
;+ FOLLOWS: +
;+ +
;+ LENGTH DESCRIPTION +
;+ WORD MAXIMUM NUMBER OF CYLS +
;+ BYTE NUMBER OF HEADS +
;+ WORD CYL FOR START REDUCED +
;+ WRITE CURRENT +
;+ WORD CYL FO RSTART PRCOMP +
;+ BYTE ECC LENGTH +
;+ BYTE STEP RATE +
;+3 BYTES TOTAL NUMBER SECTORS +
;+ BYTE 1ST BAD SECTOR SECTOR +
;+ BYTE 1ST SAT SECTOR +
;+ BYTE 1ST DIRECTORY SECTOR +
;+ BYTE 1ST DATA SECTOR +
;+ WORD LAST SAT BYTE +
;+ BYTE LAST SAT BIT +
;+ WORD SECTORS PER CYLINDER +
;+-------------------------------+
;+ THE TABLE WILL CONTAIN TWO +
;+ ENTRIES WHICH WILL BE FILLED +
;+ FROM SECTOR 0 OF THE DRIVE. +
;+ CONTROLLER CARD. THIS TABLE +
;+ WILL HAVE DEFAULT PARMS IN +
;+ CASE DRIVE ISN'T PROPERLY +
;+ FORMATED. +
;+++++++++++++++++++++++++++++++++
;
;**** NOTE: OBSERVE THE DBY ****
;+ OPS. THEY DEFINE TWO BYTES +
;+ WITH THE MSB FIRST AND LSB +
;+ LAST. OPPOSITE OF THE WOR OP.+
;+ CARE SHOULD BE USED IF CONVERT+
;+ INT TO ANOTHER ASSEMBLER FOR- +
;+ MAT. +
;********** ********* ***********
;
;+ DRIVE 0 PARM TABLE ENTRY +
DEFPT = * ;DEFAULT TABLE
DFCYLS .DBY 306 ;306 CYLINDERS
DFHEAD .BYT 2 ; 4 HEADS
DFREDU .DBY 200 ;REDUCED WRITE CURRENT BEGIN
DFPREC .DBY 200 ;START PRECOMP WRITE
DFECCL .BYT 11 ;ECC LENGTH
DFSTEP .BYT 5 ;STEP RATE
DFTOTS .BYT 0,0,100 ;NUMBER SECTORS
DFBADS .BYT 1 ;FIRST BAD SECTOR SECTOR
DFFSAT .BYT 5 ;FIRST SAT SECTOR
DFLSAT .BYT 6 ;LAST SAT SECTOR
DFFDIR .BYT 7 ;FIRST DIRECTORY SECTOR
DFFAVA .BYT 48 ;FIRST AVAILABLE SECTOR
DFSBYT .DBY 50 ;LAST SAT BYTE
DFSBIT .BYT 1 ;LAST SAT BIT
DFSCYL .WOR 34 ;SECTORS PER CYLINDER
;TEN BYTE VOLUME LABEL AREA
;
.END HARDISKZ.BIOS