From 7a583ee313412c72a65fc46ddd9ffc165d0d9acf Mon Sep 17 00:00:00 2001 From: Christian Johannesen Date: Fri, 16 Oct 2026 02:27:04 +0200 Subject: [PATCH] Expand collection to thirty programs --- README.md | 94 ++++++------- fifteen-puzzle/fifteen-puzzle.asm | 155 +++++++++++++++++++++ fifteen-puzzle/fifteen-puzzle.prg | Bin 0 -> 371 bytes fireworks/fireworks.asm | 169 +++++++++++++++++++++++ fireworks/fireworks.prg | Bin 0 -> 431 bytes jiffy-clock/jiffy-clock.asm | 124 +++++++++++++++++ jiffy-clock/jiffy-clock.prg | Bin 0 -> 290 bytes paddle-ball/paddle-ball.asm | 189 ++++++++++++++++++++++++++ paddle-ball/paddle-ball.prg | Bin 0 -> 420 bytes petscii-aquarium/petscii-aquarium.asm | 161 ++++++++++++++++++++++ petscii-aquarium/petscii-aquarium.prg | Bin 0 -> 415 bytes programs.json | 88 ++++++++---- public/app.js | 92 ++++++++----- public/index.html | 5 + public/styles.css | 12 +- scripts/build-machine-code.sh | 9 +- server.mjs | 3 +- smooth-scroller/smooth-scroller.asm | 128 +++++++++++++++++ smooth-scroller/smooth-scroller.prg | Bin 0 -> 372 bytes typing-sprint/typing-sprint.asm | 159 ++++++++++++++++++++++ typing-sprint/typing-sprint.prg | Bin 0 -> 438 bytes 21 files changed, 1271 insertions(+), 117 deletions(-) create mode 100644 fifteen-puzzle/fifteen-puzzle.asm create mode 100644 fifteen-puzzle/fifteen-puzzle.prg create mode 100644 fireworks/fireworks.asm create mode 100644 fireworks/fireworks.prg create mode 100644 jiffy-clock/jiffy-clock.asm create mode 100644 jiffy-clock/jiffy-clock.prg create mode 100644 paddle-ball/paddle-ball.asm create mode 100644 paddle-ball/paddle-ball.prg create mode 100644 petscii-aquarium/petscii-aquarium.asm create mode 100644 petscii-aquarium/petscii-aquarium.prg create mode 100644 smooth-scroller/smooth-scroller.asm create mode 100644 smooth-scroller/smooth-scroller.prg create mode 100644 typing-sprint/typing-sprint.asm create mode 100644 typing-sprint/typing-sprint.prg diff --git a/README.md b/README.md index 20ecd94..6a2763d 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,43 @@ # C64 Program Collection -Twenty-three small, polished programs for the Commodore 64, written in stock -Commodore BASIC V2 and 6502 machine code. The collection mixes arcade action, -puzzles, simulations, creative tools, sound, and visual effects. Every entry is -self-contained and runs on an ordinary PAL or NTSC C64 without a cartridge or -BASIC extension. +Thirty small, polished programs for the Commodore 64, written in stock Commodore BASIC V2 and 6502 machine code. The collection mixes arcade action, puzzles, simulations, creative tools, music, utilities, and visual effects. Every entry is self-contained and runs on an ordinary PAL or NTSC C64 without a cartridge or BASIC extension. + +Browse and run the collection at [c64.p20.dev](https://c64.p20.dev). ## Programs -| Program | Category | Language | Controls | Description | Source | Run locally | -| --- | --- | --- | --- | --- | --- | --- | -| Meteor Dodge | Arcade | BASIC | `A`, `D`, `Q` | Dodge falling meteors and build your score. | [BAS](meteor-dodge/meteor-dodge.bas) | [Run](http://localhost:8134/program/meteor-dodge) | -| Code Breaker | Logic | BASIC | `0`-`9`, Return, `Q` | Deduce a four-digit secret in ten guesses. | [BAS](code-breaker/code-breaker.bas) | [Run](http://localhost:8134/program/code-breaker) | -| Submarine Hunt | Strategy | BASIC | Row, Column, Return | Find three hidden submarines with limited sonar shots. | [BAS](submarine-hunt/submarine-hunt.bas) | [Run](http://localhost:8134/program/submarine-hunt) | -| Lunar Lander | Simulation | BASIC | `0`-`9`, Return, `-1` | Choose engine burns and touch down gently. | [BAS](lunar-lander/lunar-lander.bas) | [Run](http://localhost:8134/program/lunar-lander) | -| Memory Matrix | Memory | BASIC | `1`, `2`, `3`, `4`, `Q` | Repeat a growing sequence of flashing quadrants. | [BAS](memory-matrix/memory-matrix.bas) | [Run](http://localhost:8134/program/memory-matrix) | -| Robot Maze | Puzzle | BASIC | `W`, `A`, `S`, `D`, `Q` | Navigate a freshly generated maze to its exit. | [BAS](robot-maze/robot-maze.bas) | [Run](http://localhost:8134/program/robot-maze) | -| Music Box | Music | BASIC | `A`-`K`, `1`, `2`, `3`, `Q` | Play the SID chip as a small computer keyboard. | [BAS](music-box/music-box.bas) | [Run](http://localhost:8134/program/music-box) | -| Pixel Painter | Creative | BASIC | Cursor keys, Space, `C`, `Q` | Draw character-cell pictures on the screen. | [BAS](pixel-painter/pixel-painter.bas) | [Run](http://localhost:8134/program/pixel-painter) | -| Stock Trader | Simulation | BASIC | `B`, `S`, `W`, `Q` | Trade a volatile stock over twenty market days. | [BAS](stock-trader/stock-trader.bas) | [Run](http://localhost:8134/program/stock-trader) | -| Starfield | Demo | BASIC | `1`, `2`, `3`, `Q` | Watch and control a layered animated starfield. | [BAS](starfield/starfield.bas) | [Run](http://localhost:8134/program/starfield) | -| Snake Trail | Arcade | BASIC | `W`, `A`, `S`, `D`, `Q` | Guide a growing snake through a field of food and danger. | [BAS](snake-trail/snake-trail.bas) | [Run](http://localhost:8134/program/snake-trail) | -| Dice Poker | Dice | BASIC | `1`-`5`, Return, `Q` | Keep your best dice and chase a winning poker combination. | [BAS](dice-poker/dice-poker.bas) | [Run](http://localhost:8134/program/dice-poker) | -| Word Scramble | Word | BASIC | `A`-`Z`, Return, `Q` | Unscramble five computer-themed words from helpful clues. | [BAS](word-scramble/word-scramble.bas) | [Run](http://localhost:8134/program/word-scramble) | -| Nim Challenge | Strategy | BASIC | `1`, `2`, `3`, `0` | Outthink the computer in the classic game of twenty-one sticks. | [BAS](nim-challenge/nim-challenge.bas) | [Run](http://localhost:8134/program/nim-challenge) | -| Reaction Timer | Reflex | BASIC | Any key, `Q` | Test your reactions across five unpredictable timed rounds. | [BAS](reaction-timer/reaction-timer.bas) | [Run](http://localhost:8134/program/reaction-timer) | -| Morse Trainer | Educational | BASIC | `A`-`Z`, Return, `Q` | Learn Morse letters by reading and hearing their signals. | [BAS](morse-trainer/morse-trainer.bas) | [Run](http://localhost:8134/program/morse-trainer) | -| Kaleidoscope | Demo | BASIC | Space, `C`, `Q` | Grow colorful symmetrical patterns across the character screen. | [BAS](kaleidoscope/kaleidoscope.bas) | [Run](http://localhost:8134/program/kaleidoscope) | -| World Quiz | Trivia | BASIC | `1`, `2`, `3`, `Q` | Take a seven-stop tour of world geography and landmarks. | [BAS](world-quiz/world-quiz.bas) | [Run](http://localhost:8134/program/world-quiz) | -| Life Lab | Simulation | BASIC | Space, `R`, `Q` | Observe generations of Conway's cellular automaton evolve. | [BAS](life-lab/life-lab.bas) | [Run](http://localhost:8134/program/life-lab) | -| Cipher Wheel | Utility | BASIC | `E`, `D`, `N`, `Q` | Encode and decode secret messages with a Caesar shift. | [BAS](cipher-wheel/cipher-wheel.bas) | [Run](http://localhost:8134/program/cipher-wheel) | -| Sprite Playground | Creative | Machine Code | `W`, `A`, `S`, `D`, `C`, `Q` | Move and recolor a hardware sprite in a responsive VIC-II playground. | [ASM](sprite-playground/sprite-playground.asm) | [Run](http://localhost:8134/program/sprite-playground) | -| Raster Bars | Demo | Machine Code | `1`, `2`, `3`, `C`, `Q` | Paint animated bands of color with cycle-aware VIC-II raster timing. | [ASM](raster-bars/raster-bars.asm) | [Run](http://localhost:8134/program/raster-bars) | -| SID Arpeggiator | Music | Machine Code | `A`-`K`, `1`-`3`, `+`, `-`, Space, `Q` | Shape a looping SID arpeggio with notes, waveforms, and tempo controls. | [ASM](sid-arpeggiator/sid-arpeggiator.asm) | [Run](http://localhost:8134/program/sid-arpeggiator) | +| Program | Released | Category | Language | Controls | Description | Source | Run | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Meteor Dodge | 2026-10-07 | Arcade | BASIC | `A`, `D`, `Q` | Dodge falling meteors and build your score. | [BAS](meteor-dodge/meteor-dodge.bas) | [Run](https://c64.p20.dev/program/meteor-dodge) | +| Code Breaker | 2026-10-07 | Logic | BASIC | `0`-`9`, Return, `Q` | Deduce a four-digit secret in ten guesses. | [BAS](code-breaker/code-breaker.bas) | [Run](https://c64.p20.dev/program/code-breaker) | +| Submarine Hunt | 2026-10-07 | Strategy | BASIC | Row, Column, Return | Find three hidden submarines with limited sonar shots. | [BAS](submarine-hunt/submarine-hunt.bas) | [Run](https://c64.p20.dev/program/submarine-hunt) | +| Lunar Lander | 2026-10-07 | Simulation | BASIC | `0`-`9`, Return, `-1` | Choose engine burns and touch down gently. | [BAS](lunar-lander/lunar-lander.bas) | [Run](https://c64.p20.dev/program/lunar-lander) | +| Memory Matrix | 2026-10-07 | Memory | BASIC | `1`-`4`, `Q` | Repeat a growing sequence of flashing quadrants. | [BAS](memory-matrix/memory-matrix.bas) | [Run](https://c64.p20.dev/program/memory-matrix) | +| Robot Maze | 2026-10-07 | Puzzle | BASIC | `W`, `A`, `S`, `D`, `Q` | Navigate a freshly generated maze to its exit. | [BAS](robot-maze/robot-maze.bas) | [Run](https://c64.p20.dev/program/robot-maze) | +| Music Box | 2026-10-07 | Music | BASIC | `A`-`K`, `1`-`3`, `Q` | Play the SID chip as a small computer keyboard. | [BAS](music-box/music-box.bas) | [Run](https://c64.p20.dev/program/music-box) | +| Pixel Painter | 2026-10-07 | Creative | BASIC | Cursor keys, Space, `C`, `Q` | Draw character-cell pictures on the screen. | [BAS](pixel-painter/pixel-painter.bas) | [Run](https://c64.p20.dev/program/pixel-painter) | +| Stock Trader | 2026-10-07 | Simulation | BASIC | `B`, `S`, `W`, `Q` | Trade a volatile stock over twenty market days. | [BAS](stock-trader/stock-trader.bas) | [Run](https://c64.p20.dev/program/stock-trader) | +| Starfield | 2026-10-07 | Demo | BASIC | `1`-`3`, `Q` | Watch and control a layered animated starfield. | [BAS](starfield/starfield.bas) | [Run](https://c64.p20.dev/program/starfield) | +| Snake Trail | 2026-10-07 | Arcade | BASIC | `W`, `A`, `S`, `D`, `Q` | Guide a growing snake through a field of food and danger. | [BAS](snake-trail/snake-trail.bas) | [Run](https://c64.p20.dev/program/snake-trail) | +| Dice Poker | 2026-10-07 | Dice | BASIC | `1`-`5`, Return, `Q` | Keep your best dice and chase a winning poker combination. | [BAS](dice-poker/dice-poker.bas) | [Run](https://c64.p20.dev/program/dice-poker) | +| Word Scramble | 2026-10-07 | Word | BASIC | `A`-`Z`, Return, `Q` | Unscramble five computer-themed words from helpful clues. | [BAS](word-scramble/word-scramble.bas) | [Run](https://c64.p20.dev/program/word-scramble) | +| Nim Challenge | 2026-10-07 | Strategy | BASIC | `1`-`3`, `0` | Outthink the computer in the classic game of twenty-one sticks. | [BAS](nim-challenge/nim-challenge.bas) | [Run](https://c64.p20.dev/program/nim-challenge) | +| Reaction Timer | 2026-10-07 | Reflex | BASIC | Any key, `Q` | Test your reactions across five unpredictable timed rounds. | [BAS](reaction-timer/reaction-timer.bas) | [Run](https://c64.p20.dev/program/reaction-timer) | +| Morse Trainer | 2026-10-07 | Educational | BASIC | `A`-`Z`, Return, `Q` | Learn Morse letters by reading and hearing their signals. | [BAS](morse-trainer/morse-trainer.bas) | [Run](https://c64.p20.dev/program/morse-trainer) | +| Kaleidoscope | 2026-10-07 | Demo | BASIC | Space, `C`, `Q` | Grow colorful symmetrical patterns across the character screen. | [BAS](kaleidoscope/kaleidoscope.bas) | [Run](https://c64.p20.dev/program/kaleidoscope) | +| World Quiz | 2026-10-07 | Trivia | BASIC | `1`-`3`, `Q` | Take a seven-stop tour of world geography and landmarks. | [BAS](world-quiz/world-quiz.bas) | [Run](https://c64.p20.dev/program/world-quiz) | +| Life Lab | 2026-10-07 | Simulation | BASIC | Space, `R`, `Q` | Observe generations of Conway's cellular automaton evolve. | [BAS](life-lab/life-lab.bas) | [Run](https://c64.p20.dev/program/life-lab) | +| Cipher Wheel | 2026-10-07 | Utility | BASIC | `E`, `D`, `N`, `Q` | Encode and decode secret messages with a Caesar shift. | [BAS](cipher-wheel/cipher-wheel.bas) | [Run](https://c64.p20.dev/program/cipher-wheel) | +| Sprite Playground | 2026-10-16 | Creative | Machine Code | `W`, `A`, `S`, `D`, `C`, `Q` | Move and recolor a hardware sprite in a responsive VIC-II playground. | [ASM](sprite-playground/sprite-playground.asm) | [Run](https://c64.p20.dev/program/sprite-playground) | +| Raster Bars | 2026-10-16 | Demo | Machine Code | `1`-`3`, `C`, `Q` | Paint animated bands of color with cycle-aware VIC-II raster timing. | [ASM](raster-bars/raster-bars.asm) | [Run](https://c64.p20.dev/program/raster-bars) | +| SID Arpeggiator | 2026-10-16 | Music | Machine Code | `A`-`K`, `1`-`3`, `+`, `-`, Space, `Q` | Shape a looping SID arpeggio with notes, waveforms, and tempo controls. | [ASM](sid-arpeggiator/sid-arpeggiator.asm) | [Run](https://c64.p20.dev/program/sid-arpeggiator) | +| Paddle Ball | 2026-10-16 | Arcade | Machine Code | `A`, `D`, Space, `Q` | Keep a fast-moving ball in play with a screen-edge paddle. | [ASM](paddle-ball/paddle-ball.asm) | [Run](https://c64.p20.dev/program/paddle-ball) | +| Smooth Scroller | 2026-10-16 | Demo | Machine Code | `+`, `-`, `C`, `Q` | Send a message gliding across the screen with VIC-II fine scrolling. | [ASM](smooth-scroller/smooth-scroller.asm) | [Run](https://c64.p20.dev/program/smooth-scroller) | +| Fireworks | 2026-10-16 | Demo | Machine Code | Space, `C`, `Q` | Launch colorful PETSCII fireworks into a night sky. | [ASM](fireworks/fireworks.asm) | [Run](https://c64.p20.dev/program/fireworks) | +| Jiffy Clock | 2026-10-16 | Utility | Machine Code | `R`, Space, `Q` | Turn the C64 jiffy timer into a large live digital clock. | [ASM](jiffy-clock/jiffy-clock.asm) | [Run](https://c64.p20.dev/program/jiffy-clock) | +| Typing Sprint | 2026-10-16 | Word | Machine Code | `A`-`Z`, Space, `Q` | Race the clock while copying a Commodore-themed phrase. | [ASM](typing-sprint/typing-sprint.asm) | [Run](https://c64.p20.dev/program/typing-sprint) | +| PETSCII Aquarium | 2026-10-16 | Simulation | Machine Code | `F`, `1`-`3`, `Q` | Watch a tiny animated aquarium and feed its roaming fish. | [ASM](petscii-aquarium/petscii-aquarium.asm) | [Run](https://c64.p20.dev/program/petscii-aquarium) | +| Fifteen Puzzle | 2026-10-16 | Puzzle | Machine Code | `W`, `A`, `S`, `D`, `R`, `Q` | Slide numbered tiles until the classic four-by-four board is restored. | [ASM](fifteen-puzzle/fifteen-puzzle.asm) | [Run](https://c64.p20.dev/program/fifteen-puzzle) | ## Running the programs @@ -42,31 +47,22 @@ Start the local browser app with Docker Compose: docker compose up --build -d ``` -Open [http://localhost:8134](http://localhost:8134), or use a **Run** link in -the table. The app runs the VICE x64sc core through WebAssembly and downloads -the selected PRG through its own backend. Click inside the emulator to enable -keyboard input and sound. Direct keyboard input is enabled by default, mouse -locking is disabled, and moving the pointer anywhere over the emulator reveals -its control bar. +Open [http://localhost:8134](http://localhost:8134), or visit the hosted collection at [c64.p20.dev](https://c64.p20.dev). The app runs the VICE x64sc core through WebAssembly and downloads the selected PRG through its own backend. Click inside the emulator to enable keyboard input and sound. Direct keyboard input is enabled by default, mouse locking is disabled, and moving the pointer anywhere over the emulator reveals its control bar. -The repository is mounted read-only at `/programs`. Add a manifest entry and -its source and PRG files, then click **Refresh**; the app does not need to be -rebuilt. The default host port is configured as `8134` in `.env`. +The repository is mounted read-only at `/programs`. Add a manifest entry and its source and PRG files, then click **Refresh**; the app does not need to be rebuilt. The overview renders programs in small batches and is ready to scale without creating every card at once. The default host port is configured as `8134` in `.env`. On a Commodore 64, transfer a PRG to disk or another supported medium, then use: ```text -LOAD"METEOR-DODGE.PRG",8 +LOAD"PADDLE-BALL.PRG",8 RUN ``` -Substitute the filename and device number as needed. The machine-code PRGs -include a small BASIC `SYS` launcher, so the same `RUN` command starts them. +Substitute the filename and device number as needed. Machine-code PRGs include a small BASIC `SYS` launcher, so the same `RUN` command starts them. ## Building machine-code programs -The assembly sources use ACME syntax. Build every machine-code PRG with the -isolated tools profile; no local assembler installation is required: +The assembly sources use ACME syntax. Build every machine-code PRG with the isolated tools profile; no local assembler installation is required: ```text docker compose --profile tools run --rm assembler @@ -78,11 +74,7 @@ The tools profile is opt-in and is not started by the normal app command. Each program directory contains a loadable `.prg` and its readable source: -- BASIC programs use line-numbered, uppercase `.bas` files compatible with - stock Commodore BASIC V2. Their PRGs are tokenized at the normal `$0801` - BASIC load address. -- Machine-code programs use commented ACME `.asm` files. Their PRGs also load - at `$0801`, where a short BASIC line starts the 6502 code with `SYS`. +- BASIC programs use line-numbered, uppercase `.bas` files compatible with stock Commodore BASIC V2. Their PRGs are tokenized at the normal `$0801` BASIC load address. +- Machine-code programs use commented ACME `.asm` files. Their PRGs also load at `$0801`, where a short BASIC line starts the 6502 code with `SYS`. -All programs are self-contained and designed for ordinary PAL and NTSC C64 -hardware as well as VICE-compatible emulators. +All programs are self-contained and designed for ordinary PAL and NTSC C64 hardware as well as VICE-compatible emulators. diff --git a/fifteen-puzzle/fifteen-puzzle.asm b/fifteen-puzzle/fifteen-puzzle.asm new file mode 100644 index 0000000..c4cc567 --- /dev/null +++ b/fifteen-puzzle/fifteen-puzzle.asm @@ -0,0 +1,155 @@ +!cpu 6510 +* = $0801 +!word basic_end +!word 10 +!byte $9e +!text "2061" +!byte 0 +basic_end: !word 0 + +* = $080d +start: + lda #147 + jsr $ffd2 + ldx #0 +title_loop: + lda title,x + beq shuffle + jsr $ffd2 + inx + bne title_loop +shuffle: + ldx #0 +copy_board: + lda shuffled,x + sta board,x + inx + cpx #16 + bne copy_board + lda #13 + sta blank +main: + jsr draw_board +wait_key: + jsr $ffe4 + beq wait_key + cmp #81 + bne not_quit + jmp exit +not_quit: + cmp #82 + beq shuffle + cmp #87 + bne key_down + lda blank + cmp #12 + bcs wait_key + clc + adc #4 + jmp move_tile +key_down: + cmp #83 + bne key_left + lda blank + cmp #4 + bcc wait_key + sec + sbc #4 + jmp move_tile +key_left: + cmp #65 + bne key_right + lda blank + and #3 + cmp #3 + beq wait_key + lda blank + clc + adc #1 + jmp move_tile +key_right: + cmp #68 + bne wait_key + lda blank + and #3 + beq wait_key + lda blank + sec + sbc #1 +move_tile: + tax + ldy blank + lda board,x + sta board,y + lda #0 + sta board,x + stx blank + jmp main +draw_board: + ldx #0 +draw_loop: + stx tile_index + lda positions_lo,x + sta $fb + lda positions_hi,x + sta $fc + lda board,x + beq draw_blank + jsr split_digits + ldy #0 + lda tens + beq leading_space + ora #$30 + bne store_first +leading_space: + lda #32 +store_first: + sta ($fb),y + iny + lda ones + ora #$30 + sta ($fb),y + jmp next_tile +draw_blank: + ldy #0 + lda #32 + sta ($fb),y + iny + sta ($fb),y +next_tile: + ldx tile_index + inx + cpx #16 + bne draw_loop + rts +split_digits: + ldy #0 +split_loop: + cmp #10 + bcc split_done + sec + sbc #10 + iny + bne split_loop +split_done: + sty tens + sta ones + rts +exit: + lda #147 + jsr $ffd2 + rts + +title: !byte 147 +!text "FIFTEEN PUZZLE WASD SLIDE R RESET Q QUIT" +!byte 13,13,13,0 +shuffled: !byte 1,2,3,4,5,6,7,8,9,10,11,12,13,0,14,15 +board: !fill 16,0 +positions_lo: +!for row,0,3 { !for col,0,3 { !byte <($04f5+row*80+col*5) } } +positions_hi: +!for row,0,3 { !for col,0,3 { !byte >($04f5+row*80+col*5) } } +blank: !byte 0 +tile_index: !byte 0 +tens: !byte 0 +ones: !byte 0 diff --git a/fifteen-puzzle/fifteen-puzzle.prg b/fifteen-puzzle/fifteen-puzzle.prg new file mode 100644 index 0000000000000000000000000000000000000000..2799fa69a5b6f62accaf8af8dbf2c72a3d464420 GIT binary patch literal 371 zcmZSN;O5|Bm}g{QX2`(6uyV4(rT>c<_WtAezy@T!xbPLo(c_$J$NA!cz=f|Xd3*CX z6&7(QJo*3O_sPHu%sxLjP6mCreKPz4@7g@hlRO)qN@TM5^m3dGh6u1sxMJ}VEZ}%S z2&h7n`6Tm)gFuEvCL>6h%Y`jq(GP2Zl*LQNRcrD%_u6sJwBuaK0JO9(kJHDHV-Z7N zKIdLP&eq?1<2YOY0Odc(Dm>*_z_7M}^8*W~!3Cz33KM^ySX;=+X)y7(&mEu)SYYDs zb@^a-A4pihaFS~Ro5f466BoYq6ma$yawdSinlRbT(=Ei+)lVTHG%Cu+RY4)#G1x^R z*vHca$PQ8nat(G3QBVj}2n_WM;pOFJU}R!uVP#|I;N;@w;bq|C2Zk96`1sG^ W$kbW$mppy-{tF8W3o9}JDFy(lM}}7b literal 0 HcmV?d00001 diff --git a/fireworks/fireworks.asm b/fireworks/fireworks.asm new file mode 100644 index 0000000..e046024 --- /dev/null +++ b/fireworks/fireworks.asm @@ -0,0 +1,169 @@ +!cpu 6510 +* = $0801 +!word basic_end +!word 10 +!byte $9e +!text "2061" +!byte 0 +basic_end: !word 0 + +* = $080d +start: + lda $d020 + sta old_border + lda $d021 + sta old_background + lda #0 + sta $d020 + sta $d021 + lda #147 + jsr $ffd2 + ldx #0 +print_title: + lda title,x + beq setup + jsr $ffd2 + inx + bne print_title +setup: + lda #7 + sta center_x + lda #5 + sta burst_color +main: + jsr $ffe4 + cmp #81 + bne not_quit + jmp exit +not_quit: + cmp #67 + bne launch_key + inc burst_color + lda burst_color + and #15 + sta burst_color +launch_key: + cmp #32 + bne main + jsr launch + jmp main +launch: + lda #22 + sta rocket_y +rise: + ldx center_x + ldy rocket_y + lda #46 + jsr plot + jsr delay + ldx center_x + ldy rocket_y + lda #32 + jsr plot + dec rocket_y + lda rocket_y + cmp #7 + bne rise + ldx #0 +burst_loop: + stx particle_index + lda burst_dx,x + clc + adc center_x + sta px + lda burst_dy,x + clc + adc rocket_y + tay + ldx px + lda #42 + jsr plot + ldx particle_index + inx + cpx #12 + bne burst_loop + jsr long_delay + ldx #0 +clear_burst: + stx particle_index + lda burst_dx,x + clc + adc center_x + sta px + lda burst_dy,x + clc + adc rocket_y + tay + ldx px + lda #32 + jsr plot + ldx particle_index + inx + cpx #12 + bne clear_burst + lda center_x + clc + adc #11 + cmp #35 + bcc save_center + sbc #31 +save_center: + sta center_x + rts +plot: + sta char_value + lda row_lo,y + sta $fb + lda row_hi,y + sta $fc + txa + tay + lda char_value + sta ($fb),y + lda $fb + clc + adc #<$d400 + sta $fd + lda $fc + adc #>$d400 + sta $fe + lda burst_color + sta ($fd),y + rts +delay: + ldx #8 +delay_outer: + ldy #0 +delay_inner: + dey + bne delay_inner + dex + bne delay_outer + rts +long_delay: + ldx #45 + bne delay_outer +exit: + lda old_border + sta $d020 + lda old_background + sta $d021 + lda #147 + jsr $ffd2 + rts + +title: !byte 147 +!text "FIREWORKS SPACE LAUNCH C COLOR Q QUIT" +!byte 13,0 +burst_dx: !byte 0,1,2,$ff,$fe,0,0,1,2,$ff,$fe,0 +burst_dy: !byte $fe,$ff,0,$ff,0,2,1,1,2,1,2,$ff +row_lo: !for i,0,24 { !byte <($0400+i*40) } +row_hi: !for i,0,24 { !byte >($0400+i*40) } +center_x: !byte 0 +rocket_y: !byte 0 +burst_color: !byte 0 +particle_index: !byte 0 +px: !byte 0 +char_value: !byte 0 +old_border: !byte 0 +old_background: !byte 0 diff --git a/fireworks/fireworks.prg b/fireworks/fireworks.prg new file mode 100644 index 0000000000000000000000000000000000000000..2ee6082c1c4b407490b1f7a12169763ddf4f9b3d GIT binary patch literal 431 zcmaKpJxIe)5XWDlwK=QkBn1agTvSk62RA_piej)|79AWiwu9i{;OG(%;Yo{&lSsfO zPy0ISP;fL3@(?!>3Ocll2qFmmh_7l_f5UPAyFbTqr)VLqmz>T-W}}1pLoJy z_{Z5E*>Um$gtH-UET`5+em#k#-YnEAzweQhqJ_Lo;R|OR!i=lZ<@At zMh-;tPJEg6l=$F9kZ0f=I+rkymsXOC8?oeS3NaO5&==8INU!P3h&t*qBbG!=U?RP; z-cN|4`mMj%@`+DWMNwsqjK}xRZr{W6ncP)Hi)`+@;tQ8|PHwt?3H;FWOR$an%@5zc CE~oSW literal 0 HcmV?d00001 diff --git a/jiffy-clock/jiffy-clock.asm b/jiffy-clock/jiffy-clock.asm new file mode 100644 index 0000000..4f2df10 --- /dev/null +++ b/jiffy-clock/jiffy-clock.asm @@ -0,0 +1,124 @@ +!cpu 6510 +* = $0801 +!word basic_end +!word 10 +!byte $9e +!text "2061" +!byte 0 +basic_end: !word 0 + +* = $080d +start: + lda #147 + jsr $ffd2 + ldx #0 +print_title: + lda title,x + beq reset + jsr $ffd2 + inx + bne print_title +reset: + lda #0 + sta frames + sta seconds + sta minutes + sta paused + lda $a2 + sta last_jiffy +main: + jsr wait_frame + jsr $ffe4 + cmp #81 + bne not_quit + jmp exit +not_quit: + cmp #82 + beq reset + cmp #32 + bne update + lda paused + eor #1 + sta paused +update: + lda paused + bne display + lda $a2 + cmp last_jiffy + beq display + sta last_jiffy + inc frames + lda frames + cmp #60 + bne display + lda #0 + sta frames + inc seconds + lda seconds + cmp #60 + bne display + lda #0 + sta seconds + inc minutes + lda minutes + cmp #100 + bne display + lda #0 + sta minutes +display: + lda minutes + jsr split_digits + lda tens + ora #$30 + sta $05f0 + lda ones + ora #$30 + sta $05f1 + lda #58 + sta $05f2 + lda seconds + jsr split_digits + lda tens + ora #$30 + sta $05f3 + lda ones + ora #$30 + sta $05f4 + jmp main +split_digits: + ldx #0 +subtract_ten: + cmp #10 + bcc split_done + sec + sbc #10 + inx + bne subtract_ten +split_done: + stx tens + sta ones + rts +wait_frame: + lda #250 +wait_raster: + cmp $d012 + bne wait_raster +wait_leave: + cmp $d012 + beq wait_leave + rts +exit: + lda #147 + jsr $ffd2 + rts + +title: !byte 147 +!text "JIFFY CLOCK R RESET SPACE PAUSE Q QUIT" +!byte 13,13,13,13,13,13,13,13,13,13,0 +frames: !byte 0 +seconds: !byte 0 +minutes: !byte 0 +paused: !byte 0 +last_jiffy: !byte 0 +tens: !byte 0 +ones: !byte 0 diff --git a/jiffy-clock/jiffy-clock.prg b/jiffy-clock/jiffy-clock.prg new file mode 100644 index 0000000000000000000000000000000000000000..42ac84971a8b4e47b6f4d898a02f505cc0803091 GIT binary patch literal 290 zcmZSN;O5|Bm}g{QX2`(6uyV4(rT>c<_CDqKzy@T!xbSr)L$4HPuQX?`3}>$_=h8*J za-0g6I24}zKN)y|+2=mT$)FE+PAXjBSS!ov$p};dq%W8+U36BC^Me6U?K>&XwNjiX zZ7wK-4SFZdxmFs)6#;UkIp4`}u9e|DnR0;@$OW?%_H(S2=j1f#{lL0b0YrafU1`<( zi4~{|F7+8I^@Y{Ph+`4MNv;WO7B9J8T=>=}&)KWMnXvNLS)mITeglaQzZ1YdN|@~B y>E;%x;Oyh??5&^>q!8p9>>8q=5FFs>?5Ysp7#i%Vpb)4K80s0q3kSg900RI4cVwji literal 0 HcmV?d00001 diff --git a/paddle-ball/paddle-ball.asm b/paddle-ball/paddle-ball.asm new file mode 100644 index 0000000..6393396 --- /dev/null +++ b/paddle-ball/paddle-ball.asm @@ -0,0 +1,189 @@ +!cpu 6510 + +; Self-starting BASIC line: 10 SYS2061 +* = $0801 +!word basic_end +!word 10 +!byte $9e +!text "2061" +!byte 0 +basic_end: !word 0 + +* = $080d +start: + lda $d020 + sta old_border + lda $d021 + sta old_background + lda #147 + jsr $ffd2 + ldx #0 +title_loop: + lda title,x + beq new_ball + jsr $ffd2 + inx + bne title_loop +new_ball: + lda #20 + sta paddle_x + lda #20 + sta ball_x + lda #10 + sta ball_y + lda #1 + sta dx + sta dy +main_loop: + jsr erase_objects + jsr read_key + cmp #81 + bne not_quit + jmp exit +not_quit: + cmp #65 + bne check_right + lda paddle_x + beq check_right + dec paddle_x +check_right: + cmp #68 + bne update_ball + lda paddle_x + cmp #34 + beq update_ball + inc paddle_x +update_ball: + lda ball_x + clc + adc dx + sta ball_x + beq bounce_x + cmp #39 + bne move_y +bounce_x: + lda dx + eor #$fe + clc + adc #1 + sta dx +move_y: + lda ball_y + clc + adc dy + sta ball_y + beq bounce_y + cmp #22 + bne draw + lda ball_x + cmp paddle_x + bcc missed + sec + sbc paddle_x + cmp #6 + bcc bounce_y +missed: + jsr draw_objects +wait_serve: + jsr $ffe4 + cmp #81 + bne serve_key + jmp exit +serve_key: + cmp #32 + bne wait_serve + jmp new_ball +bounce_y: + lda dy + eor #$fe + clc + adc #1 + sta dy +draw: + jsr draw_objects + ldx #6 +delay_outer: + ldy #0 +delay_inner: + dey + bne delay_inner + dex + bne delay_outer + jmp main_loop +erase_objects: + lda #32 + jsr draw_ball + ldx #5 +erase_paddle: + txa + pha + clc + adc paddle_x + tax + ldy #23 + lda #32 + jsr plot + pla + tax + dex + bpl erase_paddle + rts +draw_objects: + lda #81 + jsr draw_ball + ldx #5 +draw_paddle: + txa + pha + clc + adc paddle_x + tax + ldy #23 + lda #160 + jsr plot + pla + tax + dex + bpl draw_paddle + rts +draw_ball: + pha + ldx ball_x + ldy ball_y + pla +plot: + sta char_value + lda row_lo,y + sta $fb + lda row_hi,y + sta $fc + txa + tay + lda char_value + sta ($fb),y + rts +read_key: + jsr $ffe4 + rts +exit: + lda old_border + sta $d020 + lda old_background + sta $d021 + lda #147 + jsr $ffd2 + rts + +title: !byte 147 +!text "PADDLE BALL A/D MOVE SPACE SERVE Q QUIT" +!byte 13,0 +row_lo: !for i,0,24 { !byte <($0400+i*40) } +row_hi: !for i,0,24 { !byte >($0400+i*40) } +paddle_x: !byte 0 +ball_x: !byte 0 +ball_y: !byte 0 +dx: !byte 0 +dy: !byte 0 +char_value: !byte 0 +old_border: !byte 0 +old_background: !byte 0 diff --git a/paddle-ball/paddle-ball.prg b/paddle-ball/paddle-ball.prg new file mode 100644 index 0000000000000000000000000000000000000000..81ff410b7a45f362b6f63240c9b0c2c5b2d04d40 GIT binary patch literal 420 zcmZ9Jze_?<6vv6EV7LU&AI~@W zq}!ZB(AX1-OZ@{44K2ze2m~v;YBls34(IT_-*XPa(JrhHSGv)ybIZKS}?S5?5uo ztU#9P(8@uf-#UT9$615vaNf^|@flVJikulhgM4(HOerPDVoDsNvZ5f$;TUdh@5d3- zDS0!F>G;mDP*L4W?oLWlD0QUY*@2C0@%ouW4vrhVhl#_BTh|!(2+x>_A>u($0400+i*40) } +speed: !byte 0 +tick: !byte 0 +food_x: !byte 0 +food_y: !byte 0 +fish_index: !byte 0 +old_x: !byte 0 +char_value: !byte 0 +old_border: !byte 0 +old_background: !byte 0 diff --git a/petscii-aquarium/petscii-aquarium.prg b/petscii-aquarium/petscii-aquarium.prg new file mode 100644 index 0000000000000000000000000000000000000000..c50d9cc1fb6361fc2b2c1dc11aa006c641f89d0d GIT binary patch literal 415 zcmYk3ze_?<6vuDs(|7C#7156+j#EJt{(#2FO6fs?FBNhLp{230p`pbkxbZ^N=dTDS zFZ7%fk{TL%gK+6DaAg!^3GA zn3E!B6V$_58ejVr(pZ76Q&5|~GY8E8BQy(C2OI-@>zgXK?=65C=5A)EIbb$nnLaKt zm-uV?1q?!FK!8m^CksXvnihkCe;Y`qBcWJyTTw8m#)Ah+d>=84;ZSG?(YG4FXk>^gs&OSY wPHZqaw