Last visit was: Thu May 01, 2025 11:18 am
It is currently Thu May 01, 2025 11:18 am



 [ 1 post ] 
 Reviving a 68000 handheld project 
Author Message

Joined: Tue Jun 03, 2014 2:40 pm
Posts: 139
Hello!

It's been a while since I announced my EPiC project (https://anycpu.org/forum/viewtopic.php?t=135) here, and a lot has changed since then. That's still on hold, but I am finally getting back into a related project from years past - a handheld PDA-like computing device reminiscent of the PalmPilot organizers of old. Even though this is a different project from EPiC, the two have a shared heritage in the 68000; EPiC was to be based on a 68060, and the handheld was originally intended to contain an actual, full-fat 68000 CPU, just for the fun of it. However, it quickly became apparent that for efficiency reasons, I would need to not do that and opt for a more modern CPU instead, either a "mobile" 68000 (such as the ColdFire line of chips which Palm chose for their handhelds) or a modern microcontroller, like one of the numerous ARM variants. I eventually chose the latter, settling on an ARM Cortex-M7. And to get something like that to run 68K code, I'm working on a virtual machine to emulate a 68000, a similar approach to what Android did in the early days, using the Dalvik virtual machine to allow Java apps to run regardless of the CPU type on which Android was actually running.

Back in the day, when I first came up with this project, I discovered the EASy68K simulator and, suddenly, with a single software package, I had the ability to write, edit, assemble and simulate the code which would ultimately run on my handheld. Nice! This was pretty sweet back when Windows 7 was the dominant OS but, nowadays, I'm a Linux guy and I haven't found a similar package to EASy68K to run on this platform, at least not one with the ease-of-use that EASy68K had. Specy (https://asm-editor.specy.app) is nice, but doesn't support all 68000 instructions and, to the extent that I saw, doesn't have any kind of hardware simulation, such as input switches, buttons, sound, or displays. So I figured, why not make my own? And since I'm going to the trouble, why not make it run in a web browser, so that everyone can enjoy it without worrying about their OS? (Side note on that here: https://anycpu.org/forum/viewtopic.php?t=1135) And with that, the die was cast. I had myself a plan. :)

Over the course of making this simulator, something became quickly apparent: the 68K is a pretty robust architecture, but one side effect of this is that its instructions are sufficiently packed to the point that decoding them on the fly would incur significant overhead, making doing so less-than-ideal. The upside, though, is that this overhead can be avoided in one of two possible ways:
    1. A just-in-time translator could be employed to run through the entire 68K app at load time and unpack all the instructions to simple and easy to access data fields before execution begins.
    2. An ahead-of-time recompiler could translate traditional 68K machine code to bytecode of my own design, which would be the only thing the virtual machine would have to understand.
Method #1 is the technique I'm currently using in my simulator, while method #2 is the technique I plan to use in the actual handheld (and maybe a future separate online simulator as well). That means that I now need to invent a virtual CPU which will, by necessity, need to implement all the instructions of the 68000, though will not be compatible with its machine code. The more straightforward manner of instruction encoding on my virtual CPU should result in a marked uptick in efficiency; instead of having to mask and shift multiple times to unpack all the operands of an instruction, it would be as simple as one byte for the instruction, one byte each for the two source operands and one for the destination operand. I know 32-bit instruction words are not the most efficient use of memory space, but that's a tradeoff I'm willing to make to see exactly how fast I can get the emulation to run. Not to mention the fact that this virtual 68000 would have the possibility of a ton more registers available than its silicon counterpart. MOVE512 instructions, anyone? :D And if space does turn out to be an issue, I could compromise a bit and perhaps have one byte for the instruction and have each instruction use only two operands (a source and a destination) instead of three, a 25% space savings.

As opposed to making my own instruction set from scratch, it would make more sense to use some existing architecture - either that of a "real" CPU or one that was perhaps made by someone here - which would fit this bill. And that leads me to the point of my post today. :)

Does anyone have any suggestions for such an ISA? Is there anything you've encountered which focuses on minimal decoding/unpacking logic and emphasizes raw speed? Preferably something which is 68000-based... or at least 68000-adjacent lol

I'm not asking you folks to do the work for me - I've begun reviewing some of the posts on here in my minimal spare time to see if anything would meet my requirements - but I figured it never hurts to ask as well, since you guys have a lot more cumulative exposure time to the CPU world than I do.

Thanks in advance! :)


Thu Nov 07, 2024 9:54 pm
 [ 1 post ] 

Who is online

Users browsing this forum: AhrefsBot, claudebot, SemrushBot and 0 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

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