Mercurial > hg > Members > kono > nitros9-code
changeset 1184:37c9e0e58367
Most booters moved to OS-9 directories
author | boisy |
---|---|
date | Fri, 30 May 2003 20:50:06 +0000 |
parents | ba75fe74449d |
children | c845c2f0ab76 |
files | 3rdparty/booters/boot_burke.asm 3rdparty/booters/boot_ide.asm 3rdparty/booters/boot_rampak.asm 3rdparty/booters/boot_scsi.asm 3rdparty/booters/boot_wd1002.asm 3rdparty/booters/makefile |
diffstat | 6 files changed, 7 insertions(+), 1385 deletions(-) [+] |
line wrap: on
line diff
--- a/3rdparty/booters/boot_burke.asm Wed May 28 20:49:30 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -******************************************************************** -* Boot - Burke & Burke Boot Module -* -* $Id$ -* -* Burke & Burke boot module... needs to be patched for OS9Boots that are -* far into the device. -* Track is the literal cylinder #, Cylinder would be including all heads -* of that track -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ - - nam Boot - ttl Burke & Burke Boot Module - - org 0 -buffptr rmb 2 Pointer to sector buffer in memory -numcyl rmb 2 Number of tracks for drive geometry init -sechead rmb 2 # of logical sectors/physical sector -numhead rmb 1 # of heads (sides) -seccyl rmb 2 # of sectors/cylinder (# of heads*sectors per head) -track rmb 2 Cylinder number last calculated ($9 - $A) -head rmb 1 Drive/head number (drive always 0) -sector rmb 1 Sector number (0-63) -vars equ 13-buffptr Size of stack variables buffer - - - ifp1 - use defsfile - endc - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $02 -edition set 2 - - mod eom,name,tylg,atrv,start,size - -u0000 rmb 0 -size equ . - -name fcs /Boot/ - fcb edition - -start ldb >MPI.Slct Set up Multipak properly for us - lda #$10 - mul - ldb #$11 - mul - stb >MPI.Slct - leas -vars,s Reserve work area on stack of 13 bytes - tfr s,u U points to beginning of 13 byte buffer - pshs u,y,x,b,a Preserve registers - ldd #$0200 512 bytes for each read from XT-GEN - std numcyl,u # of cyls on drive - sta sechead+1,u # of sectors/head - sta numhead,u # of heads on drive - os9 F$SRqMem Request 512 byte buffer from OS9P1 - lbcs L00B6 Error - tfr u,d d=Starting address of 512 byte block - ldu $06,s Get back pointer to 13 byte buffer - std buffptr,u Preserve buffer pointer - - clr >$FF51 Reset controller - - clr >$FF53 Set controller mode to 0 (part of init) - lbsr drvtype Set drive geometry (type of drive) - clrb Set initial LSN to 0 - ldx #$0000 - lbsr GetSect Figure out track/head/sector for LSN0 - bcs L00B6 Error occured in read - ldy buffptr,u Get buffer pointer - ldd DD.NAM+PD.CYL,y Get real # cylinders on drive - std numcyl,u Preserve - ldd DD.NAM+PD.SCT,y Get real # sectors/track - std sechead,u Preserve - lda DD.NAM+PD.SID,y Get real # heads - sta numhead,u Preserve - leay DD.BT,y Point to OS9Boot information - ldd DD.BSZ-DD.BT,y Get size of OS9Boot - std ,s Preserve on stack - ldb DD.BT-DD.BT,y Get MSB of starting LSN of OS9Boot - ldx DD.BT-DD.BT+1,y Get LSW of starting LSN of OS9Boot - pshs x,b Push on stack - lbsr drvtype Set up drive for real drive specs - ldd #$0200 Get size of our buffer - ldu buffptr,u Get pointer to our 512 byte buffer - os9 F$SRtMem Deallocate our old sector buffer - ldd $03,s Get back size of OS9Boot - inca Increase size by 1 block (256 bytes) - ifeq Level-1 - os9 F$SRqMem - else - os9 F$BtMem Allocate memory for boot file - endc - bcs L00B0 Error - stu $05,s Preserve pointer to start of OS9boot memory - ldu $09,s Get back pointer to local variables - ldd $05,s Get pointer to start of OS9Boot memory - std buffptr,u Move disk buffer pointer to there - ldd $03,s Get size of bootfile - beq L00A9 If zero, do someting - pshs b,a Otherwise push on stack -ReadBt std ,s Store # bytes left in boot on stack - ldb $02,s Get MSB of start sector of boot - ldx $03,s Get LSW of start sector of boot - bsr GetSect Convert to track/head/sector - bcs L00B4 If an error in getting, do something - inc buffptr,u Bump up buffer pointer by a page - ldx $03,s Bump up LSW of sector number - leax $01,x - stx $03,s And put it back - bne L00A0 If no carry over needed, proceed - inc $02,s Bump up MSB of sector number -L00A0 ldd ,s Get current boot size left to do - subd #$0100 Subtract 256 from it - bhi ReadBt If not zero yet, keep reading - leas $02,s Eat our temporary size left -L00A9 leas $03,s Eat our current LSN to get - clrb Clear carry (No error) - puls b,a pull off multipak settings (?) - bra BtExit -L00B0 leas $03,s Purge stack - bra L00B6 -L00B4 leas $05,s Purge stack - -L00B6 leas $02,s Purge stack - -BtExit pshs a - lda #$FF - sta >$FF51 Reset controller - sta >MPI.Slct Reset multipak - sta >$FFD9 Double speed on - puls u,y,x,a Get exit parameters for Boot - leas vars,s Reset stack - rts Exit from Boot - -* Get 512 byte sector from controller -* Entry X:B = 24 bit Logical sector number to get - -GetSect pshs x,b Preserve registers - ldx #$FFFF (Init X so it will be 0 in loop) - -* 24 bit divide routine. Stack=LSN (3 bytes) -* Entry: u=pointer to our local variable list - -cyldiv leax $01,x # of loops through subtract - ldd $01,s Get original x (0) - subd seccyl,u Subtract # sector/cylinder - std $01,s Preserve it back - ldb ,s Continue subtract with borrow for 24 bit - sbcb #$00 - stb ,s - bcc cyldiv If not trying to borrow again, continue - stx track,u Got track # - ldd $01,s Reset value to last in loop - addd seccyl,u - clr head,u Set head # to 0? -hddiv inc head,u Increase head #? - subd sechead,u Subtract # sectors/head? - bcc hddiv Continue subtracting until it wraps - dec head,u Adjust head to not include wrap - addd sechead,u Adjust leftover to not include wrap - lsrb Divide b by 2 (256 byte sector to 512) - stb sector,u Preserve sector # - leas $03,s Clear stack of 24 bit number - - pshs cc Preserve odd sector flag (carry bit) - - bsr cmdstrt Set up controller for new command - lda #$08 Read sector command - ldb head,u Drive/head byte (Drive always 0) - bsr dblsend Send to controller - ldd track,u Get msb of track - lsra Move right 2 bits into left two for the - rora controller - rora - ora sector,u mask in the sector number into remaining 6 bits -* ldb track+1,u Get LSB of track - bsr dblsend Send to controller - ldd #$0100 1 sector to read/no error correction/3 ms step - bsr dblsend Send that to controller - ldx buffptr,u Get pointer to sector buffer -* new code is here - puls cc Get back odd sector 1/2 indicator - bcc normal Even sector, use 1st half - bsr Eat256 Odd sector, use 2nd half - bsr Read256 Read 256 bytes off of controller - lbra chkcmplt See if command is complete -normal bsr Read256 Read 1/2 of sector - bsr Eat256 Eat half of sector - lbra chkcmplt See if command is complete - -Eat256 clrb Eat 256 bytes off of controller -Eatlp lbsr nxtready Get byte from controller - decb counter - bne Eatlp Keep eating until 256 bytes done - clrb - rts - -* Read 256 bytes from controller -* Entry: X=Pointer to current position in 512 physical sector buffer - -Read256 clrb Set counter for 256 byte read -ReadLp lbsr nxtready Go get a byte from controller - sta ,x+ Put in buffer - decb keep doing until all 256 are read - bne ReadLp - -middle clrb Clear carry for no error & return - rts - -* Send 2 bytes to the controller -* Entry: a=1st byte to send -* b=2nd byte to send - -dblsend pshs b,a Preserve d for a moment - bsr sendbyte Go send what is in a to controller - tfr b,a Send what was in b to the controller - bsr sendbyte - puls pc,b,a Return with a and b intact - -* Sends a byte to the controller when it is ready for it -* Entry: a=byte to send - -sendbyte pshs a Preserve a for a moment -waitsend bsr stable Make sure status register is stable and get it - anda #%00001011 Mask out bits - cmpa #$09 Is it expecting next byte of data packet? - bne waitsend - puls a Yes, get the byte we are sending next - sta >$FF50 Store in data register - rts - -* Sends out command packet (6 bytes). Hard coded for drive 0, head 0, -* track 0, sector 0, interleave 0, no error correction, 3 ms step rate - -cmdpckt pshs a Preserve command for a moment - bsr cmdstrt Go initialize controller for command start - puls a Get back command byte - clrb 1st option byte to 0 - bsr dblsend Send both to controller - clra - bsr dblsend Send 4 more 0's to controller - bsr dblsend (sent command byte and 5 zero bytes for command - rts packet) - -cmdstrt bsr stable - anda #%00001001 Mask out all but bits 0 and 3 - bne cmdstrt If controller command is not complete or expecting - clr >$FF52 data, keep reading status register until it is ready - rts Otherwise initialize command start - -* Make sure controller's status register is stable - -stable lda >$FF51 Get status from controller - cmpa >$FF51 Keep getting until it stabilizes - bne stable - rts - -* Set the drive type (set to 512 track - may be the error) -* Using the initialize drive geometry command -* Exit: Carry set if non-recoverable error - -drvtype lda #$0C Initialize drive geometry command - bsr cmdpckt Go init - ldd numcyl,u Get # of cylinders on media - bsr dblsend Send it out (indicates drive has 512 tracks) - ldb sechead+1,u Get # of sectors/head - lda numhead,u Get # of heads on media - lsrb Divide OS9 sectors by 2 - bsr sendbyte Send out # of heads for drive geometry - lslb Multiply WD sectors by 2 to get OS9 sectors again. - mul - std seccyl,u # sectors per cylinder (all heads on a track) - ldd numcyl,u Get # of tracks back - subd #$0001 Reduce write track=last track-1 - bsr dblsend Send out reduced write track # - bsr dblsend Also use as write precomp track # - lda #$04 Maximum ECC burst length correctable=4 - bsr sendbyte Send it out - -* Make sure command has completed -* Exit: Carry set if controller reported a non-recoverable error -* Carry clear if everything went fine - -chkcmplt bsr stable When status register is stable get it - anda #%00000111 Keep checking until controller indicates that - cmpa #%00000111 command completion code is ready to be read - bne chkcmplt - lda >$FF50 Get command completion code - bita #%00000010 Was there in error in completing the command? - beq noerror Nope, everything fine setting drive geometry - lda #$03 Error, Request Sense Status from the drive - bsr cmdpckt send Request Sense Status code - bsr nxtready Go get response from controller - anda #%00111111 Mask out all but error type and error code - pshs a Preserve it for a second - bsr eat2 Go eat next 4 bytes from controller (remaining 3 - bsr eat2 from Sense Status & command completion code) - puls a Get back original error byte - tsta No error occured? - beq noerror No error; exit without error - cmpa #%00011000 Type 1, error 8 (correctable data error)? - beq noerror Yes, return without error - comb Set carry to indicate error - rts return -noerror clrb - rts - -* Reads two byte from controller without caring what they are - -eat2 bsr nxtready - -* Waits until next byte coming from controller is ready, then gets it -* Exit: a=byte from controller - -nxtready bsr stable Make sure status register is stable and get it - anda #%00001011 Controller ready to send me next byte? - cmpa #%00001011 - bne nxtready Nope, keep waiting - lda >$FF50 Yes, get byte and return - rts Padding to get $1D0 Size -* Pad to $1d0 bytes exactly -Pad fill $39,$1D0-3-* - - emod -eom equ * - end
--- a/3rdparty/booters/boot_ide.asm Wed May 28 20:49:30 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -******************************************************************** -* Boot - IDE Boot Module (LBA Mode) -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* ? Disassembled AD 94/06/25 -* 6 Redone for IDE PTB 99/08/17 -* 7 Added use of LSN bits 23-16 BGP 02/06/27 - - nam Boot - ttl IDE Boot Module (LBA Mode) - - ifp1 - use defsfile - endc - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set 2 -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 $FF70 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 implicitely the buffer address to use - - clrb - ldx #$0000 X=0: got to sector #$0000 - bsr GetSect load in LSN0, U = buffer start - bcs L00B0 - - IFNE NitrOS9 - 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 - IFEQ Level-2 - 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 - - IFNE NitrOS9 - 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 - pshs b,x,y - ldy <Address,pcr grab the device address - bsr ChkBusy - -RdyHuh1 - lda Status,y is IDE ready for commands? - anda #DrdyBit ready ? - beq RdyHuh1 loop until Drdy =1 - - lda #WhchDriv - sta DevHead,y 0L0d/0hhh device=LBA - 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 - puls b - - lda Status,y check for error-bit - clrb - puls b,x,y,pc -* ------------------------------------------ - -ChkBusy - lda Status,y - anda #BusyBit 1xxx-xxxx - bne ChkBusy if =1 then loop - rts exit when BUSY =0 - -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 - - IFEQ Level-2 -Pad fill $39,$1D0-3-* - ENDC - - - emod -eom equ * - end
--- a/3rdparty/booters/boot_rampak.asm Wed May 28 20:49:30 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -******************************************************************** -* Boot - Disto RAMPak Boot Module -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 5 Created ADK -* 6 Fixed small bugs, improved speed BGP 98/10/20 - - nam Boot - ttl Disto RAMPak Boot Module - -* Disassembled 94/06/25 11:37:47 by Alan DeKok - - ifp1 - use defsfile - endc - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set $00 -edition set 6 - - mod eom,name,tylg,atrv,start,size - -* on-stack buffer to use - org 0 -size equ . - -name equ * - fcs /Boot/ - fcb edition - -start orcc #IntMasks ensure IRQ's are off. - - pshs x,d save 4 bytes of junk -R.D equ 1 -R.X equ 3 - - lda >MPI.Slct get current slot - pshs a save off - lda >PakSlot,pcr get multipak slot number - bmi cont if >127, invalid slot number - anda #$03 force it to be legal - ldb #$11 - mul put it into both nibbles - stb >MPI.Slct go to the desired slot - -cont ldd #$0001 request one byte (will round up to 1 page) - os9 F$SRqMem request the memory - bcs L00AE exit on error -* U is implicitely the buffer address to use - - ldx #$0000 X=0: got to sector #$0000 - bsr GetSect load in LSN0, and point Y to the buffer - bcs L00AE - - ldd <DD.BSZ,u size of the bootstrap file - std R.D,s save it on the stack (0,s is junk) - ldx <DD.BT+1,u get starting sector of the bootstrap file - - pshs x save the starting sector number - ldd #$0100 one page of memory - os9 F$SRtMem return the copy of LSN0 to free memory - - ldd R.X,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 - puls x restore the starting sector number - bcs L00AE no memory: exit with error - - stu R.X,s save start address of memory allocated - std R.D,s and the size of the boot memory - beq L00A7 if no memory allocated, exit - -SectLp pshs x,d save sector #, size of boot - bsr GetSect read one sector - bcs L00AC if there's an error, exit - puls x,d restor sector, size of boot - - leau $0100,u go up one page in memory - leax $01,x go to the next sector - subd #$0100 take out one sector, need value in B, too. - bhi SectLp loop until all sectors are read - -L00A7 puls a - sta >MPI.Slct - clrb clear carry - puls d return size of boot memory to user - bra L00B0 and go exit - -L00AC leas $04,s remove X,D off of stack -L00AE puls a - sta >MPI.Slct - leas $02,s kill D off of the stack - -L00B0 puls x restore start address of memory allocated -* leas size,s remove the on-stack buffer - clr >DPort stop the disk -L00BA rts - -* GetSect: read a sector off of the disk -* Entry: X = sector number to read -GetSect pshs d,x,y - ldy >Address,pcr grab the device address - tfr x,d move 16 bit LSN into 2 8-bit registers - sta 2,y save HB LSN - stb 1,y save LB LSN - leax ,u get buffer address to write into - clrb and start out at byte zero - -ReadLp stb ,y save byte number - lda 3,y grab the byte - sta ,x+ save in the buffer - incb go to the enxt byte - bne ReadLp - clrb no errors - puls d,x,y,pc restore registers and return - - ifgt Level-1 -Pad fill $39,$1D0-6-* - endc - -Address fdb $FF40 address of the device to boot from -PakSlot fcb $01 multipak slot number - - emod -eom equ * - end
--- a/3rdparty/booters/boot_scsi.asm Wed May 28 20:49:30 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +0,0 @@ -******************************************************************** -* Boot - SCSI Boot Module -* -* $Id$ -* -* This module allows booting from a hard drive that uses HDB-DOS -* and is controlled by a TC^3, Ken-Ton or Disto SCSI controller. -* -* It was later modified to handle hard drives with sector sizes -* larger than 256 bytes, and works on both 256 byte and larger drives, -* so it should totally replace the old SCSI boot module. -* -* Instructions followed by +++ in the comment field were added for this fix. -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 1 Original Roger Krupski distribution version -* 1b Added code to allow booting from any sector BGP 96/??/?? -* size hard drive -* Merged Ken-Ton and TC^3 module source BGP 02/05/01 - - - nam Boot - ttl SCSI Boot Module - - IFP1 - use defsfile - ENDC - -tylg set Systm+Objct -atrv set ReEnt+rev -rev set 2 -edition set 1 - -* Disto Hard Disk II Interface registers - IFNE HDII -dataport equ $FF58 -status equ dataport-2 -select equ dataport-1 -reset equ dataport-2 - ENDC - -* Disto 4-N-1 Hard Disk Interface registers - IFNE D4N1 -dataport equ $FF5B -status equ dataport-2 -select equ dataport-1 -reset equ dataport-2 - ENDC - -* Hard Disk Interface registers for the Ken-Ton and RGB HDI - IFNE KTLR -dataport equ $FF74 -status equ dataport+1 -select equ dataport+2 -reset equ dataport+3 - ENDC - - IFNE TC3 -dataport equ $FF74 -status equ dataport+1 -select equ dataport+1 - ENDC - -* Status register equates - IFNE DISTO -req equ $80 -busy equ $01 -msg equ $04 -cmd equ $40 -inout equ $20 -ack equ $02 -sel equ $00 - ELSE -req equ $01 -busy equ $02 -msg equ $04 -cmd equ $08 -inout equ $10 -ack equ $20 -sel equ $40 -rst equ $80 - ENDC - -*SCSI common command set -c$rstr equ 1 -c$rdet equ 3 -c$rblk equ 8 -c$wblk equ 10 - -* Optional command -c$ststop equ $1b park head - -* misc -errsta equ 2 -bsybit equ 8 - -**************************************************** -bootdrv equ 0 -**************************************************** - - mod eom,name,tylg,atrv,start,size - -* Data equates; subroutines must keep data in stack -v$cmd rmb 1 -v$addr0 rmb 1 -v$addr1 rmb 2 -v$blks rmb 1 -v$opts rmb 1 -v$error rmb 4 - -blockloc rmb 2 pointer to memory requested -blockimg rmb 2 duplicate of the above -bootloc rmb 3 sector pointer; not byte pointer -bootsize rmb 2 size in bytes -size equ . - -name fcs /Boot/ - fcb edition - -start clra - ldb #size -clean pshs a - decb - bne clean - tfr s,u get pointer to data area - pshs u save pointer to data area - - lda #$d0 forced interrupt; kill floppy activity - sta $FF48 command register - clrb -pause decb - bne pause - lda $FF48 clear controller - clr $FF40 make sure motors are turned off - IFGT Level-1 - sta $FFD9 fast clock - ENDC - -* Recalibrate hard drive - lbsr restore - -* Request memory for LSN0 - ldd #1 - os9 F$SRqMem request one page of RAM - bcs error - bsr getpntr - -* Get LSN0 into memory - clrb MSB sector - ldx #0 LSW sector - bsr mread - bcs error - ldd bootsize,u - beq error - pshs d - -* Return memory - ldd #$100 - ldu blockloc,u - os9 F$SRtMem - puls d - IFGT Level-1 - os9 F$BtMem - else - os9 F$SRqMem - ENDC - bcs error - bsr getpntr - std blockimg,u - -* Get os9boot into memory - ldd bootsize,u - leas -2,s same as a PSHS D -getboot std ,s - ldb bootloc,u MSB sector location - ldx bootloc+1,u LSW sector location - bsr mread - ldd bootloc+1,u update sector location by one to 24bit word - addd #1 - std bootloc+1,u - ldb bootloc,u - adcb #0 - stb bootloc,u - inc blockloc,u update memory pointer for upload - ldd ,s update size of file left to read - subd #$100 file read one sector at a time - bhi getboot - - leas 4+size,s reset the stack same as PULS U,D - ldd bootsize,u - ldx blockimg,u pointer to start of os9boot in memory - andcc #^Carry clear carry - rts back to os9p1 - -error leas 2+size,s - ldb #E$NotRdy drive not ready - rts - -getpntr tfr u,d save pointer to requested memory - ldu 2,s recover pointer to data stack - std blockloc,u - rts - -mread tstb - bne read10 - cmpx #0 - bne read10 - bsr read10 - bcc readlsn0 - rts - -readlsn0 pshs a,x,y - ldy blockloc,u - lda DD.Bt,y os9boot pointer - ldx DD.Bt+1,y LSW of 24 bit address - sta bootloc,u - stx bootloc+1,u - ldx DD.BSZ,y os9boot size in bytes - stx bootsize,u - clrb - puls a,x,y,pc - -* Generic read -read10 lda #c$rblk - bsr setup - bra command - -setup pshs b - sta v$cmd,u - stb v$addr0,u - stx v$addr1,u - ldb #1 - stb v$blks,u - clr v$opts,u - puls b,pc - -wakeup ldx #0 -wake lda status - bita #busy+sel - beq wake1 - leax -1,x - bne wake - bra wake4 -wake1 bsr wake3 - lda defid,pcr - sta dataport - bsr wake3 - sta select - ldx #0 -wake2 lda status - bita #busy - bne wake3 - leax -1,x - bne wake2 -wake4 leas 2,s - comb - ldb #E$NotRdy -wake3 rts - -command bsr wakeup - leax v$cmd,u - bsr send - bsr waitrq - bita #cmd - bne getsta - ldx blockloc,u - bsr read -getsta bsr instat - bita #bsybit - bne command - bita #errsta - beq done - comb -done rts - -send bsr waitrq - bita #cmd - beq done - bita #inout - bne done - lda ,x+ - sta dataport - bra send - -waitrq pshs b,x -wait10 lda status - bita #req - beq wait10 - puls b,x,pc - -* Patch to allow booting from sector sizes > 256 bytes - BGP 08/16/97 -* We ignore any bytes beyond byte 256, but continue to read them from -* the dataport until the CMD bit is set. -read -* next 2 lines added - clrb +++ use B as counter -read2 - bsr waitrq - bita #cmd - bne done - lda dataport - sta ,x+ -* next line commented out and next 8 lines added -* bra read - incb +++ - bne read2 +++ -read3 - bsr waitrq +++ - bita #cmd +++ - bne done +++ - lda dataport +++ - bra read3 +++ - -instat bsr waitrq - lda dataport - anda #%00001111 - pshs a - bsr waitrq - clra - sta dataport - puls a,pc - -restore lda #c$rstr - clrb - ldx #0 - lbsr setup - clr v$blks,u - bra command - - IFGT Level-1 -* Fillers to get to $1D0 -Pad fill $39,$1D0-4-* - ENDC - -* The default SCSI ID is here -defid fcb scsiid - - emod -eom equ * - end -
--- a/3rdparty/booters/boot_wd1002.asm Wed May 28 20:49:30 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,334 +0,0 @@ -******************************************************************** -* Boot - Eliminator WD1002-05 Boot Module -* -* $Id$ -* -* WD 1002-05 OS-9 Boot Subroutine (called by OS9p1) -* Copyright 1988, 1989 Bruce Isted -* All Rights Reserved -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 2 Created by Bruce Isted BRI ??/??/?? - - nam Boot - ttl Eliminator WD1002-05 Boot Module - -* These equates should be set before assembly: -FDStep equ $09 see Step Rate Table -HDStep equ $0F see step rate table - -*Step Rate Table: -*+------------------+------------------+------------------+------------------+ -*! Value=FD/HD Rate ! Value=FD/HD Rate ! Value=FD/HD Rate ! Value=FD/HD Rate ! -*+------------------+------------------+------------------+------------------+ -*! $00=40mS/7.5mS ! $04=16mS/5.5mS ! $08=08mS/3.5mS ! $0C=03mS/1.5mS ! -*! $01=25mS/7.0mS ! $05=14mS/5.0mS ! $09=06mS/3.0mS ! $0D=02mS/1.0mS ! -*! $02=20mS/6.5mS ! $06=12mS/4.5mS ! $0A=05mS/2.5mS ! $0E=01mS/0.5mS ! -*! $03=18mS/6.0mS ! $07=10mS/4.0mS ! $0B=04mS/2.0mS ! $0F=15uS/ 35uS ! -*+------------------+------------------+------------------+------------------+ - - ifp1 - use defsfile - endc - -* These equates should not have to be changed: -BEdtn equ 2 -BVrsn equ 1 -MaxCyls equ 1024 maximum cylinders supported -MaxHeads equ 16 maximum heads supported -MaxSctrs equ 64 maximum sectors per track supported -PhysDrv0 equ %10000000 SDH register mask for HD0 -PhysDrv1 equ %10001000 SDH register mask for HD1 -PhysDrv2 equ %10010000 SDH register mask for HD2 -PhysDrv3 equ %00011000 SDH register mask for FD0 -PhysDrv4 equ %00011010 SDH register mask for FD1 -PhysDrv5 equ %00011100 SDH register mask for FD2 -PhysDrv6 equ %00011110 SDH register mask for FD3 -ReadSctr equ %00100000 read sector command -Restore equ %00010000 base restore command -SelfTest equ %10010000 WD 1002-05 diagnostic test command - -* HCA memory map: - org 0 -WDData rmb 2 WD 1002-05 sector buffer/task files - rmb 2 reserved - do not use -PA equ . PIA PA offset -DDRA rmb 1 PIA DDRA offset -CRA rmb 1 PIA CRA offset -PB equ . PIA PB offset -DDRB rmb 1 PIA DDRB offset -CRB rmb 1 PIA CRB offset - -* WD 1002-05 register definitions: - org 0 -WDBuff rmb 1 WD 1002-05 sector buffer address -ErrReg equ . error register address (read) -WPCReg rmb 1 write precomp register address (write) -SctrCnt rmb 1 sector count register address -SctrReg rmb 1 sector number register address -CylLow rmb 1 cylinder LSB register address -CylHigh rmb 1 cylinder MSB register address -SDHReg rmb 1 Size/Drive/Head register address -StatReg equ . status register address (read) -CmdReg rmb 1 command register address (write) - - org 0 -U.BSZ rmb 2 boot file size -U.BSct rmb 1 number of sectors in boot file -U.BT rmb 3 boot file start LSN -U.BtStrt rmb 2 boot file start address -U.CrtCyl rmb 2 current cylinder number -U.CrtSct rmb 1 current sector number -U.CrtSid rmb 1 current side (head) number -U.Restor rmb 1 restore command incl. step rate code -U.SDH rmb 1 base WD Size/Drive/Head register copy -U.Sides rmb 1 number of disk sides (heads) -U.SPC rmb 2 sectors per cylinder -U.SPT rmb 2 sectors per track -U.StSctr rmb 1 start sector number (HD=0, FD=1) -BootMem equ . - - mod BEnd,BNam,Systm+Objct,ReEnt+BVrsn,BExec,$00 -BNam fcs "Boot" - fcb BEdtn edition number - -* base SDH register table -SDHTable equ * - fcb PhysDrv0,PhysDrv1,PhysDrv2 base SDH for hard drives - fcb PhysDrv3,PhysDrv4,PhysDrv5,PhysDrv6 base SDH for floppys -*** -* Boot subroutine module -* -* INPUT: none -* -* OUTPUT: [D]=size of bootstrap file -* [X]=start address of bootstrap file in memory -* y,u registers altered -* -* ERROR OUTPUT: [CC]=carry set -* [B]=error code -BExec ldy <D.WDAddr get HCA base address (set by auto-boot EPROM) - cmpy #$FF40 base address too low? - blo UnitErr yes, go report error... - cmpy #$FF7F base address too high? - bhi UnitErr yes, go report error... - lda <D.WDBtDr get boot drive number (set by auto-boot EPROM - cmpa #$07 legal drive number? - blo InitPIA yes, go initialize PIA... -UnitErr ldb #E$Unit - coma - rts - -DumpRead clr PB,y set WD address to sector buffer -DumpR0 lda WDData,y get a byte from WD sector buffer - decb done yet? - bne DumpR0 no, go dump another byte - rts -LSN0Info ldb #DD.FMT load number of bytes to dump - bsr DumpRead go dump LSN0 up to DD.FMT - lda WDData,y get DD.FMT (disk density, sides) - anda #$01 mask out all but disk sides bit - inca correction to bit coding - sta U.Sides,u save disk sides (not valid if HD > 2 heads) - ldd WDData,y get DD.SPT (sectors per track) - std U.SPT,u - ldb #DD.BT-DD.RES load number of bytes to dump - bsr DumpRead go dump LSN0 from DD.RES to DD.BT - lda WDData,y get DD.BT (boot file start LSN) MSB - sta U.BT,u - ldd WDData,y get DD.BT (boot file start LSN) LSBs - std U.BT+1,u - ldd WDData,y get DD.BSZ (boot file size) - std U.BSZ,u - ldb U.StSctr,u floppy drive? (start sector = 1) - bne GotInfo yes, sides info OK, go return - ldb #DD.OPT+(PD.SID-PD.OPT)-DD.DAT load number of bytes to dump - bsr DumpRead go dump LSN0 from DD.DAT to number of sides in option table - lda WDData,y get number of sides from DD.OPT section - sta U.Sides,u -GotInfo rts - -InitPIA clr CRA,y enable PIA DDRA - ldd #$033E [A]=DDRA: PA bits 7-2 = inputs, bits 1-0 = outputs - std DDRA,y [B]=CRA: PIA CA2 out high, PA slct, CA1 low to high, no IRQs - clr CRB,y enable PIA DDRB - lda #$FF [A]=DDRB: PB bits 7-0 all outputs - std DDRB,y [B]=CRB: PIA CB2 out high, PB slct, CB1 low to high, no IRQs - leas -BootMem,s open up some space for variables - leau ,s point [U] to start of variables - ldb #BootMem number of bytes to clear - leax ,u point [X] to start of variables -ClrLoop clr ,x+ initialize a byte to 0 - decb done yet? - bne ClrLoop no, go clear another byte - lda #SelfTest WD 1002-05 internal diagnostic command - lbsr CmdUpdat go issue WD command, ensure everything is ready... - bcs ReadErr error, go report it... - lda #Restore!($0F&^HDStep) default to Restore with HD step rate - ldb <D.WDBtDr get boot drive number - cmpb #$03 hard drive? - blo SaveRstr yes, go save HD Restore command... - inc U.StSctr,u set start sector to 1 for floppy disks - lda #Restore!($0F&^FDStep) get Restore with FD step rate -SaveRstr sta U.Restor,u - leax SDHTable,pc - lda b,x get base SDH register - sta U.SDH,u save it... -* restore head to track 0 - lbsr SetupTF go update WD task files (except command) - lda U.Restor,u load WD restore command code - lbsr CmdUpdat go issue WD command - bcs ReadErr error, go report it... -* read cylinder 0, head 0, first sector - lbsr GetSctr go set up, issue read command - bcs ReadErr error, go report it... - bsr LSN0Info go get disk info from LSN0 - ldd U.BSZ,u get boot file size/cylinder offset number - bne ChkInfo must be boot file size, go check other LSN0 info... - ldd U.BT+1,u get offset cylinder number - beq ReadErr must not be boot disk, go report error... - cmpd #MaxCyls offset cylinder number OK? - bhs ReadErr no, go return error... - std U.CrtCyl,u save offset cylinder -* read offset cylinder, head 0, first sector - lbsr GetSctr go set up, issue read command - bcs ReadErr error, go exit... - lbsr LSN0Info go get disk info from offset LSN0 - ldd U.BSZ,u get boot file size - beq ReadErr must not be boot disk, go report error... -* check LSN0 info -ChkInfo ldd U.SPT,u get sectors per track - beq ReadErr 0 sectors per track, go return error - cmpd #MaxSctrs sectors per track OK? - bhi ReadErr no, go return error - lda U.Sides,u get disk sides (heads) - beq ReadErr 0 sides, go return error - cmpa #MaxHeads number of heads OK? - bhi ReadErr no, go return error - mul calculate sectors per cylinder - std U.SPC,u save sectors per cylinder - ldd U.BSZ,u get boot file size - addd #$00FF round up to even sector... - sta U.BSct,u save number of sectors in boot file -* calculate boot file start cylinder, head, & sector - ldd U.BT+1,u get boot file LSN LSBs - ldx U.CrtCyl,u get current (offset) cylinder number -CylLoop subd U.SPC,u subtract sectors/cylinder - blo ChkBtMSB [D] underflow, go check boot file LSN MSB -CylLoop0 leax 1,x increment current cylinder number - bne CylLoop no overflow, go do another subtraction -ReadErr ldb #E$Read - coma set Carry for error - leas BootMem,s restore stack pointer - rts -ChkBtMSB tst U.BT,u boot file LSN MSB = 0? - beq GotCyl yes, go determine head number - dec U.BT,u decrement boot file LSN MSB - bra CylLoop0 go on... -GotCyl addd U.SPC,u restore sector number - stx U.CrtCyl,u save current cylinder number -TrkLoop subd U.SPT,u subtract sectors/track - blo GotSide [D] underflow, go save current sector number - inc U.CrtSid,u increment current side number - bra TrkLoop go do another subtraction -GotSide addd U.SPT,u restore sector number - stb U.CrtSct,u save it -* request boot file memory - pshs u save data pointer - ldd U.BSZ,u get boot file size - os9 F$SRqMem - tfr u,x move start address into [X] - puls u recover data pointer - bcs BtExit0 go return F$SRqMem error - stx U.BtStrt,u save boot file start address - ldd U.CrtCyl,u get cylinder number - bra ChkCyl go check cylinder & get first sector - -* load boot file into memory -BootLoad inc U.CrtSct,u move on to next sector - lda U.SPT+1,u get sectors per track LSB (MSB is always 0) - cmpa U.CrtSct,u done track? - bhi LoadSctr no, go get sector - clr U.CrtSct,u reset current sector number to 0 - inc U.CrtSid,u move on to next side - lda U.CrtSid,u get side number - cmpa U.Sides,u done cylinder? - blo LoadSctr no, go get sector - clr U.CrtSid,u reset side number to 0 - ldd U.CrtCyl,u get cylinder number - addd #1 move on to next cylinder - std U.CrtCyl,u save cylinder number -ChkCyl cmpd #MaxCyls cylinder number OK? - bhs ReadErr no, go return error -LoadSctr bsr GetSctr go get current sector from WD 1002-05 - bcs ReadErr error, go exit - clrb transfer 256 bytes - stb PB,y set WD sector buffer address -ReadLoop lda WDData,y get byte from WD 1002-05 - sta ,x+ save byte to buffer - decb done yet? - bne ReadLoop no, go get another byte - dec U.BSct,u count down boot file sectors remaining - bne BootLoad - clrb clear carry - ldd U.BSZ,u get boot file size - ldx U.BtStrt,u get boot file start address -BtExit0 leas BootMem,s restore stack pointer - rts - -GetSctr bsr SetupTF go set up WD task files (except command) - lda #ReadSctr load WD read sector command code -CmdUpdat ldb #CmdReg load WD command register address - bsr TFUpdat go issue command... -BusyWait ldb #StatReg - stb PB,y set WD status register address -BusyW0 ldb WDData,y get WD 1002-05 status - bitb #%00000010 valid data? (WD 1002-05 powered & connected?) - bne BWErr no, go report error... - tstb ensure [CC] sign flag is current - bmi BusyW0 yes, go check again - ldb WDData,y get valid controller status - rorb rotate error bit into carry - bcc NoError - ldb #ErrReg - stb PB,y set WD error register address - ldb WDData,y get error register contents - bne BWErr -NoError clrb - rts -BWErr comb error, set [CC] Carry... - rts - -SetupTF ldd #$01*256+SctrCnt single sector commands only - bsr TFUpdat - lda U.CrtCyl,u get current cylinder number MSB - ldb #CylHigh - bsr TFUpdat - lda U.CrtCyl+1,u get current cylinder number LSB - ldb #CylLow - bsr TFUpdat - lda U.CrtSct,u get current sector number - adda U.StSctr,u add offset... - ldb #SctrReg - bsr TFUpdat - clrb default extended head disabled - lda U.CrtSid,u get current side (head) number - cmpa #$08 extended head? - blo StdHead no, go on... - incb set enable code - anda #$07 mask out all but standard head number -StdHead stb PA,y set extended head enable/disable - ora U.SDH,u mask in base SDH copy - ldb #SDHReg -TfUpdat stb PB,y set WD register address - sta WDData,y write data to WD 1002-05 - rts - -* pad Boot module out to $01D0 exactly -Pad fill $39,$1D0-3-* - - emod -BEnd equ * - end -
--- a/3rdparty/booters/makefile Wed May 28 20:49:30 2003 +0000 +++ b/3rdparty/booters/makefile Fri May 30 20:50:06 2003 +0000 @@ -1,14 +1,13 @@ include ../../Makefile.rules DEPENDS = ./Makefile -BOOTERS_NITROS = boot_ide_nl2 -BOOTERS_L2 = boot_ktlr_id0 boot_ktlr_id5 boot_rampak \ - boot_tc3_id0 boot_tc3_id5 boot_ide boot_wd1002 \ - boot_burke boot_vhd boot_mmc_l2 -BOOTERS_L1 = boot_ktlr_id0_l1 boot_ktlr_id5_l1 boot_rampak_l1 \ - boot_tc3_id0_l1 boot_tc3_id5_l1 boot_ide_l1 \ - boot_burke_l1 boot_mmc_l1 -ALLOBJS = $(BOOTERS_NITROS) $(BOOTERS_L2) $(BOOTERS_L1) +BOOTERS_L2 = boot_ktlr_id0 boot_ktlr_id5 \ + boot_tc3_id0 boot_tc3_id5 \ + boot_vhd boot_mmc_l2 +BOOTERS_L1 = boot_ktlr_id0_l1 boot_ktlr_id5_l1 \ + boot_tc3_id0_l1 boot_tc3_id5_l1 \ + boot_mmc_l1 +ALLOBJS = $(BOOTERS_L2) $(BOOTERS_L1) all: $(ALLOBJS) $(DEPENDS) @@ -16,35 +15,19 @@ $(RM) $(ALLOBJS) -# NitrOS-9 Booters -boot_ide_nl2: boot_ide.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 -aNitrOS9=1 - # OS-9 Level Two Booters -boot_ide: boot_ide.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 - boot_ktlr_id0: boot_scsi.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 -aKTLR=1 -ascsiid=1 boot_ktlr_id5: boot_scsi.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 -aKTLR=1 -ascsiid=32 -boot_rampak: boot_rampak.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 - boot_tc3_id0: boot_scsi.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 -aTC3=1 -ascsiid=1 boot_tc3_id5: boot_scsi.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 -aTC3=1 -ascsiid=32 -boot_wd1002: boot_wd1002.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 - -boot_burke: boot_burke.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 - boot_vhd: boot_vhd.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=2 @@ -64,15 +47,6 @@ boot_tc3_id5_l1: boot_scsi.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=1 -aTC3=1 -ascsiid=32 -boot_rampak_l1: boot_rampak.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=1 - -boot_burke_l1: boot_burke.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=1 - -boot_ide_l1: boot_ide.asm - $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=1 - boot_mmc_l1: boot_mmc.asm $(AS) $(AFLAGS) $(ASOUT)$@ $< -aLevel=1