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 [2025/01/24 00:58] – [In-Class Lab: Mob Programming] chrisspo600:6502_math_lab [2025/01/29 16:25] (current) – [In-Class Lab: Mob Programming] chris
Line 33: Line 33:
 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 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, 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.
Line 47: 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 73: 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
Line 94: Line 90:
   ; Set pointer to the image   ; Set pointer to the image
   ; Use G_O or G_X as desired   ; 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 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.1737680308.txt.gz · Last modified: 2025/01/24 00:58 by chris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki