Skip to content

Lorenz Attraktor for the C64 (6502 assembly + BASIC fp math calls)

License

Notifications You must be signed in to change notification settings

githubnemo/c64-attraktor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lorenz Attraktor on C64

example.mov

Compiling / Development

This project uses the ACME assembler for no particular reason but that it was the least complicated and most easy to find assembler. I used ACME 0.97.

For testing I found it best to use VICE, I had a few problems launching .PRG files with the default configuration so I created my own launch script which enables auto start PRG mode.

Note: the script assumes that ROM files (KERNAL, BASIC, character set) are present in the ROM/ directory. Make sure to place them there. They can be found in the release download of VICE.

Running

cd src
make run

The screen should turn black and green dots should appear.

Note that normally you would need to start the program yourself using a SYS 2049 statement (or whatever the initial address is) to jump into the code. We add a header value that adds a bit of BASIC code that does this for us.

If you want to run a specific version of VICE, set the X64SC environment variable.

Running on C64

I used a SD2IEC adapter and copied the src/myprg.prg file to the root of the SD card. Then it is just a matter of loading the program:

LOAD "myprg.prg",8
RUN

I had problems where the SD2IEC adapter didn't even load the directory list (LOAD "$",8) and simply flashed the error LED. Do diagnose this I ran this code:

10 OPEN 15,8,15: INPUT #15,A$,B$,C$,D$
20 CLOSE 15
30 PRINT A$,B$,C$,D$
RUN

The message I got was "74,Drive not ready,12,0" which was caused by a intermittent fault of the SD card socket (card detect or write protect was not triggered correctly). Re-inserting the SD card a few times solved the issue.

Usage

There are three keys you can press:

  • R for clearing the screen and resetting the X/Y/Z values
  • N to play a melodic sound based on the current trajectory
  • M to play a bass sound based on the current trajectory

Resources

This project used several resources for which I am really grateful:

There are three python scripts that were helpful in the development of the final assembler code.

  1. attraktor.py - a reference implementation that got subsequently optimized to bit oeprations
  2. encode_xy.py - a way of testing & reverse engineering the bit addressing in the 320x200 (but actually 40x25 byte) screen of the C64
  3. cbm_to_float.py - a script of converting C64 floating point numbers (5 byte) to python floats for easy debugging with the VICE monitor

About

Lorenz Attraktor for the C64 (6502 assembly + BASIC fp math calls)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published