As a teenager, I didn't get much exposure to the 6502 (my machines were generally Z80) - but I did a bit of 6502 assembly language programming on an AIM-65 whilst at college.
Some years ago, I came across the KimUno - which was a 6502 emulated by an Atmel ATMega328 - running under the Arduino IDE. This uses 6502 emulation code written by Mike Chambers (already well known amongst this forum's members) - but you can find the code at the first posting of this link
https://forum.arduino.cc/index.php?topic=193216.0
With recent 6502 emulation activity over on the Gigatron Forum, I thought I'd have a go at porting the 6502 emulator code to a faster target, using the Arduino IDE and Boards Manager to (hopefully) do all the hard work.
My target board is the $25, 400MHz STM32H743ZI Nucleo board
Arduino IDE now supports this board if you install the STM32 boards using Board Manager.
Mike's code runs ehBASIC on this board without modification, but you may wish to increase the RAMSIZE to 48K (49152) and increase the serial speed to 921600 .
Using this program it will print the numbers 0 to 10000 in about 8 seconds
Code: Select all
10 FOR I = 0 TO 10000
20 PRINT I
30 NEXT I
For something a little more taxing - there is the Trig-Test that prints trig functions from 1 to 89 degrees
Code: Select all
5 REM TRIGONOMETRIC FUNCTIONS TEST 1..89 DEGREE
10 PH = 3.141592653/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.141592653 / 180.0
50 TD = 180.0 / 3.141592653
55 REM INPUT IN DEGREE (1..89)
60 FOR D = 1 TO 89
70 R = D * TR
80 S = FN ASN(FN ACS(ATN(TAN(COS(SIN(R))))))
90 T = S * TD
100 PRINT T; " "; D; " "; T-D; " "; FRE(1)
110 NEXT D
120 END
I'm sure if I used some of the modifications and tweaks as discussed in the Arduino 6502 thread it could be a lot quicker - but if you want a quick and dirty 6502 emulation in a hurry, on a stock Nucleo board, this will only take about 30 minutes to get running
regards
Ken