Pages: 1 ... 4 5 [6]   Go Down
Author Topic: Arduino/ATmega328 C64 Emulator  (Read 4508 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 3
Posts: 375
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
 
Logged

Offline Offline
Sr. Member
****
Karma: 3
Posts: 375
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, It boots smiley
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 smiley

 


* C64 Boot.jpg (66.11 KB, 600x337 - viewed 83 times.)
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 119
Posts: 4591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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?
Logged

No, I don't answer questions sent in private messages...

Offline Offline
Sr. Member
****
Karma: 3
Posts: 375
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: November 15, 2013, 05:17:54 am by janost » Logged

Meadville PA
Offline Offline
Newbie
*
Karma: 1
Posts: 14
I'll try any micro controller
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Sr. Member
****
Karma: 3
Posts: 375
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: November 30, 2013, 06:58:48 pm by janost » Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 119
Posts: 4591
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

No, I don't answer questions sent in private messages...

Pages: 1 ... 4 5 [6]   Go Up
Jump to: