spo600:6502_math_lab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spo600:6502_math_lab [2024/09/18 14:39] – [Initial Code] chris | spo600: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// | + | //[[https:// |
Follow these steps: | Follow these steps: | ||
- You will be assigned to a Zoom breakout group. Within the group, select someone to be the initial " | - You will be assigned to a Zoom breakout group. Within the group, select someone to be the initial " | ||
- | | + | - 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:// |
- | | + | |
- 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, | - Collaborate with the Driver using audio and/or video. In Pair or Mob Programming, | ||
- | - 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 | + | 2. The following code moves a 5x5 graphic |
< | < | ||
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 #< | + | ; 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 | + | |
- | 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 " | + | ; 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, | DCB $00, | ||
</ | </ | ||
- | |||
- | 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' | 6. Successively move the graphic by adding the X and Y increments to the graphic' | ||
- | 7. Make the graphic bounce when it hits the edge of the bitmapped screen, both vertically (when it hits the top/bottom) and vertically | + | 7. Make the graphic bounce when it hits the edge of the bitmapped screen, both vertically (when it hits the top/bottom) and horizontally |
---- | ---- | ||
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 fractional values for the X and Y increments (e.g., +1.5 or -0.75) | + | |
- | - 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' |
+ | * Change the graphic | ||
==== Write-Up | ==== Write-Up |
spo600/6502_math_lab.1726670352.txt.gz · Last modified: 2024/09/18 14:39 by chris