Spo Lab 3

Earlier this week I was introduced to more of the programming capabilities of the 6502 processor. We learned how to properly use subroutines, which I was quite happy about as I had run into a problem with my own experiments in lab assignment 2. It was revealed that you would have to put a BRK (break) between the main code that draws graphics and the subroutines to solve the problem. The reason is because a processor’s memory is separated into sections, or “pages.” Some pages are for graphics, and others are for storing program code. These pages are connected and stacked on top each other. This of course means if you are not careful, it would be easy to store graphical information in pages that should only contain programming information. Basically you overwrite your code and potentially exceed the memory for that page.

With this in mind, my subroutine experiment in lab 2 was basically running a second time in a point in memory that was already at the last address of a page, which would cause it to overflow and spill into the other pages (overwrite). In any case, adding the BRK solved my problem.

Two other important concepts were the ability to store pointers in labels, essentially creating a constant variable that could be reused throughout the assembler code. There was also DCB (declare bit), which allows you to store unchanging value at a memory address. This can be handy for defining data that will never need to change, and can allow programmers to generate rudimentary graphical elements like symbols or numbers:

#000
#000
#000
####

In the example above, you see 4 rows with 4 characters per row. This is a 4×4 graphic or “sprite.” If you look carefully you will see a bunch of “#” characters arranged in such a way that it looks kind of like an “L.” I used the # for illustrative purposes but if you replace them with the value “$6”, then you would generate a blue “L” in assembler. If you then put this in a label, you could then conveniently refer to this graphic, and display it where ever you want on the screen. Cool huh?

In the next blog post I will discuss my progress in creating one of the optional programs for lab 3. However regarding Tuesdays group attempt at completing the lab, we had only managed to create the numerical graphics. Outside of that however, we did start to think of the logic of how to increment the numbers up to 99. The remaining challenge was to understand how to implement keyboard input.

In any case, we will see how far I get with my own attempt. See you in the next post!

Leave a comment

Design a site like this with WordPress.com
Get started