.enabl lc ;+ ; ; Boot block prefix file. ; ; By John Wilson. This file is hereby released into the public domain. ; ; This prefix file should be prepended to a source file containing bootstrap ; init code which does any needed one-time init and obtains BUNIT's value from ; the device registers, and a simple polled I/O "read" routine. That routine ; must be named READ and must return with an RTI; it is called using the IOT ; instruction. This file defines two macros, .BTINI and .BTFIN, which define ; the fixed variables, the code to load the secondary loader using READ, and ; the code to print an error message on an I/O error (which is called using ; BPT and causes a halt). The init code should be sandwiched between these ; two macros (.BTINI sets up a stack, SP must be restored for .BTFIN). The ; READ routine should follow, which accepts the following parameters: ; ; R5 buffer address (in first 64KB of memory) ; R4 number of blocks to read, 0-112. ; R3 starting block number, 0-65535. ; ; All registers may be destroyed by the READ routine, it should return with ; RTI if successful and terminate with BPT if not (if there is enough space ; in the boot block, the READ routine should attempt retries). The source ; file should end with ".END BOOT" (so it may be punched out as a .LDA file ; with a valid starting address, for testing). The code in .BTINI saves the ; CSR address passed in R1 from the boot PROM in BCSR, which is where READ ; should get it rather than hard-coding for a particular address. R1 still ; contains the CSR on entry to the one-time init code. ; ; .BTINI ;xx is the initial value of BDEV ; ... code to put unit # in BUNIT ; ... one-time initialization code, detect pack type etc. ; .BTFIN ;finish up boot code ; READ: ; R5=bus address, R4=block count, R3=starting block ; ... read the data, code is as robust as will fit, retries if possible ; RTI ; .END BOOT ; ; 11/13/95 JMBW Created. ; ;- ttcsr= 177564 ;CTY control/status ttbuf= 177566 ;CTY output buffer ; .macro .btini dev ;dev is 2-letter device name .asect .=0 ; loads at 000000 boot: nop ;+00 req'd by DEC standard br boot1 .word .+2,0 ;+04 catch traps to 4 .word .+2,0 ;+10 and traps to 10 .word ioerr,0 ;+14 BPT vector .word read,0 ;+20 IOT vector bdev: .irpc c, ;+24 device name goes here .byte ''c&^C40 ; force to upper case .endm bunit: .word 0 ;+26 unit goes here bcsr: .word 0 ;+30 CSR goes here ; boot1: ; read secondary boot loaded from blocks 2-5 mov r1,bcsr ;save CSR (but leave it in R1) mov #2000,sp ;init stack in case needed, must be preserved ;drop through to device-specific one-time init code, then .BTEND .endm ; .macro .btfin ;finish up bootstrap ; load blocks 2-5 at 002000 mov sp,r5 ;load at 2000 (SP must still be set) mov #4,r4 ;4 blocks mov #2,r3 ;starting at block 2 iot ;do it jmp (sp) ;go ; ioerr: ; come here on I/O error (via BPT) jsr r5,ctyout ;display message on CTY .asciz '?BOOT-U-I/O error'<15><12> .even ctyout: movb (r5)+,r0 ;get a byte beq 20$ ;don't write the NUL 10$: tstb @#ttcsr ;ready? bpl 10$ mov r0,@#ttbuf ;yes, write char br ctyout 20$: halt ;give up br 20$ ;initted vars may be bashed, don't restart .endm ;READ routine follows ;