How do you make a QL emulator?

Discussion and advice about emulating the QL on other machines.
User avatar
Ruptor
Chuggy Microdrive
Posts: 70
Joined: Fri Dec 20, 2019 2:23 pm

How do you make a QL emulator?

Postby Ruptor » Tue Feb 04, 2020 9:05 pm

I normally deal with the bottom end code so this is probably a stupid question but just out of curiosity I would like to know. Do you use a processor emulator and run the original code in a shell on the computer OS or do you write a copy of the original code in a high level language that forms the emulator environment? As you can probably tell I don't have a clue. :? It seems like a very complicated thing to do but there seem to be a lot of QL emulators about so I am thinking perhaps it isn't that complicated.


User avatar
NormanDunbar
Aurora
Posts: 842
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Postby NormanDunbar » Tue Feb 04, 2020 9:42 pm

First you start with a brain the size of a planet!
Then you write or subvert an emulator for the processor and all its instruction set.
Then, somehow you emulate the hardware and when you load in your, perhaps modified, OS, it "just" works.

There's one here with source - just the mc68000 though - http://www.easy68k.com/.

Have fun.

Cheers,
Norm.


Why do they put lightning conductors on churches?
If at first you don't succeed, don't take up skydiving!
If you think your job is pointless, remember, there's someone in Germany who fits indicators to BMWs.
User avatar
tofro
QL Wafer Drive
Posts: 1789
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How do you make a QL emulator?

Postby tofro » Tue Feb 04, 2020 9:54 pm

With today's computers that are typically a 1000 times faster than the emulated CPUs probably a lot easier than it used to be (Note: I'm not saying it's a piece of cake, though).

Building a ZX Spectrum Emulator on a Gold Card QL running at close to original speed like some people did back in the 90ies or QPC1 that was running on a PC only within single digit times faster than the QL were real challenges, I guess ;)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
NormanDunbar
Aurora
Posts: 842
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Postby NormanDunbar » Tue Feb 04, 2020 10:18 pm

Shaun Morgan, on You Tube has some recent videos explaining how he wrote a 6502 emulator from scratch.

https://m.youtube.com/channel/UCO1kd2kMBLS_Q1u5zpRRXuQ - the first, of 18 or so, is at https://m.youtube.com/watch?v=saelqL-qCsc&t=3s.

Cheers,
Norm.


Why do they put lightning conductors on churches?
If at first you don't succeed, don't take up skydiving!
If you think your job is pointless, remember, there's someone in Germany who fits indicators to BMWs.
User avatar
Ruptor
Chuggy Microdrive
Posts: 70
Joined: Fri Dec 20, 2019 2:23 pm

Re: How do you make a QL emulator?

Postby Ruptor » Wed Feb 05, 2020 11:36 am

NormanDunbar wrote:First you start with a brain the size of a planet!
There's one here with source - just the mc68000 though - http://www.easy68k.com/. Have fun.
Thanks but I was only interested in how it is done I don't want to attempt it. :o My brain is the size of a pea. I was curious why there was so many and thought it must be an easy process. :? I guess it is just like the millions of Linux versions people can do it so they do but I don't know why it is just a waste of resources. One OS that works properly is enough. Imagine if we pulled all the people together and they wrote a program that did the coding, compiling and linking we could get on with the design & application that computers can't do yet. :)


User avatar
mk79
Gold Card
Posts: 459
Joined: Sun Feb 02, 2014 10:54 am

Re: How do you make a QL emulator?

Postby mk79 » Sat Feb 08, 2020 6:10 pm

Ruptor wrote:
NormanDunbar wrote:First you start with a brain the size of a planet!
There's one here with source - just the mc68000 though - http://www.easy68k.com/. Have fun.
Thanks but I was only interested in how it is done I don't want to attempt it. :o My brain is the size of a pea. I was curious why there was so many and thought it must be an easy process. :?
Well, many people climb mount Everest every year even though it has been done before.

My excuse is that I'm pretty sure I was the first one who ever managed to write one ;) Many thought it was impossible back then, but I was young (14 or so) and didn't know it was not possible, so I just wrote one.

Marcel


User avatar
NormanDunbar
Aurora
Posts: 842
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Postby NormanDunbar » Sat Feb 08, 2020 8:43 pm

It's either write an emulator, or, write a compiler - that's what I think. I sort of did the latter.

Cheers,
Norm.


Why do they put lightning conductors on churches?
If at first you don't succeed, don't take up skydiving!
If you think your job is pointless, remember, there's someone in Germany who fits indicators to BMWs.
User avatar
mk79
Gold Card
Posts: 459
Joined: Sun Feb 02, 2014 10:54 am

Re: How do you make a QL emulator?

Postby mk79 » Sun Feb 09, 2020 12:04 am

In university I always thought "I will never have to implement my own compiler, why should I learn this?". 20 years later designing and implementing a programming language for our test engineers is a pretty big part of my job, so all that knowledge about abstract syntax trees and stuff came in handy after all ;)


User avatar
NormanDunbar
Aurora
Posts: 842
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Postby NormanDunbar » Sun Feb 09, 2020 12:16 pm

I love compilers and language parsing. I'm not too good at it I admit, I did write something many years ago called ARSE, ARchive Syntax Evaluator, in C68, to parse a set of Archive program files. I tested it on a few commercial packages that I had at the time, and I remember finding bugs in them! The intention was to write the parser and when it was working, to build an Archive to DBAS converter - I nearly finished it! Well, the first part.

I knew nothing about ASTs back then, but these days, if I need a parser I don't bother writing it by hand, I use ANTLR4 (Honey Badger) by Terence Parr, and that makes life so much easier. I do have one parser out there in the wilds of GitHub, it's the one I wrote to parse an Oracle TNSNAMES.ORA file as we were having numerous problems at work with the global one. The parser discovered hidden characters within that were causing the problems so it did have a purpose. My first ever real success in the subject.

My current long term project is a complete rewrite of CPORT, from the ground up. However, I'm currently working one two books, one is currently going through "Editorial Approval" where the (Apress) "correct" all my English spellings into Americanisms, and the second is still being written. Which is why there is nothing much happening on the Assembly Language eComic at the moment.

You were 14 when you decided to write QPC? You know that planet sized brain I mention from time to time? It must be the size of Jupiter!


Cheers,
Norm.


Why do they put lightning conductors on churches?
If at first you don't succeed, don't take up skydiving!
If you think your job is pointless, remember, there's someone in Germany who fits indicators to BMWs.
User avatar
mk79
Gold Card
Posts: 459
Joined: Sun Feb 02, 2014 10:54 am

Re: How do you make a QL emulator?

Postby mk79 » Sun Feb 09, 2020 10:10 pm

Cudos for the ARSE name ;) I use a traditional FLEX/BISON setup for my stuff, but yeah, using a parser generator is a huge plus. I'm really curious what your books will be about, I always thought writing a book is pretty cool :-)

Yeah, I first decided to write "PCQL" as it was called then when I was 13. I had just switched to the PC and was pretty heart-broken about leaving my QL, but the PC had 16 million colours, which was just too alluring... I let the project lapse for a while because I thought the QL community was pretty much dead ("ha!" I say, 25 years later). But then a new issue of the German club magazine came out and 10000 lines of assembly code later the first working beta version (still using Minerva as OS) was revealed shortly before my 16th birthday. A few months later I got the SMSQ/E sources and the rest as they say is history ;) Regarding the brain, most of the time I can hardly remember what I had for breakfast, so it can't be THAT big, but thanks :-D



Who is online

Users browsing this forum: No registered users and 3 guests