6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 9:22 pm

All times are UTC




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri May 31, 2024 6:33 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
resman wrote:
Would it be possible to create a subforum, something like "6502 and Beyond" to explore such possibilities without polluting the true nature of this site?

Ed has a list of topics on expanded 65xx processor ideas, "Index of threads for improved 6502 and derived architectures."

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri May 31, 2024 9:23 pm 
Online
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
resman wrote:
Would it be possible to create a subform, something like "6502 and Beyond" to explore such possibilities without polluting the true nature of this site?


Answering this first - That's up to the people who run this site - not me. I'd like to think another sub-forum would work, but who knows...

resman wrote:
Gordon-

I've also been contemplating my future direction with the 6502 environment. My own project, the AppleIIPi, was an attempt to integrate the Apple II and 6502 into a modern Linux environment. I still use this everyday and it satisfied that itch, but skipped the in-between stage of a modern equivalent of a retro 6502 platform.


Curiously, since moving to the Pi, more possibilities have opened up for me - one thing I was never able to successfully do with my 6502 SBCs was nice video - and I think that's still something that eludes other too, but ... writing a 65C02 emulator in BCPL (or even ARM assembler) is relatively trivial, giving it some video RAM, or a framebuffer of sorts, porting my OS (or any other OS) to it is do-able, then I have a 65C02 with screen, keyboard and storage... Full circle as it were... but it does go somewhat against my initial desire to have real, physical hardware in-front of me.

I would also add that I'm not wedded to the Pi - it's convenient in this instance and I am very familiar with it but it's overly complex for this. At least I'm not running Linux on it. It's also a vehicle to making the bytecode part a "real" CPU implemented via the PiTubeDirect system on a BBC Micro.

Quote:
I think we both appreciate abstracting the 6502 through techniques such as bytecode VMs, so the idea of abstracting 6502 constructs to modern RISC CPUs would be a logical step. I'm intrigued by your experiments with porting the BCPL interpreter to ARM and RISC-V and the lessons learned.


Well, the experiments worked and the main lesson here is.. do it sooner.

The key thing that helped was having the OS and utilities written in a high level language. Binary compatibility was a bonus - easy for a bytecode interpreter - harder if I'd had to re-write the code generator in the compiler.

The ARM has some 6502 ideas - pipelined architecture, indexed addressing modes and similar condition codes come to mind, but somewhat expanded. The early ARMs had 10x the transistors of the 6502 though.

Also, running my own OS on a faster platform has actually enabled me to find bugs in the '816 version - mostly because I'm doing things on the ARM that I'd not think to do on the '816 as they'd take too long - writing the Bubble Universe for example found some bugs in my terminal/graphics drivers and writing some of the bytecode instructions in RISC-V then ARM gave me some ideas about improving the efficiency of the '816 code. There's only so many ways to calculate a Mandelbrot too, but now I can move from ASCII to colour graphics...

I'm now pondering if I ought to have made the jump to 64-bit. I started with 16-bit BCPL on the 8-bit 6502, then 32-bit BCPL on my Ruby 816 system, but now stuck to 32-bit on a 32-bit CPU? 64-bits may have to wait until I jump to a 64-bit CPU. (Taking BCPL to 64-bit is relatively trivial - there is just one bytecode instruction needed to handle it and the compiler does the rest)

But that goes back to one desire I had which was for a fully self-hosting platform. I know there are C compilers out there (for the 6502) and endless Basics but it seems we've lost, or almost lost the means to compile C on a 6502 system - I have the Aztec C disks for the Apple II, but would that help on my own 6502 SCB? Not really. Cross compiling? Well, anyone can do that but we didn't do in in 1980 so why do it now? (And hands-up, yes, I cross assemble 6502 and '816 code on my desktop) When I started on the '816 system there was not a workable C compiler for it that I could use.

The beauty of the bytecode is that I was able to run the OS and utilities as a binary on the other platforms without re-compiling it or the supporting libraries. I am able to compile the central 'exec' (the CLI and support) directly on the system, install and test it without rebooting or resorting to cross compiling. (I can do this on the '816 but compiling it takes 2 minutes on the '816 rather than 1/2 second on the ARM)

And the high level language thing - I've developed a multi-tasking OS in it with a nice (to me) CLI, the usual/generic utilities and so on in far less time that if I'd done it all in assembler - but yes, there are trade-offs - speed being the main one. But historically, using a high level language has been the way forward for things like portability. Unix 1,2 and 3 were in assembler, but v4 onwards in C - complexity was rising and it ultimately enabled it to be ported to systems other than the PDP11..

My first porting effort - to the RISC-V platform did involve some changes to the BCPL and re-compiling bits of the bootstrap system, but mainly to do with passing in data like ram regions and so on. When I developed the system initially, I had a concept of "Lo" RAM and "Hi" RAM. Lo RAM was Bank 0 in the '816 and was necessary because program stacks and the "global vector" had to live in Bank 0 as I was using 16-bit pointers to access that data. This was a huge speedup for those operations on the '816, so to launch a new program, I needed to allocate RAM for the program (Hi RAM) and RAM for the stack and global data (Low RAM) so there are effectively 2 heaps and 2 versions of getvec (the BCPL malloc) I changed this slightly to "fast" and regular RAM for the RISC-V (same RAM, but maybe in some systems they might be faster?) and kept this for ARM. But other than that there really weren't many changes needed, other than the slog of translating the '816 code into RISC-V, then into ARM. It got easier and as learned more ARM it got faster - what can take 9 instructions in '816 land takes 6 instructions in RISC-V land and takes just 2 in ARM land.... (It's almost as if ARM was designed to be an emulator for bytecodes!)

And lacking real hardware initially, being able to use the existing system to emulate a RISC-V CPU was good too. It was goo enough to enable me to boot the existing OS under the emulated RISV-V CPU too. I had working ARM hardware and an existing framework that would let me boot the ARM via network (PXE) which made testing the ARM version much easier. (Although I could just have booted it under Linux, but I didn't)

Quote:
I think what I'd like to investigate are extensions of the 6502 into the 32 bit realm. Not exactly the 65832 discussion (which didn't seem to drive all the 8 bit diehards away), but something along the lines of 6502 inspired macros that would expand to native 32 bit (perhaps even 64 bit) ARM/RISC-V code. I've also recently enjoyed playing with the lib6502 simulator that could easily be employed to provide 8 bit binary compatibility for 6502 code. I used this exact concept to implement a PLASMA testing platform under Linux, sans the ability to run native 32 bit code. lib6502 could easily be modified to allow jumping into the native 32 bit code environment that in turn could provide basic I/O and filesystem capabilities for whatever environment *it* was running under - from bare metal to Linux.


Well - given that the 6502 is Turing complete, then anything's possible :)

Macros (see also the Acheron system), your Plasma and things like Sweet-16 can be used to give you alternative environments - at the cost of execution time but the convenience of using them can outweigh that disadvantages. when I was toying with another project (a high performance BASIC for the 6502), I wrote it's memory allocator in Sweet-16....

The big thing I think needed to move beyond 8 bits in hardware is a wider data bus. That alone will save cycles - but in the retro world pushes up costs and potentially chip count. The '816 needs 2 cycles to read a 16-bit data value or 4 if it was expanded to a 32-bit system... And it still infuriates me that I have to AND #$00FF when reading a byte from RAM in 16-bit mode.

One issue with wider data and address buses is the chip pin count - that's when it starts to get out of the through-hole hobby reach. 32 data bits and even 24 address bits plus supporting clock and IO signals really takes out into QFP or PGA style packages - neither which are hobby hostile, given a keen hobbyist, or we're back to some sort of SoC with embedded RAM. My ideal "wide" 6502 would have native width buses with a generous linear address space (and I really only need 24 bits at most) the ability to fetch bytes - but the issue may then be instruction width and alignment. Early > 8 bit CPUs didn't handle un-aligned data well - even the early ARMs didn't until v6, so you had to do loads, masks and shifts. What about load immediate? LDA # ... You need 5 bytes for that to load a 32-bit value and when memory is 32-bits wide, is that going to take up 2 x 32-bit words with 3 bytes wasted, or do we do it another way? Many questions to ask and think about.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 7:00 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Thanks for an interesting thread Gordon - and your tabulation of what a next-opcode routine might look like is very illuminating. RISC-V is designed to allow for very cheap and alternatively for very fast implementations - many more opcodes needed but very amenable to an advanced CPU implementation. If programming in a HLL, RISC-V might be a win, but for me it's clear that ARM is a great place for coding by hand or for HLL targets.

No mention yet of the Pico or RP2040 - perhaps it has just too little RAM? It's very much a deterministic machine, fast enough to do bit-banging, and with very good documentation. Admittedly, not a very short document.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 7:59 am 
Online
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
BigEd wrote:
No mention yet of the Pico or RP2040 - perhaps it has just too little RAM? It's very much a deterministic machine, fast enough to do bit-banging, and with very good documentation. Admittedly, not a very short document.


I did look at it - and yes, for me, it's RAM. (Same as the RV and other ARM "mirocontrollers")

However, and again for my application, serial RAM might be an option or even a parallel RAM using it's GPIO pins, using the internal RAM as "fast" RAM and the on-board Flash to hold the OS, etc. so the only thing in external RAM would be user code. Implementing a QSPI interface may be possible and fast but that's thoughts for another day.

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 3:07 pm 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 230
Location: Kent, UK
If you can find an ARMv8 platform that suits you then that's going to be a lot of fun. The different security domains, protection levels, MMU, SMMU and virtualization... lots of scope for fun if that sort of thing appeals to you. All these things are fully specified in ARM's Architecture Reference Manuals, and there's a whole world to explore.

If you're interested in VHDL or Verilog and FPGAs, then designing your own CPU core would be a lot of fun. I've done a few - all very simple integer-only pipelines - and you can use something like nanoasm from 8bitworkshop as a configurable assembler so you don't have to write your own (unless you want to).

With a little FPGA board, you can design your own system with Flash, SRAM or DRAM, UART, SPI, I2C and whatever else you need. Of course opencores.org is a good source, and if you make everything Wishbone compliant then you'll have an easier time integrating 3rd party cores. Or you can keep to simple I/O and write it all yourself. SRAM, UART, and SPI controllers are fairly trivial. VGA is fun to work on.

I'd certainly be keen to read about your progress whichever path you take.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 3:55 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
ARMv8... the Pi Zero 2 W has one of those. Something under £20. Gordon knows this well, as do some others here, but it's worth emphasising that the Pi family is not just for Linux. Bare metal coding is quite possible, the toolchain isn't too scary. It's a complex pipelined CPU with cache, so you'll probably not be cycle-counting, unless you choose to code for the GPU instead (as is done in PiTubeDirect which might be a project worth looking into for hints as to what's possible and how it's done.)

But of course any Linux-capable CPU is going to be complex and might not have the sheen of retrocomputing.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 4:50 pm 
Online
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
sark02 wrote:
If you can find an ARMv8 platform that suits you then that's going to be a lot of fun. The different security domains, protection levels, MMU, SMMU and virtualization... lots of scope for fun if that sort of thing appeals to you. All these things are fully specified in ARM's Architecture Reference Manuals, and there's a whole world to explore.


Thanks and.. Yes, but ...

This isn't about arm, Arm, ARM... It's more about a "what if" ... What could have come after the 6502, the 65816, the ...

Apple flirted with an enhanced 6502 (the Apple ///) and the 65816 (Igs) while really going gown the 68K route.

Both Commodore and Atari went down the 68K route too.

Acorn flirted with the '816 and INS 32016 while getting ARM ready.

So ...

My choices for a mid-80's-ish CPU after the '816 might be 68K or what? Well, ARM was there, or just about. The Inmos Transputer was also there, as was the 32016.

(I'm quietly ignoring Intel at this point before anyone reminds at me)

As it happened, my career took me down the Transputer and 68K route, but the 68K was merely a tool (in the form of a Sun Workstation) to get code going on the Transputer.... Getting them today is somewhat tricky though. I did buy an Acorn Archemedes with ARM CPU and a few MB of RAM in the late 80s though.

Quote:
If you're interested in VHDL or Verilog and FPGAs, then designing your own CPU core would be a lot of fun. I've done a few - all very simple integer-only pipelines - and you can use something like nanoasm from 8bitworkshop as a configurable assembler so you don't have to write your own (unless you want to).


I am interested, but it's all about time and energy. The CPU I'm using is a virtual bytecoded one - it's the target of the BCPL compiler. It's not a trivial instruction set to encode inside a FPGA - although, saying that, neither is the Transputer assembly code but that's heavily microcoded - that would be the way.

An alternative would be to create a CPU that is C friendly - but we already have those... I'm keen to stick with BCPL for now.

Quote:
With a little FPGA board, you can design your own system with Flash, SRAM or DRAM, UART, SPI, I2C and whatever else you need. Of course opencores.org is a good source, and if you make everything Wishbone compliant then you'll have an easier time integrating 3rd party cores. Or you can keep to simple I/O and write it all yourself. SRAM, UART, and SPI controllers are fairly trivial. VGA is fun to work on.


That was my aim with RISC-V. I tried to use the GoWin tools to create a device that had a RISC-V core, wishbone bus, 1MB of RAM, video, peripherals, but it really didn't work and I ran out of time + energy to continue.

Quote:
I'd certainly be keen to read about your progress whichever path you take.


Thanks,

Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 5:01 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Yes, likewise, always interested to hear about progress - even partial progress!

I wrote the merest modicum of assembly language for the 68000, but as I recall it wasn't too bad. Fairly symmetrical, and you don't need to know the obscure opcodes if you can get the job done with the common ones.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 7:09 pm 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 230
Location: Kent, UK
Sorry, I guess I misunderstood the goal. I kinda thought burning time and energy was the point. After all, this is all just nerd-noodling, right?

My first job was a Transputer project. I had a couple of connected T800 boards with 10Mbps Ethernet ports on each and I had to write Occam for an Ethernet bridge; sending address learn-messages and packet data across the interconnect. Inmos had an Advanced Transputer Engineering course that I attended... I probably still have the folder full of stuff somewhere (this was in 1990). The course didn't help too much: the performance ended up being awful - probably my student-level Occam wasn't up to it. Still, it was only a 3 or 4 month proof-of-concept project to justify the hardware that my team kind of inherited. I moved onto a 68000-based VME chassis doing some different networky thing; this time in 'C' with a message passing RTOS. Good times.

On the custom CPU front, rather than go down the complex instructions with microcode route, or doing something fully generic and 'C'-generic, which you don't seem keen on, you could stay with the RISC philosophy, but target a tiny instruction with a bare minimum useful instruction set and addressing modes suitable for BCPL. Make that part of the fun of the endeavor.

A different direction entirely could be to do something like the Am2900 bit-slice designs of the mid-70s... a bit-slice machine (in Verilog/HDL), and have your implementation language be microcode rather than assembly language. Drive those muxes and selectors by hand. Oh boy that sounds like so much fun I may have to look at that myself.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 7:54 pm 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 984
Location: Potsdam, DE
AndrewP wrote:
There are still a few ARM processes that are available in LQFP but even the smallest has 100+ pins and a 400+Mhz clock speed.


Sadly I know of no DIP packaged current ARM chips, but the STM32L072 and many of its M0, M0+, and M3 friends run at manageable clock speeds - 32 to 84MHz, and is available in LQFP from 48 pins and up - reasonably manageable with care.

If you're really masochistic, there are some 8-pin arms from STM but I haven't got my head around them yet :mrgreen:

Neil


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 01, 2024 8:22 pm 
Offline

Joined: Thu Mar 03, 2011 5:56 pm
Posts: 284
Don't know about "current", but the NXP LPC1114 appears to be available in a 28-pin DIP package. Only 32KB ROM and 8KB RAM, though.

https://www.digikey.no/en/products/deta ... 12/3430860


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 02, 2024 3:53 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
One of the problems of going to ARM is that there is very little chance of getting a microprocessor, they are all microcontrollers for the simpler ones, and SoC's for the more complex ones (and with complex RAM requirements). I did have a brief look at early ARM chips, but didn't have much luck finding any still available, things ARM1/2/3 from Acorn even up to StrongARM. The consistency of the instruction set is appealing for ARM.

68000 is another option worth considering. There's a lot more software available and you can still get microprocessors. People are building their own 68030 designs without much trouble, and there is a lot of capability there. Plus it's easy to interface with the same I/O chips we are already using.

On the other hand, I do believe there is a lot of scope for working with the 65C816 and building on its capabilities. There's still a lot of discussion around supporting high level languages, I do believe that it can make a good target for a compiler and we could do a lot more here. I've been working on some things, but still far from finished. I would like to see a 65C816 with a full 16-bit bus, that's only going to happen with a FPGA now, but it would be interesting to work with. I don't know why one wasn't produced at some stage, Rockwell was making a lot of 64-pin chips in their QUIP layout, and PLCC was starting to appear, so it would have been easily possible, but not backward compatible.

So for me, I think there is still a lot to do with the 65C816.

Also, I don't think this kind of discussion is off-topic for 6502.org, we are discussing other architectures, but the discussion is firmly based in a starting point of 6502/65C816 so it's interesting to quite a few of us.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 03, 2024 1:58 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
jds wrote:
68000 is another option worth considering. There's a lot more software available and you can still get microprocessors. People are building their own 68030 designs without much trouble, and there is a lot of capability there. Plus it's easy to interface with the same I/O chips we are already using.


Interesting, I had been looking for some of the earlier 68000s and hadn't had much luck beyond finding some (I think referb) parts off of Jamco.

Quote:
...
I would like to see a 65C816 with a full 16-bit bus, that's only going to happen with a FPGA now, but it would be interesting to work with. I don't know why one wasn't produced at some stage, Rockwell was making a lot of 64-pin chips in their QUIP layout, and PLCC was starting to appear, so it would have been easily possible, but not backward compatible.


I would love for WDC to come out with a 56-pin PLCC 65816 where we didn't have to do the de-multiplexing ourselves.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 03, 2024 7:34 am 
Online
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Yuri wrote:
I would love for WDC to come out with a 56-pin PLCC 65816 where we didn't have to do the de-multiplexing ourselves.


There are some of solutions here - One is the W65C816SXB board which has a big external bus connector with the full bus and signals, etc. It's stuck at 8Mhz and has the old buggy ACIA on-board though - IO is decoded at $7Fxx which may or may not be an issue. Some of the other SBCs from WDC look attractive, but lack full external buses from what I recall.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 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: