AnyCPU http://anycpu.org/forum/ |
|
Emulating the 6502 on a Nucleo board http://anycpu.org/forum/viewtopic.php?f=12&t=617 |
Page 1 of 1 |
Author: | monsonite [ Sat Jul 13, 2019 1:50 pm ] |
Post subject: | Emulating the 6502 on a Nucleo board |
Hi All, I've already mentioned this on the 6502.org forum, but I thought it might be worth posting here too. Around 2011, Mike Chambers developed a 6502 emulator, written in C, that has been ported to a wide range of processors. I came across it a few years ago, when it was being offered as a means of getting an Arduino to emulate a KIM 1, with Microchess and VTL02 as applications. Recently, the 400MHz, $25, STM32H743 Nucleo board has become incorporated into the Arduino IDE - so with a wing and a prayer, I thought I'd see if Mike's 6502 emulator code and ehBASIC would port to this 400MHz processor. Yes - and after half an hour of updating the Arduino Boards Manager - I had ehBASIC running and outputting to TeraTerm. OK - this is probably not the most efficient way of emulating a 6502 on an Arm Cortex H7 - but it was very quick and painless to do. Things that are easy give instant gratification. The code ran first time, and a couple of tweaks to baudrate and RAMSIZE, I have a stock $25 Nucleo board which executes 6502 code - and ehBASIC, at about 8MHz equivalent 6502 clock speed. A 0 to 1,000,000 empty FOR-NEXT loop executed in 111 seconds. This slightly more taxing trigonometric function test ran in about 2 seconds Code: 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 regards Ken |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |