| 1 | <!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 4.01//EN"> |
| 2 | |
| 3 | <html> |
| 4 | <head> |
| 5 | <title> Pep/8: Assembly 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 | Assembly Language |
| 17 | </p> |
| 18 | </td></tr> |
| 19 | </table> |
| 20 | <p> |
| 21 | Reference: <i>Computer Systems</i>, Chapters 5, 6. |
| 22 | <p> |
| 23 | An assembly language program is a sequence of lines, each line containing either an instruction |
| 24 | from the Pep/8 instruction set specfied by a mnemonic, |
| 25 | or a pseudo-operation, also called a pseudo-op or dot command. |
| 26 | The assembly language program must end with the pseudo-op <code>.END</code>. |
| 27 | <p> |
| 28 | <a name = "Topics">Topics:</a> |
| 29 | <a href="#Writing">Writing an assembly language program</a>, |
| 30 | <a href="#Trace">Trace tag warnings</a>, |
| 31 | <a href="#Run">The Run Source option</a>. |
| 32 | |
| 33 | <h3><a name="Writing">Writing an assembly language program</a></h3> |
| 34 | |
| 35 | Writing an assembly language program is a four-step process. |
| 36 | <p> |
| 37 | <h4>Step 1.</h4> |
| 38 | With this Pep/8 application, you write the assembly language program using the built-in text editor in the Source Code pane. |
| 39 | The following figure shows the source program after entering the program from Figure 5.18 of the textbook. |
| 40 | <p> |
| 41 | <img src="qrc:/help/images/fig518.png" alt="fig518" hspace=10 vspace=10> |
| 42 | <p> |
| 43 | Strict formatting is not required as long as there is one instruction or dot command per line, |
| 44 | and at least one space between a mnemonic and an operand specifier. |
| 45 | For example, the above program could be entered as follows. |
| 46 | <p> |
| 47 | <img src="qrc:/help/images/fig518unformatted.png" alt="fig518unformatted" hspace=10 vspace=10> |
| 48 | <p> |
| 49 | <h4>Step 2.</h4> |
| 50 | After writing the assembly language program, assemble it by selecting Build->Assemble from the menu |
| 51 | or clicking on the hammer icon in the tool bar. |
| 52 | <p> |
| 53 | <img src="qrc:/help/images/assemble.png" alt="assemble" hspace=10 vspace=10> |
| 54 | <img src="qrc:/help/images/assembleicon.png" alt="assembleicon" hspace=10 vspace=10> |
| 55 | <p> |
| 56 | If there are no errors in the program a message to that effect will appear at the bottom of the main window. |
| 57 | <p> |
| 58 | <img src="qrc:/help/images/assemblysucceeded.png" alt="assemblysucceeded" hspace=10 vspace=10> |
| 59 | <p> |
| 60 | The translated program will appear in the Object Code pane, |
| 61 | and a formatted listing will appear in the Assembler Listing pane. |
| 62 | <p> |
| 63 | <img src="qrc:/help/images/fig518assembled.png" alt="fig518assembled" hspace=10 vspace=10> |
| 64 | <p> |
| 65 | If there is an error in your program, an error message will appear in the source code pane. |
| 66 | The following screenshot shows what would happen if you fail to supply the addressing mode for |
| 67 | the <code>STRO</code> instruction. |
| 68 | <P> |
| 69 | <img src="qrc:/help/images/fig518error.png" alt="fig518error" hspace=10 vspace=10> |
| 70 | <p> |
| 71 | If you would like, you can select Build->Remove Error Messages from the menu to delete the error message. |
| 72 | Then, you can correct your error and try to assemble your program again. |
| 73 | It is not necessary to remove the error message before correcting your program, as error messages |
| 74 | are automatically removed when you reassemble your program. |
| 75 | <p> |
| 76 | <img src="qrc:/help/images/removeerrormessages.png" alt="removeerrormessages" hspace=10 vspace=10> |
| 77 | <p> |
| 78 | Once you assemble your program so that a formatted listing appears in the Assembler Listing pane, |
| 79 | you can select Edit->Format From Listing from the menu. |
| 80 | Your source code will be replaced with the standard formatted source code extracted from the Assembler Listing pane. |
| 81 | <p> |
| 82 | <img src="qrc:/help/images/formatfromlisting.png" alt="formatfromlisting" hspace=10 vspace=10> |
| 83 | <p> |
| 84 | <h4>Step 3.</h4> |
| 85 | Load your program by selecting Build -> Load from the menu. |
| 86 | <p> |
| 87 | <img src="qrc:/help/images/load.png" alt="load" hspace=10 vspace=10> |
| 88 | <p> |
| 89 | <h4>Step 4.</h4> |
| 90 | To execute the program select Build -> Execute from the menu. |
| 91 | <p> |
| 92 | <img src="qrc:/help/images/execute.png" alt="execute" hspace=10 vspace=10> |
| 93 | <p> |
| 94 | <a href="#Topics">Scroll to topics</a>. |
| 95 | |
| 96 | <h3><a name="Trace">Trace tag warnings</a></h3> |
| 97 | |
| 98 | If your program assembles correctly but there is an error in your trace tags, a trace tag warning is displayed. |
| 99 | For example, here is what happens if you make an error in one of the trace tags in the program from Figure 5.26. |
| 100 | <p> |
| 101 | <img src="qrc:/help/images/fig518tracetagwarning.png" alt="fig518tracetagwarning" hspace=10 vspace=10> |
| 102 | <p> |
| 103 | Programs with trace tag warnings have assembled correctly and will still run. |
| 104 | In the debugger, you can still single step through the program, set break points, and trace memory in the Memory Dump pane. |
| 105 | However, the symbolic trace feature that shows the C++ memory model graphically in the Memory Trace pane is disabled until |
| 106 | you fix the trace tag error and reassemble your program. |
| 107 | <p> |
| 108 | <a href="#Topics">Scroll to topics</a>. |
| 109 | |
| 110 | <h3><a name="Run">The Run Source option</a></h3> |
| 111 | |
| 112 | The three steps — Assemble, Load, Execute — are combined in the single option called Run Source. |
| 113 | You can initiate a run by selecting Build->Run Source from the menu or by clicking on the Run Source icon in the tool bar. |
| 114 | <p> |
| 115 | <img src="qrc:/help/images/runsource.png" alt="runsource" hspace=10 vspace=10> |
| 116 | <img src="qrc:/help/images/runicon.png" alt="runicon" hspace=10 vspace=10> |
| 117 | <p> |
| 118 | <a href="#Topics">Scroll to topics</a>. |
| 119 | <p> |
| 120 | </body> |
| 121 | </html> |