Here is the Mandelbrot version of my Julia Set program, coded in assembly. Again, many thanks to the forum users here for their guidance, as well as the many YouTubers with their excellent tutorials on 6502 assembly language. It's a lot faster than the BASIC version, but nevertheless, benefits from being run in warp mode.
This is an uninteractive demo for the moment, but with some tweaks, I'm hoping a zoom feature will be available. (Known issue: there's a sign problem somewhere which has resulted in a mirror image Mandelbrot!)
step: POKE $0cff e.g. 50 for a step of 0.05
(smaller number, higher zoom)
iterations: POKE $0d01 e.g. 30 iterations about right, higher = slower
start x: POKE $0cf1, normally 8 (for -0.8) - nicely centred at low zoom
start y: POKE $0cf3, normally 12 (for -1.2) - again centred at low zoom
Here is my work in progress Julia Set demo! I wrote this in BASIC a couple of weeks ago when starting out on the Commander X16 journey. Since then, I have been trying to learn 6502 assembler. This is the result so far! After wrestling with floating point arithmetic (see my other posts!) I have finally managed to get something working. At the moment, the output is PETSCII, but all being well there will be a graphical version of this in the pipeline. Feel free to muck about with the code. It's probably not written very well, but I have only been doing this for a couple of weeks 🙂 (and despite being badly written, it's much faster than the BASIC version!)
Many thanks to all the experienced forum users who commented on my previous posts to help guide me through this process, as well as the many YouTubers who posted tutorials about how to program the 6502.
Watch this space for updates!
Some things you can poke around in to change the parameters:
POKE $0D30, X -- change the REAL component (this is passed as an integer but can be divided by ten a number of times to achieve smaller numbers - see below)
POKE $0D36, X -- the number of times to divide the REAL component by 10 (in order to get around the lack of FIN in the Kernal at present)
POKE $0D34, $00 -- make the REAL component positive
POKE $0D34, $FF -- make the REAL component negative
POKE $0D32, X -- change the IMAG component (this is passed as an integer but can be divided by ten a number of times to achieve smaller numbers - see below)
POKE $0D37, X -- the number of times to divide the IMAG component by 10 (in order to get around the lack of FIN in the Kernal at present)
POKE $0D35, $00 -- make the IMAG component positive
POKE $0D35, $FF -- make the IMAG component negative
**EDITED TO ADD: for all those who are new like me, exploring this world, please see the forum thread where some of the more experienced coders here have pointed out some really useful Kernal routines which take the pain out of this!!
Hi all! As I journey towards 6502 mastery (LOL), this demo explores floating point numbers and how they are stored and managed in binary. It borrows heavily from others' code to achieve what I was struggling to do from first principles, and I am grateful to all the YouTubers, bloggers and hobbyists out there who have kindly shared their work in this area.
This particular routine takes a binary floating point number stored in memory and displays it on the screen in a human-readable decimal format. It also dumps some of the memory addresses involved so you can have a look under the hood.
Some functions include:
Displays the floating point number stored in MSB, NMSB, NLSB, LSB and BEXP as a decimal number on screen (PETSCII string)
Memory dump. Shows paired bytes at the address, looping for MemDumpLen addresses (default=8)
If you click try it now, you can poke around in memory to change the starting parameters of the programme. For example, to change the most significant byte of the mantissa, POKE $080E,XX and to change the binary exponent, POKE $081E,XX then type RUN again to see the results.
FLTTODEC was adapted by me for the specific hardware of the Commander X16 from Jeff Tranter's code, who in turn adapted it for CC65 from the original appearing in Compute! issues 9 and 11, 1981 by Marvin L. De Jong.
Jeff's Blog: https://jefftranter.blogspot.com/
This program is written using kickc of Jesper Gravgaard. I'm helping him to create a framework encapsulating the CX16 vera in order to be able to quickly create graphical effects for games.
This is a short demo and I hope you like it.
This program uses the keyboard to progress through the program!
So be sure to run this from the desktop, since the emulator on mobile phones do not have a keyboard!
By rjeI was missing Bach's "Invention 13", and so here's my first attempt.
Naturally, this will need to be debugged... I think I heard a couple bad notes in there.
Then, naturally, this will need some sprite graphics... the X16 butterfly in shifting colors or something.
But for now, here's the first 13 bars that Commodore Business Machines used in the early 80s.
This may be of interest to absolute 6502 assembly beginners like me, although advanced 6502 programmers may cringe at the way I've done things here! This program does very little, but it is a repository of useful assembly routines for things like printing different bytes of memory (useful for debugging) as well as some basic math operations. I will keep adding to this as I progress through my assembly journey (I'm aiming to write my fractal BASIC programs in assembly).
Thanks to the following YouTubers for their excellent tutorials on all things 6502:
Ben Eater - YouTube
Matt Heffernan - YouTube
ChibiAkumas - YouTube (and also his excellent website: Assembly Tutorials: Learn 6502 Assembly Programming... With ChibiAkumas!)
Function usage: (notation for cc65 assembler)
.byte (list of PETSCII character codes to print, ending in a $0 byte)
.byte (list of PETSCII character codes to print, ending in a $0 byte)
.word (start address of memory dump)
Set MEMDUMPLEN to the number of addresses you wish print_mem to display.
By HookazoidA small intro/demo type thingy as the result of me trying to "dust off" and re-learn some 30 year old assembly.
This took most of my Christmas break. Starting out I was really stumped by some of the VERA stuff: The registers, the layers, loading data, 4bpp colors, high bit addressing. But, eventually it started to make sense a bit.
All this would have been impossible for me without the very helpful blogs at https://www.8bitcoding.com/ and https://justinbaldock.wordpress.com/category/retrocomputing/commander-x16/. The Vera Graphics Convertor was also very useful.
I used KickAssembler for the code. I've uploaded the .asm file as well, just in case it's useful for anyone else learning this stuff.
By desertfishI learned about the various screen modes of the Vera chip.
As long as you reduce the number of colors to fit it all in the available video memory, high res 640x480 bitmap images are perfectly possible.
256 colors requires way too much memory though, so for simplicity sake, I reduced it all the way back to 2 colors black and white.
This is a quick and dirty Julia set demo written in Commander X16 BASIC. It generates a random Julia set each time it is run. I strongly suggest using the emulator's -warp option to speed things up a bit! Enjoy the fractal action! 🙂
This is a quick and dirty Mandelbrot set demo written in Commander X16 BASIC. I strongly suggest using the emulator's -warp option to speed things up a bit! I plan to make this a bit more user friendly, and include more options for zooming, changing colours etc. But for now, enjoy the fractal action! 🙂
CX16 port of the "MAD-COMPUTER" program published in the October 1985 issues of Mad Magazine
By desertfishThis is a multi-format image viewer program. It supports IFF, PCX, BMP and Koala (c64). It supports full-screen 320x240x256 color bitmap mode and IFF Color Cycling !
Due to emulator restrictions (it seems) It only works when running from an sd-card file, so I've provided a zipped one that contains the program and a few sample images.
The source code is here https://github.com/irmen/prog8/tree/master/examples/cx16/imageviewer
The video below shows the program in action!
By lamb-duhPlay a game of pool on your commander X16. Click inside the light green circle to hit the white ball around the table.
By jnewmanAnother cheap color cycle demo plotting a globe and cycling the palette.
Press 'Q' to quit
By canada2002This simple BASIC program draws three graphics examples by using the LINE command.
It runs on Commander X16 R37 and R38.
This examples runs formerly on a Commodore C64 with a little help of a machine language program to draw the lines, sets graphics mode etc.
By desertfishI wrote a program that loads Commodore-64 multicolor pixel art images in the "koala" file format, and displays them to a regular Commander X16 320x200 graphics screen.
The C64 uses a fixed palette of 16 colors for all its graphics.
I do find that the saturation of the default colors in de c64 palette in the Cx16 emulator is not very good though: when the images are displayed on a C64 or in an emulator like Vice for instance, they look much better in my opinion.
So the program sets a custom palette (the "pepto" Vic-II colors) to make the images look closer like they would on a C64.
This program has been integrated in a multi-format image viewer now, the source code of that is here https://github.com/irmen/prog8/tree/master/examples/cx16/imageviewer
By jnewmanPlaying with Color Cycling. Only changes colors 7-14 in the palette to cycle a gradient for the sprite displayed on the screen. Inspired by games of old that used this trick to animate graphics.
By OttoRaytracer in Basic with a sphere and its shadow, and a plane with a pattern.
Originally written for C64 with Simon's Basic and published 1986 in german magazine c't (issue 1, page 104).
According to the article it took 3 to 4 hours on a c64. It's much faster on a x16, but nevertheless use warp mode.
I changed the following compared to the original code:
I added alternative plane pattern formulas in the lines 110 to 220 (4 patterns; just [un]comment the according lines) I added lines 1205, 1206 and 1615 to read the input from data statements instead of user input I changed the graphic commands (screen, line, pset) from line 2000 and on I added the data for the objects line 2010: the sphere (x, y, z, radius) and the position of the lamp (x, y, z); same for all pictures followed by individual data per picture (5 pictures; just [un]comment the according lines for the others) coordinates of camera (x, y, z) and viewing vector (x, y, z); e.g. lines 2064 and 2065 aperture angles (horizontal, vertical); aspect ratio already adapted to X16; e.g. line 2066 line 2080: data for the view; same for all pictures; coordinates of top right corner (x, y) coordinates of bottom left corner (x, y) view window size (width, height) Press "S" for a quick sketch or "D" for the real stuff ...
On demand I could share more info from the article content.
Tested with R38
By canada2002This demo is an adopted C64 basic program (from the german owners manual) for the Commander X16 using the PSG.
This programm runs under R37 and R38.
By SlithyMattA sequel to my demo from Christmas 2019, but refactored to work with the R38 emulator and using new music and graphics.
You can play it here, on your emulator, or just watch it on YouTube:
Also available on GitHub: https://github.com/SlithyMatt/x16-xmas/releases/tag/2020.0
By desertfish3d animated Cobra MK3 ship from Elite! Uses 16 bits integer math and has hidden-line removal..
This is an almost 1-to-1 conversion of the same program I wrote for the C64, but it runs a lot faster on the CommanderX16 🙂
Here is the (prog8) source code https://github.com/irmen/prog8/blob/master/examples/cx16/cobramk3-gfx.p8
I haven't figured out how to wait for the Vertical blank yet, to reduce the flickering perhaps...
By SlithyMattThis is a demo of the X16's capability to use PETSCII graphic characters to build super-sized characters that are 4x the size of regular characters.
Simply load and run ZOOMTEXT.PRG and type away.
When you get bored, simply type "quit" (no shift!) to get back to BASIC. You can try with either the default PETSCII character set, or the mixed-case PETSCII set (by hitting Ctrl-N before running).
Follow on GitHub: https://github.com/SlithyMatt/x16-zoomtext
By SlithyMattWireframe Demo beta version 0.1 - only supports a single line, but lets the user move and modify it with the joystick or keyboard.
See GitHub for code and documentation: https://github.com/SlithyMatt/x16-wireframe
By SlithyMattA short BASIC program that adds three emojis to the current PETSCII character set. Rather than the normal graphic characters expected, Shift-P, Q, and R will give you smiling, frowning, and amazed emojis, respectively. This program can be easily expanded upon to add additional modified characters.
Available on GitHub: https://github.com/SlithyMatt/x16-zoomtext/blob/master/emoji.bas
By StephenHornMatriculate was my first demo written for the X16 emulator, and an early version of it was featured in Dave's Building My Dream Computer - Part 2 video. It uses the default font, and emulates the Matrix rain of code.
The source code for this can be found here: https://github.com/indigodarkwolf/x16-matriculate-text