User Tools

Site Tools


spo600:6502_math_lab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
spo600:6502_math_lab [2024/09/18 14:39] – [Initial Code] chrisspo600:6502_math_lab [2025/01/29 16:25] (current) – [In-Class Lab: Mob Programming] chris
Line 29: Line 29:
 ==== In-Class Lab: Mob Programming ==== ==== In-Class Lab: Mob Programming ====
  
-//Mob Programming// is an extended form of [[https://en.wikipedia.org/wiki/Pair_programming|Pair Programming.]]+//[[https://en.wikipedia.org/wiki/Team_programming#Mob_programming|Mob Programming]]// is an extended form of [[https://en.wikipedia.org/wiki/Pair_programming|Pair Programming.]]
  
 Follow these steps: Follow these steps:
   - You will be assigned to a Zoom breakout group. Within the group, select someone to be the initial "Driver" - the person who will be typing.   - You will be assigned to a Zoom breakout group. Within the group, select someone to be the initial "Driver" - the person who will be typing.
-  - Within the group, select someone who is not driving to be the "Presenter" - the person that will present your group's results to the class. +  - Decide on how you're going to share the final code between members of your group. This might be as simple as pasting it into the Zoom chat (Caution!), or you could use a [[https://pastebin.com/|pastebin]], e-mail attachment, Git repository, or any other scheme that everyone agrees upon.
-  - Decide on how you're going to share the code between members of your group. This might be as simple as pasting it into the Zoom chat (Caution!), or you could use a Pastebin, e-mail attachment, or Git repository, or any other scheme that everyone agrees upon.+
   - Have the Driver share their screen with the group.   - Have the Driver share their screen with the group.
   - Collaborate with the Driver using audio and/or video. In Pair or Mob Programming, most of the coding suggestions come from those observing the Driver, not the Driver themselves.   - Collaborate with the Driver using audio and/or video. In Pair or Mob Programming, most of the coding suggestions come from those observing the Driver, not the Driver themselves.
-  - Feel free to switch the driver periodically as you see fit.+  - It can be a good idea to switch the driver periodically as you see fit.
   - Perform the lab as outlined below.   - Perform the lab as outlined below.
- 
  
 ====  Setup  ==== ====  Setup  ====
Line 48: Line 46:
  
 ====  Initial Code  ==== ====  Initial Code  ====
-2. The following code moves a graphic around the screen:+2. The following code moves a 5x5 graphic diagonally across the screen:
    
 <code> <code>
Line 74: Line 72:
 define YPOS $21 define YPOS $21
  
-; Set up the data structure + 
-; The syntax #<LABEL returns the low byte of LABEL +START: 
-; The syntax #>LABEL returns the high byte of LABEL + 
-LDA #<G_X     ; POINTER TO GRAPHIC +; Set up the width and height elements of the data structure 
-STA $10 +  LDA #$05 
-LDA #>G_X +  STA $12       ; IMAGE WIDTH 
-STA $11 +  STA $13       ; IMAGE HEIGHT
-LDA #$05 +
-STA $12       ; IMAGE WIDTH +
-STA $13       ; IMAGE HEIGHT+
  
 ; Set initial position X=Y=0 ; Set initial position X=Y=0
-LDA #$00 +  LDA #$00 
-STA XPOS +  STA XPOS 
-STA YPOS+  STA YPOS
  
 ; Main loop for diagonal animation ; Main loop for diagonal animation
 MAINLOOP: MAINLOOP:
  
-  ; Set pointer to the graphic "O"+  ; Set pointer to the image 
 +  ; Use G_O or G_X as desired 
 +  ; The syntax #<LABEL returns the low byte of LABEL 
 +  ; The syntax #>LABEL returns the high byte of LABEL 
   LDA #<G_O   LDA #<G_O
   STA $10   STA $10
Line 100: Line 99:
  
   ; Place the image on the screen   ; Place the image on the screen
-  LDA #$10  ; LOCATION OF DATA STRUCTURE +  LDA #$10  ; Address in zeropage of the data structure 
-  LDX XPOS +  LDX XPOS  ; X position 
-  LDY YPOS +  LDY YPOS  ; Y position 
-  JSR DRAW+  JSR DRAW  ; Call the subroutine
  
   ; Delay to show the image   ; Delay to show the image
Line 136: Line 135:
  
   ; Repeat infinitely   ; Repeat infinitely
-  JMP $0600+  JMP START
  
 ; ========================================== ; ==========================================
Line 282: Line 281:
 DCB $00,$00,$00,$00,$00 DCB $00,$00,$00,$00,$00
 </code> </code>
-  
  
-3. Test the code by pressing the Assemble button, then the Run button. If the there are any errors assembling (compiling) the code, they will appear in the message area at the bottom of the page. Make sure the code is running correctly and that you understands how it works. Don't be afraid to experiment!+3. Test the code by pressing the Assemble button, then the Run button. You can adjust the speed slider as needed. If the there are any errors assembling (compiling) the code, they will appear in the message area at the bottom of the page. Make sure the code is running correctly and that you understands how it works. Don't be afraid to experiment!
  
 ==== Bouncing Graphic ==== ==== Bouncing Graphic ====
Line 290: Line 288:
 4. Select a starting location for the graphic where X and Y have different values. 4. Select a starting location for the graphic where X and Y have different values.
  
-5. Select an X increment that is -1 or +1, and a Y increment that is -1 or +1.+5. Select an X increment that is -1 or +1, and a Y increment that is -1 or +1. You can choose to use either a signed byte or some other representation to hold these values.
  
 6. Successively move the graphic by adding the X and Y increments to the graphic's X and Y position. 6. Successively move the graphic by adding the X and Y increments to the graphic's X and Y position.
  
-7. Make the graphic bounce when it hits the edge of the bitmapped screen, both vertically (when it hits the top/bottom) and vertically (when it hits the left/right edge).+7. Make the graphic bounce when it hits the edge of the bitmapped screen, both vertically (when it hits the top/bottom) and horizontally (when it hits the left/right edge).
  
 ---- ----
Line 304: Line 302:
 ====  Challenges (Optional, Recommended)  ==== ====  Challenges (Optional, Recommended)  ====
  
-Try these experiments+Here are some challenges for further experimentation if you're interested
-Permit values other than -1 and +1 for the X and Y increments. +  Permit integer values other than -1 and +1 for the X and Y increments (deltas)
-Permit fractional values for the X and Y increments (e.g., +1.5 or -0.75) +  Permit fractional values for the X and Y increments (e.g., +1.5 or -0.75). One way of doing this would be to use 16-bit (2-byte) X and Y increment values (deltas), where the lowest byte is fractional and the highest byte is integer (i.e., the radix point is between the two bytes). 
-- Change the graphic each time it bounces.+  * Perturb (subtly disrupt or randomize) the ball's position or bounce so that it is not overly predictable. (Remember that there's a pseudo-random number generator available in memory location $00FE). 
 +  * Change the graphic image or colour each time it bounces.
  
 ====  Write-Up  ==== ====  Write-Up  ====
spo600/6502_math_lab.1726670352.txt.gz · Last modified: 2024/09/18 14:39 by chris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki