Implimenting BCPL on 6502

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
MartyG
Posts: 7
Joined: 31 Oct 2023

Implimenting BCPL on 6502

Post by MartyG »

Hi All;
I am new to 6502 CPU's, but, I would like to port or implement BCPL on my 6502 based machine..
What I have is Ben Eaters 6502 kit, and I have ordered the Serial kit as well for I/o..
What would be the first steps toward that (I have read and copied Gordon's 816 stuff, in my notebook..)
THANK YOU Marty
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Implimenting BCPL on 6502

Post by drogon »

MartyG wrote:
Hi All;
I am new to 6502 CPU's, but, I would like to port or implement BCPL on my 6502 based machine..
What I have is Ben Eaters 6502 kit, and I have ordered the Serial kit as well for I/o..
What would be the first steps toward that (I have read and copied Gordon's 816 stuff, in my notebook..)
THANK YOU Marty
The easiest way would be to write a little OS that can support Acornsoft ROMS then run the Acornsoft BCPL ROM. You'll need a filing system of some sorts too. I used this environment extensively in the early 80s to develop a system of networked BBC Micros in a factory automation/robotics setting.

That will give you an environment where you can directly edit, compile and debug 16-bit BCPL programs with optional floating (and fixed) point calculations package.

If you want 32-bit numbers, then it will be more of a challenge, but possible on the 6502 - my own BCPL "rom" is pushing 16KB on the '816 though.

You might want to start by fetching and installing Martin Richards compiler and utilities, etc. on a local (Linux) system though to get to grips with it all, however I'm not sure that can generate the old 16-bit code anymore that the Acornsoft/BBC Micro ROM requires. A lot of that has been lost to time.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
MartyG
Posts: 7
Joined: 31 Oct 2023

Re: Implimenting BCPL on 6502

Post by MartyG »

Hi All;

Thank You, Gordon, for Your Prompt Reply, and help..

I have much of Martin Richards BCPL stuff, and I will take a look later at what I have..

He had a Disk Crash awhile back and I was able to help Him get some of His files Restored, from my back-ups..

I will look into the BBC Micro and other related files when I have the time..

Again, THANK YOU for Your Help and Suggestions.. Marty
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Implimenting BCPL on 6502

Post by drogon »

MartyG wrote:
Hi All;

Thank You, Gordon, for Your Prompt Reply, and help..

I have much of Martin Richards BCPL stuff, and I will take a look later at what I have..

He had a Disk Crash awhile back and I was able to help Him get some of His files Restored, from my back-ups..

I will look into the BBC Micro and other related files when I have the time..

Again, THANK YOU for Your Help and Suggestions.. Marty
I think it's one of those rock/hard places to work with - if you want to start from scratch and make a 16-bit BCPL system and are happy with cross compiling on (e.g. a Linux desktop) then it's probably not that hard. Even a 32-bit system on a 65C02 shouldn't be too difficult to imagine, but again cross compiling.

And there we have another conundrum - the current flashy 6502 projects seem to be designed for just that - compile C on a desktop and drag and drop an entire binary, bootstrap, code, the lot into some smart device incorporating either a real or emulated 6502 and "Ooo - look, I can blink an LED" and it's only taken 100 lines of C compiling to 10K of 6502 ....

What I wanted something that was a bit of a modern take on the thing I used in the 80s which wasn't some big S100 type thing running CP/M...

The current BCPL compiler is pushing 50KB (binary) so running it on a 6502 is not going to happen - hence I went to the 65816. It was not all I expected and the effort of making it look like a 32-bit virtual machine to the underlying BCPL was not as easy as I felt I could have been - and it wasn't as fast as I felt it could have been.

I did manage to get the original Acornsoft ROM going on my original 6502 system, but it won't run on the 816, even in emulation mode - I've not spent too much time, but I think it's because I moved the OS vectors and the BCPL ROM has them encoded in some weird way that my system can't find (I moved the Acorn MOS vectors due to the clash with the hardware vectors in the '816 and I can patch the BBC Basic, COMAL, and a few other ROMs just fine).

I'm interested to know how you're getting on though - maybe you can become the 3rd active BCPL programmer on the planet ;-)

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Implimenting BCPL on 6502

Post by BigEd »

(Welcome Marty! Great service you did there, helping recover data for Martin Richards!)
MartyG
Posts: 7
Joined: 31 Oct 2023

Re: Implimenting BCPL on 6502

Post by MartyG »

Hi All;
Thank You Gordon and Ed for Your prompt reply..
I Found the BBC Code that I have from Martin Richards, and I have the code for 16 bit from R. Nortier (spelling may not be correct.)..
Today has been busy and it looks like tomorrow will be busy as well also..
I am Wire-wrapping my 6800 Board, that way I can add things like Led's and it should hold together better than the Breadboard, that Ben Eater uses in the kits..
I have Martin Richards book, but, I also know that there was a Book for the BBC implementation, that I need to get a PDF of, which should help some.. THANK YOU Marty
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Implimenting BCPL on 6502

Post by drogon »

MartyG wrote:
Hi All;
Thank You Gordon and Ed for Your prompt reply..
I Found the BBC Code that I have from Martin Richards, and I have the code for 16 bit from R. Nortier (spelling may not be correct.)..
Today has been busy and it looks like tomorrow will be busy as well also..
I am Wire-wrapping my 6800 Board, that way I can add things like Led's and it should hold together better than the Breadboard, that Ben Eater uses in the kits..
I have Martin Richards book, but, I also know that there was a Book for the BBC implementation, that I need to get a PDF of, which should help some.. THANK YOU Marty
PDFs of the BBC Micro BCPL Books are online:

https://stardot.org.uk/forums/viewtopic.php?t=21166

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
MartyG
Posts: 7
Joined: 31 Oct 2023

Re: Implimenting BCPL on 6502

Post by MartyG »

Hi All;

Thank You Gordon.. I will take a look at these files later..THANK YOU Marty
MartyG
Posts: 7
Joined: 31 Oct 2023

Re: Implimenting BCPL on 6502

Post by MartyG »

Hi All;
Ok, what I am looking for next is the following snippets of code that will run with CC65, they are memcpy, realloc, calloc, malloc and getvec and how do I run CC65 on my linux machine,, (Linux Mint)..

THANK YOU Marty
MartyG
Posts: 7
Joined: 31 Oct 2023

Re: Implimenting BCPL on 6502

Post by MartyG »

Hi All;
Correction, Robert Nordier not Nortier..
https://www.nordier.com/index.html
For His 16 bit stuff..

THANK YOU Marty
GlennSmith
Posts: 162
Joined: 26 Dec 2002
Location: Occitanie, France

Re: Implimenting BCPL on 6502

Post by GlennSmith »

Hi, have you managed to get cc65 running on your Linux box? I have it running native on my (Mint) machine - I'll have to go and look at how I did it, though. Give a shout if you need help.
Glenn-in-France
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: Implimenting BCPL on 6502

Post by Proxy »

installing cc65 on linux is very simple, just do "sudo apt install cc65" in a terminal (assuming apt is the package manager) or use VScode and install the cc65 addon.
actually setting it up with a custom target is more complicated, but not by a lot as there is a small tutorial for it: https://cc65.github.io/doc/customizing.html
Post Reply