User Tools

Site Tools


spo600:6502_assembly_language_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_assembly_language_lab [2024/05/08 03:48] – [Calculating Performance] chrisspo600:6502_assembly_language_lab [2025/01/10 21:22] (current) – [Calculating Performance] chris
Line 11: Line 11:
       * [[6502 Addressing Modes]]       * [[6502 Addressing Modes]]
     *  External     *  External
 +      * [[https://www.pagetable.com/c64ref/6502/?tab=2|6502 instructions via the "Ultimate Commodore 64 Reference" site]]
       * [[http://www.6502.org/tutorials/6502opcodes.html|6502 Opcodes with Register Definitions]]       * [[http://www.6502.org/tutorials/6502opcodes.html|6502 Opcodes with Register Definitions]]
       * [[https://www.masswerk.at/6502/6502_instruction_set.html|6502 Opcodes with Detailed Operation Information]]       * [[https://www.masswerk.at/6502/6502_instruction_set.html|6502 Opcodes with Detailed Operation Information]]
       *  [[https://docs.google.com/spreadsheets/d/1a1-ZZ1opY8xcuUHNxj3YW75dxOPynSuP2-QGSvZGzYY/edit?usp=sharing|Spreadsheet of bitmapped display memory locations]]       *  [[https://docs.google.com/spreadsheets/d/1a1-ZZ1opY8xcuUHNxj3YW75dxOPynSuP2-QGSvZGzYY/edit?usp=sharing|Spreadsheet of bitmapped display memory locations]]
   * Video   * Video
-    * [[https://web.microsoftstream.com/video/ed7aedf1-fe6f-4b72-bbf1-c9b4e6e80af9|Calculating 6502 Program Execution Time]] (18 minutes)+    * [[https://seneca-my.sharepoint.com/:v:/g/personal/chris_tyler_senecapolytechnic_ca/EUYMUBIw9plDjsggZBZUDCQB5AttK-CDKtAIIHbIIxQbAQ?nav=eyJwbGF5YmFja09wdGlvbnMiOnsic3RhcnRUaW1lSW5TZWNvbmRzIjozOTcxLjI2NSwidGltZXN0YW1wZWRMaW5rUmVmZXJyZXJJbmZvIjp7InNjZW5hcmlvIjoiQ2hhcHRlclNoYXJlIiwiYWRkaXRpb25hbEluZm8iOnsiaXNTaGFyZWRDaGFwdGVyQXV0byI6ZmFsc2V9fX0sInJlZmVycmFsSW5mbyI6eyJyZWZlcnJhbEFwcCI6IlN0cmVhbVdlYkFwcCIsInJlZmVycmFsVmlldyI6IlNoYXJlQ2hhcHRlckxpbmsiLCJyZWZlcnJhbEFwcFBsYXRmb3JtIjoiV2ViIiwicmVmZXJyYWxNb2RlIjoidmlldyJ9fQ&e=9QFWMI|Calculating 6502 Program Execution Time]] 
 =====  Lab 1  ===== =====  Lab 1  =====
  
Line 42: Line 44:
    
  
-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. 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!
  
 ====  Calculating Performance  ==== ====  Calculating Performance  ====
-4. Calculate how long it takes for the code to execute, assuming a 1 MHz clock speed. Also calculate the total memory usage for the program code plus any pointers or variables. **This is a very important part of this lab. Double-check your work carefully!** 
  
-Refer to the video on [[https://web.microsoftstream.com/video/ed7aedf1-fe6f-4b72-bbf1-c9b4e6e80af9|Calculating 6502 Program Execution Time]] for instructions on how to do this. Note that the example in the video is colouring only 1/4 of the bitmapped display, not the entire bitmapped screen - your result will be longer and different.+**This is the key part of the lab.**
  
-5. Find one or more ways to decrease the time taken to fill the screen with a solid colour. Calculate the execution time of the fastest version of this program that you can create. Challenge: the fastest version is nearly twice as fast as the original version shown above!+4. Calculate how long it takes for the code to execute, assuming a 1 MHz clock speed. 
 + 
 +Tip: The most common problem with performance analysis is the incorrect calculation of the number of times each instruction will execute. Check that part of your work carefully. 
 + 
 +5. Also calculate the total memory usage for the program code plus any pointers or variables.  
 + 
 +Refer to the video on [[https://seneca-my.sharepoint.com/:v:/g/personal/chris_tyler_senecapolytechnic_ca/EUYMUBIw9plDjsggZBZUDCQB5AttK-CDKtAIIHbIIxQbAQ?nav=eyJwbGF5YmFja09wdGlvbnMiOnsic3RhcnRUaW1lSW5TZWNvbmRzIjozOTcxLjI2NSwidGltZXN0YW1wZWRMaW5rUmVmZXJyZXJJbmZvIjp7InNjZW5hcmlvIjoiQ2hhcHRlclNoYXJlIiwiYWRkaXRpb25hbEluZm8iOnsiaXNTaGFyZWRDaGFwdGVyQXV0byI6ZmFsc2V9fX0sInJlZmVycmFsSW5mbyI6eyJyZWZlcnJhbEFwcCI6IlN0cmVhbVdlYkFwcCIsInJlZmVycmFsVmlldyI6IlNoYXJlQ2hhcHRlckxpbmsiLCJyZWZlcnJhbEFwcFBsYXRmb3JtIjoiV2ViIiwicmVmZXJyYWxNb2RlIjoidmlldyJ9fQ&e=9QFWMI|Calculating 6502 Program Execution Time]] for instructions on how to do this. Note that the example in the video is colouring only 1/4 of the bitmapped display, not the entire bitmapped screen - your result will be longer and different. 
 + 
 +6. **Find one or more ways to decrease the time taken to fill the screen with a solid colour. Calculate the execution time of the fastest version of this program that you can create. Challenge: the fastest version is nearly twice as fast as the original version shown above!**
  
 ====  Modifying the Code  ==== ====  Modifying the Code  ====
-6. Change the code to fill the display with light blue instead of yellow. (Tip: you can find the colour codes on the [[6502 Emulator]] page). 
  
-7. Change the code to fill the display with a different colour on each page (each "page" will be one-quarter of the bitmapped display).+7. Change the code to fill the display with light blue instead of yellow. (Tip: you can find the colour codes on the [[6502 Emulator]] page).
  
-====  Experiments (Optional, Recommended)  ====+8. Change the code to fill the display with a different colour on each page (each "page" will be one-quarter of the bitmapped display). 
 + 
 +9. Make each pixel a random colour. (Hint: use the psudo-random number generator mentioned on the [[6502 Emulator]] page). 
 + 
 +====  Experiments  ====
  
 Go back to the bitmap code above, and try these experiments: Go back to the bitmap code above, and try these experiments:
   -  Add this instruction after the ''loop:'' label and before the ''sta ($40),y'' instruction: ''tya''   -  Add this instruction after the ''loop:'' label and before the ''sta ($40),y'' instruction: ''tya''
   -  What visual effect does this cause, and how many colours are on the screen? Why?   -  What visual effect does this cause, and how many colours are on the screen? Why?
-  -  Add this instruction after the ''tya''''lsr''+  -  Add this instruction after the ''tya''''lsr''
   -  What visual effect does this cause, and how many colours are on the screen? Why?   -  What visual effect does this cause, and how many colours are on the screen? Why?
-  -  Repeat the above tests with two, three, four, and five ''lsr'' instructions in a row. Describe and explain the effect in each case.+  -  Repeat the above tests with two, three, four, and five ''lsr'' instructions in a row. Describe and __explain__ the effect in each case.
   -  Repeat the tests using ''asl'' instructions instead of ''lsr'' instructions. Describe and explain the effect in each case.   -  Repeat the tests using ''asl'' instructions instead of ''lsr'' instructions. Describe and explain the effect in each case.
   -  Revert to the original code.   -  Revert to the original code.
   -  The original code includes one ''iny'' instruction. Test with one to five consecutive ''iny'' instructions. Describe and explain the effect in each case. **Note:** it is helpful to place the Speed slider is on its lowest setting (left) for these experiments.   -  The original code includes one ''iny'' instruction. Test with one to five consecutive ''iny'' instructions. Describe and explain the effect in each case. **Note:** it is helpful to place the Speed slider is on its lowest setting (left) for these experiments.
   -  Revert to the original code.   -  Revert to the original code.
-  -  Make each pixel a random colour. (Hint: use the psudo-random number generator mentioned on the [[6502 Emulator]] page).+
  
 ====  Challenges (Optional, Recommended)  ==== ====  Challenges (Optional, Recommended)  ====
Line 84: Line 96:
   -  An introduction, so that someone who happens across your blog will understand the context of what you're writing about.   -  An introduction, so that someone who happens across your blog will understand the context of what you're writing about.
   -  The results from the //Calculating Performance// and //Modifying Code// portions of the lab, including the code, a description of how the code works, and the results produced.   -  The results from the //Calculating Performance// and //Modifying Code// portions of the lab, including the code, a description of how the code works, and the results produced.
 +  - Any significant code in a form that allows it to be tested.
 +    - In the case of this lab, this is the version of the software that you've modified to improve performance.
 +    - This code should be either (a) directly included in the blog in a form where it can be easily cut-and-pasted into the emulator for testing, or (b) in a repository so it can be easily cut-and-pasted or downloaded for testing. (Recommendation: test it!)
   -  The results of the Optional sections, if you performed them, and your explaination for each observed result.   -  The results of the Optional sections, if you performed them, and your explaination for each observed result.
   -  Your experiences with this lab -- your impressions of Assembly Language, what you learned, and your reflections on the process.   -  Your experiences with this lab -- your impressions of Assembly Language, what you learned, and your reflections on the process.
spo600/6502_assembly_language_lab.1715140100.txt.gz · Last modified: 2024/05/08 07:48 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki