<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Even though someone found a utility for the 8200, a program like
      this is handy for other machines (and device roms).<br>
    </p>
    <p>A good outline of the essentials of PFN (and file) mapping, but
      for general use...</p>
    <p>You neither compute the checksum hinted at by "format" (and
      "buffer"), nor do you $FAO or output it.  Also, the movw @ 40$:
      (and the /2 above) may  want to be movl /4; most VAX do longword
      fetches for i-stream; as I mentioned previously, word reads from
      I/O space may or may not be supported on a given
      platform/address.   Note that the "checksum" is more often a
      CRC-32 than a 16-bit quantity.</p>
    <p>You don't need <tt>$iouv2def for this,nor lib.mlb.</tt><tt> (I
        expect that you borrowed code from something that did.)<br>
      </tt></p>
    <p>I recommend an explicit $close of the file, which can provide the
      exit status.  And .BIN would be a better file extension than .exe
      (since you're not writing an executable file.)  <br>
    </p>
    <p>Finally, the count at 40$ -1L and the 'page_count' symbol ought
      to be functions of something like "rom_length" so they stay
      consistent.  e.g. rom_length = ^X10000; page_count =
      <rom_length+511>/512; loop_count = rom_length / (2 or 4);<br>
    </p>
    Have fun.<br>
    <br>
    <div class="moz-cite-prefix">On 18-Mar-17 11:47, Rick Murphy wrote:<br>
    </div>
    <blockquote
      cite="mid:021a8ddb-58d4-d7be-2f8a-dd13e659175a@rickmurphy.net"
      type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 3/16/2017 11:53 PM, Robert
        Armstrong wrote:<br>
      </div>
      <blockquote cite="mid:017401d29ed1$fa2703a0$ee750ae0$@com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <meta name="Generator" content="Microsoft Word 12 (filtered
          medium)">
        <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal" style="margin-bottom:12.0pt"><span
              style="color:#1F497D">></span>Under VMS, PFN map a
            section to the EEPROM, copy it to normal memory & write
            it to disk.<span style="color:#1F497D"><o:p></o:p></span></p>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> 
              Um, fair enough.  I don’t suppose someone has a program
              already written to do this?  <o:p></o:p></span></p>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">  I
              could have easily done that about ten or fifteen years
              ago, and in theory I still can, but it’ll probably take an
              afternoon with the VMS manuals to remember how </span><span
style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">J</span></p>
        </div>
      </blockquote>
      Here's an example, which I wrote for the MicroVAX. Took me a bit
      to find this.<br>
      <br>
      The program creates a file called ROM.EXE and copies the boot ROM
      into that file.<br>
      Note the "                        vbn=#<^X20040000/512>" 
      line - that says that the ROM is mapped into physical address
      20040000 on that system. Likely different for others. Size of the
      ROM is calculated by the "page_count" variable.<br>
          -Rick<br>
      <br>
      <tt>        .title  copyrom - Copy the rom</tt><tt><br>
      </tt><tt>         .psect  data    rd, wrt, nopic, noshr, noexe,
        long</tt><tt><br>
      </tt><tt>         .library        /sys$Library:lib/</tt><tt><br>
      </tt><tt>         $iouv2def</tt><tt><br>
      </tt><tt>         $secdef</tt><tt><br>
      </tt><tt>         .psect  data    rd, wrt, nopic, noshr, noexe,
        long</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt>         page_count = ^X10000/^X200</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> file_fab:       $FAB    ALQ=page_count,-</tt><tt><br>
      </tt><tt>                         FAC=<GET,PUT>,-</tt><tt><br>
      </tt><tt>                         FNM=<ROM.EXE>,-</tt><tt><br>
      </tt><tt>                         FOP=UFO</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> p1_space:       .quad   0</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> copy_sec_base:  .long   0</tt><tt><br>
      </tt><tt>                 .long   0</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> rom_sec_base:   .long   0</tt><tt><br>
      </tt><tt>                 .long   0</tt><tt><br>
      </tt><tt> buf_descr:      .long   80</tt><tt><br>
      </tt><tt>                 .address        buffer</tt><tt><br>
      </tt><tt> buffer:         .blkb   80</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> format:         .ascid  /Checksum is !XW/</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt>         .psect  code    rd, nowrt, pic, noshr, exe, long</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt>         .entry  go, ^m<></tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt>         $create fab=file_fab</tt><tt><br>
      </tt><tt>         blbs    r0, 10$</tt><tt><br>
      </tt><tt>         ret</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> 10$:    $crmpsc_s       inadr=p1_space,-</tt><tt><br>
      </tt><tt>                         retadr=copy_sec_base,-</tt><tt><br>
      </tt><tt>                        
        flags=#<sec$m_expreg!sec$m_wrt>,-</tt><tt><br>
      </tt><tt>                         chan=file_fab+fab$l_stv</tt><tt><br>
      </tt><tt>         blbs    r0, 20$</tt><tt><br>
      </tt><tt>         ret</tt><tt><br>
      </tt><tt> </tt><tt><br>
      </tt><tt> 20$:    $crmpsc_s       inadr=p1_space,-</tt><tt><br>
      </tt><tt>                         retadr=rom_sec_base,-</tt><tt><br>
      </tt><tt>                        
        flags=#<sec$m_expreg!sec$m_pfnmap>,-</tt><tt><br>
      </tt><tt>                         pagcnt=#page_count,-</tt><tt><br>
      </tt><tt>                         vbn=#<^X20040000/512></tt><tt><br>
      </tt><tt>         blbs    r0, 30$</tt><tt><br>
      </tt><tt>         ret</tt><tt><br>
      </tt><tt> 30$:    movl    rom_sec_base, r0</tt><tt><br>
      </tt><tt>         movl    copy_sec_base, r1</tt><tt><br>
      </tt><tt>         movl    #^x10000/2, r2</tt><tt><br>
      </tt><tt> 40$:    movw    (r0)+, (r1)+</tt><tt><br>
      </tt><tt>         sobgtr  r2, 40$</tt><tt><br>
      </tt><tt>         movl    #1,r0</tt><tt><br>
      </tt><tt>         ret</tt><tt><br>
      </tt><tt>         .end    go</tt><br>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>