.title Display home block info ;+ ; This example MACRO program will read, format, and print to ; SYS$OUTPUT the contents of a disk homeblock and storage control ; block. It requires read access to both INDEXF.SYS and BITMAP.SYS. ; It prompts for the disk name. ;- .library /sys$library:lib/ $fibdef $hm2def $clsdef $scbdef .macro qio_err, ?l1, ?l2 blbs r0, l1 ret l1: movzwl iosb, r0 blbs r0, l2 ret l2: .endm qio_err .macro movpro, whichprot movzwl whichprot(r6),r7 movl outlin+4, r8 movc3 #1, #^A"(", (r8) incl r8 movc3 #1, #^A"S", (r8) incl r8 movc3 #1, #^A":", (r8) incl r8 makcod movc3 #1, #^A",", (r8) incl r8 movc3 #1, #^A"O", (r8) incl r8 movc3 #1, #^A":", (r8) incl r8 makcod movc3 #1, #^A",", (r8) incl r8 movc3 #1, #^A"G", (r8) incl r8 movc3 #1, #^A":", (r8) incl r8 makcod movc3 #1, #^A",", (r8) incl r8 movc3 #1, #^A"W", (r8) incl r8 movc3 #1, #^A":", (r8) incl r8 makcod movc3 #1, #^A")", (r8) .endm movpro .macro makcod, ?p1, ?p2, ?p3, ?p4 blbs r7, p1 movc3 #1, #^A"R", (r8) incl r8 p1: rotl #-1, r7, r7 blbs r7, p2 movc3 #1, #^A"W", (r8) incl r8 p2: rotl #-1, r7, r7 blbs r7, p3 movc3 #1, #^A"E", (r8) incl r8 p3: rotl #-1, r7, r7 blbs r7, p4 movc3 #1, #^A"D", (r8) incl r8 p4: rotl #-1, r7, r7 .endm makcod .macro movnum, length, offset, base, signum, ?n1, ?n2 pushl length pushl signum pushal outlin pushal offset(r6) cmpl #0, base bneq n1 calls #4,G^ots$cvt_l_ti blbs r0,n2 ret n1: calls #4,G^ots$cvt_l_tz blbs r0,n2 ret n2: .endm movnum .macro movstr, count, source, ?s1 movc5 count, source(r6), #^A" ", #^D40, outlin+8 s1: .endm movstr .macro movdat, whichdate, format, ?d1, ?d2 addl3 whichdate(r6), whichdate+4(r6), r7 cmpl #0, r7 bneq d1 cmpl format, #1 beql d1 movnum #4, whichdate, #0, #1 brw d2 d1: pushl #0 pushaq whichdate(r6) pushal outlin pushal outlin calls #4,G^sys$asctim blbs r0, d2 ret d2: .endm movdat .macro movout, txt, ?o1 movc3 #^D35,txt+8,outbuf movc3 #^D40,outlin+8,outbuf+36 pushal outd calls #1,G^lib$put_output blbs r0, o1 ret o1: movc3 #^D40,spaces+8,outlin+8 .endm movout fib: .blkb fib$c_length fib_desc: .long fib$c_length .address fib filename:.ascid /INDEXF.SYS;1/ bitname: .ascid /BITMAP.SYS;1/ device: .ascid / / device_p: .ascid /Device to access: / channel:.word 0 iosb: .quad data: .blkb 512 outd: .long 75 outa: .address outbuf outbuf: .blkb 75 spaces: .ascid / / header: .ascid / Homeblock for device / hmlbn: .ascid / LBN of homeblock / ahmlbn: .ascid / LBN of backup homeblock / aidxlbn: .ascid / LBN of backup index file header / struclev: .ascid / Structure level and version / cluster: .ascid / Storage bitmap cluster factor / hmvbn: .ascid / VBN of homeblock / ahmvbn: .ascid / VBN of backup homeblock / aidxvbn: .ascid / VBN of backup index file header / ibmvbn: .ascid / VBN of index file bitmap / ibmlbn: .ascid / LBN of index file bitmap / maxfil: .ascid / Maximum files allowed / ibmsiz: .ascid / Blocks in index file bitmap / resfil: .ascid / Number of reserved files / devtyp: .ascid / Disk device type (always 0) / rvn: .ascid / Relative volume number / setcnt: .ascid / Number of volumes in this set / volchr: .ascid / Volume characteristics: / rdchk: .ascid /readcheck/ rdchk_s=.-rdchk-8 wtchk: .ascid /writecheck/ wtchk_s=.-wtchk-8 erase: .ascid /erase-on-delete/ erase_s=.-erase-8 highw: .ascid /nohighwater/ highw_s=.-highw-8 none: .ascid /none/ none_s=.-none-8 volown: .ascid / UIC of volume owner / volpro: .ascid / Volume protection code / filpro: .ascid / Default file protection / chksum1: .ascid / First checksum / credat: .ascid / Volume creation date / window: .ascid / Default window size / lrulim: .ascid / Directory pre-access limit / extend: .ascid / Default file extent quantity / retmin: .ascid / Minimum file retention period / retmax: .ascid / Maximum file retention period / revdat: .ascid / Volume revision date / minsec: .ascid / Minimum security class / seclev: .ascid / Secrecy level:/ intlev: .ascid / Integrity level:/ seccat: .ascid / Secrecy category mask:/ intcat: .ascid / Integrity category mask:/ maxsec: .ascid / Maximum security class / sernum: .ascid / Media serial number / strucnam: .ascid / Volume set name / volnam: .ascid / Volume label / ownnam: .ascid / Name of volume owner / format: .ascid / Volume format / chksum2: .ascid / Second checksum / scbhdr: .ascid / Storage control block for device / volsiz: .ascid / Volume size in logical blocks / blksiz: .ascid / Device blocking factor / sectrs: .ascid / Sectors per track / tracks: .ascid / Tracks per cylinder / clylnd: .ascid / Number of cylinders on device / sts: .ascid / Status word: / mpdrty: .ascid /map dirty/ mpdrty_s=.-mpdrty-8 mpaloc: .ascid /map pre-allocated/ mpaloc_s=.-mpaloc-8 flaloc: .ascid /file numbers pre-allocated/ flaloc_s=.-flaloc-8 qodrty: .ascid /quota file dirty/ qodrty_s=.-qodrty-8 hdrwrt: .ascid /write-back header caching/ hdrwrt_s=.-hdrwrt-8 sts2: .ascid / Secondary status: / wrtcnt: .ascid /Systems with write access to disk / lcknam: .ascid / Volume lock name / mnttim: .ascid / Time of last mount / bckrev: .ascid / BACKUP revision number / gennum: .ascid / Shadow set revision date / scbchksum: .ascid / Block checksum / outlin: .ascid / / fao_devtype: .ascid /Value is !UL, which is an illegal value./ fao_struclev: .ascid / !UB,!UB/ fao_uic: .ascid / !%U/ n_a: .ascid /Not yet implemented/ tmp: .long 0 .entry homdef, ^m<> pushab device pushab device_p pushab device calls #3, g^lib$get_input BLBS r0, 10$ ret 10$: moval fib, r5 movl #^x40004, fib$w_did(r5) movl #^x10001, fib$w_fid(r5) bisl2 #fib$m_nowrite, fib$l_acctl(r5) $ASSIGN_S - DEVNAM=DEVICE, - chan=channel blbs r0, 20$ ret 20$: $qiow_s chan=channel,- func=#io$_access!io$m_access, - iosb=iosb, - p1=fib_desc, - p2=#filename qio_err $qiow_s chan=channel, - func=#io$_readvblk, - iosb=iosb, - p1=data, - p2=#512, - p3=#2 qio_err moval data, r6 movl #^D12,outlin movc5 device, device+8, #^A" ", #^D40, outlin+8 movout header movout spaces movnum #4,hm2$l_homelbn,#0, #1 movout hmlbn movnum #4,hm2$l_alhomelbn,#0, #1 movout ahmlbn movnum #4,hm2$l_altidxlbn,#0, #1 movout aidxlbn movl #hm2$w_struclev,r7 movzbl (r6)[r7],r8 pushl r8 incl r7 movzbl (r6)[r7],r8 pushl r8 pushal outlin pushl #0 pushal fao_struclev calls #4,G^sys$fao movout struclev movnum #2,hm2$w_cluster,#0, #1 movout cluster movnum #2,hm2$w_homevbn,#0, #1 movout hmvbn movnum #2,hm2$w_alhomevbn,#0, #1 movout ahmvbn movnum #2,hm2$w_altidxvbn,#0, #1 movout aidxvbn movnum #2,hm2$w_ibmapvbn,#0, #1 movout ibmvbn movnum #4,hm2$l_ibmaplbn,#0, #1 movout ibmlbn movnum #4,hm2$l_maxfiles,#0, #1 movout maxfil movnum #2,hm2$w_ibmapsize,#0, #1 movout ibmsiz movnum #2,hm2$w_resfiles,#0, #1 movout resfil movnum #2,hm2$w_devtype,#0, #1 movzwl hm2$w_devtype(r6), r7 cmpl #0, r7 beql 21$ pushl r7 pushal outlin pushl #0 pushal fao_devtype calls #4,G^sys$fao 21$: movout devtyp movnum #2,hm2$w_rvn,#0, #1 movout rvn movnum #2,hm2$w_setcount,#0, #1 movout setcnt movout volchr movzwl hm2$w_volchar(r6), r7 movl #0, r8 bbc #hm2$v_readcheck, r7, 22$ movc3 #rdchk_s, rdchk+8, outlin+8 movout spaces incl r8 22$: bbc #hm2$v_writcheck, r7, 24$ movc3 #wtchk_s, wtchk+8, outlin+8 movout spaces incl r8 24$: bbc #hm2$v_erase, r7, 26$ movc3 #erase_s, erase+8, outlin+8 movout spaces incl r8 26$: bbc #hm2$v_nohighwater, r7, 28$ movc3 #highw_s, highw+8, outlin+8 movout spaces incl r8 28$: cmpl #0, r8 bneq 30$ movc3 #none_s, none+8, outlin+8 movout spaces 30$: movl hm2$l_volowner(r6),r7 pushl r7 pushal outlin pushl #0 pushal fao_uic calls #4,G^sys$fao movout volown movpro hm2$w_protect movout volpro movpro hm2$w_fileprot movout filpro movnum #2,hm2$w_checksum1,#1, #4 movl outlin+4, r8 movc3 #1, #^A"%",6(r8) movc3 #1, #^A"X",7(r8) movout chksum1 movl #^D24, outlin movdat hm2$q_credate, #1 movout credat movl #^D12, outlin movnum #1,hm2$b_window,#0, #1 movout window movnum #1,hm2$b_lru_lim,#0, #1 movout lrulim movnum #2,hm2$w_extend,#0, #1 movout extend movl #^D16, outlin movdat hm2$q_retainmin, #0 movout retmin movl #^D12, outlin movl #^D16, outlin movdat hm2$q_retainmax, #0 movout retmax movl #^D12, outlin movl #^D24, outlin movdat hm2$q_revdate, #1 movout revdat movl #^D12, outlin movout minsec movnum #1,hm2$r_min_class+cls$b_secur_lev,#0, #1 movout seclev movnum #1,hm2$r_min_class+cls$b_integ_lev,#0, #1 movout intlev movl outlin+4, r8 movnum #4, hm2$r_min_class+cls$q_secur_cat+4,#1, #8 movc3 #8, 4(r8), 12(r8) movnum #4, hm2$r_min_class+cls$q_secur_cat,#1, #8 movc3 #1, #^A"%",2(r8) movc3 #1, #^A"X",3(r8) movout seccat movl outlin+4, r8 movnum #4, hm2$r_min_class+cls$q_integ_cat+4,#1, #8 movc3 #8, 4(r8), 12(r8) movnum #4, hm2$r_min_class+cls$q_integ_cat,#1, #8 movc3 #1, #^A"%",2(r8) movc3 #1, #^A"X",3(r8) movout intcat movout maxsec movnum #1,hm2$r_max_class+cls$b_secur_lev,#0, #1 movout seclev movnum #1,hm2$r_max_class+cls$b_integ_lev,#0, #1 movout intlev movl outlin+4, r8 movnum #4, hm2$r_max_class+cls$q_secur_cat+4,#1, #8 movc3 #8, 4(r8), 12(r8) movnum #4, hm2$r_max_class+cls$q_secur_cat,#1, #8 movc3 #1, #^A"%",2(r8) movc3 #1, #^A"X",3(r8) movout seccat movl outlin+4, r8 movnum #4, hm2$r_max_class+cls$q_integ_cat+4,#1, #8 movc3 #8, 4(r8), 12(r8) movnum #4, hm2$r_max_class+cls$q_integ_cat,#1, #8 movc3 #1, #^A"%",2(r8) movc3 #1, #^A"X",3(r8) movout intcat movnum #4,hm2$l_serialnum,#0, #1 movout sernum movstr #hm2$s_strucname, hm2$t_strucname movout strucnam movstr #hm2$s_volname, hm2$t_volname movout volnam movstr #hm2$s_ownername, hm2$t_ownername movout ownnam movstr #hm2$s_format, hm2$t_format movout format movnum #2,hm2$w_checksum2,#1, #4 movl outlin+4, r8 movc3 #1, #^A"%",6(r8) movc3 #1, #^A"X",7(r8) movout chksum2 movout spaces movout spaces ; begin read and format of SCB $dassgn_s chan=channel blbs r0, 50$ ret 50$: moval fib, r5 movl #^x40004, fib$w_did(r5) movl #^x10001, fib$w_fid(r5) bisl2 #fib$m_nowrite, fib$l_acctl(r5) $ASSIGN_S - DEVNAM=DEVICE, - chan=channel blbs r0, 60$ ret 60$: $qiow_s chan=channel,- func=#io$_access!io$m_access, - iosb=iosb, - p1=fib_desc, - p2=#bitname qio_err $qiow_s chan=channel, - func=#io$_readvblk, - iosb=iosb, - p1=data, - p2=#512, - p3=#1 qio_err moval data, r6 movl #^D12,outlin movc5 device, device+8, #^A" ", #^D40, outlin+8 movout scbhdr movout spaces movl #scb$w_struclev,r7 movzbl (r6)[r7],r8 pushl r8 incl r7 movzbl (r6)[r7],r8 pushl r8 pushal outlin pushl #0 pushal fao_struclev calls #4,G^sys$fao movout struclev movnum #2, scb$w_cluster, #0, #1 movout cluster movnum #4, scb$l_volsize, #0, #1 movout volsiz movnum #4, scb$l_blksize, #0, #1 movout blksiz movnum #4, scb$l_sectors, #0, #1 movout sectrs movnum #4, scb$l_tracks, #0, #1 movout tracks movnum #4, scb$l_cylinder, #0, #1 movout clylnd movout sts movl scb$l_status(r6), r7 movl #0, r8 bbc #scb$v_mapdirty, r7, 70$ movc3 #mpdrty_s, mpdrty+8, outlin+8 movout spaces incl r8 70$: bbc #scb$v_mapalloc, r7, 72$ movc3 #mpaloc_s, mpaloc+8, outlin+8 movout spaces incl r8 72$: bbc #scb$v_filalloc, r7, 74$ movc3 #flaloc_s, flaloc+8, outlin+8 movout spaces incl r8 74$: bbc #scb$v_quodirty, r7, 76$ movc3 #qodrty_s, qodrty+8, outlin+8 movout spaces incl r8 76$: bbc #scb$v_hdrwrite, r7, 78$ movc3 #hdrwrt_s, hdrwrt+8, outlin+8 movout spaces incl r8 78$: cmpl #0, r8 bneq 79$ movc3 #none_s, none+8, outlin+8 movout spaces 79$: movout sts2 movl scb$l_status2(r6), r7 movl #0, r8 bbc #scb$v_mapdirty2, r7, 80$ movc3 #mpdrty_s, mpdrty+8, outlin+8 movout spaces incl r8 80$: bbc #scb$v_mapalloc2, r7, 82$ movc3 #mpaloc_s, mpaloc+8, outlin+8 movout spaces incl r8 82$: bbc #scb$v_filalloc2, r7, 84$ movc3 #flaloc_s, flaloc+8, outlin+8 movout spaces incl r8 84$: bbc #scb$v_quodirty2, r7, 86$ movc3 #qodrty_s, qodrty+8, outlin+8 movout spaces incl r8 86$: bbc #scb$v_hdrwrite2, r7, 88$ movc3 #hdrwrt_s, hdrwrt+8, outlin+8 movout spaces incl r8 88$: cmpl #0, r8 bneq 89$ movc3 #none_s, none+8, outlin+8 movout spaces 89$: movnum #2, scb$w_writecnt, #0, #1 movout wrtcnt movstr #scb$s_volockname, scb$t_volockname movout lcknam movl #^D24, outlin movdat scb$q_mounttime, #1 movout mnttim movl #^D12, outlin movnum #2, scb$w_backrev, #0, #1 movout bckrev movl #^D24, outlin movdat scb$q_genernum, #1 movout gennum movl #^D12, outlin movnum #2, scb$w_checksum, #1, #4 movl outlin+4, r8 movc3 #1, #^A"%",6(r8) movc3 #1, #^A"X",7(r8) movout scbchksum movl #1, r0 ret .end homdef