<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Heavendeep Kaur Munjal</title>
    <description>The latest articles on DEV Community by Heavendeep Kaur Munjal (@heavenmunjal).</description>
    <link>https://dev.to/heavenmunjal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1258092%2Fc6f5b0e6-4f5e-430b-a4ee-ec7853d50edd.png</url>
      <title>DEV Community: Heavendeep Kaur Munjal</title>
      <link>https://dev.to/heavenmunjal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/heavenmunjal"/>
    <language>en</language>
    <item>
      <title>Project Stage 3</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Tue, 23 Apr 2024 02:35:01 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/project-stage-3-e8m</link>
      <guid>https://dev.to/heavenmunjal/project-stage-3-e8m</guid>
      <description>&lt;h2&gt;
  
  
  Reflecting on Feedback: Enhancing the ACLE Documentation
&lt;/h2&gt;

&lt;p&gt;In my journey to improve the ACLE (Architecture Compatibility Linkage Editor) documentation, I recently received valuable feedback from both my professor and a classmate, Kristjan, from my SPO600 section. Their insights shed light on important nuances and considerations that warrant attention in the ongoing development of the ACLE standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Classmate Feedback: Exploring Macro Behavior and Compiler Support
&lt;/h2&gt;

&lt;p&gt;Kristjan's feedback focused on the behavior of certain macros and compiler support for Function Multi Versioning (FMV). He noted that while macros such as "&lt;strong&gt;GNUC&lt;/strong&gt;" from the GCC documentation yielded expected results, macros specific to FMV, such as "__HAVE_FEATURE_MULTI_VERSIONING", did not provide the expected outcomes. Additionally, Kristjan encountered issues with the &lt;code&gt;-fno-function-multi-versioning&lt;/code&gt; flag, which was not recognized by the compiler.&lt;/p&gt;

&lt;p&gt;These observations prompt a deeper exploration into the functionality of these macros and flags across different compilers and platforms. Understanding their behavior under various conditions is crucial for ensuring the reliability and portability of code written with the ACLE standard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Professor Feedback: Examining Current Implementation and Standards
&lt;/h2&gt;

&lt;p&gt;My professor provided detailed insights into the current implementation of the ACLE standard and highlighted areas that require clarification and potential refinement. Notably, he pointed out discrepancies between the standard and the current implementation, such as unimplemented features and undefined macros.&lt;/p&gt;

&lt;p&gt;One significant aspect highlighted by my professor is the need for alignment between the ACLE standard and compiler implementations. This ensures consistency and clarity for developers leveraging the standard across different compiler versions and architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking Action: Engaging with the Community
&lt;/h2&gt;

&lt;p&gt;In response to the feedback received, I reached out to Andrew Carlotti, a key contributor to the ACLE standard, as suggested by my professor. Engaging with Andrew allowed for a fruitful discussion on the discrepancies and potential improvements needed in the ACLE standard.&lt;/p&gt;

&lt;p&gt;Andrew's insights provided valuable context on the current implementation challenges and outlined future directions for enhancing the standard. Collaborating with community members like Andrew is essential for driving continuous improvement and ensuring the relevance and effectiveness of the ACLE standard in real-world development scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving Forward: Iterative Development and Collaboration
&lt;/h2&gt;

&lt;p&gt;As I continue to iterate on the ACLE documentation and contribute to the standard, I'm committed to addressing the feedback received and collaborating with the community to drive positive change. By fostering an open dialogue and actively engaging with stakeholders, we can collectively shape a robust and reliable standard that meets the evolving needs of software developers.&lt;/p&gt;

&lt;p&gt;In conclusion, the feedback received from both my professor and classmates serves as a catalyst for further refinement and enhancement of the ACLE documentation and standard. Through ongoing collaboration and iterative development, we can empower developers with the tools and resources they need to build efficient and compatible software solutions.&lt;/p&gt;

&lt;p&gt;The document you found provides valuable insights into the rationale and design considerations behind Function Multi Versioning (FMV) support for Arm architectures. Here's a summary and some thoughts on how you can incorporate it into your blog post:&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Function Multi Versioning Support for Arm Architectures
&lt;/h2&gt;

&lt;p&gt;Function Multi Versioning (FMV) is a powerful feature supported by various architectures, aimed at enhancing software development and deployment. While FMV implementation details may vary across architectures, the document sheds light on its design specifically for Arm architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rationale for FMV Support on Arm
&lt;/h2&gt;

&lt;p&gt;The document emphasizes the importance of uniformity in source code formats across toolchains and platforms to simplify software development and deployment. However, due to the complexity and variability of Arm architectures, FMV support on Arm is designed to be bound to features rather than CPU implementations. This approach ensures consistency and compatibility across different Arm architectures and kernel configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  FMV in the Arm ACLE
&lt;/h2&gt;

&lt;p&gt;Unlike some architectures where FMV might be defined in the ABI, on Arm architectures, FMV is defined in the Arm C Language Extensions (ACLE). This decision is based on the fact that FMV does not alter function behavior from the ABI perspective. Regardless of which version is called, functions derived via FMV maintain the same signature and calling convention as the original function.&lt;/p&gt;

&lt;p&gt;To avoid confusion with existing attributes, Arm introduces &lt;code&gt;target_version&lt;/code&gt; and &lt;code&gt;target_clones&lt;/code&gt; attributes specifically for FMV purposes. These attributes ensure clarity and specificity when defining FMV-related behavior in the ACLE.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feature Test Macro and Attributes
&lt;/h2&gt;

&lt;p&gt;To enable users to determine the availability of FMV support in their toolchain, a feature test macro &lt;code&gt;__HAVE_FUNCTION_MULTI_VERSIONING&lt;/code&gt; is proposed. This macro allows developers to conditionally compile code based on FMV support.&lt;/p&gt;

&lt;p&gt;The document also outlines various use cases and considerations for FMV-aware compilers processing FMV-related attributes. Whether the compiler is aware of these attributes or not, clear guidelines ensure consistent behavior and compatibility across different compiler implementations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage 2 : Fixing the ACLE Documentation</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Thu, 11 Apr 2024 00:26:16 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/project-stage-2-1b9f</link>
      <guid>https://dev.to/heavenmunjal/project-stage-2-1b9f</guid>
      <description>&lt;h2&gt;
  
  
  First Step : Forking the official repo for ACLE Documentation
&lt;/h2&gt;

&lt;p&gt;The first step I did was to fork the repo so that I can make the fixes to the ACLE documentation and work towards creating a Pull Request in the future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Official Repo:
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ARM-software" rel="noopener noreferrer"&gt;
        ARM-software
      &lt;/a&gt; / &lt;a href="https://github.com/ARM-software/acle" rel="noopener noreferrer"&gt;
        acle
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Arm C Language Extensions (ACLE)
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
   &lt;a rel="noopener noreferrer" href="https://github.com/ARM-software/acleArm_logo_blue_RGB.svg"&gt;&lt;img id="user-content-index_logo" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FARM-software%2FacleArm_logo_blue_RGB.svg"&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://github.com/ARM-software/acle#contributors-" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/6d069450bcc6dc6cad9a0b2828879d886079c738faad9ee72681737badec5e96/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f616c6c5f636f6e7472696275746f72732d33352d6f72616e67652e7376673f7374796c653d666c61742d737175617265" alt="All Contributors"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/ARM-software/acle/actions/workflows/ci.yml/badge.svg"&gt;&lt;img src="https://github.com/ARM-software/acle/actions/workflows/ci.yml/badge.svg" alt="Continuous Integration"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Arm C Language Extensions&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;This repository contains the source material from which the
specifications for the Arm C Language Extensions (ACLE) are derived.&lt;/p&gt;
&lt;p&gt;The latest release of the specifications can be browsed online at
&lt;a href="https://arm-software.github.io/acle/" rel="nofollow noopener noreferrer"&gt;arm-software.github.io/acle/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The PDF version of the documents can be retrieved from the &lt;a href="https://github.com/ARM-software/acle/releases/latest" rel="noopener noreferrer"&gt;latest
release&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;The development version is stored on the branch &lt;code&gt;main&lt;/code&gt; at
&lt;a href="https://github.com/ARM-software/acle/" rel="noopener noreferrer"&gt;github.com/ARM-software/acle/&lt;/a&gt;,
while the latest released version is tracked by the branch
&lt;code&gt;latest-release&lt;/code&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Contributing&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Contributions of any kind are always welcome! Please check the
&lt;a href="https://github.com/ARM-software/acleCONTRIBUTING.md" rel="noopener noreferrer"&gt;contribution guidelines&lt;/a&gt; for details.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Defect reports&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Please report defects in or enhancements to the specifications in this folder to
the &lt;a href="https://github.com/ARM-software/acle/issues" rel="noopener noreferrer"&gt;issue tracker page on
GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For reporting defects or enhancements to documents that currently are not yet
included in this repo and are thus only hosted on developer.arm.com, please send
an email to &lt;a href="https://github.com/ARM-software/aclemailto:arm.acle@arm.com" rel="noopener noreferrer"&gt;arm.acle@arm.com&lt;/a&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;List of documents&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;HTML version&lt;/th&gt;
&lt;th&gt;PDF version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://arm-software.github.io/acle/main/" rel="nofollow noopener noreferrer"&gt;Arm C&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ARM-software/acle" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Forked Repo:
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/HeavenMunjal" rel="noopener noreferrer"&gt;
        HeavenMunjal
      &lt;/a&gt; / &lt;a href="https://github.com/HeavenMunjal/acle" rel="noopener noreferrer"&gt;
        acle
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Arm C Language Extensions (ACLE)
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
   &lt;a rel="noopener noreferrer" href="https://github.com/HeavenMunjal/acleArm_logo_blue_RGB.svg"&gt;&lt;img id="user-content-index_logo" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FHeavenMunjal%2FacleArm_logo_blue_RGB.svg"&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://github.com/HeavenMunjal/acle#contributors-" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/33371ff76892d0e9e228c8f7c2f09a73ec4910648cec88134058f8439e8bb5b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f616c6c5f636f6e7472696275746f72732d33342d6f72616e67652e7376673f7374796c653d666c61742d737175617265" alt="All Contributors"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/ARM-software/acle/actions/workflows/ci.yml/badge.svg"&gt;&lt;img src="https://github.com/ARM-software/acle/actions/workflows/ci.yml/badge.svg" alt="Continuous Integration"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Arm C Language Extensions&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;This repository contains the source material from which the
specifications for the Arm C Language Extensions (ACLE) are derived.&lt;/p&gt;
&lt;p&gt;The latest release of the specifications can be browsed online at
&lt;a href="https://arm-software.github.io/acle/" rel="nofollow noopener noreferrer"&gt;arm-software.github.io/acle/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The PDF version of the documents can be retrieved from the &lt;a href="https://github.com/ARM-software/acle/releases/latest" rel="noopener noreferrer"&gt;latest
release&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;The development version is stored on the branch &lt;code&gt;main&lt;/code&gt; at
&lt;a href="https://github.com/ARM-software/acle/" rel="noopener noreferrer"&gt;github.com/ARM-software/acle/&lt;/a&gt;,
while the latest released version is tracked by the branch
&lt;code&gt;latest-release&lt;/code&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Contributing&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Contributions of any kind are always welcome! Please check the
&lt;a href="https://github.com/HeavenMunjal/acleCONTRIBUTING.md" rel="noopener noreferrer"&gt;contribution guidelines&lt;/a&gt; for details.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Defect reports&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Please report defects in or enhancements to the specifications in this folder to
the &lt;a href="https://github.com/ARM-software/acle/issues" rel="noopener noreferrer"&gt;issue tracker page on
GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For reporting defects or enhancements to documents that currently are not yet
included in this repo and are thus only hosted on developer.arm.com, please send
an email to &lt;a href="https://github.com/HeavenMunjal/aclemailto:arm.acle@arm.com" rel="noopener noreferrer"&gt;arm.acle@arm.com&lt;/a&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;List of documents&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;HTML version&lt;/th&gt;
&lt;th&gt;PDF version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://arm-software.github.io/acle/main/" rel="nofollow noopener noreferrer"&gt;Arm C&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/HeavenMunjal/acle" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Finding issues to work on:
&lt;/h2&gt;

&lt;p&gt;After my research, looking through the issues my professor provided me, Checking the documentation myself and going through the already filed issues. i found the below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Mentions that FMV may be disabled at compile time by a compiler flag, but this flag is not documented&lt;/li&gt;
&lt;li&gt;The macro __HAVE_FEATURE_MULTI_VERSIONING (or __FEATURE_FUNCTION_MULTI_VERSIONING or __ARM_FEATURE_FUNCTION_MULTIVERSIONING) does not appear to be defined&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1st Issue
&lt;/h2&gt;

&lt;p&gt;The issue was fixed by the changes from the &lt;a href="https://github.com/HeavenMunjal/acle/commit/6c01fdfc45879802a5aa50bd7d3fd47b0a839c1d" rel="noopener noreferrer"&gt;commit&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;To address the missing documentation regarding the compiler flag that disables Function Multi Versioning (FMV), we can add a section that explicitly mentions this flag and provides guidance on how to use it. Here's a proposed addition to the documentation:&lt;/p&gt;

&lt;h3&gt;
  
  
  Disabling Function Multi Versioning
&lt;/h3&gt;

&lt;p&gt;Function Multi Versioning (FMV) can be a powerful tool for optimizing software to run on various hardware configurations. However, there may be scenarios where a developer needs to disable this feature, such as for debugging purposes or to ensure compatibility with specific hardware that does not benefit from FMV.&lt;/p&gt;

&lt;p&gt;To disable FMV at compile time, the compiler provides a specific flag. This flag instructs the compiler not to generate multiple versions of a function based on the target attributes and to use only the &lt;code&gt;default&lt;/code&gt; version of the function. The use of this flag ensures that the compiled binary does not contain any versioned functions other than the default.&lt;/p&gt;

&lt;h4&gt;
  
  
  Compiler Flag
&lt;/h4&gt;

&lt;p&gt;The compiler flag to disable FMV is &lt;code&gt;-fno-function-multi-versioning&lt;/code&gt;. This flag can be added to the compiler's command line arguments when compiling the source code.&lt;/p&gt;

&lt;p&gt;Example usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc &lt;span class="nt"&gt;-fno-function-multi-versioning&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; my_program my_program.c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;gcc&lt;/code&gt; is the compiler being used to compile &lt;code&gt;my_program.c&lt;/code&gt;. By including the &lt;code&gt;-fno-function-multi-versioning&lt;/code&gt; flag, FMV is disabled for this compilation, ensuring that only the default versions of any multi-versioned functions are included in the final binary.&lt;/p&gt;

&lt;h4&gt;
  
  
  Considerations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;When FMV is disabled using the &lt;code&gt;-fno-function-multi-versioning&lt;/code&gt; flag, all &lt;code&gt;__attribute__((target_version("name")))&lt;/code&gt; and &lt;code&gt;__attribute__((target_clones("name",...)))&lt;/code&gt; attributes in the source code are ignored.&lt;/li&gt;
&lt;li&gt;Developers should carefully consider the implications of disabling FMV, as it may impact the performance optimizations that FMV can provide on supported hardware.&lt;/li&gt;
&lt;li&gt;It is recommended to use this flag only when necessary, such as during specific testing or debugging sessions, or when targeting hardware that does not support the features used by the versioned functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By providing clear documentation on how to disable FMV, developers can have better control over their compilation process and make informed decisions about when and how to use FMV for their applications.&lt;/p&gt;

&lt;p&gt;This addition clearly documents how to disable FMV, providing developers with the necessary information to control this feature during the compilation process.&lt;/p&gt;

&lt;h2&gt;
  
  
  2nd Issue
&lt;/h2&gt;

&lt;p&gt;The second issue was fixed in the &lt;a href="https://github.com/HeavenMunjal/acle/commit/a014c2d617f68d11cbe31c9ae07a5efdb2fda3ec" rel="noopener noreferrer"&gt;commit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To include and document the presence of a macro that indicates compiler support for Function Multi Versioning (FMV), such as &lt;code&gt;__HAVE_FEATURE_MULTI_VERSIONING&lt;/code&gt;, &lt;code&gt;__FEATURE_FUNCTION_MULTI_VERSIONING&lt;/code&gt;, or &lt;code&gt;__ARM_FEATURE_FUNCTION_MULTIVERSIONING&lt;/code&gt;, you can add a section to the documentation that explains how to check for FMV support using these macros. This will guide developers on how to write conditional code that leverages FMV only when it is available.&lt;/p&gt;

&lt;h3&gt;
  
  
  Documenting Compiler Support for FMV
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Checking for FMV Support
&lt;/h4&gt;

&lt;p&gt;To write portable code that optionally uses Function Multi Versioning (FMV) features, it's crucial to check whether the compiler supports FMV. This can be done by checking predefined macros that are set by the compiler when FMV is supported. The specific macro to check can vary based on the compiler and the target architecture.&lt;/p&gt;

&lt;h4&gt;
  
  
  Predefined Macros for FMV Support
&lt;/h4&gt;

&lt;p&gt;The compiler may define one or more of the following macros to indicate support for FMV:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;__HAVE_FEATURE_MULTI_VERSIONING&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;__FEATURE_FUNCTION_MULTI_VERSIONING&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;__ARM_FEATURE_FUNCTION_MULTIVERSIONING&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These macros, if defined, indicate that the compiler supports FMV and that the FMV-specific attributes (&lt;code&gt;__attribute__((target_version("name")))&lt;/code&gt; and &lt;code&gt;__attribute__((target_clones("name",...)))&lt;/code&gt;) can be used in the code.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example Usage
&lt;/h4&gt;

&lt;p&gt;Before using FMV-specific attributes in your code, check if the compiler supports FMV by checking the relevant macro:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#if defined(__HAVE_FEATURE_MULTI_VERSIONING) || defined(__FEATURE_FUNCTION_MULTI_VERSIONING) || defined(__ARM_FEATURE_FUNCTION_MULTIVERSIONING)
&lt;/span&gt;&lt;span class="c1"&gt;// FMV is supported by the compiler&lt;/span&gt;
&lt;span class="n"&gt;__attribute__&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;target_clones&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"arch1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"arch2"&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;optimized_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Optimized implementation&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="cp"&gt;#else
&lt;/span&gt;&lt;span class="c1"&gt;// FMV is not supported by the compiler&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;optimized_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Standard implementation&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="cp"&gt;#endif
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;optimized_function&lt;/code&gt; is defined with FMV-specific attributes if FMV is supported. Otherwise, a standard implementation of the function is provided.&lt;/p&gt;

&lt;h4&gt;
  
  
  Note to Developers
&lt;/h4&gt;

&lt;p&gt;Developers should refer to their compiler's documentation to understand which macro(s) are defined when FMV is supported. This documentation may vary between compilers and target architectures. The presence of these macros allows developers to write code that is both portable and optimized for performance on supported platforms.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By documenting the macros that indicate FMV support, developers can conditionally compile FMV-specific code, ensuring that their applications can be compiled with or without FMV support based on the capabilities of the compiler being used. This approach enhances the portability and performance of applications across different platforms and compiler versions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project stage 1</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Wed, 10 Apr 2024 23:51:41 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/project-stage-1-519h</link>
      <guid>https://dev.to/heavenmunjal/project-stage-1-519h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Procedure&lt;/strong&gt;&lt;br&gt;
First Obtain the source code for the current development version of GCC from the Git repository.&lt;br&gt;
git clone &lt;/p&gt;

&lt;p&gt;&lt;code&gt;git://gcc.gnu.org/git/gcc.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd gcc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Task 1: Command-line Parsing&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding the Task&lt;/strong&gt;&lt;br&gt;
The goal is to enable AFMV directly from the GCC command line, allowing us to specify architectural feature versions for optimized code generation. This capability will be a significant step forward, particularly for applications that demand high performance on AArch64 platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigating GCC's Codebase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Command line parsing logic lie­s primarily in gcc/gcc.c and gcc/common.opt files. While line numbe­rs may shift between ve­rsions, these files se­rve as our entry point for integrating ne­w AFMV options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Path Ahead&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The task involves e­xtending existing command line option parsing to re­cognize AFMV options. Careful coding ensure­s new options process correctly during compilation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools of the Trade&lt;/strong&gt;&lt;br&gt;
 We'll be using text editors or IDEs for code modifications, command-line utilities for codebase navigation, and version control systems for change management. The new options will require regular expressions and data structures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Success Testing&lt;/strong&gt;&lt;br&gt;
 The robust test cases will be constructed, and we use the GCC testing framework DejaGnu to make sure the new functionality works as supposed and maintains compatibility with current features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Skills and Knowledge&lt;/strong&gt;&lt;br&gt;
 A deep investigation into the GCC codebase, into the AArch64 architecture and into the FMV mechanism will have to be made. C programming skills and skills in debugging will also be required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Independent Progress&lt;/strong&gt;&lt;br&gt;
 To avoid getting sticky, the changes I've made to command-line parsing should remain pretty modular, with mock objects or stubs deployed at first to simulate architectural features during the initial phases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaborative Integration&lt;/strong&gt;&lt;br&gt;
 In further refining, the command-line parsing logic has to be easily configured for integration with the other code sections responsible for FMV cloning and pruning, so as to make the AFMV function fully functional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Effort Estimation&lt;/strong&gt;&lt;br&gt;
 The amount of effort to be applied to this task is between 40-60 hours; it depends on both the complexity of the GCC codebase and its accurate, exhaustive testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Enhancing GCC with AFMV support for the AArch64 architecture is like opening a new chapter in high-performance computing. The addition of this feature from the command line saves development time and reveals the full potential of the AArch64 architecture. Keep tuned for more updates as we continue to push the boundaries of compiler technology.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Task 2 Version List Processing&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding the Task&lt;/strong&gt;&lt;br&gt;
It includes extracting from the provided version list the architectural features for Gnu Compiler Collection (GCC) validation of AArch64 systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigating GCC's Codebase&lt;/strong&gt;&lt;br&gt;
Source Files: Firstly, the primary source files that handle parsing and processing command-line options in GCC reside within &lt;code&gt;gcc/gcc.c&lt;/code&gt; and &lt;code&gt;gcc/common.opt&lt;/code&gt;. Next, &lt;code&gt;gcc/config/aarch64/aarch64.c&lt;/code&gt; also includes some architecture-specific code which may be relatable for validating the AArch64 features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Path Ahead&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enhance or tweak the command-line option parsing mechanism, including its recognition and processing of a list of architectural feature versions. &lt;/li&gt;
&lt;li&gt;Implement validation logic to ensure that every specified feature version is one supported by the AArch64 architecture in GCC. &lt;/li&gt;
&lt;li&gt;Integrate this validation logic smooth and seamlessly into the existing command-line processing workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tools of the Trade&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tools: Use text editors or IDEs for making code changes, grep for searching the GCC codebase, and Git for version control. &lt;/li&gt;
&lt;li&gt;Techniques: Utilize parsing techniques for the version list and conditional logic for feature validation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Success Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design test cases for all valid and invalid version scenarios of architectural features. &lt;/li&gt;
&lt;li&gt;Deploy the existing testing framework, which could be DejaGnu, to automatic testing and ensure compatibility with existing tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Skills and Knowledge&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand, in full, the architecture of command-line processing for GCC, and AArch64 specifications in detail.&lt;/li&gt;
&lt;li&gt;Understand the versioning for architectural features in GCC that are supported at the AArch64 level.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Independent Progress&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design the version list processing and validation as a modular component that can be built and tested independently of other enhancements.&lt;/li&gt;
&lt;li&gt;Use mock data for architectural features during initial development to minimize dependencies on other tasks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Collaborative Integration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always ensure that the processed version list, which is validated, will be used correctly by the AFMV feature for generating optimized code for specified architectural features. &lt;/li&gt;
&lt;li&gt;Adjust and coordinate with the developers working on related tasks so as to guarantee effortless integration and operation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Effort Estimation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Estimate: Approximately 30-50 hours.&lt;/li&gt;
&lt;li&gt;Rationale: Considering this to be the estimated hours, it includes the analysis of the relevant sections of the GCC codebase, implementation of processing and validating the version list, creation of the corresponding tests, and integrating with other AFMV-related tasks. This takes into consideration the complexity of the code of GCC and extensive testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
This approach outlines a roadmap for adding version list processing capability to GCC, highlighting the steps and considerations necessary to successfully complete the task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task that interests me the most&lt;/strong&gt;&lt;br&gt;
Command-line parsing is very eye catching to me and sounds interesting and has such a unique task for a developer like me because it is the intersection between user experience and core functionality. It is the first point of contact between the user and the application, where commands and options are interpreted, setting the stage for how the software will function. It's a critical component that can greatly influence the usability and flexibility of a program. Command-line parsing involves a deep dive into complex problem-solving, as developers must think about a wide range of user inputs and make sure that the application behaves appropriately. The task demands precision and attention to detail; any omission can lead to big issues in how the software operates.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>64-Bit Assembly Language Lab</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Wed, 20 Mar 2024 00:14:23 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/64-bit-assembly-language-lab-2k6i</link>
      <guid>https://dev.to/heavenmunjal/64-bit-assembly-language-lab-2k6i</guid>
      <description>&lt;p&gt;The very first thing to do is setup the the servers: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8eg4ld7qccqe4h09vz2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8eg4ld7qccqe4h09vz2s.png" alt="Image description" width="800" height="412"&gt;&lt;/a&gt;&lt;br&gt;
Go to the folder:  &lt;code&gt;cd spo600/examples/hello/assembler/&lt;/code&gt;&lt;br&gt;
Then using &lt;code&gt;make&lt;/code&gt; building the c files: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8m84t3lovcnnar8p1mp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8m84t3lovcnnar8p1mp.png" alt="Image description" width="800" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the files using &lt;code&gt;cat&lt;/code&gt; command and By &lt;code&gt;objdump -d objectfile&lt;/code&gt;  we can look at the code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpztuhnw1gbupcmfge5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpztuhnw1gbupcmfge5g.png" alt="Image description" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k614y525fpwtt03t4p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k614y525fpwtt03t4p0.png" alt="Image description" width="800" height="371"&gt;&lt;/a&gt;&lt;br&gt;
The code to include loop index values, showing each digit from 0 to 30 in AArch64 assembly language:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.text
.global _start

start = 0                               /* loop index starting value */
max = 31                                /* loop exits when the index hits this number */

_start:
        mov     x3,start                /* set loop index */

loop:
        mov     x9,10           /* store divisor in register */
        udiv    x10,x3,x9       /* divide and store quotient in register */
        msub    x11,x9,x10,x3       /* store remainder in register */
    adr     x1,msg                  /* message location */
    cmp     x10,0           /* check if quotient is 0 */ 
    b.eq    next            /* jump if quotient is 0 */
    add     x12,x10,0x30            /* convert to ascii and store in register */
    strb    w12,[x1,6]              /* place quotient in msg */


next:
    add     x13,x11,0x30            /* convert to ascii and store in register */
    strb    w13,[x1,7]              /* place remainder in msg */
        mov     x2,len                  /* message length */
        mov     x0,1                    /* file descriptor stdout */
        mov     x8,64                   /* syscall sys_write */
        svc     0                       /* syscall */

        add     x3,x3,1                 /* increment index */
        cmp     x3,max                  /* check if index is at max */
        b.ne    loop                    /* loop if index not at max */

        mov     x0,0                    /* exit status */
        mov     x8,93                   /* syscall sys_exit */
        svc     0                       /* syscall */

.data

msg:    .ascii  "Loop:   \n"
.set len, . - msg

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In x86_64 assembly language program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.text
.global  _start

start = 0               /* loop index starting value */
max = 31                /* loop exits when the index hits this number */

_start:
    mov     $start,%r15     /* set loop index */

loop:
    mov $0,%rdx         /* clear register */
    mov %r15,%rax       /* store dividend in register */
    mov $10,%r10        /* store divisor in register */
    div %r10            /* divide */
    mov %rax,%r11       /* store quotient in register */
    mov %rdx,%r12       /* store remainder in register */
    cmp $0,%r11         /* check if quotient is 0 */
    je  next            /* jump if quotient is 0 */
    add $0x30,%r11      /* convert to ascii */
    mov %r11b,msg+6     /* place quotient in msg */

next:
    add $0x30,%r12      /* convert to ascii */
    mov %r12b,msg+7     /* place remainder in msg */
        mov $len,%rdx       /* message length */
        mov $msg,%rsi       /* message location */
        mov $1,%rdi         /* file descriptor stdout */
        mov $1,%rax         /* syscall sys_write */
        syscall             /* syscall */

    inc     %r15            /* increment index */
    cmp     $max,%r15       /* check if index is at max */
    jne     loop            /* loop if index not at max */

        mov $0,%rdi         /* exit status */
        mov $60,%rax        /* syscall sys_exit */
        syscall             /* syscall */

.data

msg:    .ascii      "Loop:   \n"
.set len , . - msg

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, exploring assembly programming across diverse architectures provided invaluable insights into low-level computing. From the nostalgic simplicity of 6502 to the complex optimizations of x86_64 and AArch64, each architecture challenged and expanded my understanding, enriching my programming journey with hands-on experience and newfound &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Assembly language code</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Mon, 05 Feb 2024 16:32:09 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/assembly-language-code-1b14</link>
      <guid>https://dev.to/heavenmunjal/assembly-language-code-1b14</guid>
      <description>&lt;p&gt;About:&lt;br&gt;
maze game using zero-page variables for efficient memory access and execution speed. These variables include ROW, COL, DRAWN_ROW, MAZE_L, MAZE_H, PLAYER_L, PLAYER_H, TARGET_L, and TARGET_H. ROW and COL track the player's current position in the maze, while DRAWN_ROW counts the drawn rows on the screen. MAZE_L and MAZE_H point to where the maze is drawn, and PLAYER_L and PLAYER_H point to the player's position. TARGET_L and TARGET_H point to the target position the player aims to reach. Zero-page variables optimize memory usage and speed up access to critical data during execution, crucial for game performance. The code initializes the game, manages player movements, checks for collisions, and handles game completion. It uses ROM routines for screen initialization and displays instructions and completion messages. Maze data, help text, and completion messages are provided in the code. The game loop continuously updates the player's position, receives user input, checks for collisions, and displays appropriate messages upon game completion. By leveraging zero-page variables, the code enhances memory management and execution efficiency, essential for smooth gameplay in assembly-based maze games.&lt;/p&gt;

&lt;p&gt;Code: &lt;br&gt;
; zero-page variables&lt;br&gt;
define  NEW_ROW     $20 ; current row&lt;br&gt;
define  NEW_COL     $21 ; current column&lt;br&gt;
define  NEW_DRAWN_ROW   $22 ; number of drawn rows&lt;br&gt;
define  NEW_MAZE_L      $14 ; a pointer that points to where the maze will &lt;br&gt;
define  NEW_MAZE_H      $15 ; be drawn&lt;br&gt;
define  NEW_PLAYER_L    $10 ; a pointer that points to the player in the &lt;br&gt;
                ; screen&lt;br&gt;
define  NEW_PLAYER_H    $11&lt;br&gt;
define  NEW_TARGET_L    $12 ; a pointer that points to the target position&lt;br&gt;
define  NEW_TARGET_H    $13 ; where the player wants to proceed&lt;/p&gt;

&lt;p&gt;; constants&lt;br&gt;
define  PATH        $03 ; path color&lt;br&gt;
define  PLAYER      $0e ; player color&lt;br&gt;
define  HEIGHT      7   ; height of the maze &lt;br&gt;
define  WIDTH       7   ; width of the maze&lt;/p&gt;

&lt;p&gt;; ROM routine&lt;br&gt;
define  SCINIT      $ff81 ; initialize/clear screen&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    jsr printHelp
    jsr drawMaze
    jsr gameInit
    jsr gameLoop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;printHelp:  ldy #$00    ; print instructions on the screen&lt;br&gt;
pHelpLoop:  lda help,y&lt;br&gt;
        beq done&lt;br&gt;
        sta $f000,y&lt;br&gt;
        iny&lt;br&gt;
        bne pHelpLoop&lt;/p&gt;

&lt;p&gt;gameInit:   lda #$01    ; initialize ROW, COL to make the player &lt;br&gt;
        sta NEW_ROW     ; starting at $0221 of the screen&lt;br&gt;
        sta NEW_COL&lt;br&gt;
        rts&lt;/p&gt;

&lt;p&gt;gameLoop:   jsr updatePosition&lt;br&gt;
        jsr getkey&lt;br&gt;
        jsr checkCollision&lt;br&gt;
        ldx #$00    ; clear out the key buffer&lt;br&gt;
        stx $ff&lt;br&gt;
        jmp gameLoop&lt;/p&gt;

&lt;p&gt;updatePosition: ldy NEW_ROW     ; load PLAYER pointer with ROW &lt;br&gt;
        lda table_low,y&lt;br&gt;
        sta NEW_PLAYER_L&lt;br&gt;
        lda table_high,y&lt;br&gt;
        sta NEW_PLAYER_H&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ldy NEW_COL     ; place the player at (POINTER + COL)
    lda #PLAYER
    sta (NEW_PLAYER_L),y
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;getkey:     lda $ff     ; get the input key&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    cmp #$80    ; allow arrow keys only
    bmi getkey
    cmp #$84
    bpl getkey

    pha     ; save the accumulator
    lda #PATH   ; set color of the current position to PATH
    sta (NEW_PLAYER_L),y
    pla     ; restore accumulator

    cmp #$80    ; check key is up
    bne checkRight

    dec NEW_ROW     ; ... if yes, decrement ROW
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;checkRight: cmp #$81    ; check if key is right&lt;br&gt;
        bne checkDown&lt;br&gt;
        inc NEW_COL     ; ... if yes, increment COL&lt;br&gt;
        rts&lt;/p&gt;

&lt;p&gt;checkDown:  cmp #$82    ; check if key is down&lt;br&gt;
        bne checkLeft&lt;br&gt;
        inc NEW_ROW     ; ... if yes, increment ROW&lt;br&gt;
        rts&lt;/p&gt;

&lt;p&gt;checkLeft:  cmp #$83    ; check if key is left&lt;br&gt;
        bne done&lt;br&gt;
        dec NEW_COL     ; ... if yes, decrement COL&lt;br&gt;
        rts&lt;/p&gt;

&lt;p&gt;done:       rts     ; break out of a loop or subroutine&lt;/p&gt;

&lt;p&gt;checkCollision: ldy NEW_ROW     ; load TARGET pointer with ROW &lt;br&gt;
        lda table_low,y&lt;br&gt;
        sta NEW_TARGET_L&lt;br&gt;
        lda table_high,y&lt;br&gt;
        sta NEW_TARGET_H&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ldy NEW_COL     ; load the color from the target
    lda (NEW_TARGET_L),y; at (POINTER + COL)

    cmp #$01
    beq done
    cmp #$03
    beq done
    cmp #$0a
    beq gameComplete

    lda #$00
    sta (NEW_TARGET_L),y

    lda $ff
    cmp #$80    ; if input key was up...
    bne ifRight

    inc NEW_ROW     ; ... if yes, increment ROW
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ifRight:    cmp #$81    ; if input key was right...&lt;br&gt;
        bne ifDown&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    dec NEW_COL     ; ... if yes, decrement COL
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ifDown:     cmp #$82    ; if input key was down...&lt;br&gt;
        bne ifLeft&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    dec NEW_ROW     ; ... if yes, decrement ROW
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ifLeft:     cmp #$83    ; if input key was left...&lt;br&gt;
        bne done&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    inc NEW_COL     ; ... if yes, increment COL
    rts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;gameComplete:   jsr SCINIT&lt;br&gt;
        ldy #$00    ; print game completion message on the screen &lt;br&gt;
pGameComplete:  lda complete,y&lt;br&gt;
        beq done&lt;br&gt;
        sta $f000,y&lt;br&gt;
        iny&lt;br&gt;
        bne pGameComplete&lt;br&gt;
        brk&lt;/p&gt;

&lt;p&gt;drawMaze:   lda #$21    ; a pointer pointing to the first pixel&lt;br&gt;
        sta NEW_MAZE_L  ; of the screen&lt;br&gt;
        lda #$02&lt;br&gt;
        sta NEW_MAZE_H&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    lda #$00    ; number of drawn rows
    sta NEW_DRAWN_ROW

    ldx #$00    ; maze data index
    ldy #$00    ; column index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;draw:       lda maze_data,x&lt;br&gt;
        sta (NEW_MAZE_L), y&lt;br&gt;
        inx&lt;br&gt;
        iny&lt;br&gt;
        cpy #WIDTH  ; compare with the number of WIDTH&lt;br&gt;
        bne draw    ; if not, keep drawing the column&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    inc NEW_DRAWN_ROW   ; increment the number of row
    lda #HEIGHT
    cmp NEW_DRAWN_ROW   ; compare with the number of HEIGHT
    beq done

    lda NEW_MAZE_L
    clc
    adc #$20    ; add 32(0x0020) to increment the row
    sta NEW_MAZE_L  ; of the pixel
    lda NEW_MAZE_H
    adc #$00
    sta NEW_MAZE_H

    ldy #$00    ; reset the column index for the new row
    beq draw            
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;; help text message&lt;br&gt;
help:&lt;br&gt;
dcb "P","l","a","y",32,"w","i","t","h",32,"a","r","r","o","w"&lt;br&gt;
dcb 32,"k","e","y","s",32,"t","o",32,"c","o","n","t","r","o","l",10&lt;br&gt;
dcb 00&lt;/p&gt;

&lt;p&gt;; game complete message&lt;br&gt;
complete:&lt;br&gt;
dcb "Y","o","u",32,"c","o","m", "p", "l", "e", "t", "e", "d", 32&lt;br&gt;
dcb "t","h","e",32,"g","a","m","e","!"&lt;br&gt;
dcb 00&lt;/p&gt;

&lt;p&gt;; maze map data&lt;br&gt;
maze_data:&lt;br&gt;
dcb 01,00,01,00,01,01,01&lt;br&gt;
dcb 01,01,01,00,00,00,01&lt;br&gt;
dcb 00,00,01,00,01,00,01&lt;br&gt;
dcb 01,00,01,00,01,01,01&lt;br&gt;
dcb 01,00,01,00,01,00,01&lt;br&gt;
dcb 01,00,01,00,01,00,01&lt;br&gt;
dcb 01,01,01,01,01,00,10&lt;/p&gt;

&lt;p&gt;; these two tables contain the high and low bytes&lt;br&gt;
; of the addresses of the start of each row&lt;br&gt;
table_high:&lt;br&gt;
dcb $02,$02,$02,$02,$02,$02,$02,$02&lt;br&gt;
dcb $03,$03,$03,$03,$03,$03,$03,$03&lt;br&gt;
dcb $04,$04,$04,$04,$04,$04,$04,$04&lt;br&gt;
dcb $05,$05,$05,$05,$05,$05,$05,$05&lt;/p&gt;

&lt;p&gt;table_low:&lt;br&gt;
dcb $00,$20,$40,$60,$80,$a0,$c0,$e0&lt;br&gt;
dcb $00,$20,$40,$60,$80,$a0,$c0,$e0&lt;br&gt;
dcb $00,$20,$40,$60,$80,$a0,$c0,$e0&lt;br&gt;
dcb $00,$20,$40,$60,$80,$a0,$c0,$e0&lt;/p&gt;

&lt;p&gt;User input: keyboard keys&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xt8uylnnzqmljfhsgih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xt8uylnnzqmljfhsgih.png" alt="Image description" width="317" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Moving: &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxfbzt9bf4qm1ro6nvu2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxfbzt9bf4qm1ro6nvu2.png" alt="Image description" width="369" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finished: the red mark changes to green&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffr4o2b24htcb95karonm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffr4o2b24htcb95karonm.png" alt="Image description" width="203" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Output: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjx0u6ko3xvao0h335zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdjx0u6ko3xvao0h335zt.png" alt="Image description" width="800" height="615"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Summary: &lt;br&gt;
It was a very fun lab. I have made maze before but with python and using assembly language was a game changer for me. This could be made with more difficult mazes and level up with time.&lt;/p&gt;

</description>
      <category>lab2</category>
    </item>
    <item>
      <title>Introduction to 6502 Assembly Language</title>
      <dc:creator>Heavendeep Kaur Munjal</dc:creator>
      <pubDate>Wed, 31 Jan 2024 19:46:01 +0000</pubDate>
      <link>https://dev.to/heavenmunjal/introduction-to-6502-assembly-language-47n3</link>
      <guid>https://dev.to/heavenmunjal/introduction-to-6502-assembly-language-47n3</guid>
      <description>&lt;p&gt;Welcome to the kickoff of our journey into the captivating world of assembly language programming! In this hands-on lab, dive into the basics of 6502 assembly language using the 6502 Emulator. Through experimentation and optimization, uncovered valuable insights that set the stage for mastering more complex assembly languages such as x86_64 and AArch64. Let's dive in and have fun!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up&lt;/strong&gt;&lt;br&gt;
Began the lab by opening the 6502 Emulator in a new tab or window. Kept this guide handy for reference as you navigate through the lab.&lt;br&gt;
Note: Remember to save the work periodically using git or by copying the code to local files, as the emulator does not automatically save your progress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3uf73p5nc4iiqy2wknh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3uf73p5nc4iiqy2wknh.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bitmap Code&lt;/strong&gt;&lt;br&gt;
Added the code provided in the lab into the emulator and then assembled and then ran on the site. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp267bob3dryxqp908tbq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp267bob3dryxqp908tbq.png" alt="Image description" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code provided gives the color yellow. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Calculating Performance:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fym5iueyeh8h7yrhzd9xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fym5iueyeh8h7yrhzd9xp.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Decrease the time taken to fill the screen with a solid colour:&lt;br&gt;
To reduce the time needed to fill the screen with a solid color, we can optimize the loop structure and improve memory access efficiency.&lt;/p&gt;

&lt;p&gt;lda #$00   ; set a pointer in memory location $40 to point $0200&lt;/p&gt;

&lt;p&gt;sta $40       ; ... low byte ($00) goes in address $40&lt;br&gt;
lda #$02&lt;br&gt;
sta $41       ; ... high byte ($02) goes into address $41&lt;br&gt;
lda #$07      ; colour number&lt;/p&gt;

&lt;p&gt;ldx #$00      ; set X register to 0&lt;br&gt;
lda #$07      ; load accumulator with color number&lt;/p&gt;

&lt;p&gt;fill_loop:&lt;br&gt;
    sta ($40),x    ; set pixel color at the address (pointer)+X&lt;br&gt;
    inx            ; increment index&lt;br&gt;
    bne fill_loop  ; continue until X reaches 0 again&lt;br&gt;
    inc $41        ; increment the page&lt;br&gt;
    cpx #$06       ; compare with 6&lt;br&gt;
    bne fill_loop  ; continue until done all pages&lt;/p&gt;

&lt;p&gt;it utilize the X register to iterate through the 256 pixels of a page, eliminating the necessity for the Y register and its associated instructions.&lt;br&gt;
By removing the Y register and its increment instruction, we save cycles.&lt;br&gt;
Reducing the number of branching instructions is achieved by employing the X register to loop through the pixels.&lt;br&gt;
The need to load Y with #$00 and increment it inside the loop has been eliminated.&lt;/p&gt;

&lt;p&gt;Total cycles: &lt;br&gt;
5+(256×(5+2))+5+3×6=5+(256×7)+5+18=5+1797+5+18=1825 cycles&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code now showing light blue instead of yellow&lt;/strong&gt;&lt;br&gt;
modified the code by: lda #$e   ; colour number&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvusx5y1hxx68nvfqph2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvusx5y1hxx68nvfqph2c.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code now changing display with a different color on each page&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      lda #$00    ; set a pointer at $40 to point to $0200
    sta $40
    lda #$02
    sta $41

    lda #$06    ; colour number
    sta $10 ; store colour number to memory location $10

    ldy #$00    ; set index to 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;loop:    sta ($40),y    ; set pixel at the address (pointer)+Y&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    iny ; increment index
    bne loop    ; continue until done the page

    inc $41 ; increment the page

    inc $10 ; increment the color number
    lda $10 ; colour number

    ldx $41 ; get the current page number
    cpx #$06 ; compare with 6
    bne loop ; continue until done all pages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1jshww324jbn31wao2k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1jshww324jbn31wao2k.png" alt="Image description" width="402" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reflection:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lab 1 in assembly language programming (ALP) and the 6502 Emulator environment was an enlightening experience for a newcomer like myself. Setting up the emulator was straightforward, emphasizing the importance of file management and version control using tools like git. Exploring the provided bitmap code was both fascinating and challenging, requiring a deep understanding of each instruction's purpose and sequence. Calculating the code's performance metrics, including execution time and memory usage, was a new concept that demanded attention to detail and system constraints. Optimizing the code to decrease execution time underscored the significance of algorithmic efficiency and resource utilization in ALP. Modifying the code to experiment with different colors on the display expanded my understanding of memory manipulation and graphical output. Despite the challenges, Lab 1 sparked a sense of curiosity and eagerness to delve deeper into ALP and low-level programming. The hands-on nature of the lab provided valuable insights into system architecture and optimization techniques, laying a strong foundation for future exploration and learning in the realm of assembly language programming.&lt;/p&gt;

</description>
      <category>lab1</category>
    </item>
  </channel>
</rss>
