.title fxdrv -- fixed-disk emulator .ident /1.0/ ; EDIT # 0022 21 Sept 1982 14:18:10 DB1:[21,7]FXDRV.MAC;34 ; PREVIOUS EDIT 21 Sept 1982 14:11:56 DB1:[21,7]FXDRV.MAC;33 ; by Ray Van Tassle 18 Sept 1982 ; ; Ray Van Tassle ; Motorola ; 1301 E. Algonquin Rd. ; Room 4135 ; Schaumburg, Ill. ; (312)-576-6017 ; ; emulate a disk by using an in-core partition ; as the "disk" ; ; Some values of interest: ; ; "disk" octal KW octal par size ; blks blks dec bytes (set /main) ; ----- ----- ---- ----- ----------- ; 1. 01 1/4 01000 010 ; 4. 04 1 04000 040 ; 256. 400 64 0400000 04000 ; 1024. 2000 256 2000000 20000 ; .mcall pcbdf$,devdf$,abodf$ pcbdf$ devdf$ abodf$ fxpar: .rad50 /fxdisk/ ; partition name s.prlb=s.frk+0 ; partition's relocation bias ap6val= 140000 ; addr corresponding to apr6 ap5val= 120000 ; " " apr5 apdif= 020000 ; difference mvsiz= 512. ; size of each move ($blxio) ;mvsiz= 128. ; (to test out mulitple move logic) mvrm= mvsiz/64. ; same, adjusted for relocation bias .iif ne > .error 5; mvsiz must be a multiple of 64. bytes fmrlb: .word 0 ; source relocation bias fmadr: .word 0 ; source addr (in apr5) torlb: .word 0 ; dest relocation bias toadr: .word 0 ; dest addr (in apr6) bcnt: .word 0 ; byte count ; DEVICE DISPATCH TABLE ; $FXTBL:: ;REF. LABEL .WORD FXINI ;DEVICE INITIATOR .WORD FXCAN ;CANCEL I/O .WORD FXTMO ;DEVICE TIMEOUT .WORD FXPWF ;POWER RECOVERY ;********************************************** ; powerfail (driver load) entry point ; the "disk" is a common partition with a special name fxpwf:: mov #fxpar,r3 ; go look for it call $srnam bcs 40$ ; didn't find it--error bit #ps.com,p.stat(r2) beq 40$ ; br if it isn't a common br 50$ ; can't find a valid partition 40$: clr u.cw3(r5) ; set disk size to zero mov #t.ndnr,r0 ; print "device not ready" msg call $dvmsg return ; we did find it. ; figure the disk size & apr5/apr6 values 50$: mov p.size(r2),r0 ; size in 64. byte blocks asr r0 ; convert to 512. byte blocks asr r0 ; (size * 0100 / 01000) asr r0 mov r0,u.cw3(r5) mov p.rel(r2),r0 ; get partition addr mov r0,s.prlb(r4) ; (in form for apr5/6 for $blxio) fxcan: ; cancel I/O fxtmo: ; timeout fxret: return ; just return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; I/O OPERATION REQUESTED ; we only honor read and write fxini: call $gtpkt ; get i/o packet bcs fxret ; none mov #ie.blk&377,r0 tst i.prm+10(r1) ; check requested block number bne 70$ ; bad mov u.cnt(r5),r3 ; round up to highest block requested add #777,r3 ror r3 clrb r3 swab r3 add i.prm+12(r1),r3 ; start addr + # blocks bcs 70$ ; bad cmp r3,u.cw3(r5) bhi 70$ ; bad cmpb i.fcn+1(r1),#io.wlb/256. ; write?? beq fxwrit ; br if yes cmpb i.fcn+1(r1),#io.rlb/256. ; read?? beq fxread ; br if yes mov #ie.ifc&377,r0 ; invalid function code 70$: MOV R0,S.PRLB+2(R4) ; SAVE INVALID FUNC CODE MOV I.PRM+12(R1),S.PRLB+4(R4) ; BLOCK REQ MOV U.CNT(R5),S.PRLB+6(R4) ; SIZE REQ call $ioalt jmp fxini ;********************************* ; write--source is user buffer. dest is the partition fxwrit: mov s.prlb(r4),torlb ; dest mov #ap6val,toadr mov i.prm+012(r1),r0 ; adjust part rlb for block # asl r0 ; (blk # *01000 / 0100) asl r0 asl r0 add r0,torlb mov u.buf(r5),fmrlb ; source mov u.buf+2(r5),fmadr sub #apdif,fmadr ; set to be in apr5 br fxtrn ; go transfer the data ;********************************* ; read -- source is the partition...dest is user buffer fxread: mov s.prlb(r4),fmrlb ; dest mov #ap5val,fmadr mov i.prm+012(r1),r0 ; adjust part rlb for block # asl r0 ; (blk # *01000 / 0100) asl r0 asl r0 add r0,fmrlb mov u.buf(r5),torlb ; source mov u.buf+2(r5),toadr br fxtrn ; go transfer the data ;************************************ ; transfer the data between the user buffer and the "disk" (partition) ; ; Use $BLXIO, to transfer a block (512. bytes) at a time. fxtrn: mov u.cnt(r5),bcnt ; size to transfer 5$: mov bcnt,r0 ; get remaining size beq fxdon ; br if all done cmp r0,#mvsiz blos 10$ mov #mvsiz,r0 ; max size per shot 10$: sub r0,bcnt ; adjust remaining count mov fmrlb,r1 ; source (apr5) mov fmadr,r2 mov torlb,r3 ; dest (apr6) mov toadr,r4 call $blxio ; go move it add #mvrm,fmrlb ; adjust relocation biases add #mvrm,torlb br 5$ fxdon: mov u.cnt(r5),r1 ; successful completion mov #is.suc&377,r0 call $iodon jmp fxini .END