changeset 1683:786453492c1e

Format doesn't multiply total sectors * bps if TYP.DSQ bit is clear
author boisy
date Sat, 31 Jul 2004 17:27:05 +0000
parents e2ac12787e55
children c0c47b363b5d
files level1/cmds/format.asm level1/modules/boot_idelba.asm level1/modules/makefile
diffstat 3 files changed, 30 insertions(+), 246 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/format.asm	Fri Jul 30 23:49:50 2004 +0000
+++ b/level1/cmds/format.asm	Sat Jul 31 17:27:05 2004 +0000
@@ -3,6 +3,13 @@
 *
 * $Id$
 *
+* Notes:
+*   1. If the TYP.DSQ bit in IT.TYP is clear, then the total number
+*      of sectors is NOT multiplied by the bytes per sector.  This
+*      means that descriptors using partition offsets will need to
+*      fill IT.CYL, IT.SID and IT.SCT with values that reflect the
+*      number of 256 byte sectors on the disk.
+*
 * Edt/Rev  YYYY/MM/DD  Modified by
 * Comment
 * ------------------------------------------------------------------
@@ -60,7 +67,6 @@
 maxdns   rmb   1
 tpi      rmb   1
 numsides rmb   1
-*u0014    rmb   1
 ncyls    rmb   2                total number of cylinders
 u0017    rmb   1
 u0018    rmb   1
@@ -129,21 +135,26 @@
 *val2     fdb   $0000
 *val3     fdb   $0000
 hdsdat   fdb   $80E5,$80E5,$0000
+* Single Density Track Data
 sgtdat   fdb   $0100,$28FF,$0600,$01FC,$0CFF,$0000
+* Single Density Sector Data
 sgsdat   fdb   $0600,$01FE,$0400,$01F7,$0AFF,$0600
          fdb   $01FB,$80E5,$80E5,$01F7,$0AFF,$0000
          fcb   $FF
 sgfidp   fdb   $0043
 sgsize   fdb   $0128
 
-* Double Density Data
+* Double Density Track Data
 dbtdat   fdb   $504E,$0C00,$03F6,$01FC,$204E,$0000
+* Double Density Sector Data
 dbsdat   fdb   $0C00,$03F5,$01FE,$0400,$01F7,$164E
          fdb   $0C00,$03F5,$01FB,$80E5,$80E5,$01F7
          fdb   $164E,$0000
          fcb   $4E
 dbfidp   fdb   $0090
 dbsize   fdb   $0152
+
+* Double Density Color Computer Format (Disk BASIC)
 dctdat   fdb   $204E,$0000,$0C00,$03F5,$01FE,$0400
          fdb   $01F7,$164E,$0C00,$03F5,$01FB,$80E5
          fdb   $80E5,$01F7,$184E,$0000
@@ -242,7 +253,6 @@
          bcs   Exit             exit if error
          ldb   PD.SID-PD.OPT,x  number of surfaces
          stb   <numsides        save it
-*         stb   <u0014           save it
          ldb   PD.SToff-PD.OPT,x foreign disk format?
          beq   L0143            no,
          tfr   b,a              yes, get copy
@@ -260,7 +270,7 @@
          stb   <mfm             save double-density (Yes/No)
          stb   <maxdns          save it again
          ldb   ,s               get saved PD.DNS byte
-         lsrb                   checking
+         lsrb                   now 96/135 TPI bit is in bit pos 0
          pshs  b                save it
          andb  #$01             tpi (0=48, 1=96/135)
          stb   <tpi             save it
@@ -268,8 +278,8 @@
          lsrb                   
          andb  <maxdns
          stb   <u004C
-         puls  b
-         stb   <u004D
+         puls  b		get original PD.DNS byte
+         stb   <u004D		store it
          beq   L0169
          stb   <u004B
          clr   <stoff
@@ -293,7 +303,7 @@
          stb   <clustsiz        save it
          stb   <sectmode        and sector mode
 *** ADDED CODE -- BGP.  CHECK FOR PRESENCE OF SS.DSIZE
-         lda   PD.TYP-PD.OPT,x	get type byte
+         lda   <dtype		get type byte
          bita  #TYPH.DSQ	drive size query bit set?
          beq   nogo@		no, don't bother querying the drive for its size
          lda   <diskpath        get disk path number
@@ -311,7 +321,6 @@
 chs@
          stx   <ncyls           save cylinders
          stb   <numsides        save sides
-*         stb   <u0014           ????
          sty   <sectors         save sectors/track
          sty   <sectors0        save sectors/track 0
 nogo@
@@ -636,7 +645,7 @@
          stx   <sectdata        sector data pointer
          ldb   <dtype           get disk drive type
          bitb  #TYP.HARD+TYP.NSF hard disk or non-standard type?
-         bne   L0323            no, check track data
+         bne   L0323            yes, branch
          tst   <u004D           
          beq   L031B
          leax  >dctdat,pcr
@@ -677,6 +686,9 @@
          adcb  #$00
          stb   <totsects
 ack@
+         lda   <dtype		get type byte
+         bita  #TYPH.DSQ	drive size query bit set?
+         beq   mlex@            branch if so (we don't take bps into account here)
 **** We now multiply totsects * the bytes per sector
          dec   <bps		decrement bytes per sector (8=7,4=3,2=1,1=0)
          beq   mlex@		exit out ofloop if zero
@@ -832,16 +844,16 @@
          rts                    yes, return
 
 ********************************************************************
-*
+* Writes AA bytes of BB to X (byte pairs are in tables above)
 ********************************************************************
 
 L044E    ldy   <u000E
-L0451    ldd   ,y++
-         beq   L046B
-L0455    stb   ,x+
-         deca  
-         bne   L0455
-         bra   L0451
+L0451    ldd   ,y++			get two bytes at Y
+         beq   L046B			branch if zero (end)
+L0455    stb   ,x+			store B at X and post increment
+         deca  				decrement count
+         bne   L0455			continue if not done
+         bra   L0451			else get next byte pair
 L045C    lda   <dtype			get drive's PD.TYP
          bita  #TYP.HARD+TYP.NSF	hard disk or non-standard format?
          beq   L046C			branch if neither
@@ -1585,7 +1597,7 @@
 *DSided   fcc   "Double sided? "
 NumGood  fcc   "Number of good sectors: $"
 NGoodLen equ *-NumGood
-HDFmt    fcc   "this is a HARD disk - are you sure? "
+HDFmt    fcc   "This is a HARD disk - are you sure? "
 *HDFmt    fcc   "WARNING: You are formatting a HARD Disk.."
 *         fcb   C$LF
 *         fcc   "Are you sure? "
--- a/level1/modules/boot_idelba.asm	Fri Jul 30 23:49:50 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-********************************************************************
-* Boot - IDE Boot Module (LBA Mode)
-*
-* $Id$
-*
-* Edt/Rev  YYYY/MM/DD  Modified by
-* Comment
-* ------------------------------------------------------------------
-*   ?      1994/06/25  Alan DeKok
-* Diassembled.
-*
-*   6      1999/08/17  Paul T. Barton
-* Redone for IDE.
-*
-*   7      2002/06/27  Boisy G. Pitre
-* Added use of LSN bits 23-16.
-*
-*   7r1    2004/05/12  Boisy G. Pitre
-* Optimized, made to wait on !BUSY and DRDY, added slowdown POKE
-* for Fujitsu 128MB CF (may be temporary)
-
-         nam   Boot
-         ttl   IDE Boot Module (LBA Mode)
-
-         IFP1
-         use   defsfile
-         ENDC
-
-tylg     set   Systm+Objct
-atrv     set   ReEnt+rev
-rev      set   $00
-edition  set   7
-
-* Disassembled 94/06/25 11:37:47 by Alan DeKok 
-* ReDone by Paul T. Barton 99/08/17, for IDE 
-* 
-Port     equ   $FF50      still leaves room for SSPak & SSP & MPI 
-RData    equ   0          data 0..7 
-WData    equ   0          data 0..7 
-ErrReg   equ   1          Has the errors 
-SecCnt   equ   2          always =1 
-SecNum   equ   3
-CylLow   equ   4
-CylHigh  equ   5
-DevHead  equ   6          0,1,0,DEV,0,0,0,0 
-Status   equ   7          Results of read/write 
-CmdIde   equ   7          Commands 
-Latch    equ   8          Latch
-
-ReadCmd  equ   $20
-Diagnos  equ   $90
-
-BusyBit  equ   %10000000  BUSY=1 
-DrdyBit  equ   %01000000  drive ready=1 
-DscBit   equ   %00010000  seek finished=1 
-DrqBit   equ   %00001000  data requested=1 
-ErrBit   equ   %00000001  error_reg has it 
-RdyTrk   equ   %01010000  ready & over track 
-RdyDrq   equ   %01011000  ready w/ data 
-Master   equ   %11100000  LBA MODE 
-Slave    equ   %11110000  LBA MODE 
-
-
-WhchDriv equ   Master     Drive to use (Master or Slave)
-
-         mod   eom,name,tylg,atrv,start,size
-
-* on-stack buffer to use 
-         org   0
-btmem    rmb   2
-btsiz    rmb   2
-btloc    rmb   3
-size     equ   .
-
-name     fcs   /Boot/
-         fcb   edition
-
-start          
-         orcc  #IntMasks  ensure IRQ's are off. 
-         leas  -size,s
-
-         clr   >$FF40     stop the disk 
-*         lbsr  Init 
-
-         ldd   #$0001     request one byte (will round up to 1 page) 
-         os9   F$SRqMem   request the memory 
-         bcs   L00B0      exit on error 
-
-* U is implicitly the buffer address to use 
-
-         clrb  
-         ldx   #$0000     X=0: got to sector #$0000 
-         bsr   GetSect    load in LSN0, U = buffer start 
-         bcs   L00B0
-
-         IFGT  Level-1
-         lda   #'0        --- loaded in LSN0 
-         jsr   <D.BtBug   --- 
-         ENDC  
-
-         ldd   <DD.BSZ,u  size of the bootstrap file 
-         std   btsiz,s    save it on the stack (0,s is junk) 
-         lda   <DD.BT,u   get starting sector bits 23-16
-         ldx   <DD.BT+1,u get starting sector of the bootstrap file 
-         sta   btloc,s
-         stx   btloc+1,s
-
-         ldd   #256       one page of memory 
-         os9   F$SRtMem   return the copy of LSN0 to free memory 
-
-         ldd   btsiz,s    get size of boot memory to request 
-         IFGT  Level-1
-         os9   F$BtMem    ask for the boot memory 
-         ELSE  
-         os9   F$SRqMem   ask for the boot memory 
-         ENDC  
-         bcs   L00AE      no memory: exit with error 
-
-         std   btsiz,s
-         stu   btmem,s    save start address of memory allocated 
-         ldd   btsiz,s    and the size of the boot memory 
-         beq   L00B0      if no memory allocated, exit 
-         pshs  d          save off temp size
-SectLp         
-         ldb   btloc+2,s
-         bsr   GetSect    read one sector 
-         bcs   L00AE      if there's an error, exit 
-
-         IFGT  Level-1
-         lda   #'.        dump out a period for boot debugging 
-         jsr   <D.BtBug   do the debug stuff 
-         ENDC  
-
-         leau  256,u
-         leax  1,x        go to the next sector 
-         bne   Sect2
-         incb  
-         stb   btloc+2,s
-Sect2          
-         ldd   ,s
-         subd  #256       take out one sector, need value in B, too. 
-         std   ,s
-         bhi   SectLp     loop until all sectors are read 
-
-L00A7    clrb             clear carry 
-         ldd   btsiz+2,s
-
-L00AE    leas  $02,s      kill D off of the stack 
-         ldx   btmem,s
-L00B0    leas  size,s     remove the on-stack buffer 
-L00BA    rts   
-
-Address  fdb   Port
-
-* GetSect: read a sector off of the disk 
-* Entry: B,X = sector number to read 
-* Memory: U = where to put it 
-
-GetSect        
-         IFGT  Level-1
-         clr   >$FFD8
-         ENDC
-         pshs  b,x,y
-         ldy   <Address,pcr grab the device address 
-ChkBusy  tst   Status,y
-         bmi   ChkBusy    if =1 then loop 
-
-         lda   #WhchDriv
-         sta   DevHead,y  0L0d/0hhh device=LBA 
-RdyHuh1  lda   Status,y   is IDE ready for commands? 
-         anda  #BusyBit+DrdyBit   ready ? 
-         cmpa  #DrdyBit
-         bne   RdyHuh1    loop until Drdy=1 and Busy=0
-
-         lda   #$01       only one at a time 
-         sta   SecCnt,y   only one at a time 
-         stb   CylHigh,y  bits 23-16 
-         tfr   x,d        sector number to read 
-         sta   CylLow,y   hi-byte 
-         stb   SecNum,y
-         leax  ,u         where to put the sector 
-         lda   #ReadCmd   read one sector 
-         sta   CmdIde,y   finish process 
-
-Blk2           
-         lda   Status,y   is IDE ready to send? 
-         anda  #DrqBit    DRQ, data request 
-         beq   Blk2       loop while DRQ =0 
-
-         clr   ,-s
-BlkLp          
-         lda   RData,y    A <- IDE 
-         ldb   Latch,y
-         std   ,x++       into RAM 
-         inc   ,s
-         bpl   BlkLp      go get the rest 
-b@       lda   RData,y	  read remainig 256 bytes
-         dec   ,s
-         bne   b@
-         puls  b
-
-*         lda   Status,y   check for error-bit 
-         clrb  
-         IFGT  Level-1
-         clr   >$FFD9
-         ENDC
-         puls  b,x,y,pc
-* ------------------------------------------ 
-
-*Init           
-*         pshs  d,y
-*         ldy   <Address,pcr
-*         bsr   ChkBusy    could be spinning up... 
-*         lda   #Diagnos   hits all drives 
-*         sta   CmdIde,y   ./ 
-*         bsr   ChkBusy    wait 'til both done 
-*         clrb             no errors 
-*         puls  d,y,pc
-
-         IFGT  Level-1
-Pad      fill  $39,$1D0-3-*
-         ENDC
-
-
-         emod  
-eom      equ   *
-         end
-
--- a/level1/modules/makefile	Fri Jul 30 23:49:50 2004 +0000
+++ b/level1/modules/makefile	Sat Jul 31 17:27:05 2004 +0000
@@ -15,7 +15,7 @@
 TPB		= $(3RDPARTY)/booters
 
 BOOTERS		= boot_1773_6ms boot_1773_30ms \
-		boot_burke boot_idelba boot_rampak boot_wd1002
+		boot_burke boot_rampak boot_wd1002
 BOOTTRACK	= rel $(BOOTERS)
 KERNEL		= krn krnp2
 SYSMODS		= ioman init sysgo_dd sysgo_h0