Posts

Showing posts with the label Lab2

SPO600 Lab2 (Pt.3)-- challenges 3 & 4 and reflection

SPO600 Lab2 (Pt.3)-- challenges 3 & 4 and  reflection Subsequence to part1 and part2 , I am revising a 6502 instruction assembly program which allows a logo to bounce within the screen. Challenges Lets work on Challenges 3 and 4. 1. Permit integer value other than -1 and +1 for the X and Y increments (logo velocity). 2. Permit fractional value for the X and Y increments (eg. +1.5 or -0.75) 3. Perturb the ball's position or velocity  4. Change the graphic image or colour each time it bounces  Problems analysis and solutions Assumption:  1. Only velocity of the bounce direction will be changed. 2. the logo is allowed to stop in case the ball velocity changed to 0 due to the perturbing. (unlikely happening) 3. We do not do perturb to the position since it is just similar to that of velocity. Solution: Simple add a Perturb subroutine so that we can add perturbing when it bounds. code: ; draw-image-subroutine.6502 ; ; This is a routine that can place an arbitrary ;...

SPO600 Lab2 (Pt.2)-- challenges 1 and 2

In Part 1 , I have modified the code of 6502 processor so that an logo can bounce within the screen.  Challenges Now, we have a few challenges. We would like to modified the code so that it can meet the following requirement: 1. Permit integer value other than -1 and +1 for the X and Y increments (logo velocity). 2. Permit fractional value for the X and Y increments (eg. +1.5 or -0.75) 3. Perturb the ball's position or velocity (To be done next blog) 4. Change the graphic image or colour each time it bounces (To be done next blog) Challenge 1.  Problems analysis and solutions Assumption: the velocity cannot be larger than the screen size, i.e. the ball will not bounce more than once within one frame.  Problem of Challenge 1: Since the current algorithm is just checking whether the logo is on the edge to decide whether we should reverse the velocity to perform a bounce. However, it only works when the velocity is 1. If the velocity is 2 and the displacement of the ball fro...

SPO600 Lab2 (Pt.1)

 In this Lab, I was provided with below 6502 processor assembly program. The program is to display a logo on the screen. The logo moves with increment of x and y by 1. When it reach the edge, it will go back to the initial position of top left (x=0, y=0).  Original code is as below (Copyright details in the program beginning comment):- ; ; 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+ ; ; ; 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 START: ; Set up the width and height elements of the data structure 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: ; S...