6.3 KiB
Examples
The examples showcased here are designed to compile with a compiler built from the newest sources. If you are using a release version of the compiler, consider browsing the older versions of the examples:
Cross-platform examples
-
Hello world (C64/C16/PET/VIC-20/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX/Z1013) – simple text output
-
Fizzbuzz (C64/C16/PET/VIC-20/PET/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX/X16) – everyone's favourite programming task
-
Fizzbuzz 2 (C64/C16/PET/VIC-20/PET/Atari/Apple II/BBC Micro/ZX Spectrum/PC-88/Armstrad CPC/MSX/CoCo) – an alternative, more extensible implementation of fizzbuzz
-
Fizzbuzz JP (PC-88/Japanese C64) – Fizzbuzz, but in Japanese
-
Text encodings (C64/ZX Spectrum) – examples of text encoding features
-
Echo (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX)– simple text input and output
-
Calculator (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX/TRS-80) – simple numeric input and output
-
Guessing game (C64/C16/VIC-20/Apple II/ZX Spectrum/PC-88/MSX/TRS-80/Z1013) – a guess-a-number game
-
Fire effect (C64/C16/ZX Spectrum) – a simple fire effect
-
readkey
test (C64/C16/PET/VIC-20/Atari/Apple II/Armstrad CPC/ZX Spectrum/PC-88/TRS-80/Z1013) – keyboard reading test -
Screen encoding test (C64/C16) – default-to-screen encoding conversion test
-
Bell (Apple II/ZX Spectrum) – a program that goes *ding!*
-
Life (C64/C16/Atari/ZX Spectrum) – Conway's game of life
-
Reg dump (C64/C16/ZX Spectrum/CoCo) – a program that simply prints the initial values of CPU registers
-
Test suite (C64/C16/Atari/Apple II/BBC Micro/Armstrad CPC/ZX Spectrum/PC-88/CoCo) – the semi-official test-suite for Millfork
Commodore 64 examples
Graphical examples
-
Rasterbar – simple rasterbar effect
-
Softscrolling – soft-scrolling a single line of text
-
Galencia starfield – a port of the starfield effect from the game Galencia
-
Space Poker [external link] – a game made for the 2018 Reset C64 Craptastic 4KB Game Competition
Other examples
-
Multifile (source code, platform definition) – how to create a program made of multiple files loaded on demand
-
Panic – how panic works on C64, showing the address of where it happened
Famicom/NES examples
-
NES 101 tutorial example – a port of the tutorial example from the NES 101 tutorial by Michael Martin
-
MMC4 example – the same thing as above, but uses a MMC4 mapper just to test bankswitching
-
Pong example – simple pong example based off pong1.asm by bunnyboy of the nintendoage.com forums
Atari Lynx examples
- Lynx demo example – a simple sprite demo
Atari 8-bit examples
Hardware specific examples
-
System Off example – programming with ROM off
-
DLI example – simple display list and display list interrupt example
-
Horizontal scroll example – simple horizontal scroll example
-
Vertical scroll example – simple vertical scroll example
-
Horizontal stars example – horizontal stars done on one missile
Music
-
CMC Player – CMC player with sample music
-
MPT Player – MPT player with sample music
Benchmarks
-
Grand Theft Antic – ANTIC impact on CPU depending on the used graphic mode
-
GR.8 Chessboard Benchmark – chessboard drawing benchmark in GR.8
-
FOR Countdown Benchmark – countdown from 1,999,999 to 0 (FOR loop)
-
WHILE Countdown Benchmark – countdown from 1,999,999 to 0 (WHILE loop)
-
Sieve of Eratosthenes (1899) Benchmark – sieve of Eratosthenes, 1899 primes algorithm
-
Monte Carlo PI approximation Benchmark – measures the efficiency of multiplication
-
Bubble Sort Benchmark – sort 255 elements
Other examples
-
Test OS module – quick test for a8_os.mfk module
-
Rainbow example – simple scrolling rasterbars
-
Quatari Landscape – part of Quatari 256B intro
Game Boy examples
- GB test example – a partial port of the NES example, with a rudimentary experimental text output implementation
Atari 2600 examples
- Colors – simple static rasterbars
MSX examples
- Encoding test – 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.