;+ ; ; A9 boot PROM for RL01/02. ; ; By John Wilson . ; This program is hereby placed in the public domain. ; ; 10/20/2000 JMBW Created. ; ;- dl$csr= 174400 ;base RL11 (etc.) CSR ; dlcs= 0 ;(774400) control/status dlba= 2 ;(774402) bus addr dlda= 4 ;(774404) disk addr dlmp= 6 ;(774406) multipurpose ; dlerr= 100000 ;composite error ; dlrdy= 200 ;ready ; dlgst= 2*2 ;get status dlsek= 3*2 ;seek dlrdh= 4*2 ;read header dlrdd= 6*2 ;read data ; dldry= 1 ;drive ready ; ; Macro to check an assumption about constants: ; .macro .assume a,cond,b .if cond - .iff .err ; assumption a cond b is false .endc .endm ; ; ROM header ; .asect .= 0 name: .word 'D*400!'L ;DL, backwards .word 200-. ;offset to next PROM nodiag: ; no-diags DL0: entry is at +4 br dl0 ;skip diags diag: ; diag DL0: entry is at +6 ;;; diags like what? dl0: clr r0 ;no console emulator, always use unit #0 .= 10 ;(already there) go: ; +10 -- unit # in R0 br go1 ; +12 -- unit # in R0 ;;; supposed diags here too? no space anyway go1: mov #dl$csr,r1 ;R1 points at base CSR mov pc,r4 ;must point 20 bytes past signature .assume . eq 20 ; clear errors mov #13,dlda(r1) ;reset error bits (if any are set) mov r0,r2 ;copy unit # swab r2 ;unit # in <9:8> bis #dlgst,r2 ;cmd=get status mov r2,(r1) ;start cmd 10$: bit #dlerr!dlrdy,(r1) ;wait for error or success beq 10$ bmi 60$ ;error .assume dlerr eq 100000 ; read header to find out where we are add #dlrdh-dlgst,r2 ;change cmd to "read header" mov r2,(r1) ;start cmd 20$: bit #dlerr!dlrdy,(r1) ;wait for error or success beq 20$ bmi 60$ ;error .assume dlerr eq 100000 mov dlmp(r1),r3 ;read header word bic #177,r3 ;isolate cyl ; seek to cyl 0 (both sectors making up block 0 are there) inc r3 ;bits <1:0>=01 for "seek" cmd mov r3,dlda(r1) ;write to disk addr reg add #dlsek-dlrdh,r2 ;change cmd to "seek" mov r2,(r1) ;start cmd 30$: bit #dlerr!dlrdy,(r1) ;wait for error or seek started beq 30$ bmi 60$ ;error .assume dlerr eq 100000 40$: bit #dlerr!dldry,(r1) ;wait for error or drive ready bmi 60$ ;error .assume dlerr eq 100000 ; read cyl 0, side 0, sectors 0-1 add #dlmp,r1 ;point at multi-purpose reg mov #-<1000/2>,(r1) ;word count = 1 block clr -(r1) ;disk addr = 0/0/0 .assume dlda eq dlmp-2 clr -(r1) ;bus addr = 0 .assume dlba eq dlda-2 add #dlrdd-dlsek,r2 ;change cmd to "read" mov r2,-(r1) ;start cmd .assume dlcs eq dlba-2 50$: bit #dlerr!dlrdy,(r1) ;wait for error or success beq 50$ bmi 60$ ;error .assume dlerr eq 100000 clr pc ;happy, drop into boot block 60$: ; error of some kind, just give up halt br 60$ ; .end