2018-01-21 20:55:44 +00:00
|
|
|
|
# Examples
|
|
|
|
|
|
2020-09-09 00:47:07 +00:00
|
|
|
|
The examples showcased here are designed to compile with a compiler built from newest sources.
|
2020-02-08 21:38:06 +00:00
|
|
|
|
If you are using a release version of the compiler, consider browsing the older versions of the examples:
|
|
|
|
|
|
2020-09-15 15:16:47 +00:00
|
|
|
|
* [for version 0.3.22](https://github.com/KarolS/millfork/tree/v0.3.22/examples)
|
|
|
|
|
|
2020-08-01 21:42:02 +00:00
|
|
|
|
* [for version 0.3.18](https://github.com/KarolS/millfork/tree/v0.3.18/examples)
|
|
|
|
|
|
2020-04-08 10:10:02 +00:00
|
|
|
|
* [for version 0.3.16](https://github.com/KarolS/millfork/tree/v0.3.16/examples)
|
|
|
|
|
|
2020-02-08 21:38:06 +00:00
|
|
|
|
* [for version 0.3.14](https://github.com/KarolS/millfork/tree/v0.3.14/examples)
|
|
|
|
|
|
|
|
|
|
* [for version 0.3.12](https://github.com/KarolS/millfork/tree/v0.3.12/examples)
|
|
|
|
|
|
|
|
|
|
* [for version 0.3.10](https://github.com/KarolS/millfork/tree/v0.3.10/examples)
|
|
|
|
|
|
2018-01-21 20:55:44 +00:00
|
|
|
|
## Cross-platform examples
|
|
|
|
|
|
2020-03-31 16:58:19 +00:00
|
|
|
|
* [Hello world](crossplatform/hello_world.mfk) (C64/C16/PET/VIC-20/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX) – simple text output
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
2019-09-14 01:34:32 +00:00
|
|
|
|
* [Fizzbuzz](crossplatform/fizzbuzz.mfk) (C64/C16/PET/VIC-20/PET/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX/X16) – everyone's favourite programming task
|
2019-07-08 17:26:48 +00:00
|
|
|
|
|
2020-07-31 14:07:39 +00:00
|
|
|
|
* [Fizzbuzz 2](crossplatform/fizzbuzz2.mfk) (C64/C16/PET/VIC-20/PET/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX/CoCo) – an alternative, more extensible implemententation of fizzbuzz
|
2019-07-26 22:58:10 +00:00
|
|
|
|
|
2019-07-30 13:30:18 +00:00
|
|
|
|
* [Fizzbuzz JP](crossplatform/fizzbuzz_jp.mfk) (PC-88/Japanese C64) – Fizzbuzz, but in Japanese
|
|
|
|
|
|
2018-12-19 21:32:55 +00:00
|
|
|
|
* [Text encodings](crossplatform/text_encodings.mfk) (C64/ZX Spectrum) – examples of text encoding features
|
2018-12-17 16:18:29 +00:00
|
|
|
|
|
2020-04-08 09:11:25 +00:00
|
|
|
|
* [Echo](crossplatform/echo.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX)– simple text input and output
|
2018-07-27 22:58:20 +00:00
|
|
|
|
|
2020-04-08 09:11:25 +00:00
|
|
|
|
* [Calculator](crossplatform/calculator.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX) – simple numeric input and output
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
2020-04-08 09:11:25 +00:00
|
|
|
|
* [Guessing game](crossplatform/guess.mfk) (C64/C16/Apple II/ZX Spectrum/PC-88/MSX) – a guess-a-number game
|
2018-12-30 18:10:57 +00:00
|
|
|
|
|
2018-12-29 19:12:19 +00:00
|
|
|
|
* [Fire effect](crossplatform/fire.mfk) (C64/C16/ZX Spectrum) – a simple fire effect
|
|
|
|
|
|
2020-04-08 09:11:25 +00:00
|
|
|
|
* [`readkey` test](crossplatform/readkeytest.mfk) (C64/C16/PET/VIC-20/Atari/Apple II/Armstrad CPC/ZX Spectrum/PC-88) – keyboard reading test
|
2020-03-31 16:58:19 +00:00
|
|
|
|
|
2019-11-04 01:31:04 +00:00
|
|
|
|
* [Screen encoding test](crossplatform/screnctest.mfk) (C64/C16) – default-to-screen encoding conversion test
|
|
|
|
|
|
2018-12-19 21:32:55 +00:00
|
|
|
|
* [Bell](crossplatform/bell.mfk) (Apple II/ZX Spectrum) – a program that goes \*ding!\*
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
2019-07-12 11:30:50 +00:00
|
|
|
|
* [Life](crossplatform/life.mfk) (C64/C16/Atari/ZX Spectrum) – Conway's game of life
|
2019-07-08 17:26:48 +00:00
|
|
|
|
|
2020-09-09 00:47:07 +00:00
|
|
|
|
* [Reg dump](crossplatform/regdump.mfk) (C64/C16/ZX Spectrum/CoCo) – a program that simply prints the initial values of CPU registers
|
2020-07-31 14:07:39 +00:00
|
|
|
|
|
|
|
|
|
* [Test suite](tests) (C64/C16/Atari/Apple II/BBC Micro/Armstrad CPC/ZX Spectrum/PC-88/CoCo) – the semi-official test-suite for Millfork
|
2020-04-05 22:00:48 +00:00
|
|
|
|
|
2018-12-19 21:32:55 +00:00
|
|
|
|
## Commodore 64 examples
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
2018-01-23 12:37:03 +00:00
|
|
|
|
### Graphical examples
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
|
|
|
|
* [Rasterbar](c64/rasterbar.mfk) – simple rasterbar effect
|
|
|
|
|
|
|
|
|
|
* [Softscrolling](c64/softscroll.mfk) – soft-scrolling a single line of text
|
|
|
|
|
|
2020-09-09 00:47:07 +00:00
|
|
|
|
* [Galencia starfield](c64/galencia.mfk) – a port of the starfield effect from the game *Galencia*
|
2018-01-21 20:55:44 +00:00
|
|
|
|
|
2019-07-15 11:52:05 +00:00
|
|
|
|
* [Space Poker \[external link\]](https://github.com/KarolS/spacepoker) – a game made for the 2018 Reset C64 Craptastic 4KB Game Competition
|
|
|
|
|
|
2018-12-19 21:32:55 +00:00
|
|
|
|
### Other examples
|
|
|
|
|
|
2019-01-05 00:19:14 +00:00
|
|
|
|
* Multifile ([source code](c64/multifile.mfk), [platform definition](c64/multifile.ini)) –
|
2020-09-09 00:47:07 +00:00
|
|
|
|
how to create a program made of multiple files loaded on demand
|
2019-01-05 00:19:14 +00:00
|
|
|
|
|
2018-12-19 21:32:55 +00:00
|
|
|
|
* [Panic](c64/panic_test.mfk) – how panic works on C64, showing the address of where it happened
|
|
|
|
|
|
2018-03-15 22:46:16 +00:00
|
|
|
|
## Famicom/NES examples
|
|
|
|
|
|
|
|
|
|
* [NES 101 tutorial example](nes/nestest.mfk) – a port of the tutorial example from the NES 101 tutorial by Michael Martin
|
|
|
|
|
|
2018-03-17 16:09:30 +00:00
|
|
|
|
* [MMC4 example](nes/nestest_mmc4.mfk) – the same thing as above, but uses a MMC4 mapper just to test bankswitching
|
|
|
|
|
|
2019-09-27 21:44:58 +00:00
|
|
|
|
* [Pong example](nes/pong.mfk) – simple pong example based off pong1.asm by bunnyboy of the nintendoage.com forums
|
|
|
|
|
|
2019-09-19 23:44:18 +00:00
|
|
|
|
## Atari Lynx examples
|
|
|
|
|
|
|
|
|
|
* [Lynx demo example](atari_lynx/atari_lynx_demo.mfk) – a simple sprite demo
|
|
|
|
|
|
2019-10-22 00:14:14 +00:00
|
|
|
|
## Atari 8-bit examples
|
|
|
|
|
|
|
|
|
|
* [Rainbow example](a8/rainbow.mfk) – simple scrolling rasterbars
|
|
|
|
|
|
2020-09-16 10:04:39 +00:00
|
|
|
|
* [DLI example](a8/dli_example.mfk) – simple display list and display list interrupt example
|
2020-09-08 23:45:39 +00:00
|
|
|
|
|
2020-09-18 23:34:29 +00:00
|
|
|
|
* [Horizontal scroll example](a8/endless_scroll.mfk) – simple horizontal scroll example
|
|
|
|
|
|
|
|
|
|
* [Vertical scroll example](a8/vertical_scroll.mfk) – simple vertical scroll example
|
2020-09-08 23:45:39 +00:00
|
|
|
|
|
2020-09-16 10:04:39 +00:00
|
|
|
|
* [System Off example](a8/systemoff_example.mfk) – Programming example with ROM off
|
|
|
|
|
|
2020-09-18 23:34:29 +00:00
|
|
|
|
* [GR.8 Chessboard Benchmark](a8/gr8_chessboard_benchmark.mfk) – Chessboard drawing benchmark in GR.8
|
|
|
|
|
|
|
|
|
|
* [FOR Countdown Benchmark](a8/countdown_for_benchmark.mfk) – Countdown from 1,999,999 to 0 (FOR loop)
|
|
|
|
|
|
|
|
|
|
* [WHILE Countdown Benchmark](a8/countdown_while_benchmark.mfk) – Countdown from 1,999,999 to 0 (WHILE loop)
|
2020-09-17 09:13:28 +00:00
|
|
|
|
|
2020-09-19 11:02:55 +00:00
|
|
|
|
* [Sieve of Eratosthenes (1899) Benchmark](a8/sieve1899.mfk) – Sieve of Eratosthenes, 1899 primes algorithm
|
2020-09-19 10:52:41 +00:00
|
|
|
|
|
|
|
|
|
* [Monte Carlo PI estimation Benchmark](a8/montecarlo_pi_benchmark.mfk) – measures the efficiency of multiplication
|
|
|
|
|
|
2019-03-18 22:15:05 +00:00
|
|
|
|
## Game Boy examples
|
|
|
|
|
|
|
|
|
|
* [GB test example](gb/gbtest.mfk) – a partial port of the NES example, with a rudimentary experimental text output implementation
|
|
|
|
|
|
2018-04-03 21:13:57 +00:00
|
|
|
|
## Atari 2600 examples
|
|
|
|
|
|
|
|
|
|
* [Colors](vcs/colors.mfk) – simple static rasterbars
|
2019-07-08 17:26:48 +00:00
|
|
|
|
|
2019-07-30 22:20:18 +00:00
|
|
|
|
## MSX examples
|
|
|
|
|
|
|
|
|
|
* [Encoding test](msx/encoding_test.mfk) – text encoding test; displays three lines of text in three different languages,
|
|
|
|
|
no more one of which will display correctly depending on the default font of your computer.
|
2019-09-14 01:34:32 +00:00
|
|
|
|
|
|
|
|
|
# Commander X16 examples
|
|
|
|
|
|
|
|
|
|
* [Palette](x16/palette.mfk) – displays the default 256-colour palette.
|
|
|
|
|
|
2019-12-01 22:13:51 +00:00
|
|
|
|
* [Balls](x16/balls.mfk) – 16 sprites using 240 colours.
|
2020-05-01 13:19:25 +00:00
|
|
|
|
|
|
|
|
|
* [Joy demo](x16/joydemo.mfk) – simple joystick demo.
|