<?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: Joyce Wei</title>
    <description>The latest articles on DEV Community by Joyce Wei (@joycew414).</description>
    <link>https://dev.to/joycew414</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%2F700401%2Fdcb6084a-b914-467a-9c75-d69069e17712.png</url>
      <title>DEV Community: Joyce Wei</title>
      <link>https://dev.to/joycew414</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joycew414"/>
    <language>en</language>
    <item>
      <title>SPO600 - Inline Assembler</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Thu, 16 Dec 2021 04:55:25 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-inline-assembler-10f7</link>
      <guid>https://dev.to/joycew414/spo600-inline-assembler-10f7</guid>
      <description>&lt;p&gt;Inline Assembly is the assembly language code which is being embedded into the program written in another programming language. The most commonly programming language is C.&lt;/p&gt;

&lt;p&gt;To embedded assembly language code into a C program, we can use one of the following forms: &lt;code&gt;asm(...);&lt;/code&gt; or &lt;code&gt;__asm__ (...);&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can use &lt;code&gt;asm("..." "...");&lt;/code&gt; noticed there is a space between or &lt;code&gt;asm("...\n ...")&lt;/code&gt; to indicate the line break of the assembly code, and use 'asm("\t")' to indicate a tab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input and Output Operands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;=&lt;/strong&gt; - output-only register: discarded the previous content and replaced with output value
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int x=10, y;
__asm__ ("mov %1,%0"  // "mov [destination], [source]"

   : "=r"(y)    // output register value is moved to y
                // register is called %0 in template

   : "r"(x)     // input value from x is placed in a register
                // register is called %1 in template
   :
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;+&lt;/strong&gt; - input and output register: the register can input the value to the assembly code and output the value from the assembly code.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int x=10, y;
__asm__ ("mov %1,%0"
   : "+r"(y)       // + indicates read/write register
   : "0"(x)        // output register is same as %0
   :
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>SPO600 - Profiling</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Thu, 16 Dec 2021 04:36:59 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-week-11-jl8</link>
      <guid>https://dev.to/joycew414/spo600-week-11-jl8</guid>
      <description>&lt;p&gt;Profiling is the process of analyzing software performance based on the time, memory, temporary storage and energy where the time includes total real time, user time and the time that kernel spent. &lt;/p&gt;

&lt;p&gt;There are two techniques to determine the resource usage on a per-function basis. The first technique is sampling which keeps interrupting the program and determining which function is currently executing. The second technique is instrumentation which sets a breakpoint to where we are interested in and determine when and how often the code is take place.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Project Stage 3</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Thu, 16 Dec 2021 03:21:30 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-project-stage-3-10o7</link>
      <guid>https://dev.to/joycew414/spo600-project-stage-3-10o7</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The stage three of SPO600 project is required to recommend how the open source package &lt;a href="https://github.com/videolan/vlc"&gt;VLC&lt;/a&gt; from stage two should be extended to support SVE2. The difference between SVE and SVE2 is that the SVE is fixed-width, whereas SVE2 is variable-width and has additional functional coverage of instruction set that SVE has.&lt;/p&gt;

&lt;h2&gt;
  
  
  SVE2 Enhancements
&lt;/h2&gt;

&lt;p&gt;The ARMv9 architecture released this year supports SVE2 which is a superset of SVE and Neon. According to the &lt;a href="https://developer.arm.com/documentation/102340/0001/Introducing-SVE2"&gt;official document&lt;/a&gt;, the SVE2 instruction set can accelerate the common algorithms for multimedia application which is VLC needed. From the file &lt;a href="https://github.com/videolan/vlc/blob/e3f38be0ccab13d46041de208bcceb917278f289/modules/video_filter/deinterlace/merge_sve.S"&gt;merge_sve.S&lt;/a&gt; and &lt;a href="https://github.com/videolan/vlc/blob/e3f38be0ccab13d46041de208bcceb917278f289/modules/video_filter/deinterlace/merge_arm64.S"&gt;merge_arm64.S&lt;/a&gt; we can see the software is using ARMv8 architecture, so the first task is to upgrade the ARMv8 to ARMv9. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As I scan through the &lt;a href="https://developer.arm.com/documentation/dai0548/latest"&gt;SVE Programming Examples&lt;/a&gt; and the &lt;a href="https://github.com/videolan/vlc"&gt;VLC source code&lt;/a&gt;, I cannot find a place to update the existing source code to SVE2 instruction set. Since SVE2 is also support SVE instruction set, the program will not break if we upgrade the architecture to ARMv9. Before I can provide further recommendation for SVE2 enhancements to VLC package, I need to have deeper understanding on SVE2 and the VLE source code first.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Project Stage 2</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 13 Dec 2021 04:58:34 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-project-stage-2-3n50</link>
      <guid>https://dev.to/joycew414/spo600-project-stage-2-3n50</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The open source package that I will be discuss in this blog is VLC. According to the &lt;a href="https://github.com/videolan/vlc"&gt;official GitHub&lt;/a&gt;, VLC is a media player and multimedia engine that has been ported to different computing platforms. VLC can play various multimedia files, discs streams, allows playback from devices, and ids able to convert to or stream in various formats. &lt;/p&gt;

&lt;p&gt;There are 557 contributors in this project and the last commit to the project is on April 14, 2021. According to the &lt;a href="https://www.videolan.org/vlc/stats/downloads.html"&gt;official website&lt;/a&gt;, the total download number is 6,566,829 across all versions and OS.&lt;/p&gt;

&lt;h2&gt;
  
  
  SIMD
&lt;/h2&gt;

&lt;p&gt;In the file &lt;a href="https://github.com/videolan/vlc/blob/75bca603749d8bfb7048a84ea811cbdb19447596/include/vlc_cpu.h"&gt;vlc_cpu.h&lt;/a&gt; under the &lt;code&gt;include&lt;/code&gt; folder, we can see the CPU compatibilities of Neon and SVE for aarch64 system are specified in this file where Neon and SVE are different naming of SIMD.&lt;/p&gt;

&lt;p&gt;There is a file named &lt;a href="https://github.com/videolan/vlc/blob/e3f38be0ccab13d46041de208bcceb917278f289/modules/video_filter/deinterlace/merge_arm64.S"&gt;merge_arm64.S&lt;/a&gt;, we know that &lt;code&gt;arm64&lt;/code&gt; is other name for &lt;code&gt;aarch64&lt;/code&gt; and this file is there to add build system support / CPU detection for aarch64 SIMD system.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Project Stage 1</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Thu, 02 Dec 2021 04:59:29 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-project-stage-1-a51</link>
      <guid>https://dev.to/joycew414/spo600-project-stage-1-a51</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this project we are benchmarking digital sound programs on both x86_64 and AArch64 systems. &lt;/p&gt;

&lt;p&gt;There will be six programs (vol0.c to vol5.c) in total to be testing and they are just different approach to the same problem. Two of them will be specific to x86_64 system only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prediction
&lt;/h2&gt;

&lt;p&gt;I am predicting the vol4.c program will have better performance because it is using SIMD optimization through inline assembly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarking
&lt;/h2&gt;

&lt;p&gt;The following are the results from each program. We can see that the programs don't produce the same output and there is a significant difference in vol3.c program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1QEiZc-T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nl2smxcyr9ulsurtap6w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1QEiZc-T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nl2smxcyr9ulsurtap6w.jpg" alt="Image description" width="148" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will be using 500000000 samples to test the programs and the results in following screenshot are the time taken to scale the samples.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F-OUS7-6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pf3uex7c5xcjhxsrklxv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F-OUS7-6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pf3uex7c5xcjhxsrklxv.jpg" alt="Image description" width="654" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the result, it takes approximately 1.5 seconds to scaling 500000000 sound samples using a x86_64 system. But when the results from AArch64 is much better than x86_64 even without SIMD optimization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory Usage
&lt;/h2&gt;

&lt;p&gt;vol0.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HK1aL47N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0f90uketu33xg3gof1oo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HK1aL47N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0f90uketu33xg3gof1oo.jpg" alt="Image description" width="738" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;vol1.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--joPEqxvk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b1qhgfqks4882rsswz7n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--joPEqxvk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b1qhgfqks4882rsswz7n.jpg" alt="Image description" width="739" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;vol2.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n8ZVW4LJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ndb6oxw45b5paif81im.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n8ZVW4LJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ndb6oxw45b5paif81im.jpg" alt="Image description" width="741" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;vol3.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pXpPlGCm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev5u08n47xq1e0yv1bd1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pXpPlGCm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev5u08n47xq1e0yv1bd1.jpg" alt="Image description" width="731" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;vol4.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J37uoarf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qodkyy56ppmncrexbeat.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J37uoarf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qodkyy56ppmncrexbeat.jpg" alt="Image description" width="731" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;vol5.c&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YVtsLHQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5cj1gpz0xxl6a373uovn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YVtsLHQv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5cj1gpz0xxl6a373uovn.jpg" alt="Image description" width="731" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Compiler Option
&lt;/h2&gt;

&lt;p&gt;To increase the performance of the program, we can add compiler option -O2, -O3, -Ox via the Makefile.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions
&lt;/h2&gt;

&lt;p&gt;Q: What does this next block do? Why?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ovLRENg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efofew370sj1t7ygy4ke.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ovLRENg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efofew370sj1t7ygy4ke.jpg" alt="Image description" width="478" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code block is checking if the system architecture is AArch64. If the system is AArch64 then compile vol0 to vol5. Otherwise, only compile vol0 to vol3 because vol4 and vol5 are specific to AArch64 architecture.&lt;/p&gt;

&lt;p&gt;Q: Why is this needed?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k-UuY8wa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l2f8y1viqczxwigrzpq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k-UuY8wa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l2f8y1viqczxwigrzpq.jpg" alt="Image description" width="280" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are accumulating the total data are processed in SAMPLES array in each programs, so we can compare the result.&lt;/p&gt;

&lt;p&gt;Q: Why is this needed?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MpmsARJ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1y3wk3b4gvbiz1150ovl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MpmsARJ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1y3wk3b4gvbiz1150ovl.jpg" alt="Image description" width="253" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This line is printing the result to the console.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Lab3 - 6502 Assembly Language Math Lab</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 01 Nov 2021 03:53:58 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-lab3-6502-assembly-language-math-lab-1iba</link>
      <guid>https://dev.to/joycew414/spo600-lab3-6502-assembly-language-math-lab-1iba</guid>
      <description>&lt;p&gt;In lab3 we are making a kaleidoscope program using 6502 assembly language. The bitmap screen is break down into 4 quadrants and user will be able to draw pixels on second quadrant(top-left) using arrow keys on keyboard. The pixels drawn will be reflect to other 3 quadrants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HwjSTsvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7jwmbhz0otvysm7nape.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HwjSTsvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7jwmbhz0otvysm7nape.jpg" alt="result" width="192" height="192"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gaMZMqmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tub241gstpo41li1b5n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gaMZMqmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tub241gstpo41li1b5n.jpg" alt="result-colour" width="185" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ; zero-page variable locations
 define ROW     $20 ; current row
 define COL     $21 ; current column
 define POINTER     $10 ; ptr: start of row
 define POINTER_H   $11

 ; constants
 define DOT     $01 ; dot colour location
 define CURSOR      $04 ; purple colour


setup:  lda #$0f    ; set initial ROW,COL
    sta ROW
    sta COL
    LDA #$01
    STA DOT

draw:   jsr draw_cursor

getkey:
    ldx #$00    ; clear out the key buffer
    lda $ff     ; get a keystroke
    stx $ff

    cmp #$30
    bmi getkey
    cmp #$40
    bpl continue

    SEC
    sbc #$30
    tay
    lda color_pallete, y
    sta DOT
    jmp done

continue:   
    cmp #$43    ; handle C or c
    beq clear
    cmp #$63
    beq clear

    cmp #$80    ; if not a cursor key, ignore
    bmi getkey
    cmp #$84
    bpl getkey

    pha     ; save A

    lda DOT ; set current position to DOT
    sta (POINTER),y
    jsr draw_on_quads

    pla     ; restore A

    cmp #$80    ; check key == up
    bne check1

    dec ROW     ; ... if yes, decrement ROW
    jmp done

 check1:    
    cmp #$81    ; check key == right
    bne check2

    inc COL     ; ... if yes, increment COL
    jmp done

 check2:    
    cmp #$82    ; check if key == down
    bne check3

    inc ROW     ; ... if yes, increment ROW
    jmp done

 check3:    
    cmp #$83    ; check if key == left
    bne done

    dec COL     ; ... if yes, decrement COL
    clc
    bcc done

 clear: 
    lda table_low   ; clear the screen
    sta POINTER
    lda table_high
    sta POINTER_H

    ldy #$00
    tya

 c_loop:    
    sta (POINTER),y
    iny
    bne c_loop

    inc POINTER_H
    ldx POINTER_H
    cpx #$06
    bne c_loop

 done:  
    clc     ; repeat
    bcc draw


 draw_cursor:
    lda ROW     ; ensure ROW is in range 0:0F
    and #$0f
    sta ROW

    lda COL     ; ensure COL is in range 0:0F
    and #$0f
    sta COL

    ldy ROW     ; load POINTER with start-of-row
    lda table_low,y
    sta POINTER
    lda table_high,y
    sta POINTER_H

    ldy COL     ; store CURSOR at POINTER plus COL
    lda #CURSOR
    sta (POINTER),y

    rts

 draw_on_quads:     
    LDA POINTER ;; save the pointer to the
    PHA     ;; original location in top_left_quad
    LDA POINTER_H
    PHA

; top right quadrant
    LDA #$10
    CLC
    SBC COL
    CLC
    ADC #$10
    TAY
    LDA DOT
    STA (POINTER),y

    TYA
    PHA     ; save the y offset

; bottom left quadrant  
    lda #$10    ; load POINTER with start-of-row
    CLC
    SBC ROW
    CLC
    ADC #$10
    TAY

    lda table_low,y
    sta POINTER
    lda table_high,y
    sta POINTER_H

    ldy COL     ; store CURSOR at POINTER plus COL
    lda DOT
    sta (POINTER),y

    PLA
    TAY

; bottom right quadrant 
    lda DOT
    sta (POINTER),y

    PLA
    STA POINTER_H
    PLA
    STA POINTER

    RTS

 ; these two tables contain the high and low bytes
 ; of the addresses of the start of each row

 table_high:
 dcb $02,$02,$02,$02,$02,$02,$02,$02
 dcb $03,$03,$03,$03,$03,$03,$03,$03
 dcb $04,$04,$04,$04,$04,$04,$04,$04
 dcb $05,$05,$05,$05,$05,$05,$05,$05,

 table_low:
 dcb $00,$20,$40,$60,$80,$a0,$c0,$e0
 dcb $00,$20,$40,$60,$80,$a0,$c0,$e0
 dcb $00,$20,$40,$60,$80,$a0,$c0,$e0
 dcb $00,$20,$40,$60,$80,$a0,$c0,$e0

color_pallete:
dcb $01,$02,$03,$04,$05,$06,$07,$08,$09,$0a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The subroutines:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;"draw_cursor" is restricting the area where the cursor is allowed to go which is second quadrant only by setting the range of row and column to [$00 : $0F]&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"draw_on_quads" is reflecting the pixels in the second quadrant to other 3 quadrants by storing a copy of the current position and adding the x or y offset to the cursor.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>SPO600 Lab2 - Experiments</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 01 Nov 2021 03:53:45 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-lab2-experiments-3d4k</link>
      <guid>https://dev.to/joycew414/spo600-lab2-experiments-3d4k</guid>
      <description>&lt;p&gt;This section is going to modify the starter code in order to do some experiment with the bitmap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Starter Code&lt;/strong&gt;&lt;br&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 #$07    ; colour number

    LDY #$00    ; set index to 0

loop:   
    STA ($40),y ; set pixel at the address (pointer)+Y

    INY         ; increment index
    BNE loop    ; continue until done the page

    INC $41     ; increment 1 page
    LDX $41     ; get current page number
    CPX #$06    ; compare with 6
    BNE loop    ; continue until done the page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--slNfyO8U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ewq16d7tpzbabg994d2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--slNfyO8U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ewq16d7tpzbabg994d2.jpg" alt="Starter Code Result" width="154" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experiment 1&lt;/strong&gt;&lt;br&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 #$07    ; colour number

    LDY #$00    ; set index to 0

loop:   
    TYA     ; experiment 1
    STA ($40),y ; set pixel at the address (pointer)+Y

    INY         ; increment index
    BNE loop    ; continue until done the page

    INC $41     ; increment 1 page
    LDX $41     ; get current page number
    CPX #$06    ; compare with 6
    BNE loop    ; continue until done the page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--59cTy6NQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ddjsw9282usi1woaxof3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--59cTy6NQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ddjsw9282usi1woaxof3.jpg" alt="Experiment 1" width="149" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding "TYA" after the "loop" label and before the "STA ($40),y", there are 32 vertical lines with 16 different colours displayed on the bitmap. &lt;/p&gt;

&lt;p&gt;This is because "TYA" means "Transfer Y to A" and our accumulator(A) is holding the colour. Since we are incrementing the Y register after "TYA", the colour will change every time the value of Y register is incremented. Moreover, there are only 16 colours available and the bitmap has 32 columns so the vertical lines will be displayed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experiment 2&lt;/strong&gt;&lt;br&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 #$07    ; colour number

    LDY #$00    ; set index to 0

loop:   
    TYA     ; experiment 1
    LSR         ; experiment 2
    STA ($40),y ; set pixel at the address (pointer)+Y

    INY         ; increment index
    BNE loop    ; continue until done the page

    INC $41     ; increment 1 page
    LDX $41     ; get current page number
    CPX #$06    ; compare with 6
    BNE loop    ; continue until done the page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1XmwqEAS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knz1v70upyqfova9el82.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1XmwqEAS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knz1v70upyqfova9el82.jpg" alt="Experiment 2" width="148" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The instruction "LSR" means "Logical Shift Right" which will shift every bits one position to the right, this will result the vertical lines with one pixel wider.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zcv8ObiE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnqnqgcrvixe8f1dud7l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zcv8ObiE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnqnqgcrvixe8f1dud7l.jpg" alt="Experiment 2-2" width="148" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we adding more "LSR" instruction, the wider the pixels will be.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Lab2 - 6502 Assembly Language Lab</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 01 Nov 2021 03:53:36 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-lab2-6502-assembly-language-lab-384</link>
      <guid>https://dev.to/joycew414/spo600-lab2-6502-assembly-language-lab-384</guid>
      <description>&lt;p&gt;In lab2 we are going to draw borders around the bitmap screen with 4 different colours using 6502 assembly language.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5dAwvY9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvtz2fx6kusc259484yt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5dAwvY9c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvtz2fx6kusc259484yt.jpg" alt="result" width="201" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;br&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 #$05    ; colour number: green
    LDY #$00    ; set index to 0

; draw green line at the top of the bitmap screen

top:    
    STA ($40),y ; set pixel at the address (pointer)+Y
    INY         ; increment index
    CPY #$20    ; 
    BNE top         ; continue until done the page


    LDA #$05    ; set page to 5
    STA $41     ; 

    LDA #$06    ; colour number: blue
    LDY #$E0    ; set index to starting index of last line in pg.5

; draw blue line at the bottom of the bitmap screen

bottom: 
    STA ($40),y ; set pixel at the address (pointer)+Y
    INY         ; increment index
    CPY #$00    ; 
    BNE bottom      ; continue until done the page


    LDA #$02    ; set page to 2
    STA $41     ; 

    LDY #$00    ; set index to starting index of pg.2

; draw yellow line to the left and 
; purple line to the right of the bitmap screen

sides:  
    CLC     ; clear carry to prevent accumulating of a value
    LDA #$07    ; colour number: yellow
    STA ($40),y ; set pixel at the address (pointer)+Y
    TYA     ; transfer y to a
    ADC #$1F    ; increment memory (a) by 1f (32 in hex = 1 line)
    TAY     ; transfer a to y
    LDA #$04    ; colour number: purple
    STA ($40),y ; set pixel at the address (pointer)+Y
    INY     ; increment y (to first index of next line)
    CPY #$00    ; 
    BNE sides   ; continue until done the page

    INC $41     ; increment 1 page
    LDX $41     ; get current page number
    CPX #$06    ; compare with 6
    BNE sides   ; continue until done the page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have break down the process of drawing the borders into 3 parts. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;loop "top" draws a green border at the top of the bitmap screen
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jy1drxIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh7xivk8hmj1uqyk5e0f.jpg" alt="top" width="190" height="192"&gt;
&lt;/li&gt;
&lt;li&gt;loop "bottom draws a blue border at the bottom of the bitmap screen by setting the starting index to $05E0
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u0Hk5moH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lceih3742j2ejkvvzhp.jpg" alt="bottom" width="187" height="190"&gt;
&lt;/li&gt;
&lt;li&gt;loop "sides" draws a yellow border to the left and a purple border to the right of the bitmap screen by keep switching between the two colours and increasing the index of the current line.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fNucO2iR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/260xwfrwtjjtm2hhd66k.jpg" alt="sides" width="189" height="192"&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>SPO600 - 6502 Assembly Language Bitmap</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 01 Nov 2021 03:53:22 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-6502-assembly-language-bitmap-1eof</link>
      <guid>https://dev.to/joycew414/spo600-6502-assembly-language-bitmap-1eof</guid>
      <description>&lt;p&gt;During the introduction to 6502 assembly language lecture, we have first introduced with the X and Y registers and accumulator. Also, we have take a look into how to move around the bitmap and change the colour of the pixel .&lt;/p&gt;

&lt;p&gt;In the following code, I have try to load 3 different colours into the accumulator and registers then draw 9 pixels into the bitmap as an excise on how to move the pixels around.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Result&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xBbWH0HW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mb1tcxxa4skcwjc52awd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xBbWH0HW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mb1tcxxa4skcwjc52awd.jpg" alt="result" width="148" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LDA #01
LDX #07
LDY #03

STA $0200
STX $020f
STY $021f

STA $0400
STX $040f
STY $041f

STA $05e0
STX $05f0
STY $05ff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Opcode&lt;/strong&gt;&lt;br&gt;
LDA: LoaD Accumulator&lt;br&gt;
LDX: LoaD X register&lt;br&gt;
LDY: LoaD Y register&lt;/p&gt;

&lt;p&gt;STA: STore Accumulator&lt;br&gt;
STX: STore X register&lt;br&gt;
STY: STore Y register&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 Lab1 - Code Review</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Mon, 01 Nov 2021 03:53:03 +0000</pubDate>
      <link>https://dev.to/joycew414/spo600-lab1-code-review-1lh1</link>
      <guid>https://dev.to/joycew414/spo600-lab1-code-review-1lh1</guid>
      <description>&lt;p&gt;The open source projects required a license which specifies the authorization that everyone in the community has in order to contribute and make change to the code.&lt;/p&gt;

&lt;p&gt;In this lab, I will be look into two open source projects each with different licenses and observe the code review process on how the contributors can contribute to the project. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DuckDuckGo iOS Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;DuckDuckGo is an internet search engine that licensed under the Apache 2.0 license. &lt;/p&gt;

&lt;p&gt;To contribute to this project, contributors can either report an issue or require to create a pull request with a fix in their &lt;a href="https://github.com/duckduckgo/iOS"&gt;GitHub page&lt;/a&gt; with detailed description stated. Once one of the reviewers has reviewed the code and approved the changes, the code will be merge into the main branch.&lt;/p&gt;

&lt;p&gt;There are two participants in this &lt;a href="https://github.com/duckduckgo/iOS/pull/980"&gt;pull request&lt;/a&gt;, one is the contributor and one is the reviewer. The whole process take up 3 days to add a JS prompts support to the application. The contributor creates the pull request first, then the reviewer will review the code and provide some feedbacks. Once the code is fixed and approved, the code will be merged into the main branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mikro-Orm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mikro-Orm is TypeScript ORM for Node.js application that licensed under the MIT license.&lt;/p&gt;

&lt;p&gt;To contribute to this project, contributors can either report an issue or require to create a pull request with a fix in their &lt;a href="https://github.com/mikro-orm/mikro-orm"&gt;GitHub page&lt;/a&gt; with description stated. Once the reviewer has reviewed the code and approved the changes, the code will be merge into the main branch.&lt;/p&gt;

&lt;p&gt;There are two participants in this &lt;a href="https://github.com/mikro-orm/mikro-orm/pull/2305"&gt;pull request&lt;/a&gt;, one is the contributor and one is the reviewer. The whole process only takes up less than an hour to fix a missing type issue. The contributor creates the pull request first, then the reviewer will review the code and request changes to the fix code. Once the code is fixed and approved, a code coverage comment bot will come and show the code coverage result in the comment then the fix code will be merged into the main branch.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Hello, Open Source.</title>
      <dc:creator>Joyce Wei</dc:creator>
      <pubDate>Sat, 11 Sep 2021 03:48:11 +0000</pubDate>
      <link>https://dev.to/joycew414/hello-open-source-449</link>
      <guid>https://dev.to/joycew414/hello-open-source-449</guid>
      <description>&lt;p&gt;&lt;b&gt;About Me&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Hi there, I am Joyce, a CPA (Computer Programming and Analysis) student at Seneca College. I am currently living in Toronto Canada.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Why OSD600?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;OSD600 is a Open Source Development course. This course provides the opportunity for me as a student developer to get better understanding on how to use GitHub to managing and contributing to various open source  projects. After the end of this course I will be gaining real world experience on collaborating with other developers and contributing to open source projects on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Explore Repos&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;I am interested in accessibility related field and the query language Graphql. &lt;a href="https://github.com/apollographql/apollo-client"&gt;apollo-client&lt;/a&gt; is a package that helps you to build the client side of a web app with backend API server using GraphQL. I am learning GraphQL on my own time and I found that both Apollo server and Apollo client are really helpful and easy-to-use when building a GraphQL backend.&lt;/p&gt;

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