Why emulate other computers on the X16?

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
DragWx
Posts: 341
Joined: Tue Mar 07, 2023 9:07 pm

Why emulate other computers on the X16?

Post by DragWx »

...when it's already the perfect X16 emulator? :P

The X16 is pretty much a cousin of the C64 and the VIC-20, so it makes sense for users to wonder about running C64 or VIC-20 games on it (before being disappointed that it's not possible**).

What I'm wondering about more is, to those asking about something like a plug-in card that can turn the X16 into a ZX Spectrum or an Apple II for example, what do you see the X16 as? Like, what were you hoping to do with it?

It is fun to think about whether such a thing is possible at all on the X16, and hypothetically what it would take to do it. That's probably what's giving us the serial, wifi, and midi cards. :D

...but to me, it seems strange to think that there are many people who don't see the X16 as its own thing, and merely a stepping stone to something else. That is, "I have this thing, but I want it to be a different thing instead".

Maybe it's because we're so early in the X16's lifespan that it hasn't had time to really establish itself?

Maybe these are users looking for something to do with the X16, but aren't programmers or developers, so that aspect doesn't appeal to them?

This is actually pretty interesting about how we see weird new things like the X16. I wonder if there were similar situations long ago? Like, at the introduction of the VIC-20, were people wondering if they could run their Atari games on it? I'll bet that did happen. :D




** Yes, I know about BASIC V2 games, but you know what I mean. :P
mgkaiser
Posts: 60
Joined: Sat Dec 02, 2023 6:49 pm

Re: Why emulate other computers on the X16?

Post by mgkaiser »

You could probably pull off a VIC-20 emulator. VERA can do the VIC screen size. The screen size is small enough to scape an area of memory corresponding to the VIC-20 screen in an interrupt and update the VERA screen with the data. You can probably even do the same with the VIC ports. I had a PET emulator on my C-64 which did similar and made many PET BASIC programs work (and the C-64 was fractionally SLOWER than the real PET). 8Mhz should be plenty of slack to make a passable 1Mhz VIC-20 work. Will everything work? Likely not. But will many BASIC programs work? Likely.
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: Why emulate other computers on the X16?

Post by Edmond D »

mgkaiser wrote: Tue Oct 01, 2024 4:21 pm You could probably pull off a VIC-20 emulator. VERA can do the VIC screen size. The screen size is small enough to scape an area of memory corresponding to the VIC-20 screen in an interrupt and update the VERA screen with the data. You can probably even do the same with the VIC ports. I had a PET emulator on my C-64 which did similar and made many PET BASIC programs work (and the C-64 was fractionally SLOWER than the real PET). 8Mhz should be plenty of slack to make a passable 1Mhz VIC-20 work. Will everything work? Likely not. But will many BASIC programs work? Likely.
An emulator is a lot of work, and sometimes the environment doesn't do everything the original machine did.

I'd suggest porting any VIC-20 basic programs to the X16 platform rather than building an emulator for the X16 to host and run. This approach gives the program a new life, rather than having it trapped in time in the 1980s. The basic source code is just there. Of course complied or ML programs and anything that takes advantage of the VIC hardware would be harder or not possible to convert. Some programmers enjoy a challenge; the reward to them justifies their effort.

One of these days I'll have my X16 computer up and running and I am hoping to dabble in converting some of the sample game programs in the user guide to the X16. I'll start with a direct conversion, then squash some bugs and refactor the code, finishing with making the program as "X16ish" as possible. It might even be a collaborative effort.

Someday ....
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: Why emulate other computers on the X16?

Post by TomXP411 »

mgkaiser wrote: Tue Oct 01, 2024 4:21 pm You could probably pull off a VIC-20 emulator. VERA can do the VIC screen size. The screen size is small enough to scape an area of memory corresponding to the VIC-20 screen in an interrupt and update the VERA screen with the data. You can probably even do the same with the VIC ports. I had a PET emulator on my C-64 which did similar and made many PET BASIC programs work (and the C-64 was fractionally SLOWER than the real PET). 8Mhz should be plenty of slack to make a passable 1Mhz VIC-20 work. Will everything work? Likely not. But will many BASIC programs work? Likely.
Actually... that's possible, at least for some subset of VIC-20 software. Not everything would work, but since the X16's CPU is 8x faster, it can use those extra cycles to copy video from the VIC-20's frame buffer to VERA, and the hypervisor could monitor certain memory locations and perform the equivalent operations on the X16.

That won't work for anything that directly accesses BASIC or KERNAL code, although it might work for stuff that sticks to the public KERNAL jump table.
mgkaiser
Posts: 60
Joined: Sat Dec 02, 2023 6:49 pm

Re: Why emulate other computers on the X16?

Post by mgkaiser »

Yup. There are PET Emulators for the C64 that do exactly this and they work well enough, at least for BASIC programs, even though the C64 is maybe 3% slower than the PET due to the cycles that the VIC-II "steals" and even slower than that on a PAL C-64 given that they run a touch slower than 1Mhz.
DragWx
Posts: 341
Joined: Tue Mar 07, 2023 9:07 pm

Re: Why emulate other computers on the X16?

Post by DragWx »

A VIC-20 emulator seems like an interesting project, but what's on the VIC-20 that you want to see on the X16?

Because, if anyone wanted to play around with the VIC-20's BASIC interpreter, graphics, and sound capabilities, I have good news for you about your X16. :P
bit-twiddler
Posts: 2
Joined: Wed Oct 16, 2024 12:46 am

Re: Why emulate other computers on the X16?

Post by bit-twiddler »

I came over to the Commander X16 from the MEGA65 because the platform offered more to me than MEGA65 (I could have saved myself over $800 U.S. on the MEGA65 plus shipping). The X16 community is a heck of a lot more active in the U.S. than the MEGA65 (good luck on that forum if one does not speak German). I like the fact that the X16 is not trying to be a clone of a poorly documented unreleased computer, which is still poorly documented for anything other than BASIC programming (I haven't written anything in BASIC on a microcomputer since I purchased the Atari Assembler/Editor cartridge in 1981). The MISTer, which I also own, is a better deal for those who desire hardware emulation of a lot of different architectures. I like the fact that the Commander X16 offers a level of graphics not available on the early micros. It brings fresh ideas to old technology. Plus, it can also use a real 65816.

My goal is to port a Forth dialect that I wrote in IA-32 assembly language using TASM ideal mode in my free time during a period spanning 1995 until 2000 (I took my sweet old time). It is just under 5K lines of IA-32 macro assembler code. Forty kilobytes of memory is a lot of memory with Forth because primitive calls/jumps only require two bytes instead of three. Forth is faster than compiled C on the 6502 because the 6502 lacks support for a stack large enough to support invocation records (a.k.a. parameters and local variables) as well as lacking the ability to push a 16-bit value the on the hardware stack or a software stack with one instruction. With Forth, the dictionary can also be held in high memory and discarded when one is ready to "turnkey" an app; thereby, not consuming any of the lower 40K. The software stacks and coding techniques are optimized to make maximum use of values on the stack.
danboid
Posts: 73
Joined: Sat Jan 28, 2023 2:47 am

Re: Why emulate other computers on the X16?

Post by danboid »

The only people asking that are those who don't understand how much compute resources it takes to emulate one machine at full speed on another.

It also stems from the fact the the X16 is a new platform yet we've been able to play Mega Drive, C64 games etc on smart phones and similar devices for about 20 years now. I had a pre N95 / pre iPhone Sony smartphone in the early 2000's that had a full speed Mega Drive / Genesis emulator on it for example but I know enough to know that even that 20 year old phone has a much faster CPU than than the X16 does.
User avatar
Daedalus
Posts: 229
Joined: Fri Nov 11, 2022 3:03 am

Re: Why emulate other computers on the X16?

Post by Daedalus »

I think the problem is engineers. We have a penchant to "Look for problems to solve." whether that problem needs to be solved or not. Some problems are "Algorithm like" and have already been solved. Implementing an already solved problem is much easier than solving an actual problem, and itches the scratch of "Solving a problem."

That said, if you want to emulate a simple computer, use a complex computer with many many times the computing resources than the computer being emulated. A modern PC can be programmed to emulate virtually any 80's era computer with ease. Of course, then you'll have to learn to program in C and use a windowing library like SDL (Which is how the X16 emulator is made.)

I think danboid is right, people that casually ask for this don't really grasp the complexity of it. But that's OK. As Sun Tsu says, "The journey of a thousand li starts with the first step."

We're lucky, we live in an age where we can use ubiquitously available modern computers to emulate anything we can imagine that could have been built with 1980's or 90's technology, then, if we really want, use off the shelf microcontrollers and FPGAs to implement it. And the emulation part is cheap... you just use the computer you already have.
Post Reply