{"id":2433,"date":"2025-06-07T04:37:50","date_gmt":"2025-06-07T04:37:50","guid":{"rendered":"https:\/\/diznr.com\/?p=2433"},"modified":"2025-06-07T04:37:50","modified_gmt":"2025-06-07T04:37:50","slug":"system-programming-pass-1-assemblers-concept-of-single-pass-assemblers-and-its-working-in-programming-system","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/system-programming-pass-1-assemblers-concept-of-single-pass-assemblers-and-its-working-in-programming-system\/","title":{"rendered":"System Programming: Pass 1 assemblers-Concept of single pass Assemblers and it&#8217;s working in system programming"},"content":{"rendered":"<p>System Programming: Pass 1 assemblers-Concept of single pass Assemblers and it&#8217;s working in system programming.<\/p>\n<p>[fvplayer id=&#8221;32&#8243;]<\/p>\n<h3 data-start=\"0\" data-end=\"49\"><strong data-start=\"4\" data-end=\"47\">Pass 1 Assemblers in System Programming<\/strong><\/h3>\n<p data-start=\"51\" data-end=\"259\">Assemblers are programs that <strong data-start=\"80\" data-end=\"109\">convert assembly language<\/strong> code into <strong data-start=\"120\" data-end=\"136\">machine code<\/strong>. Based on how they process the source code, assemblers are categorized into <strong data-start=\"213\" data-end=\"228\">Single-Pass<\/strong> and <strong data-start=\"233\" data-end=\"247\">Multi-Pass<\/strong> assemblers.<\/p>\n<h3 data-start=\"266\" data-end=\"307\"><strong data-start=\"269\" data-end=\"305\">What is a Single Pass Assembler?<\/strong><\/h3>\n<p data-start=\"308\" data-end=\"550\">A <strong data-start=\"310\" data-end=\"335\">Single-Pass Assembler<\/strong> processes the source code in <strong data-start=\"365\" data-end=\"377\">one pass<\/strong>, meaning it scans the assembly code <strong data-start=\"414\" data-end=\"427\">only once<\/strong> to generate machine code. It does not revisit instructions, making it <strong data-start=\"498\" data-end=\"518\">fast but limited<\/strong> in handling forward references.<\/p>\n<p data-start=\"552\" data-end=\"587\"><strong data-start=\"552\" data-end=\"585\">Example of Forward Reference:<\/strong><\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre language-assembly\">JMP LABEL   ; Forward reference (LABEL not yet defined)<br \/>\n...<br \/>\nLABEL: NOP  ; Label defined later<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"698\" data-end=\"807\">A <strong data-start=\"700\" data-end=\"725\">single-pass assembler<\/strong> struggles with this because it encounters <code data-start=\"768\" data-end=\"779\">JMP LABEL<\/code> before knowing its address.<\/p>\n<h3 data-start=\"814\" data-end=\"855\"><strong data-start=\"817\" data-end=\"855\">Working of a Single-Pass Assembler<\/strong><\/h3>\n<h3 data-start=\"856\" data-end=\"888\"><strong data-start=\"860\" data-end=\"888\">Key Functions in Pass 1:<\/strong><\/h3>\n<ol data-start=\"889\" data-end=\"1533\">\n<li data-start=\"889\" data-end=\"964\">\n<p data-start=\"892\" data-end=\"922\"><strong data-start=\"892\" data-end=\"920\">Scanning the Source Code<\/strong><\/p>\n<ul data-start=\"926\" data-end=\"964\">\n<li data-start=\"926\" data-end=\"961\">Reads each line of assembly code.<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"965\" data-end=\"1118\">\n<p data-start=\"968\" data-end=\"1001\"><strong data-start=\"968\" data-end=\"999\">Generating the Symbol Table<\/strong><\/p>\n<ul data-start=\"1005\" data-end=\"1118\">\n<li data-start=\"1005\" data-end=\"1051\">Records labels and their memory locations.<\/li>\n<li data-start=\"1055\" data-end=\"1118\">Handles <strong data-start=\"1065\" data-end=\"1087\">forward references<\/strong> (may use a fix-up approach).<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"1120\" data-end=\"1261\">\n<p data-start=\"1123\" data-end=\"1172\"><strong data-start=\"1123\" data-end=\"1170\">Assigning Addresses (Location Counter &#8211; LC)<\/strong><\/p>\n<ul data-start=\"1176\" data-end=\"1261\">\n<li data-start=\"1176\" data-end=\"1216\">Tracks instruction memory addresses.<\/li>\n<li data-start=\"1220\" data-end=\"1261\">Increments <code data-start=\"1233\" data-end=\"1237\">LC<\/code> for each instruction.<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"1263\" data-end=\"1400\">\n<p data-start=\"1266\" data-end=\"1299\"><strong data-start=\"1266\" data-end=\"1297\">Translating to Machine Code<\/strong><\/p>\n<ul data-start=\"1303\" data-end=\"1400\">\n<li data-start=\"1303\" data-end=\"1339\">Converts mnemonics into opcodes.<\/li>\n<li data-start=\"1343\" data-end=\"1400\">Tries to resolve addresses immediately (if possible).<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"1402\" data-end=\"1533\">\n<p data-start=\"1405\" data-end=\"1438\"><strong data-start=\"1405\" data-end=\"1436\">Handling Forward References<\/strong><\/p>\n<ul data-start=\"1442\" data-end=\"1533\">\n<li data-start=\"1442\" data-end=\"1533\">If an address is unknown, it may generate <strong data-start=\"1486\" data-end=\"1513\">incomplete machine code<\/strong> and fix it later.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3 data-start=\"1540\" data-end=\"1584\"><strong data-start=\"1544\" data-end=\"1584\">Advantages of Single-Pass Assemblers<\/strong><\/h3>\n<p data-start=\"1585\" data-end=\"1752\">\u00a0Faster execution since only <strong data-start=\"1615\" data-end=\"1627\">one pass<\/strong> is needed.<br data-start=\"1638\" data-end=\"1641\" \/>\u00a0Requires <strong data-start=\"1652\" data-end=\"1667\">less memory<\/strong> compared to multi-pass assemblers.<br data-start=\"1702\" data-end=\"1705\" \/>\u00a0Efficient for <strong data-start=\"1721\" data-end=\"1731\">simple<\/strong> assembly programs.<\/p>\n<h3 data-start=\"1754\" data-end=\"1775\"><strong data-start=\"1758\" data-end=\"1775\">Disadvantages<\/strong><\/h3>\n<p data-start=\"1776\" data-end=\"1967\">\u00a0Cannot fully handle <strong data-start=\"1798\" data-end=\"1820\">forward references<\/strong> efficiently.<br data-start=\"1833\" data-end=\"1836\" \/>\u00a0May produce <strong data-start=\"1850\" data-end=\"1877\">incomplete machine code<\/strong>, needing extra fixes.<br data-start=\"1899\" data-end=\"1902\" \/>\u00a0Limited <strong data-start=\"1912\" data-end=\"1930\">error checking<\/strong> compared to multi-pass assemblers.<\/p>\n<h3 data-start=\"1974\" data-end=\"2021\"><strong data-start=\"1977\" data-end=\"2021\">Example: Single-Pass Assembler in Action<\/strong><\/h3>\n<p data-start=\"2022\" data-end=\"2059\">Consider the following assembly code:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre language-assembly\">START:  MOV A, B<br \/>\nJMP LABEL<br \/>\nADD C<br \/>\nLABEL:  SUB D<br \/>\nHLT<br \/>\n<\/code><\/div>\n<\/div>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"2152\" data-end=\"2486\">\n<thead data-start=\"2152\" data-end=\"2188\">\n<tr data-start=\"2152\" data-end=\"2188\">\n<th data-start=\"2152\" data-end=\"2167\">Instruction<\/th>\n<th data-start=\"2167\" data-end=\"2178\">Address<\/th>\n<th data-start=\"2178\" data-end=\"2188\">Action<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2224\" data-end=\"2486\">\n<tr data-start=\"2224\" data-end=\"2268\">\n<td>MOV A, B<\/td>\n<td>1000<\/td>\n<td>Encoded directly<\/td>\n<\/tr>\n<tr data-start=\"2269\" data-end=\"2332\">\n<td>JMP LABEL<\/td>\n<td>1001<\/td>\n<td>Address unknown (forward reference)<\/td>\n<\/tr>\n<tr data-start=\"2333\" data-end=\"2377\">\n<td>ADD C<\/td>\n<td>1002<\/td>\n<td>Encoded directly<\/td>\n<\/tr>\n<tr data-start=\"2378\" data-end=\"2441\">\n<td>LABEL: SUB D<\/td>\n<td>1003<\/td>\n<td>Define LABEL (resolve previous JMP)<\/td>\n<\/tr>\n<tr data-start=\"2442\" data-end=\"2486\">\n<td>HLT<\/td>\n<td>1004<\/td>\n<td>Encoded directly<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<ul data-start=\"2488\" data-end=\"2623\">\n<li data-start=\"2488\" data-end=\"2559\"><strong data-start=\"2490\" data-end=\"2518\">Pass 1 assigns addresses<\/strong> and stores labels in a <strong data-start=\"2542\" data-end=\"2558\">symbol table<\/strong>.<\/li>\n<li data-start=\"2560\" data-end=\"2623\"><strong data-start=\"2562\" data-end=\"2602\">Forward references (e.g., JMP LABEL)<\/strong> require fixes later.<\/li>\n<\/ul>\n<h3 data-start=\"2630\" data-end=\"2647\"><strong data-start=\"2633\" data-end=\"2647\">Conclusion<\/strong><\/h3>\n<p data-start=\"2648\" data-end=\"2873\">A <strong data-start=\"2650\" data-end=\"2675\">Single-Pass Assembler<\/strong> is <strong data-start=\"2679\" data-end=\"2708\">fast and memory-efficient<\/strong>, making it suitable for simple systems. However, <strong data-start=\"2758\" data-end=\"2780\">forward references<\/strong> pose a challenge, which <strong data-start=\"2805\" data-end=\"2830\">Multi-Pass Assemblers<\/strong> solve by scanning the code multiple times.<\/p>\n<p data-start=\"2875\" data-end=\"2989\" data-is-last-node=\"\" data-is-only-node=\"\">Would you like a <strong data-start=\"2892\" data-end=\"2941\">detailed example with machine code generation<\/strong> or <strong data-start=\"2945\" data-end=\"2985\">comparison with a Two-Pass Assembler<\/strong>?<\/p>\n<h3 data-start=\"2875\" data-end=\"2989\"><a href=\"https:\/\/kishoreinvssut.yolasite.com\/resources\/System_programming\/03.Assembler.pdf\" target=\"_blank\" rel=\"noopener\">System Programming: Pass 1 assemblers-Concept of single pass Assemblers and it&#8217;s working in system programming<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.wbuthelp.com\/chapter_file\/2677.pdf\" target=\"_blank\" rel=\"noopener\">Module 1: Assemblers &#8211; WBUTHELP.COM<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.kharagpurcollege.ac.in\/studyMaterial\/23554Study-materials-for-BCA-3rd-semester-System-Programming2.pdf\" target=\"_blank\" rel=\"noopener\">System Programming<\/a><\/h3>\n<article class=\"text-token-text-primary w-full\" dir=\"auto\" data-testid=\"conversation-turn-106\" data-scroll-anchor=\"true\">\n<div class=\"text-base my-auto mx-auto py-5 [--thread-content-margin:--spacing(4)] @[37rem]:[--thread-content-margin:--spacing(6)] @[72rem]:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)\">\n<div class=\"[--thread-content-max-width:32rem] @[34rem]:[--thread-content-max-width:40rem] @[64rem]:[--thread-content-max-width:48rem] mx-auto flex max-w-(--thread-content-max-width) flex-1 text-base gap-4 md:gap-5 lg:gap-6 group\/turn-messages focus-visible:outline-hidden\">\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\n<div class=\"relative flex-col gap-1 md:gap-3\">\n<div class=\"flex max-w-full flex-col grow\">\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"e1781ced-be6c-4f30-921d-0a79512a1b2c\" data-message-model-slug=\"gpt-4o\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose dark:prose-invert w-full break-words light\">\n<p data-start=\"0\" data-end=\"250\">Here\u2019s a comprehensive explanation of <strong data-start=\"38\" data-end=\"59\">Pass 1 Assemblers<\/strong>, focusing on the <strong data-start=\"77\" data-end=\"114\">concept of Single Pass Assemblers<\/strong>, their <strong data-start=\"122\" data-end=\"133\">working<\/strong>, and use in <strong data-start=\"146\" data-end=\"168\">System Programming<\/strong> \u2013 a key topic in <strong data-start=\"186\" data-end=\"249\">GATE CSE\/IT and university-level system programming courses<\/strong>.<\/p>\n<hr data-start=\"252\" data-end=\"255\" \/>\n<h2 data-start=\"257\" data-end=\"328\">\ud83d\udcd8 <strong data-start=\"263\" data-end=\"328\">System Programming \u2013 Single Pass Assembler (Pass 1 Assembler)<\/strong><\/h2>\n<hr data-start=\"330\" data-end=\"333\" \/>\n<h3 data-start=\"335\" data-end=\"367\">\ud83d\udd39 <strong data-start=\"342\" data-end=\"367\">What is an Assembler?<\/strong><\/h3>\n<p data-start=\"368\" data-end=\"502\">An <strong data-start=\"371\" data-end=\"384\">assembler<\/strong> is a system program that converts <strong data-start=\"419\" data-end=\"440\">assembly language<\/strong> instructions (mnemonics) into <strong data-start=\"471\" data-end=\"487\">machine code<\/strong> (binary code).<\/p>\n<hr data-start=\"504\" data-end=\"507\" \/>\n<h2 data-start=\"509\" data-end=\"547\">\ud83d\udd04 <strong data-start=\"515\" data-end=\"547\">What is a Pass in Assembler?<\/strong><\/h2>\n<ul data-start=\"549\" data-end=\"743\">\n<li data-start=\"549\" data-end=\"612\">\n<p data-start=\"551\" data-end=\"612\">A <strong data-start=\"553\" data-end=\"561\">pass<\/strong> is a complete scan over the entire source program.<\/p>\n<\/li>\n<li data-start=\"613\" data-end=\"743\">\n<p data-start=\"615\" data-end=\"675\">Based on the number of scans, assemblers are categorized as:<\/p>\n<ul data-start=\"678\" data-end=\"743\">\n<li data-start=\"678\" data-end=\"706\">\n<p data-start=\"680\" data-end=\"706\"><strong data-start=\"680\" data-end=\"706\">Single Pass (One pass)<\/strong><\/p>\n<\/li>\n<li data-start=\"709\" data-end=\"743\">\n<p data-start=\"711\" data-end=\"743\"><strong data-start=\"711\" data-end=\"743\">Two Pass (Pass 1 and Pass 2)<\/strong><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr data-start=\"745\" data-end=\"748\" \/>\n<h2 data-start=\"750\" data-end=\"791\">\ud83d\ude80 <strong data-start=\"756\" data-end=\"791\">Single Pass Assembler \u2013 Concept<\/strong><\/h2>\n<h3 data-start=\"793\" data-end=\"814\">\u2705 <strong data-start=\"799\" data-end=\"814\">Definition:<\/strong><\/h3>\n<p data-start=\"815\" data-end=\"992\">A <strong data-start=\"817\" data-end=\"842\">Single Pass Assembler<\/strong> translates <strong data-start=\"854\" data-end=\"899\">assembly code to machine code in one scan<\/strong> of the source file. It processes each instruction and simultaneously generates machine code.<\/p>\n<hr data-start=\"994\" data-end=\"997\" \/>\n<h2 data-start=\"999\" data-end=\"1053\">\ud83e\udde0 <strong data-start=\"1005\" data-end=\"1053\">Key Characteristics of Single Pass Assembler<\/strong><\/h2>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"1055\" data-end=\"1708\">\n<thead data-start=\"1055\" data-end=\"1161\">\n<tr data-start=\"1055\" data-end=\"1161\">\n<th data-start=\"1055\" data-end=\"1082\" data-col-size=\"sm\">Feature<\/th>\n<th data-start=\"1082\" data-end=\"1161\" data-col-size=\"md\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1269\" data-end=\"1708\">\n<tr data-start=\"1269\" data-end=\"1376\">\n<td data-start=\"1269\" data-end=\"1297\" data-col-size=\"sm\">\ud83d\udd52 Efficiency<\/td>\n<td data-start=\"1297\" data-end=\"1376\" data-col-size=\"md\">Faster because it scans the source only once<\/td>\n<\/tr>\n<tr data-start=\"1377\" data-end=\"1484\">\n<td data-start=\"1377\" data-end=\"1405\" data-col-size=\"sm\">\ud83d\udd01 No Re-scanning<\/td>\n<td data-start=\"1405\" data-end=\"1484\" data-col-size=\"md\">No second pass is needed<\/td>\n<\/tr>\n<tr data-start=\"1485\" data-end=\"1599\">\n<td data-start=\"1485\" data-end=\"1513\" data-col-size=\"sm\">\ud83d\udccb Symbol table<\/td>\n<td data-start=\"1513\" data-end=\"1599\" data-col-size=\"md\">Maintains a symbol table as it encounters labels (may use forward reference table)<\/td>\n<\/tr>\n<tr data-start=\"1600\" data-end=\"1708\">\n<td data-start=\"1600\" data-end=\"1629\" data-col-size=\"sm\">\ud83d\udce6 Forward reference issue<\/td>\n<td data-start=\"1629\" data-end=\"1708\" data-col-size=\"md\">Uses placeholders or back-patching for labels not yet defined<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"1710\" data-end=\"1713\" \/>\n<h3 data-start=\"1715\" data-end=\"1751\">\ud83d\udccc <strong data-start=\"1722\" data-end=\"1751\">How Does It Work? (Steps)<\/strong><\/h3>\n<ol data-start=\"1753\" data-end=\"2303\">\n<li data-start=\"1753\" data-end=\"1898\">\n<p data-start=\"1756\" data-end=\"1776\"><strong data-start=\"1756\" data-end=\"1774\">Initialization<\/strong><\/p>\n<ul data-start=\"1780\" data-end=\"1898\">\n<li data-start=\"1780\" data-end=\"1837\">\n<p data-start=\"1782\" data-end=\"1837\">Set <strong data-start=\"1786\" data-end=\"1811\">Location Counter (LC)<\/strong> to track memory address<\/p>\n<\/li>\n<li data-start=\"1841\" data-end=\"1898\">\n<p data-start=\"1843\" data-end=\"1898\">Initialize <strong data-start=\"1854\" data-end=\"1870\">Symbol Table<\/strong> and <strong data-start=\"1875\" data-end=\"1898\">Machine Code buffer<\/strong><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"1900\" data-end=\"2261\">\n<p data-start=\"1903\" data-end=\"1963\"><strong data-start=\"1903\" data-end=\"1924\">Read line-by-line<\/strong><br data-start=\"1924\" data-end=\"1927\" \/>For each line in the source code:<\/p>\n<ul data-start=\"1967\" data-end=\"2261\">\n<li data-start=\"1967\" data-end=\"2054\">\n<p data-start=\"1969\" data-end=\"2054\">If it has a <strong data-start=\"1981\" data-end=\"1990\">label<\/strong>, insert it into the <strong data-start=\"2011\" data-end=\"2027\">Symbol Table<\/strong> with the current LC value.<\/p>\n<\/li>\n<li data-start=\"2058\" data-end=\"2125\">\n<p data-start=\"2060\" data-end=\"2125\">If it contains a <strong data-start=\"2077\" data-end=\"2089\">mnemonic<\/strong>, generate <strong data-start=\"2100\" data-end=\"2124\">corresponding opcode<\/strong>.<\/p>\n<\/li>\n<li data-start=\"2129\" data-end=\"2216\">\n<p data-start=\"2131\" data-end=\"2216\">If it uses a label not yet defined (forward reference), mark it and back-patch later.<\/p>\n<\/li>\n<li data-start=\"2220\" data-end=\"2261\">\n<p data-start=\"2222\" data-end=\"2261\">Increment LC based on instruction size.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li data-start=\"2263\" data-end=\"2303\">\n<p data-start=\"2266\" data-end=\"2303\"><strong data-start=\"2266\" data-end=\"2289\">Output machine code<\/strong> line by line.<\/p>\n<\/li>\n<\/ol>\n<hr data-start=\"2305\" data-end=\"2308\" \/>\n<h2 data-start=\"2310\" data-end=\"2359\">\ud83d\uddbc\ufe0f <strong data-start=\"2317\" data-end=\"2359\">Diagram: Single Pass Assembler Working<\/strong><\/h2>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">pgsql<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">           +<span class=\"hljs-comment\">----------------------+<\/span><br \/>\nSource <span class=\"hljs-comment\">--&gt;|   Single Pass        |--&gt; Object Code<\/span><br \/>\nCode      |    Assembler         |<br \/>\n+<span class=\"hljs-comment\">----------------------+<\/span><br \/>\n| Symbol <span class=\"hljs-keyword\">Table<\/span>         |<br \/>\n| <span class=\"hljs-keyword\">Location<\/span> Counter     |<br \/>\n| Opcode <span class=\"hljs-keyword\">Table<\/span>         |<br \/>\n| Literal <span class=\"hljs-keyword\">Table<\/span>        |<br \/>\n| Forward <span class=\"hljs-keyword\">Ref<\/span> <span class=\"hljs-keyword\">Handler<\/span>  |<br \/>\n+<span class=\"hljs-comment\">----------------------+<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<hr data-start=\"2745\" data-end=\"2748\" \/>\n<h2 data-start=\"2750\" data-end=\"2785\">\ud83d\udd04 <strong data-start=\"2756\" data-end=\"2785\">Forward Reference Example<\/strong><\/h2>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">asm<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre! language-asm\">    JMP  NEXT<br \/>\n...<br \/>\nNEXT: MOV A, B<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"2836\" data-end=\"3065\">\n<li data-start=\"2836\" data-end=\"3065\">\n<p data-start=\"2838\" data-end=\"2924\">While processing <code data-start=\"2855\" data-end=\"2865\">JMP NEXT<\/code>, the address of <code data-start=\"2882\" data-end=\"2888\">NEXT<\/code> is <strong data-start=\"2892\" data-end=\"2909\">not yet known<\/strong>, so assembler:<\/p>\n<ul data-start=\"2927\" data-end=\"3065\">\n<li data-start=\"2927\" data-end=\"2967\">\n<p data-start=\"2929\" data-end=\"2967\">Adds it to <strong data-start=\"2940\" data-end=\"2967\">Forward Reference Table<\/strong><\/p>\n<\/li>\n<li data-start=\"2970\" data-end=\"2992\">\n<p data-start=\"2972\" data-end=\"2992\">Leaves a placeholder<\/p>\n<\/li>\n<li data-start=\"2995\" data-end=\"3065\">\n<p data-start=\"2997\" data-end=\"3065\">Once <code data-start=\"3002\" data-end=\"3008\">NEXT<\/code> is encountered, it <strong data-start=\"3028\" data-end=\"3044\">back-patches<\/strong> the correct address.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr data-start=\"3067\" data-end=\"3070\" \/>\n<h2 data-start=\"3072\" data-end=\"3091\">\ud83d\udccc <strong data-start=\"3078\" data-end=\"3091\">Use Cases<\/strong><\/h2>\n<ul data-start=\"3092\" data-end=\"3249\">\n<li data-start=\"3092\" data-end=\"3174\">\n<p data-start=\"3094\" data-end=\"3174\">Used in simple compilers, bootloaders, embedded systems where speed is critical.<\/p>\n<\/li>\n<li data-start=\"3175\" data-end=\"3249\">\n<p data-start=\"3177\" data-end=\"3249\">Not suitable for complex features like macros, advanced directives, etc.<\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"3251\" data-end=\"3254\" \/>\n<h2 data-start=\"3256\" data-end=\"3274\">\u2705 Summary Table<\/h2>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"3276\" data-end=\"3780\">\n<thead data-start=\"3276\" data-end=\"3347\">\n<tr data-start=\"3276\" data-end=\"3347\">\n<th data-start=\"3276\" data-end=\"3303\" data-col-size=\"sm\">Aspect<\/th>\n<th data-start=\"3303\" data-end=\"3347\" data-col-size=\"sm\">Single Pass Assembler<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"3421\" data-end=\"3780\">\n<tr data-start=\"3421\" data-end=\"3492\">\n<td data-start=\"3421\" data-end=\"3448\" data-col-size=\"sm\">Number of scans<\/td>\n<td data-start=\"3448\" data-end=\"3492\" data-col-size=\"sm\">One<\/td>\n<\/tr>\n<tr data-start=\"3493\" data-end=\"3564\">\n<td data-start=\"3493\" data-end=\"3520\" data-col-size=\"sm\">Speed<\/td>\n<td data-start=\"3520\" data-end=\"3564\" data-col-size=\"sm\">Faster<\/td>\n<\/tr>\n<tr data-start=\"3565\" data-end=\"3636\">\n<td data-start=\"3565\" data-end=\"3592\" data-col-size=\"sm\">Handling forward refs<\/td>\n<td data-col-size=\"sm\" data-start=\"3592\" data-end=\"3636\">Uses backpatching or dummy addresses<\/td>\n<\/tr>\n<tr data-start=\"3637\" data-end=\"3708\">\n<td data-start=\"3637\" data-end=\"3664\" data-col-size=\"sm\">Complexity<\/td>\n<td data-start=\"3664\" data-end=\"3708\" data-col-size=\"sm\">Lower<\/td>\n<\/tr>\n<tr data-start=\"3709\" data-end=\"3780\">\n<td data-start=\"3709\" data-end=\"3736\" data-col-size=\"sm\">Output<\/td>\n<td data-start=\"3736\" data-end=\"3780\" data-col-size=\"sm\">Machine code with resolved symbols<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"3782\" data-end=\"3785\" \/>\n<h3 data-start=\"3787\" data-end=\"3804\">\ud83d\udd0d Want more?<\/h3>\n<p data-start=\"3806\" data-end=\"3820\">I can provide:<\/p>\n<ul data-start=\"3821\" data-end=\"4003\">\n<li data-start=\"3821\" data-end=\"3865\">\n<p data-start=\"3823\" data-end=\"3865\">\ud83d\udcd8 A <strong data-start=\"3828\" data-end=\"3841\">PDF Notes<\/strong> summary of this topic<\/p>\n<\/li>\n<li data-start=\"3866\" data-end=\"3925\">\n<p data-start=\"3868\" data-end=\"3925\">\ud83c\udfaf <strong data-start=\"3871\" data-end=\"3890\">GATE-level MCQs<\/strong> on Single vs Two Pass Assemblers<\/p>\n<\/li>\n<li data-start=\"3926\" data-end=\"4003\">\n<p data-start=\"3928\" data-end=\"4003\">\ud83d\udcbb A <strong data-start=\"3933\" data-end=\"3954\">simulated example<\/strong> with real assembly input and machine code output<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"4005\" data-end=\"4049\" data-is-last-node=\"\" data-is-only-node=\"\">Just let me know what format helps you best!<\/p>\n<h3 data-start=\"4005\" data-end=\"4049\"><a href=\"https:\/\/pcgicks.wordpress.com\/wp-content\/uploads\/2015\/02\/com-212-introduction-to-system-programming-theory.pdf\" target=\"_blank\" rel=\"noopener\">System Programming: Pass 1 assemblers-Concept of single pass Assemblers and it&#8217;s working in system programming<\/a><\/h3>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>System Programming: Pass 1 assemblers-Concept of single pass Assemblers and it&#8217;s working in system programming. [fvplayer id=&#8221;32&#8243;] Pass 1 Assemblers in System Programming Assemblers are programs that convert assembly language code into machine code. Based on how they process the source code, assemblers are categorized into Single-Pass and Multi-Pass assemblers. What is a Single Pass [&hellip;]<\/p>\n","protected":false},"author":64,"featured_media":2434,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1778],"tags":[1776,1777,1779],"class_list":["post-2433","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system-programming","tag-concept-of-single-pass-assemblers-and-its-working-in-system-programming","tag-pass-1-assemblers","tag-system-programming"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/comments?post=2433"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2433\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media\/2434"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=2433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=2433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=2433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}