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

  • |

    Nothing good to say

    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!I try not to make this a personal blog. Soon enough I will be blogging about my CS 2 adventures- Level…

  • |

    Getting Organized

    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! With just a few weeks until school started (me going into my senior year I am both excited and apprehensive),…

  • |

    Setting All Videos To Show Controls In LearnDash

    One of the biggest pieces of feedback I’ve gotten on my course videos in recent weeks was that the controls on my videos were hidden. To be honest, I didn’t realize students couldn’t scrub through videos, or rewind – I assumed everything was working! After looking through the LearnDash settings and not finding a global…

  • Getting Organized II

    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! Last Time, I talked about a number of different calendars to get organized. I also mentioned my personal favorite was…

  • Another Year Gone By

    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!Well today (or really yesterday) I had my last final of my junior year, which more or less makes me a…