View unanswered posts | View active topics It is currently Thu Mar 28, 2024 11:57 am



Reply to topic  [ 3 posts ] 
 Simulated PDP-8, FOCAL-69 & Lunar Lander run on Teensy 4.0 
Author Message

Joined: Mon Aug 14, 2017 8:23 am
Posts: 157
The Teensy 4.0 is a small footprint, breadboard friendly, 600MHz ARM Cortex M7 microcontroller.

I bought a handful of these earlier this week and I am finding it an ideal platform to simulate experimental or retro cpus.

My first experiments were with a 6502 simulation, with ehBASIC preloaded into the Flash. This ran with a simulated speed of about 45MHz.

Next, I loaded up some simulation code that I have been developing for a 16-bit DIY processor. This worked perfectly at around 20 million simulated instructions per second.

Tonight, I have come across a PDP-8 simulator - originally written by Jean Claude Wippler from Jeelabs. Another trawl found a version adapted for Arduino with FOCAL-69 preloaded into ROM. With this I have successfully got the Lunar Lander game to run.

Code:
FIRST RADAR CHECK COMING UP


COMMENCE LANDING PROCEDURE
TIME,SECS   ALTITUDE,MILES+FEET   VELOCITY,MPH   FUEL,LBS   FUEL RATE
    =   0       = 120  =    0       = 3600.00    = 16000.0      K=:0
    =  10       = 109  = 5016       = 3636.00    = 16000.0      K=:0
    =  20       =  99  = 4224       = 3672.00    = 16000.0      K=:0
    =  30       =  89  = 2904       = 3708.00    = 16000.0      K=:0
    =  40       =  79  = 1056       = 3744.00    = 16000.0      K=:0
    =  50       =  68  = 3960       = 3780.00    = 16000.0      K=:0
    =  60       =  58  = 1056       = 3816.00    = 16000.0      K=:0
    =  70       =  47  = 2904       = 3852.00    = 16000.0      K=:170
    =  80       =  37  = 1474       = 3539.86    = 14300.0      K=:200
    =  90       =  27  = 5247       = 3140.80    = 12300.0      K=:200
    = 100       =  19  = 4537       = 2710.41    = 10300.0      K=:200
    = 110       =  12  = 5118       = 2243.83    =  8300.0      K=:200
    = 120       =   7  = 2284       = 1734.97    =  6300.0      K=:200
    = 130       =   3  = 1990       = 1176.06    =  4300.0      K=:200
    = 140       =   0  = 5040       =  556.96    =  2300.0      K=:168
    = 150       =   0  =  986       =-  13.63    =   620.0      K=:0
    = 160       =   0  =  922       =   22.37    =   620.0      K=:0
    = 170       =   0  =  330       =   58.37    =   620.0      K=:30
    = 180       =   0  =   48       =-  20.19    =   320.0      K=:0
    = 190       =   0  =   80       =   15.81    =   320.0      K=:12
ON THE MOON AT=   193.96 SECS
IMPACT VELOCITY OF=    11.73M.P.H.
FUEL LEFT:=   272.49 LBS
CONGRATULATIONS ON A POOR LANDING


Lunar Lander is exceptionally challenging for the newcomer. I eventually hit upon the technique of free-falling for 70 seconds, then an 80 second main burn, which consumes almost all the fuel, followed by a small corrective burn resulting in a rather bumpy landing.

The 6502 simulator with ehBASIC is here

https://forum.arduino.cc/index.php?topic=193216.0

The PDP-8 simulator with FOCAL-69 in Program memory is here. You need to increase the MEMSIZE to 32768

https://github.com/KedalionDaimon/DEC-PDP-8-on-Arduino

The Lunar Lander program is documented towards the end of the Wikipedia article here:

https://en.wikipedia.org/wiki/FOCAL_(pr ... g_language)

The Teensy 4.0 costs about $20 (£18.50 in UK) it makes an ideal platform for simulation processors from bygone times.


Last edited by monsonite on Sun Sep 13, 2020 9:31 am, edited 1 time in total.



Sun Sep 13, 2020 12:57 am
Profile

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1780
That's great! Would I be right in thinking the Teensy has a USB port and appears as a serial device to the host? And can be powered over the USB too?


Sun Sep 13, 2020 7:24 am
Profile

Joined: Mon Aug 14, 2017 8:23 am
Posts: 157
Quote:
Would I be right in thinking the Teensy has a USB port and appears as a serial device to the host? And can be powered over the USB too?


Ed - correct on both points. Theres a micro USB connector at one end of the board which provides one means to power the board and appears as a serial port to the host.

This means for these text based computer simulations you really only need a USB cable to get started. No breadboard, wiring or external power supply are needed - it is literally plug and play.

I had to install Arduino IDE 1.8.12 (as opposed to the latest 1.8.13 which had some incompatibilitiy issues) and the Teensy Plugin - which is available on the PJRC website.

Once this is done, development is very straightforward. Code that has been written for earlier members of the Arduino board clan compiles and loads without problem.

I am becoming increasingly impressed with FOCAL - it's floating point math and trig functions go way beyond what I would have expected from an interactive/interpreted language which fits into 4K words of memory. I suspect FOCAL will become a topic for wider discussion on the forum.

I must also congratulate Jean Claude Wippler for his PDP-8 simulation in C, and the work done by Nino Ivanov, to take this simulation, make it compatible with Arduino C++ functions and add the 4K FOCAL code into the program ROM space. It all justs works - straight out of the can.


Sun Sep 13, 2020 8:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software