Post topics, source code that relate to the Arduino Platform

User avatar
By NardJ
#26935 That's great, it works here too! :shock:
(Although with a lot of effort on my esp-01, because it oftens gets stuck in a reboot loop, probably due bad connection on my breadboard).

I don't understand the difference between using a cpp and c file very well, but the cpp seems more transparent (easier to understand codewise for me). What do you mean by "...mismatch of having both, since cpu.c was present"?

I noticed there was a lot of dynamic memory (for global variables) left, so I was able to adjust "#define RAM_SIZE 1536" in cpu.cpp to "#define RAM_SIZE 34816" (32kB) . EhBasic reports 34047 Bytes free!

Also I did a speed test "FOR I=1 TO 10000:NEXT I" should run within 10 second in ehBasic on a genuine C64 (1Mhz). This test took a Mini Pro (16MHz) about 60 seconds, but the esp8266 finished in 15 seconds on 80 Mhz, and in 8 seconds on 160 Mhz. So speedwise the esp8266 should be able to emulate a 8 bit/1Mhz home computer (with 32kB of RAM). And I remember that this emulation code was derived from sourcebase for pc's so could be further optimized.

This could be the base for a very cheap C64 (or Apple ][ if you like :D ). I found some internet posts which claim that with a esp-12 it should be possible to get some sort of ISP interface. So using this to interface to 2x 32k256 chips we have 64kB. Another pin to input a ps/2 keyboard and a pin to output video commands.
User avatar
By martinayotte
#26947
NardJ wrote:I don't understand the difference between using a cpp and c file very well, but the cpp seems more transparent (easier to understand codewise for me). What do you mean by "...mismatch of having both, since cpu.c was present"?

The signature of every functions in C++ are different with the same in C, this means that at link time, there could be some "undefined" since they are not matching each other. That's why I've rename the cpu.cpp file and figured out that most compile errors were gone. Only few errors left that I've also corrected.

NardJ wrote:I found some internet posts which claim that with a esp-12 it should be possible to get some sort of ISP interface. So using this to interface to 2x 32k256 chips we have 64kB. Another pin to input a ps/2 keyboard and a pin to output video commands.

What do you mean by "ISP" ? I presume you means "SPI" ...
Interfacing RAM would be a bit difficult since it won't be accessible directly, it will need some caching mechanism.
PS/2 keyboard should be easy to add. Video will also be a bit difficult, it will need to handled with some kind of co-processor or an FPGA.
User avatar
By NardJ
#26967 (SPI indeed.)

I tried an adaptation of the 6502 emu-code by Pito who inserted a C64 ROM, adjusted it for Pic32 (added VT100 terminal output) and added some sort of caching. http://forum.arduino.cc/index.php?topic=193216.msg2113719#msg2113719.

With your previous code as example I could figure out all the necessary changes. (see attachment). Since the rom is a bit larger, the free memory is less. The output is
Code: Select all    **** COMMODORE 64 BASIC V2 ****

 64K RAM SYSTEM  28767 BASIC BYTES FREE

READY.
FOR I=1 TO 10000:NEXT I

READY.

(The for next loop still finishes in 8 seconds, so 112% the speed of real C64.)

Using this as base I am going to try to hook up 2 32k256 chips this week!
You do not have the required permissions to view the files attached to this post.