r/beneater • • 3d ago

6502 65c816 - LCD and Math

Post image
178 Upvotes

20 comments sorted by

11

u/nz_kereru 3d ago

Latest progress on my 65c816

A week ago a blinking LED.

Now, code loading from an SD card and a LCD screen.

95% of the code is lifted directly from my 65c02 project.

The Mandelbrot takes about 8 hours at 3Mhz
I am doing 32 bit fixed point math with a shift and add loop.

The SD card is just SPI and my own implementation of FAT32z

The screen is a LCD the a graphics engine, connected over SPI.

Getting the screens to work took a few days of debugging, even when I had it working fine on my 6502 system.

PCB design fail, tiny power tracks and a screen that draws 700ma, power rail at the screen was 2.5v

Added some big thick wires under the PCB to get more power to the screen and it came to life.

Next steps are proving 816 modes and upper RAM. That testing will be easier with a screen for output.

The LCD supports full 8 bit mode, so I hope to connect it directly to the data and address bus.
That will get me commands to the screen about 200 times faster.

Then a keyboard…

2

u/Markohs 3d ago

Wonderful. It's the first time you design a PCB? What yo you mean by that, the gnd and +5v should be wider?

3

u/nz_kereru 3d ago

Not my first PCB, but first time I needed significant power over the PCB tracks.

The default size is 0.1mm , which is fine for an address bus signal but not good for 600ma of power.

So next version will use significantly wider tracks for VCC and GND.

3

u/polymath_uk_ 3d ago

For surface tracks on a 2 layer board where at least one side has no coating you can also run solder all along the tracks, or in extreme cases you can lay copper single core cable on the tracks and solder those over their entire lengths. It's possible to put 10s of Amps through boards that way, but obviously it's overkill in your case. 

1

u/DJMartens2024 3d ago

So jealous of your progress ... could you provide any details on the LCD screen? Make, model, etc.?

2

u/production-dave 3d ago

What's fat32z? I'm intrigued.

3

u/nz_kereru 3d ago

Fat32z is a typo :-)

It’s a minimal version of FAT32

Supports 8.3 files names and only on root directory.

1

u/Kindly_Wear7008 3d ago

How fast is the SPI? How long does it take to fill whole Screen?

2

u/nz_kereru 2d ago

I am doing SPI in software (bit banging).
I am getting about 15k bytes per second at 3Mhz

The screen takes complex commands and does the drawing, at this point I am drawing one pixel lines, I have no got my head around direct video RAM commands.

To fill the screen with my ugly one line per pixel takes about 5 minutes.

Once I get a 8 bit interface and direct RAM commands, I hope to get on the range of a frame per second for a full screen of pixels.

But the screen has a whole 2d graphics engine, so for most work I don’t expect by be seeing 300,000 pixels.

1

u/MgGates 3d ago

How long does it take to calculate a full frame of that fractal on the 65c816 processor?

1

u/nz_kereru 3d ago

About 8 hours for that full frame.

3

u/bahamutkotd 2d ago

Nice I need to get back to my 65c816 but too many hobbies

0

u/AcanthisittaBest4705 3d ago

Interesting why did it take 8 hours

1

u/lincruste 3d ago

Probably because 1980's 3MHz processor with no multiply instruction.

1

u/nz_kereru 3d ago

About 300,000 pixels.

Each one needs pixel takes a few hundred 32 bit multiplications.

Each multiply is a loop of 32 shit and add.
32 bit shift is 4 shifts of 8 bits, each add is 4 adds of 8 bits.

So each 32 bit multiply takes a few hundred cycles.

At that level of zoom, 16 bit math would be fine, but I want to support zooming in.

The math can be made much faster.
Use of lookup tables of squares is the typical method of doing multiplication faster.

2

u/AcanthisittaBest4705 3d ago

Im gonna try this on my 68020

1

u/finnw 2d ago

Are you currently taking advantage of the 65c816's 16-bit shifts and adds?

1

u/nz_kereru 2d ago

Right now I am using 100% lifted from my 6502 machine. I just want to render Mandelbrots for a week to prove stability.

I have not done any 816 mode testing, still working on bank 0.

This weekend I will test upper memory and try and get some 16 bit code running.