Posts

Showing posts from September, 2024
This week for my lab we get to decide a program to write in our 6502 emulator. This program must fit the following criteria:  You must output to the character screen as well as the graphics (bitmapped) screen. You must accept user input from the keyboard in some form. You must use some arithmetic/math instructions (to add, subtract, do bitwise operations, or rotate/shift My choice of program to meet these requirements will  be an addition and subtraction calculator that takes in two numbers for user input then performs either addition or subtraction to the two numbers. We already have an addition calculator as an example and I will follow that to build the subtraction portion of the lab.  ; Adding calculator ; ROM routine entry points define SCINIT $ff81 ; initialize/clear screen define CHRIN $ffcf ; input character from keyboard define CHROUT $ffd2 ; output character to screen define SCREEN $ffed ; get screen size define PLOT $fff0 ; get/set...

Lab 2 COMPLETE

 This is the second part of lab number 2 where I had to develop assembly code to change the bouncing pattern to bounce between the corners of the screen. Before I start writing the actual code, I'm going to speculate on what needs to be done in order to achieve this effect. We already have a way to change the incrementation of the x and y pos, as previously written about in my previous post. The next step will be to check x and y boundaries so that the program will know when to bounce back and change the x and y increments into a negative value. This is the code for the x and y position increments: define XPOS $20 define YPOS $21 define XINC $22 define YINC $23 First we define the X and YINC variables and assign them in memory, then we will simply use LDA and STA to set their values. ; draw-image-subroutine.6502 ; ; This is a routine that can place an arbitrary  ; rectangular image on to the screen at given ; coordinates. ; ; Chris Tyler 2024-09-17 ; Licensed under GPLv2+ ; ; ...
Lab2 : In class Below is the code we used to perform various tasks to alter the result of the code. This code is a circle animation starting at the top left of the screen that moves to the opposite corner then repeats the animation. ; ; The subroutine is below starting at the  ; label "DRAW:" ; ; Test code for our subroutine ; Moves an image diagonally across the screen ; Zero-page variables define XPOS $20 define YPOS $21 ; Set up the data structure ; The syntax #<LABEL returns the low byte of LABEL ; The syntax #>LABEL returns the high byte of LABEL LDA #<G_X     ; POINTER TO GRAPHIC STA $10 LDA #>G_X STA $11 LDA #$05 STA $12       ; IMAGE WIDTH STA $13       ; IMAGE HEIGHT ; Set initial position X=Y=0 LDA #$00 STA XPOS STA YPOS ; Main loop for diagonal animation MAINLOOP:   ; Set pointer to the image   ; Use G_O or G_X as desired   LDA #<G_O   STA $10   LDA #>G_O   STA $11 ...

SPO600 lab 1

 Hi, my name is Daniel Park and this blog will contain information and notes on the SPO600 course I am taking. This class is about Software Portability and Optimization and I will be learning the use of Assembly Language for the first time. The first part of this lab contains a piece of code which fills the display with yellow. We will determine various aspects of this code such as how long it takes to execute, the total memory usage, and ways to alter this for different output.  Below is the code:                     lda #$00 ; set a pointer in memory location $40 to point to $0200             sta $40 ; ... low byte ($00) goes in address $40             lda #$02             sta $41 ; ... high byte ($02) goes into address $41             lda #$07 ; colour numbe...