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

  • Uploading Images in PHP

    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 dabbling in PHP for some time, and writing an image upload script about 8 months ago, I would like to…

  • |

    Coding Process

    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!Here is a paper I recently found. It’s on my coding process (after being a coder for about 2.5 months), and…

  • |

    How to Learn a New Programming Language

    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! As I said in the last two posts, Google I/O was truly inspiring. It got me to thinking about how…

  • Wow….

    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!So Joe, what did you do today? “O you know, the usual. Spur of the moment trip to Hershey Park, Texas…

  • Types of classes, part 2

    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!Today I will continue my series on classes in Java. To review where we are, you can read this post. First…