[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-759762-105":3,"detail-sidebar-cat-0-en-105":79,"doc-detail-759762-en":129,"doc-similar-759762":160},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":72,"head_meta":74,"extra_data":76,"updated_unix":78},105,"en","coe-205-lab-manual-lab-4-basic-instructions-and-addressing-modes","COE 205 Lab Manual - Lab 4 - Basic Instructions and Addressing Modes","","COE 205 Lab 4 focuses on fundamental x86 assembly instructions and how data moves and is interpreted using different addressing modes. It explains MOV, MOVZX (zero extension), MOVSX (sign extension), and XCHG through a sample program, then guides assembling/linking and step-by-step debugging to trace register and memory changes. The lab also covers core arithmetic instructions INC, DEC, ADD, SUB, and NEG, including the behavior of CPU flags (CF, OF, SF, ZF, PF).",{"@graph":14,"@context":71},[15,34,54],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/coe-205-lab-manual-lab-4-basic-instructions-and-addressing-modes/759762/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":48,"encodingFormat":47,"isAccessibleForFree":49,"interactionStatistic":50},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/coe-205-lab-manual-lab-4-basic-instructions-and-addressing-modes/759762.png","ImageObject",300,407,{"name":42,"@type":43},"acoobca","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-28",true,{"@type":51,"interactionType":52,"userInteractionCount":22},"InteractionCounter",{"@type":53},"ViewAction",{"@type":55,"mainEntity":56},"FAQPage",[57,63,67],{"name":58,"@type":59,"acceptedAnswer":60},"What do MOV, MOVZX, MOVSX, and XCHG do in this lab?","Question",{"text":61,"@type":62},"MOV copies a value to the destination. MOVZX moves with zero extension, MOVSX moves with sign extension, and XCHG exchanges the source and destination contents.","Answer",{"name":64,"@type":59,"acceptedAnswer":65},"How should students assemble, link, and trace the example program moves.asm?",{"text":66,"@type":62},"Assemble and link moves.asm, then run moves.exe in a Windows debugger. Use the Watch window to observe var1 and var2 and step through instructions while checking register changes.",{"name":68,"@type":59,"acceptedAnswer":69},"Which arithmetic instructions and flags are covered in the lab’s addition and subtraction section?",{"text":70,"@type":62},"INC, DEC, ADD, SUB, and NEG are covered along with flags CF, OF, SF, ZF, and PF. ADD, SUB, and NEG affect all these flags, while INC/DEC do not modify CF.","https://schema.org",{"og:url":32,"og:type":73,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":75,"canonical":32},"index,follow",{"doc_id":77,"site_id":7},759762,1795894376,{"code":4,"msg":80,"data":81},"success",[82,86,90,93,98,103,108,113,118,121,125],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":83,"show_sort_weight":84,"slug":85},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":87,"show_sort_weight":88,"slug":89},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":91,"slug":92},70,"exam",{"id":94,"doc_module":4,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},5,"Comic",60,"comic",{"id":99,"doc_module":4,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},6,"Technology",50,"technology",{"id":104,"doc_module":4,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},7,"Healthcare",40,"healthcare",{"id":109,"doc_module":4,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},8,"Research & Report",30,"research-report",{"id":114,"doc_module":4,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},9,"Religion & Spirituality",20,"religion-spirituality",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":119,"show_sort_weight":116,"slug":120},"World Cup","world-cup",{"id":122,"doc_module":4,"doc_module_name":25,"category_name":123,"show_sort_weight":122,"slug":124},10,"Lifestyle","lifestyle",{"id":126,"doc_module":4,"doc_module_name":25,"category_name":127,"show_sort_weight":94,"slug":128},19,"General","general",{"code":4,"msg":80,"data":130},{"doc_id":77,"user_id":131,"nickname":42,"user_avatar":132,"doc_module":4,"category_id":33,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":22,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":122,"language":138,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":139,"faqs":140,"seo_title":141,"seo_description":12,"update_tm":78,"read_time":142,"preview_page_count":33,"preview_urls":143},3985747870733,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","COE 205 Lab Manual Lab 4: Basic Instructions and Addressing Modes-page 36  \nLab 4: Basic Instructions and Addressing Modes  \nContents  \n4.1. Data Transfer Instructions  \n4.2. Addition and Subtraction  \n4.3. Data Addressing Modes  \n4.4. LOOP Instruction  \n4.5. Copying a String  \n4.6. Summing an Array of Integers  \n4.1 Data Transfer Instructions  \nData transfer instructions move data between registers or between registers and memory. These instructions are briefly described below. For more details, refer to the lecture notes or your textbook. The following program demonstrates the MOV, MOVZX, MOVSX, and XCHG instructions:  \nMOV destination, source Move source to destination.  \nMOVZX destination, source Move source to destination with zero extension.  \nMOVSX destination, source Move source to destination with sign extension.  \nXCHG destination, source Exchange source with destination.  \nTITLE Data Transfer Examples (File: moves.asm)  \n; Demonstration of MOV, MOVZX, MOVSX, and XCHG  \n.686  \n.MODEL flat, stdcall  \n.STACK  \nINCLUDE [Irvine32.inc](Irvine32.inc)  \n[.data](.data)[ ](.data)var1 WORD 1000hvar2 WORD 2000h  \n.code main PROC  \n; Demonstrating MOV and MOVZX  \nmov ax, 0A69Bh  \nmovzx bx, al  \nmovzx ecx,ah  \nmovzx edx,ax  \n; Demonstrating MOVSX  \nmovsx bx, al  \nmovsx ecx,ah  \nmovsx edx,ax  \n; Demonstrating XCHG  \nxchg ax,var1  \nxchg ax,var2  \nxchg ax,var1  \nexit  \nmain ENDP  \nEND main  \nPrepared by Dr. MuhamedMudawar © KFUPM– Revised August 2006  \nCOE 205 Lab Manual Lab 4: Basic Instructions and Addressing Modes-page 37  \n4.1.1 Lab Work: Assemble and Link moves.asm  \nOpen file moves.asm and assemble and link the file. You can use the make32 batch file from the command prompt or from the ConTEXT editor’s Tools menu.  \n4.1.2 Lab Work: Trace the Execution of Program moves.exe  \nNow run the Windows debugger to trace the execution of the above program. You may open the debugger from ConTEXT Tools menu or by typing: windbg –QY–G moves.exe Open the Watch window to view the var1 and var2 variables. You can also watch registers under the Watch window by typing their names preceded with the @ symbol as shown below. Observe that the type of registers is unsigned int and the value is shown in hexadecimal. You can change the type of a register to char, short, or int (depending on its size), to see its value as a signed decimal.  \nTry first to guess the values of the registers and memory variables in the above program after the execution of each instruction. Write your answers in hexadecimal in the specified boxes. Place the cursor at the beginning of the main procedure and press F7 . Now step through the program by pressing F10 and watch the changes in registers and variables. Make the necessary corrections to your answers.  \nMOV and MOVZX  \n\n| 1) al, ah (hex) = |\n| --- |\n| 3) ecx (hex) = |\n\nMOVSX  \n\n| 5) bx (hex) = |\n| --- |\n| 6) ecx (hex) = |\n\nXCHG  \n\n| 8) ax (hex) = |\n| --- |\n| 9) ax (hex) = |\n| 10) ax (hex) = |\n\n\n| 2) bx (hex) = |\n| --- |\n| 4) edx (hex) = |\n\n7) edx (hex) =  \n\n| 8) var1 (hex) = |\n| --- |\n| 9) var2 (hex) = |\n| 10) var1 (hex) = |\n\nPrepared by Dr. MuhamedMudawar © KFUPM– Revised August 2006  \nCOE 205 Lab Manual Lab 4: Basic Instructions and Addressing Modes-page 38  \n4.2 Addition and Subtraction  \nInteger addition and subtraction are two of the most fundamental operations that a processor can perform. In the following Program, you will learn about the INC, DEC, ADD, SUB, and NEG instructions. You will also learn about the flags affected by these arithmetic instructions:  \nINC destination DEC destination  \nADD destination, source SUB destination, source NEG destination  \nCF  \nOF  \nSF  \nZF  \nPF  \nIncrement destination by 1.  \nDecrement destination by 1.  \nAdd source to destination.  \nSubtract source from destination.  \nNegate destination by computing 2's complement. Carry Flag: set if unsigned result is out of range.  \nOverflow Flag: set if signed result is out of range.  \nSign Flag: set if sign bit of result is negative (or ","cbCaiqKDHeulqX9G","https://ap.wps.com/l/cbCaiqKDHeulqX9G","pdf",125042,"English","# Contents\n## 4.1 Data Transfer Instructions\n## 4.2 Addition and Subtraction\n## 4.3 Data Addressing Modes\n## 4.4 LOOP Instruction\n## 4.5 Copying a String\n## 4.6 Summing an Array of Integers","[{\"question\":\"What do MOV, MOVZX, MOVSX, and XCHG do in this lab?\",\"answer\":\"MOV copies a value to the destination. MOVZX moves with zero extension, MOVSX moves with sign extension, and XCHG exchanges the source and destination contents.\"},{\"question\":\"How should students assemble, link, and trace the example program moves.asm?\",\"answer\":\"Assemble and link moves.asm, then run moves.exe in a Windows debugger. Use the Watch window to observe var1 and var2 and step through instructions while checking register changes.\"},{\"question\":\"Which arithmetic instructions and flags are covered in the lab’s addition and subtraction section?\",\"answer\":\"INC, DEC, ADD, SUB, and NEG are covered along with flags CF, OF, SF, ZF, and PF. ADD, SUB, and NEG affect all these flags, while INC/DEC do not modify CF.\"}]","COE 205 Lab Manual - Lab 4 - Basic Instructions and Addressing Modes | PDF",25,[144,148,152,156],{"page_no":22,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/eed3d77518c4274ebfa0bef0543eda66.webp",983,1390,{"page_no":26,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/0aa7e6c6511ff916225988ccf3be00be.webp",982,1389,{"page_no":30,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/f4c19341dc70e9a419fea19b561027c1.webp",981,1387,{"page_no":33,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/8ef309a3f21d3895d4abf42c1416a48f.webp",980,1386,{"list":161,"token":11},[162,168,174,180,187,193,200,207,214,221],{"doc_id":163,"doc_title":164,"file_type":136,"home_preview_img_url":165,"slug":166,"view_count":126,"category_name":29,"create_tm":167},299710,"TEAS Exam at ATI - How to Take the TEAS Exam at ATI - Steps for Access and Proctoring","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229905841342/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=YFE%2BTAeCaIhoIdtYRo7ulO95zRA%3D","teas-exam-at-ati-how-to-take-the-teas-exam-at-ati-steps-for-access-and-proctoring",1789770877,{"doc_id":169,"doc_title":170,"file_type":136,"home_preview_img_url":171,"slug":172,"view_count":114,"category_name":29,"create_tm":173},295863,"The Big Picture 2 - Getting around - Lesson plan and exercises","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229905254389/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=s2mCtgv%2BxUxkGC4VeyNCW3CrqI8%3D","the-big-picture-2-getting-around-lesson-plan-and-exercises",1789724771,{"doc_id":175,"doc_title":176,"file_type":136,"home_preview_img_url":177,"slug":178,"view_count":126,"category_name":29,"create_tm":179},299709,"ATI TEAS Remote Proctored Exam via Institution or ATI - How to Take the ATI TEAS Remote Proctored Exam","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229905551770/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=Udu%2BniNgKJcgquxe0jDJLRrnP8M%3D","ati-teas-remote-proctored-exam-via-institution-or-ati-how-to-take-the-ati-teas-remote-proctored-exam",1789770871,{"doc_id":181,"doc_title":182,"file_type":136,"home_preview_img_url":183,"slug":184,"view_count":185,"category_name":29,"create_tm":186},656935,"Lewis Dot Skittles Lab - Ionic and Covalent Bonding","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975336501/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=psRQ2ZAcmKi2fUhsDtspkP9t4q0%3D","lewis-dot-skittles-lab-ionic-and-covalent-bonding",16,1792971559,{"doc_id":188,"doc_title":189,"file_type":136,"home_preview_img_url":190,"slug":191,"view_count":122,"category_name":29,"create_tm":192},662793,"Lab12 ME 170 - Creo Lab Assignment","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229981690295/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=xGetejYI%2BwE9hltYj5QCZMugfj8%3D","lab12-me-170-creo-lab-assignment",1793222480,{"doc_id":194,"doc_title":195,"file_type":136,"home_preview_img_url":196,"slug":197,"view_count":198,"category_name":29,"create_tm":199},30189,"MAHAJYOTI BARTI SARTHI TRTI MPSC CET 2024 Question Paper with Solutions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229724648473/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=rfxp2vmFm32b4DYXnMYUQYBBYm8%3D","mahajyoti-barti-sarthi-trti-mpsc-cet-2024-question-paper",6715,1778285986,{"doc_id":201,"doc_title":202,"file_type":136,"home_preview_img_url":203,"slug":204,"view_count":205,"category_name":29,"create_tm":206},30575,"Pinnacle SSC Maths 7th Edition in English","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229724812523/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=oWIww0kLmHzOz9jiR4bHXpHoedE%3D","pinnacle-ssc-maths-7th-edition-in-english",4860,1778287912,{"doc_id":208,"doc_title":209,"file_type":136,"home_preview_img_url":210,"slug":211,"view_count":212,"category_name":29,"create_tm":213},30560,"Pinnacle SSC General Studies 7th Edition in English","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229724655912/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=Kws6l5QRMx73etnDUv5md0kI64I%3D","pinnacle-ssc-general-studies-7th-edition-in-english",3154,1778287783,{"doc_id":215,"doc_title":216,"file_type":136,"home_preview_img_url":217,"slug":218,"view_count":219,"category_name":29,"create_tm":220},30906,"ACCA SBR Strategic Business Reporting Study Text 2025-26","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229725712789/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=DDEkfh6%2BEYdAhYV%2BkVOq%2BA8xZ60%3D","acca-sbr-strategic-business-reporting-study-text-2025-26",2562,1778363092,{"doc_id":222,"doc_title":223,"file_type":136,"home_preview_img_url":224,"slug":225,"view_count":226,"category_name":29,"create_tm":227},30775,"ACCA Corporate and Business Law (LW ENG) Study Text","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229725711159/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166959&Signature=VPurohd03YAzeZh9JXddEQcQg7I%3D","acca-corporate-and-business-law-lw-eng-study-text",1859,1778361391]