Show Posts
Pages: [1] 2 3 ... 138
1  Development / Other Hardware Development / Re: Half-Byte Computer 'console'-ATMega 328 based 'computer' and gaming console on: July 15, 2014, 12:04:16 am
Finally, I am need of a storage solution for Tiny Basic. Since only a thousand bytes are left for TB program space, I cannot use the SD card library, which requires 512 bytes for a buffer. I don't want this board to have to be tethered to a computer, so I need something simple and very cheap. 
The simplest and cheapest solution is to redesign the stuff with atmega1284p (or better) and a microsd socket..

2  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 06, 2014, 07:21:00 am
This is the version with transferring deltas only from C64 video RAM to the VT100 terminal (25 rows x 40 columns).
VRAM is a temporary video memory holding "old" characters. We compare the new RAM[] to VRAM and if a difference we print the new character at the VT100 [row,col] position.

Mind you have to have CapsLock on on your keyboard..

Works nice with VT100 in TeraTerm.

Code:
..
uint8_t VRAM[1000];

void VTposition(uint8_t row, uint8_t col) {
Serial.write(27);
Serial.write('[');
Serial.print(row + 1);
Serial.write(';');
Serial.print(col + 1);
Serial.write('H');
}

void setup () {
Serial.begin (115200);
Serial.println ("Booting the ROM..");
reset6502();
delay(1000);
for (int i=0; i<1000; i++){
VRAM[i] = RAM[i+1024];
}
}

void loop () {
int v_address = 0;
for (uint8_t row=0; row<25; row++) {
for (uint8_t col=0; col<40; col++) {
if (Serial.available()) {
curkey = Serial.read() & 0x7F;
RAM[198] = 1;
RAM[631] = curkey;
}

exec6502(100);

uint8_t petscii = RAM[v_address + 1024];

if (VRAM[v_address] != petscii) {
VRAM[v_address] = petscii;
VTposition(row, col);
if (petscii<32) petscii = petscii + 64;
Serial.write(petscii);
}
v_address++;
}
}
}
3  Development / Other Hardware Development / Re: 8MB Ramdisk (external RAM) for Arduino.. on: July 05, 2014, 06:40:41 pm
We found out that for experimenting with DUE's EMB bus timings it is better to fill in the memory with random numbers. Below find the sketch.
Code:
// DUE EMB Example for 8MB Ramdisk v.1.1
// 1M BYTES RANDOM WRITE/READ
// Library used: https://github.com/delsauce/ArduinoDueParallel
// DUE at 84MHz (12ns clock)
// Provided as-is, no warranties of any kind
// Pito 7/2014

/* Wiring:
 ==============================================
 RDisk   DUE's header    DUE's EMB signal name
 ==============================================
 D0-D7   PIN34-PIN41     D0-D7
 /WR     PIN45           NWE
 /RD     PWM4            NRD
 /DATA   PWM9            A0 (A0=0 wr/rd data, A0=1 wr addresses)
 /MS     GND             GND
 ==============================================
 */

#include <Parallel.h>

// Setting up the rd/wr starting Address (8388607 max)
int set_address(unsigned long address){
Parallel.write(1, address >> 20);  // addr[23..20]
Parallel.write(1, address >> 16);
Parallel.write(1, address >> 12);
Parallel.write(1, address >> 8);
Parallel.write(1, address >> 4);
Parallel.write(1, address);  // addr[3..0]
}

void setup() {

// Configure parallel bus for 8bits, no CS, A0, and NRD and NWE
Parallel.begin(PARALLEL_BUS_WIDTH_8, PARALLEL_CS_1, 1, 1, 1);

// Configure bus timings.. EXPERIMENTAL
// We do not use any real addressing
Parallel.setAddressSetupTiming(1,1,1,1);

// NWE, NCSWE, NRD, NCSRD  - we do not use NCSs
Parallel.setPulseTiming(5,1,7,1);

// better read datasheet for CycleTiming:
Parallel.setCycleTiming(7,9);

// make a dummy read
Parallel.read(0);

// set the Serial
Serial.begin(115200);
}

void loop() {

unsigned i;
unsigned sumr, sumw, elapsedw, elapsedr;
unsigned char data;

randomSeed(micros());

Serial.println("START OF THE TEST");
Serial.println("WRITING 1Mil RANDOM BYTES TO RAMDISK");

// Write 1 million random data
sumw = 0;
elapsedw = millis();
set_address(0L);
for(i=0; i<1000000; i++){
data = random(256);
Parallel.write(0, data);
sumw = sumw + data;
}
elapsedw = millis() - elapsedw;

Serial.println("READING AND SUM 1Mil RANDOM BYTES FROM RAMDISK");
// Read and sum 1million of data from Address=0L
sumr = 0;
elapsedr = millis();
set_address(0L);
for(i=0; i<1000000; i++){
sumr = sumr + Parallel.read(0);
}
elapsedr = millis() - elapsedr;

Serial.print("SUM_W = ");
Serial.println(sumw);
Serial.print("SUM_R = ");
Serial.println(sumr);
Serial.print("ELAPSED WRITE = ");
Serial.print(elapsedw);
Serial.println(" msec");
Serial.print("ELAPSED READ = ");
Serial.print(elapsedr);
Serial.println(" msec");
Serial.println("TEST STOP");
Serial.println(" ");

//while(1);
}
4  Using Arduino / Storage / Re: Any ideas how can one program this SRAM? on: July 05, 2014, 06:21:48 pm
What about this:
http://forum.arduino.cc/index.php?topic=220918.0
8MBytes, 11 wires only, compatible with EMB-SMC bus, existing driver for DUE interface with 4.3MBytes/sec - see the topic.
You can connect several modules in various configurations.
It has got an autoincrement, so you set the initial address and then just write/read the data..
5  Using Arduino / Storage / Re: Using Mighty 1284P with SD card issues. on: July 05, 2014, 06:13:34 pm
Do you use a solderless breadboard? If so try to refresh all the contacts (put out/in the wires/pins few times)..
6  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 05, 2014, 03:54:29 am
I ran it on pic32mx Fubarino o'clocked 120MHz (compiled with chipkit's compiler, USB serial com), and the below trigo test took about 10secs (C64 V2 ROM). I only read the first half of the bottom line to eliminate video. So it seems there is an issue somewhere (provided mips is ~20% faster than arm and my clock is 30% more yours)  smiley For example, if you do not switch CapsLock on, it returns in 1 sec as it does not run the code (the code is empty).. smiley Unless the mips compiler is a crap I would estimate 19.9 secs for your code in the DUE..

PS: The test for reference:
Code:
5  REM PITO'S TRIGONOMETRIC FUNCTIONS TEST 0..89 DEGREE
6  REM FOR C64 V2 BASIC ROMS
7  REM BASED ON WELLKNOWN "9 DEGREE" CALC FORENSIC TEST
8  REM ASIN(ACOS(ATAN(TAN(COS(SIN(9.0)))))) = 9.0 IN DEGREE
10 PH = 3.1415926536/2.0
15 REM DEFINE ARCSIN AND ARCCOS
20 DEF FN ASN(X) = ATN(X/SQR(1.0-X*X))
30 DEF FN ACS(X) = PH-ATN(X/SQR(1.0-X*X))
35 REM TR, TD - TO RAD, TO DEG
40 TR = 3.1415926536 / 180.0
50 TD = 180.0 / 3.1415926536
55 REM INPUT IN DEGREE (0..89)
60 FOR D = 0 TO 89
70 T = SIN(TR*D)
72 T = COS(TR*T)
74 T = TAN(TR*T)
76 T = TD*ATN(T)
80 T = TD*FN ACS(T)
90 T = TD*FN ASN(T)
100 PRINT D; "="; T; " DELTA="; T-D
110 NEXT D
120 END

Code:
READY.
RUN
 0 = .0708403071  DELTA= .0708403071
 1 = 1.00188405  DELTA= 1.88405439E-03
 2 = 2.00156704  DELTA= 1.56704057E-03
 3 = 3.00102166  DELTA= 1.02166273E-03
 4 = 4.00055188  DELTA= 5.51875681E-04
 5 = 5.00046232  DELTA= 4.62317839E-04
 6 = 5.99979405  DELTA=-2.05950812E-04
 7 = 6.99975351  DELTA=-2.46489421E-04
 8 = 8.00046608  DELTA= 4.6607852E-04
 9 = 9.00044075  DELTA= 4.40750271E-04
 10 = 10.0001669  DELTA= 1.66922808E-04
..
 84 = 83.9999204  DELTA=-7.96020031E-05
 85 = 85.0002601  DELTA= 2.60084868E-04
 86 = 86.0004052  DELTA= 4.05162573E-04
 87 = 87.0003106  DELTA= 3.10570002E-04
 88 = 88.0004901  DELTA= 4.90099192E-04
 89 = 89.0023091  DELTA= 2.30902433E-03

READY.
7  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 04, 2014, 05:08:09 am
And your program completes in 1.5 seconds on the emulator running on the DUE smiley
Hard to believe smiley
8  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:32:34 pm
I don't know what you want to measure?
People might be interested to see how the cpu.c emulator performs with avr, CM0, CMO+, CM3, CM4, pic32MX, pic32MZ, etc.. compiled with X, Y, Z compilers..  So when they want start to measure the enhBasic running a benchmark is the good option..
9  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:19:22 pm
When you need to compare architectures/compilers running the cpu.c emulator then the best option is to use the enhBasic as it communicates via Serial only. So the error related to the communication with the emulated system (with Basic) is small.
The C64 rom communicates via video stream, where the stream takes a lot of time in comparison to the time spent in the emulator. That issue is the same for my Terminal printing, as well as for your tft video emulation.
10  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:03:31 pm
Unless some tricks applied I cannot do it easily with C64 as when I stop the video I cannot see the test has finished smiley
With enhBasic you may print start/stop and measure the elapsed time. No video buffer needs to be read.
11  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 03:50:45 pm
I cannot compare that under C64 even when run on both systems, as the video (not related to the emulation) messes heavily the results up..
The enhBasic is good for benchmarking (of the emulation speed) on various systems as the serial i/o there does not interfere too much.
12  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 03:41:00 pm
It does not matter because both benchmarks were done under enhBasic.  1284p mighty 84secs, second system 8.1secs.
There is serial i/o in enhBasic, so the video does not interfere into the measurement..
13  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 03:29:44 pm
I ran the enhBasic with above trigonometric test under arduino @16MHz (no video mess) and it took 84secs/
Then I ran it under the second system (also the enhBasic,no video mess) and it did it in 8.1sec. So my understanding is the second system's emulation speed  is ~10x faster than the arduino @16MHz - based on your info it means 6MHz.
I doubt DUE can do that such fast..
14  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 03:14:45 pm
I think the 100 in the 6502exec is not about "delays", but it says "do 100 6502 instructions before returning from 6502exec".
With 1 it will do a single 6502 instruction, then it returns. So the higher number there the more time it spends in 6502 emulation..
Also, I think there must be a function which offers a char at a specific ram address to be printed into video ram..
Finding that point I can get rid of the video mess and hook the stuff similarly as the enhBasic does..
15  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 02:59:13 pm
This takes 4.5sec on my system:
Code:
10 FOR I = 1 TO 10000
20 NEXT I
READY.
RUN

That makes 10000/4500*1MHz or a 2.2MHz 6502 smiley
But that is with exec6502(100); inside the "video and input loop" sending 1000bytes of video @115k2 continuously. So it must be much higher speed than the 2.2MHz. How to measure it then??.
Pages: [1] 2 3 ... 138