Go Down

Topic: Arduino/ATmega328 C64 Emulator (Read 9154 times) previous topic - next topic

janost

I have to give this up for a while.
It boots when the video is disabled but not with video on.

I'll write the emulator for serial ANSI VT-100.

janost

Ok, It boots :)
But the resources are so limited that its not useable.

With just 48bytes free RAM on the Nano and an external 64K EEPROM, it starts.
But its not useable, its like running with a CPU clock of 70KHz on the 6502.

I've proved my point and will leave this now.

But this has born the VideoBlaster.
And it makes a damn good platform for games and retrocomputing.

I will look into TinyBasic and make something usefull of it :)

 

fungus

I was never really going to emulate a C64, and there's far better BASICs if you want it for BASIC programming. :-)

The video signal generation is more interesting/useful.

I'm a bit worried about the tearing on the lines of text. I think it's because your interrupts aren't happening exactly on the right clock cycle on each line. There's ways around that but we need to do a little test first.

Put this code in your loop() function:


Code: [Select]

#define NOP __asm__("nop\n\t")
void loop()
{
  while (1) {
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
    NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;
  }
}


This ensures that the CPU spends most of its time executing instructions that only take one clock cycle.

Does it improve the display?
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

janost

#78
Nov 15, 2013, 11:01 am Last Edit: Nov 15, 2013, 11:17 am by janost Reason: 1
The tearing comes from the LCD-display.

An LCD-TV display only got 960pixels across divided by the 3 primary colors.
That is 320pixels and I'm running at 512pixels across.

If I fill the screen with white blocks the borders are straight.

When I use a 4MHz pixelclock there is no tearing.
But then only a maximum of 22chars or 176 usefull pixels across.

It probably has a combfilter on the video input.

The code is the same, just a different pixelclock and less shifterloads per line.

My loop() function goes to sleep if the scanline is within scanline 56 to 255 with PAL.
So it only Draws pixels and then sleep on active lines.

Without it, all characters on the screen jitters.

MicroNut

I have a Due and was wondering if the 6502 emulator would run on it. With 512K Flash and 96K Ram it should have plenty of room to run programs. Also I was thinking of offloading the sound and video and keyboard onto a "co-processor" via SPI. The Parallax Propeller chip does video and a  PS2 keyboard easily and someone has written code for SID emulation with is extremely good. If not SPI maybe by 8 bit buss instead since the Due has plenty of I/O and the Propeller should be able to read it in.

janost

#80
Dec 01, 2013, 12:31 am Last Edit: Dec 01, 2013, 12:58 am by janost Reason: 1

I have a Due and was wondering if the 6502 emulator would run on it. With 512K Flash and 96K Ram it should have plenty of room to run programs. Also I was thinking of offloading the sound and video and keyboard onto a "co-processor" via SPI. The Parallax Propeller chip does video and a  PS2 keyboard easily and someone has written code for SID emulation with is extremely good. If not SPI maybe by 8 bit buss instead since the Due has plenty of I/O and the Propeller should be able to read it in.


It will definitly run on a Due.
You can get the code from me to boot it.

I have a Due and it will for shure work.

But isnt that to easy and plain simple?

Also the sound should be run on a 328 with a SID emulator?

I have all of this in my new Bambino board.
ATmega1284 with an Uno footprint.

fungus


I have a Due and was wondering if the 6502 emulator would run on it.


Sure, but what's the point?

Why not just get something cheaper with a TV output (eg. Raspberry Pi) and run a C64 emulator on it?
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up