FastLED for Apple II Just committed on github:

FastLED for Apple II
Just committed on github: “FastLED6502” – a lightweight port of FastLED’s core functions to 6502 assembly language for the Apple ][, Apple ][+, Apple //e, and Apple //gs. The code is in the “extras” directory here https://github.com/FastLED/FastLED/tree/FastLED3.1/extras

This new code supports APA102 / Adafruit DotStar LED strips, as well as LPD8806 and WS2801 (though those are not fully tested yet). Just connect the CLK and DI pins from the LED strip to pins 5 and 12 on your Apple II’s DIP game connector port, add power, and you’re ready to go. Other pin configurations are also supported, configurable in the source. Fastest pin access method is automatically selected depending on the pins you configure, as always.

24-bit FastLED Rainbow colors are included, along with FillRainbow, Random8 and a number of other useful functions.

“Three-wire” clockless LED strips such as the WS2811 NeoPixel are not supported now, nor will they ever be. The CPU is would need to be about 20X faster to support them, and it isn’t. Likewise, the Apple //c and Apple //c+ are not supported, because they lack the necessary digital output pins on their DB-9 joystick/mouse connector.

Considering that the Apple II sports a 1MHz 6502 so slow that even a “NOP” takes two cycles, overall performance is pretty good: more than 30 frames per second for a 100-pixel strip.

This bit of code is completely nuts, and we don’t expect anyone to use it. At all. Ever. Accordingly, we’re not going to really support it, either. At all. Ever.

But here it is, in all it’s insane glory, “FastLED6502”.

FastLED6502.s65 source code:
https://github.com/FastLED/FastLED/blob/FastLED3.1/extras/FastLED6502.s65

RainbowDemo.s65, as shown in video:
https://github.com/FastLED/FastLED/blob/FastLED3.1/extras/RainbowDemo.s65
http://www.youtube.com/watch?v=PMYer_e9LhU

Loop
lda gHue
clc
adc gHueSpeed
sta gHue

ldx gHue
ldy gHueDelta
jsr FastLED_FillRainbow_XY

jsr AddGlitter        

jsr FastLED_Show    ; This is where the magic happens
jmp Loop

Wow, 6502 assembly. That brings back memories.

Hey, the Arduino is an 8-bit machine, and so’s the Apple II – how different could they be?!? Well, let’s see…

The Apple II’s 1MHz 6502 has one (1) general purpose 8-bit register, and two 8-bit index registers. It takes 2-7 clock cycles to execute a single instruction.

The Arduino’s 16MHz ATmega 328p has 32 general purpose registers, several of which can be used in 16-bit pairs. Most instructions take 1 or 2 cycles.

Let me put it another way: in the same amount of time that it takes an Apple II to perform a single “NOP” (do nothing) instruction, an Arduino Uno can perform sixteen 8-bit X 8-bit multiplications. So, yeah, there are a few differences, I guess.

Anyway… it was a fantastic bit of fun to get this up and running – and I’m actually kind of proud of the “100 pixels at 30 FPS” performance!

That’s incredible. But can make a 40x40 LED array as a replacement Lo-Res graphics display? Only have to do 15 colors (well, 14 if you count the GRAY1 and GRAY2 as one) :slight_smile:

You know, if I thought this project was worth $400, I would have BUILT a 40x40 matrix and SCRN-scraped the lores screen onto it…

Next, please port it to the Sinclair ZX81 with virtual LED strip in glorious blocky black and white! :slight_smile:

The Sinclair ZX81 lacks sufficient RAM to do anything (unless you managed to get the 16k add-on RAM module to stay connected).

But how about throwing some real power at it: I think I still have my Atari 1040STf in a closet somewhere…

@P_Routon , I’m afraid I have to disagree! Here is my ZX81 running a virtual LED strip in all it’s glory!

http://postimg.org/image/m2366tpkn/

Inspiring work! I might have to pull out my 6502 based midi LED & XY oscilloscope controller I built back in the mid '80s…

@Mark_Ortiz
I’m not sure what that link is supposed to show – I get four semi-random images.

But I guess I am wrong about using the ZX81. I keep confusing that powerhouse with the Sinclair ZX80 I owned back in the day. It came standard with 1k of RAM for program and data.

@P_Routon I was only joking. The image is at the top (the thin black/grey blocky line) - those other images are adverts from that hoster.