CGORMAN@DREW.BITNET (Chris Gorman, 201-377-3000 [x 205]) (07/21/87)
This was in the pageswapper a while back and someone here pounded it
in. Please forgive if this is already available; I be new here!
-Chris Gorman
Student Sys$manager
Drew University Computing Center
Madison, NJ
--- CUT'N'PASTE ---
.title format_ramdisk
;
;
;Author: Andrew W. Potter
; Rochester Institute of Technology
;
; This program accesses a RAMDISK and allocates an initial
; size in blocks for the memory device. This size equals
; the amount of pages taken from Non-paged pool. (ie. If you
; play with this, make sure your NPAGEVIR is set to a big value
;
;
; to use, you must connect the pseudo disk driver
;
; $ run sys$system:sysgen
; SYSGEN> CONNECT PDA0:/NOADAPTER/DRIVER=PDDRIVER
; SYSGEN> EXIT
;
;
$IODEF
.psect data, NOSHR,PIC,NOEXE,WRT
;
; prompt for device
;
prompt: .ascid /RAMDISK Device Name : /
;
; prompt for blocks
;
sizepr: .ascid /Size in Blocks : /
;
; ascii block count (input)
;
s_blk: .ascid / /
;
; ascii device name (input)
;
devnam: .ascid / /
;
; longword specifying size.
;
blocks: .blkl 1
;
; status block for QIO
;
istat: .blkl 2
;
; Channel for QIO
;
chan: .blkw 1
;
.psect code, SHR,PIC,EXE,NOWRT
;
.entry main ^M<>
pushaw devnam ; push address of len. of devnam
pushaq prompt ; push address of prompt descr.
pushaq devnam ; push address of device descr.
calls #3,g^lib$get_input ; get input
blbs r0,ok_1 ; if OK then continue
ret ; otherwise return with status
ok_1:
pushal devnam ; upcase the response
pushal devnam
calls #2,g^str$upcase
;
pushaw s_blk ; get the size in blocks
pushaq sizepr ; same way as above
pushaq s_blk
calls #3,g^lib$get_input ; get input
blbs r0,ok_2 ; if OK then continue
ret ; otherwise, get out
ok_2:
pushal blocks ; convert text size to
pushaq s_blk ; an unsigned longword
calls #2,g^ots$cvt_tu_1
blbs r0,ok_3
ret
ok_3:
$assign_s - ; get the channel
chan = chan, -
devnam = devnam
blbs r0,ok_4
ret
ok_4:
; Call QIOW directly because we want the
; P1 parameter to go by value, not by reference
;
pushl #0 ; p6
pushl #0 ; p5
pushl #0 ; p4
pushl #0 ; p3
pushl #0 ; p2
pushl blocks ; p1 = size of ramdisk
pushl #0 ; ASTPRM
pushl #0 ; ASTADR
pushal istat ; IO status block
pushl #IO$_FORMAT ; function code (format it)
movzwl chan,-(sp) ; channel
pushl #0 ; EFN (not used)
calls #12,sys$qiow ; call it
blbs r0,end_ok ; if OK then continue
ret ; otherwise get out
end_ok:
movl istat,r0 ; Done. Leave IO status in r0
; for cli
ret
.end main