Today I'll talk about Lab 4. We had to pick two tasks out of four and develop the solution using my least favour language: assembly. Our group chose the options 2 (data input form) and 4 (screen colour selector) thinking that would be the easiest ones. The other options were adding calculator and hexdump. This post will talk about the colour selector, and my next will be the input form.
The colour selector project was quite easy to do relatively. There are only 16 colours available (0 to F in hex). We have to list them in the text area and allow the selection using the cursor (up and down). Once the colour is selected, we have to paint the graph area.
The graph area we did before. Basically, we have to store the colour code for every pixel in the display using the memory location between $0200 and $05FF. In the last post, we deal with up and down keys to change the numeric display. However, we never dealt with character display before.
The character display works the same way as the graph. Its memory locations range from $F000 to $F7CF and have 25 lines of 80 characters (80x25). The complication here is the navigation between rows. It is not a matter of just increment the high bite – meaning more code and more working hours. Fortunately, we have ROM routines to help us to navigate, get and set the characters. Just like calling a function.
To know more about the ROM routines, access the 6502 simulator notes and take a look at "ROM Routines."
I tried to put as many comments in the code that I could. Also, that was my first time using the stack (instructions pha and pla) that saved my code! The stack is a handy area to save data when you need to free registers to do something and then restore that data.
I'm proud of myself finishing this code. I know that is room for improvement, but I can see my progress using assembly. See you in the next post.
Comments
Post a Comment