Coding at a new level

Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don't hold it against me. One of the perils of having a 20+ year old website!

This semester I am taking a class called Machine Organization and Assembly Language. What this amounts to is learning how to program on lower levels than Java and C++. Instead I am [currently] programing right to the hardware, or one level higher. It’s interesting and in some ways more difficult. While there is a lot to know in higher levels like Java, there is more you have to keep track of in Machine and Assembly. Right now we are using a pseudo architecture called “Pep/8” which is a simple ‘machine/OS’. It is not actually used, but servers on an academic level to illustrate.

Below is some code at first machine level and then assembler in Pep/8. The program reads in 2 single digit numbers and outputs a single digit answer. For example: 2+2 wouls yield 4, which 8+4 would yield 2. Achieve this, I checked to see if the sum was greater than 9, if so, subtract
10.

04 00 0B 00 00 00 00 00 00 00 0A 31 00 03 31 00 05 C1 00 03 71 00 05 E1 00 07 B1 00 09 08 00 29 C1 00 07 81 00 09 E1 00 07 39 00 07 00 zz

…What that results to in Assembly is:

pep8 assmbly

To give some perspective, in Java, it would look something like this…

{
//read in 2 ints, I and j
int sum= i + j;
if(sum >= 10){
sum= sum - 10;
}
System.out.print (sum);
}

…Later

Similar Posts

  • | |

    Random Code Generator 1.0

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!A couple of weeks ago, when I officially launched the redesign, I mentioned the forthcoming release of a plugin I wrote…

  • |

    15 Video Games that Will Stick with You

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!Got this from a Facebook Meme, then felt it would be a good blog post. The rules: Don’t take too long…

  • |

    Make wp-caption the same (responsive) width as the Image

    I was working on a problem last week in WordPress where the caption for an image was extending the whole width of the container, not staying the width of the image. This make sense – the image is inside the .wp-caption container. So how to we fix it? Let me tell you!

  • |

    About Coding with AI…

    Telling an AI to make an app is not app development, just like telling a 5 year old to draw a Picasso isn’t a Picasso.

  • |

    Google Web Toolkit

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! After I got back from Google I/O, I mentioned Google Web Toolkit was something they showed off that I was…

  • New Facebook Fun

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! For all the people out there with Facebook, an online social site for college and now high school students all…