swissChili | e392aeb | 2020-08-10 15:52:10 -0700 | [diff] [blame^] | 1 | <html> |
| 2 | <head> |
| 3 | <meta name="viewport" content="width=device-width"> |
| 4 | <link rel="stylesheet" |
| 5 | href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css"> |
| 6 | <link rel="stylesheet" href="styles.css"> |
| 7 | <title>Examples</title> |
| 8 | </head> |
| 9 | <body> |
| 10 | <main class="split container"> |
| 11 | <div class="sidebar"> |
| 12 | <h2><a href="/">6502</a></h2> |
| 13 | |
| 14 | <p> |
| 15 | 6502 Toolchain written by <a href="https://github.com/swissChili">swissChili</a> |
| 16 | </p> |
| 17 | |
| 18 | <ul> |
| 19 | <li><a href="https://github.com/swissChili/6502">Git</a></li> |
| 20 | <li><a href="/usage.html">Basic usage</a></li> |
| 21 | <li><a href="/examples.html">Example programs</a></li> |
| 22 | <li><a href="/building.html">Building from source</a></li> |
| 23 | </ul> |
| 24 | </div> |
| 25 | <div class="body"> |
| 26 | <h1> Example Programs</h1> |
| 27 | Download the compiled programs and try them out in the emulator! |
| 28 | <h3> Colors</h3> |
| 29 | Draws every supported color on the screen. |
| 30 | <a href="colors.dat" download>Download</a> |
| 31 | <br> |
| 32 | <pre><code class> LDY #$0 |
| 33 | loop: |
| 34 | TYA |
| 35 | STA $200, Y |
| 36 | STA $300, Y |
| 37 | STA $400, Y |
| 38 | STA $500, Y |
| 39 | INY |
| 40 | CMP #$ff |
| 41 | BCC loop |
| 42 | BRK</code></pre> |
| 43 | <h3> Disco</h3> |
| 44 | Epilepsy warning: lots of flashing colors. Due to how much faster this emulator is |
| 45 | than the one this program was written for, it's more of just flashing colors than |
| 46 | what it originally looked like. |
| 47 | <a href="disco.dat" download>Download</a> |
| 48 | <br> |
| 49 | <pre><code class>; Taken from 6502asm.com |
| 50 | <br> |
| 51 | start: |
| 52 | inx |
| 53 | txa |
| 54 | sta $200, y |
| 55 | sta $300, y |
| 56 | sta $400, y |
| 57 | sta $500, y |
| 58 | iny |
| 59 | tya |
| 60 | cmp 16 |
| 61 | bne do |
| 62 | iny |
| 63 | jmp start |
| 64 | do: |
| 65 | iny |
| 66 | iny |
| 67 | iny |
| 68 | iny |
| 69 | jmp start</code></pre> |
| 70 | </div> |
| 71 | </main> |
| 72 | |
| 73 | <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script> |
| 74 | <script> |
| 75 | document.addEventListener('DOMContentLoaded', (event) => { |
| 76 | document.querySelectorAll('pre code').forEach((block) => { |
| 77 | hljs.highlightBlock(block); |
| 78 | }); |
| 79 | }); |
| 80 | </script> |
| 81 | </body> |
| 82 | </html> |