********************************************* * Rdisk * A driver for a Ram disk! * * By G.Twist (c) 1986 * * modified by Bernd H. Neuner 1987 * * Version for a totally different Ram disk! * * By the APRMCS - J.B. & O.B. (C) 1991,1992 * nam Rdisk ttl A Device Driver for a RAM Disk ifp1 use /d0/defs/os9defs use /d0/defs/iodefs use /d0/defs/rbfdefs endc *********************** * Edition History * # date Comments * -- -------- ---------------------------------------------- * 1 86/12/17 Driver first developed GDT * 2 86/12/18 work to fix minor access bugs GDT * 3 30.11.87 bug in COPY routine fixed. BHN (no more error 214 now.) * 4 31.12.91 Test version for main RAM JB/OB * 5 08.01.92 Driver for 128K PIA RAM JB/OB * 6 18.09.92 Up-issue to support up to 512K JB Edition equ 5 Current Edition Revision equ 3 Current Revision number NumDrvs set 1 Number of drives * pia control comands pia.ddr equ %00111000 pia.off equ %00111100 pia.act equ %00101100 ext.msr equ %00000001 ext.lsr equ %00001000 ext.read equ %00000010 ext.writ equ %00000110 output equ %11111111 outb equ %00001111 pia.iora equ 0 pia.cnra equ 1 pia.iorb equ 2 pia.cnrb equ 3 org Drvbeg rmb NumDrvs*DrvMem LSNZERO rmb 1 RAMSTA equ . mod RAMEND,RAMNAM,Drivr+Objct,Reent+Revision,RAMENT,RAMSTA fcb $FF set all capabilities RAMNAM fcs /Rdisk/ fcb Edition RAMENT lbra INIT lbra READ lbra WRITE lbra GETSTA lbra PUTSTA lbra TERM ***************************** * INIT * Set up the ramdisk * INIT clr V.WAKE,U lda #1 sta V.NDRV,U clr LSNZERO,U lda #$FF leax DrvBeg,U sta DD.Tot,X sta V.Trak,X * set up pia ldx V.PORT,U lda #pia.off sta pia.cnra,x select a side off lda #pia.ddr sta pia.cnrb,x select b side ddr lda #outb sta pia.iorb,x set ls 4 bits to outputs lda #pia.off sta pia.cnrb,x select b side io reg clr pia.iorb,x clrb INITXIT rts ***************************** * READ * read a sector from disk * READ clr LSNZERO,U bsr VALID bcs READ99 bsr READS tst LSNZERO,U beq READ90 lda PD.DRV,Y ldb #DRVMEM mul leax DRVBEG,U leax D,X ldy PD.BUF,Y ldb #DD.SIZ-1 COPLSN0 lda B,Y sta B,X decb bpl COPLSN0 READ90 clrb READ99 rts ***************************** * WRITE * Write a sector to disk * WRITE bsr VALID bcs WRIT99 bsr WRITS clrb WRIT99 rts ***************************** * VALID * validate a sector * and set up external registers * to reqired page in ram * VALID tstb bne SECTERR cmpx #2048 bge SECTERR cmpx #$0000 bne NOTLSN0 inc LSNZERO,U NOTLSN0 pshs y ldy V.PORT,U lda #pia.ddr select direction reg sta pia.cnra,y lda #output set bits to output sta pia.iora,y lda #pia.act enable ca2 strobe sta pia.cnra,y lda #ext.msr select ms sector reg sta pia.iorb,y tfr x,d sta pia.iora,y write ms value lda pia.iora,y do the read (strobe) lda #ext.lsr select ls sector reg sta pia.iorb,y stb pia.iora,y write ls value ldb pia.iora,y do the read (strobe) clr pia.iorb,y select nothing puls y note a side still set for output clrb rts SECTERR comb ldb #241 sector error rts ************************ * READS * Y=Path Discr. * READS pshs X,Y,D ldy PD.BUF,Y ldx V.PORT,U lda #pia.ddr sta pia.cnra,x clr pia.iora,x lda #pia.act sta pia.cnra,x lda #ext.read sta pia.iorb,x leax pia.iora,x clrb READS10 lda ,x sta ,y+ decb bne READS10 ldx V.PORT,U clr pia.iorb,x lda #pia.off sta pia.cnra,x puls X,Y,D,PC ************************ * WRITS * Y=Path Discr. * WRITS pshs X,Y,D ldy PD.BUF,Y ldx V.PORT,U lda #pia.ddr sta pia.cnra,x lda #output sta pia.iora,x lda #pia.act sta pia.cnra,x lda #ext.writ sta pia.iorb,x leax pia.iora,x clrb WRITS10 lda ,y+ sta ,x lda ,x decb bne WRITS10 ldx V.PORT,U clr pia.iorb,x lda #pia.off sta pia.cnra,x puls X,Y,D,PC ************************** * GETSTA * get device status * GETSTA equ * Unknown comb ldb #E$UnkSVC rts ************************** * PUTSTA * Set device Status * PUTSTA cmpb #SS.Reset beq PUTSTA90 cmpb #SS.WTrk bne Unknown PUTSTA90 clrb rts ***************************** * TERM * terminate Driver * TERM rts emod RAMEND equ * ****************************************** * RamDisk Discriptor module * * Source By G.D.Twist * * Re-done by us again! * ifp1 use /d0/defs/os9defs endc nam D ttl Drive Discriptor module mod DEnd,DNam,DEVIC+OBJCT,REENT+1,DMgr,DDrv fcb DIR.+SHARE.+PREAD.+PWRIT.+UPDAT.+EXEC.+PEXEC. fcb $FF IOBlock (unused) fdb $FF34 hardware address fcb DNam-*-1 option byte count fcb $1 Rbf device fcb 0 Drive number fcb 03 6ms Step rate fcb $80 Standard OS9 Winchester drive fcb 0 Single density fdb 4 number of tracks fcb 1 number of sides fcb 1 dont verify any writes fdb 256 sectors per track fdb 256 sectors on track 0, side 0 fcb 1 sector interleave factor fcb 1 sector allocation size DNam fcs "R0" DMgr fcs "RBF" DDrv fcs "RDisk" emod DEnd equ * end