| 1 | <!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 4.01//EN"> |
| 2 | |
| 3 | <html> |
| 4 | <head> |
| 5 | <title> Pep/8: Machine Language Documentation </title> |
| 6 | <style type="text/css" media="all"> |
| 7 | code { font-family:Courier, 'Courier New', monospace; font-size:11pt } |
| 8 | img { vertical-align:text-top; } |
| 9 | h4 { margin-bottom: 0; border-bottom-width: 0; padding-bottom: 0; } |
| 10 | </style> |
| 11 | </head> |
| 12 | <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#000033" alink="#0066FF"> |
| 13 | <table bgcolor="#FB9F14" width="100%" cellpadding="2" cellspacing="0" border="0"> |
| 14 | <tr><td> |
| 15 | <p style="text-align:center; font-family:helvetica, arial, sans-serif; font-size:14pt; font-weight:bold; color: #29315E"> |
| 16 | Machine Language |
| 17 | </p> |
| 18 | </td></tr> |
| 19 | </table> |
| 20 | <p> |
| 21 | Reference: <i>Computer Systems</i>, Chapters 3, 4. |
| 22 | <p> |
| 23 | A machine language program is a binary sequence, that is, a sequence of ones and zeros, that the |
| 24 | machine interprets according to its von Neumann cycle as in Figure 4.31 of the text. |
| 25 | Therefore, to write a machine language program is to write a sequence of ones and zeros. |
| 26 | Fortunately, the Pep/8 loader permits you to use the hexadecimal abbreviation for binary, as Section 3.4 explains. |
| 27 | <p> |
| 28 | <a name = "Topics">Topics:</a> |
| 29 | <a href="#Writing">Writing a machine language program</a>, |
| 30 | <a href="#Run">The Run Object option</a>. |
| 31 | |
| 32 | <h3><a name="Writing">Writing a machine language program</a></h3> |
| 33 | |
| 34 | Writing a machine language program is a three-step process. |
| 35 | <p> |
| 36 | <h4>Step 1.</h4> |
| 37 | With this Pep/8 application, you write the machine language program in hexadecimal in the Object Code pane. |
| 38 | The following figure shows the object program from Figure 4.41 of the text. |
| 39 | <p> |
| 40 | <img src="qrc:/help/images/fig0441.png" alt="fig0441" hspace=10 vspace=10> |
| 41 | <p> |
| 42 | A hexadecimal program must follow precise formatting rules. |
| 43 | Each hex number representing a byte must contain exactly two characters. |
| 44 | Each character must be in 0..9, A..F, or a..f and must be followed by exactly one space. |
| 45 | There must be no leading spaces at the beginning of a line |
| 46 | and no trailing spaces at the end of a line. |
| 47 | The last two characters in the file must be lowercase <code>zz</code>, |
| 48 | which is used as the terminating sentinel by the loader. |
| 49 | <p> |
| 50 | <h4>Step 2.</h4> |
| 51 | After writing the machine language program, load it by selecting Build -> Load from the menu. |
| 52 | <p> |
| 53 | <img src="qrc:/help/images/load.png" alt="load" hspace=10 vspace=10> |
| 54 | <p> |
| 55 | If there are no errors in the program a message to that effect will appear at the bottom of the main window. |
| 56 | <p> |
| 57 | <img src="qrc:/help/images/loadsucceeded.png" alt="loadsucceeded" hspace=10 vspace=10> |
| 58 | <p> |
| 59 | <h4>Step 3.</h4> |
| 60 | To execute the program select Build -> Execute from the menu. |
| 61 | <p> |
| 62 | <img src="qrc:/help/images/execute.png" alt="execute" hspace=10 vspace=10> |
| 63 | <p> |
| 64 | With this program, the output appears in the output pane. |
| 65 | <p> |
| 66 | <img src="qrc:/help/images/fig0441output.png" alt="fig0441output" hspace=10 vspace=10> |
| 67 | <p> |
| 68 | <a href="#Topics">Scroll to topics</a>. |
| 69 | |
| 70 | <h3><a name="Run">The Run Object option</a></h3> |
| 71 | |
| 72 | The two steps — Load, Execute — are combined in the single option called Run Object. |
| 73 | You can initiate a run by selecting Build->Run Object from the menu. |
| 74 | <p> |
| 75 | <img src="qrc:/help/images/runobject.png" alt="runobject" hspace=10 vspace=10> |
| 76 | <p> |
| 77 | <a href="#Topics">Scroll to topics</a>. |
| 78 | <p> |
| 79 | </body> |
| 80 | </html> |