How do you make a QL emulator?

Discussion and advice about emulating the QL on other machines.
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 » Mon Feb 10, 2020 10:16 pm

Evening Ruptor.

You ask why someone should reinvent the wheel, re Python.

Why not? Maybe Guido had one of those itches he needed to scratch - the current crop of languages didn't do it for him perhaps? Why do we have lots of anything? TV channels, car manufacturers, 1980s retro computers etc. I'm not sure why you think it's a problem.

If we just stuck with what we had, but tried to improve it, where would we be I wonder? Chasing animals across the plains of Africa armed with "Pointy Stick, version 2020" perhaps? :D

I was taught structured programming too, Jackson SP, to be precise. I still use it today because it mainly works. But JSP was another version of SP back then - so why bother with inventing JSP when we had a perfectly good SP?

Who gives a toss what the OO crowd say or think? Not me, and I suspect, not you either - but it has it's place. I wrote a utility for work in plain C and it worked, but maintaining it was a nightmare. (No, my code wasn't that bad!) When I updated it to C++, it became far easier to maintain and enhance.

Progress comes in many forms, better versions of your current thing, new ways to do or use it, and so on. People do it because they can - although sometimes just because you can, doesn't mean you should!

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.
stevepoole
Trump Card
Posts: 226
Joined: Mon Nov 24, 2014 2:03 pm

Re: How do you make a QL emulator?

Postby stevepoole » Mon Feb 10, 2020 11:28 pm

Hi all,
OK, so Python is said to be THE programming language of today....
But if so, why are there not dozens of Python magazines printing hundresds of complex programs written by ordinary people, as there were for BASIC in the eighties ?
And is Python that easy to use ? Instead of getting down to writing code, you have to adapt, drag and drop snippets of bits and pieces all over the place... to assemble them. Not exactly intuitive !

QL Procedural Basic keywords can be learnt quickly. (My daughter wrote her first program when she was six...).
BASIC was the language of choice in the 80s. Today's children need it, if they are to acquire the programming skills that employers are finding it difficult to detect in them these days.
Basic is slow, which is why we need compilers that can translate it into javascript, to run fast on most platforms.
The main difference betwwen basic code and javascript is simply one of syntax. The logic structures are pretty much the same.
Having hand-coded some Basic to Javascript, I would welcome a transpiler that could do the job for me....
Such a transpiler now exists for Atari & Amiga, but we must wait for a 'standard Basic' version that will be OK for QLs.
Steve.


User avatar
Pr0f
Gold Card
Posts: 468
Joined: Thu Oct 12, 2017 9:54 am

Re: How do you make a QL emulator?

Postby Pr0f » Tue Feb 11, 2020 7:53 am

I have a device called a TINI which is based on an 8051 derrivative - it basically runs Java byte code - so it's reasonably quick, and you can just throw java at it, through a simple compile at run time mechanism.

I see no reason why something similar couldn't be done with a tokenized BASIC - so the speed becomes less of an issue.

There are several PIC32 BASIC implementations that use this approach and run like greased goosse shit off a stick. It's entirely feasible that a similar approach for the 68K could be done.


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 11, 2020 9:08 am

Hi Steve,

stevepoole wrote:Hi all,
OK, so Python is said to be THE programming language of today....
But if so, why are there not dozens of Python magazines printing hundresds of complex programs written by ordinary people, as there were for BASIC in the eighties ?
And is Python that easy to use ? Instead of getting down to writing code, you have to adapt, drag and drop snippets of bits and pieces all over the place... to assemble them. Not exactly intuitive !


At the moment, it does seem to be Python (or Go) which are flavour of the month. I much prefer Python myself. Go is just a little too weird for me.


stevepoole wrote:QL Procedural Basic keywords can be learnt quickly. (My daughter wrote her first program when she was six...).
BASIC was the language of choice in the 80s. Today's children need it, if they are to acquire the programming skills that employers are finding it difficult to detect in them these days.


I'm afraid I'm going to disagree - children do not need it at all. No employer is looking for Basic as a skill I'm afraid. I've had Basic on my CV for years (since 1982 at least) and so far, I've never seen a Basic job advertised, or requested as a skill, and as I contract, I've never had a contact asking if I can do Basic. It's a beginner's learning language and not much more. I last wrote a Basic program in about 1981 at the North of Scotland Hydro Electric Board HQ in Aberdeen. It was a small data entry system to reconcile pre-pay electricity meter readings with the money collected from within them.

I see and hear about lots of jobs looking for Python skills, amongst others - Java, C/C++, SQL, PL/SQL even Cobol, but never Basic. (Or, indeed JavaScript!)

There are plenty of kids around with coding skills (some of them better than mine too) who have never coded in Basic - thanks in the main to the Raspberry Pi which does tend to favour Python.

stevepoole wrote:The main difference betwwen basic code and javascript is simply one of syntax. The logic structures are pretty much the same.

So, learn Javascript instead of Basic?

stevepoole wrote:Having hand-coded some Basic to Javascript, I would welcome a transpiler that could do the job for me....
Such a transpiler now exists for Atari & Amiga, but we must wait for a 'standard Basic' version that will be OK for QLs.
Steve.


The problem, I think - with my limited knowledge of the exact utility you mention - is that QL SuperBASIC is far far better than your average run of the mill Basics. If we want a transpiler to convert SuperBASIC to JavaScript, we are going to have to do it ourselves. I doubt that anyone in the Atari or Amiga camps will do it for us - they already appear to have their needs catered for. We could, of course, start off from where they are and modify what they have for our needs .... if we wait, it will be like the "second coming" - predicted often and it never happens!


Perhaps, if I write C68Port, my clone of CPORT, then if I write it correctly, it might be a fairly simple process to change the back end code generator to generate JavaScript instead of C68 code. Watch this space...


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 11, 2020 9:25 am

Norman

what employers are looking for today is people who can write software that other people can understand.

Just because software today is no longer a one-man show. The language is basically (sic) irrelevant as long as it's something everybody can manage. Python is just one example (and I like it).

Most of what was developed in terms of programming languages during the last 30 or so years was exactly trying to improve that situation: Languages you can read and understand instead of write-only ones. And yes, in my experience that situation has improved with these developments (not so much as it could have, maybe, but still a lot of improvement).

Another aspect: Singing the song of praise to BASIC (in general) is maybe a severe exaggeration not deserved by a lot of dialects. (not so much for properly written SuperBASIC, maybe) - On the week-end I have tried to write a very, very simply ZX Basic program to get something going on the Spectrum - That touch of romance I felt in the beginning soon faded away to nothing - Oh my, is that limited and slow!


Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
stevepoole
Trump Card
Posts: 226
Joined: Mon Nov 24, 2014 2:03 pm

Re: How do you make a QL emulator?

Postby stevepoole » Tue Feb 11, 2020 10:36 am

Hi Norman,
Python produces very verbose code : the bloatware syndrome. It reminds me of Turtle graphics, an alternative language for small children who have not finished secondary maths education. It seems easy, but takes you away from real coding.
IBM BASIC is not good because of GOTOs, but Procedural Basics allow good naming, the key to writing comprehensible code.
Javascript is a great language , as it allows code to be run on almost any platform, but being compiled, is hard to debug. BAsics, being interpreted are much easier to prototype with. Once your program works and is debugged, handcode it into flutter, dart, kotlin,angular, php,ruby, Net or any of the many languages employers demand. (This plethora of frequently updated languages and platforms is why youngsters get discouraged from their initial projects... writing games ! )
I still have hundreds of often complex basic programs from divers magazines in a cupboard, for all machines. I know the guy that wrote the 'magic snake' program in Basic on his Oric Atmos one day. He was immediately employed by French Telecoms as a software engineer, even though he was only a school teacher ! Employers want people with Logic, rather than a vast knowledge of Visual studio or whatever.
Learning Basic is a good stepping-stone for Javascript, C++ and other languages.... Most programming jobs are in narrow niches, where very few candidates are competent before being trained on the job. QL Forever !
Regards,
Steve.


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 11, 2020 12:47 pm

Hi Tobias, Steve,

Tobias:

I agree that employers should be looking for people who write understandable code, but these days, recruitment is usually hived off to a third party who run a text search on a database full of CVs to see who pops up. I get requests all the time for a "SQL DBA" when what they mean is "SQL Server DBA" - I don't do SQL Server, I do Oracle and I get hundreds of emails with text like "your CV shops that you are a candidate for a position as a SQL DBA" followed by a list of mandatory skills, none of which I have. :D I even have words in my CV that will be picked up by these text searches to get me in the door for an interview - where I usually get the position, even if I don't have the particular skill the third party was searching for. (Something like I'm afraid that I do not have XXXXX as one of my skills" - try it sometime!

I should state for the record, that I think SuperBASIC is one, if not the, best BASIC that there is going. I love it.


Steve:

Python produces no bloatware as it is "interpreted". Interpreted in as much as it is "compiled" into byte code when executed:

Code: Select all

echo 'print("Hello World!")' >> MyCode.py
python MyCode.py

Hello World!


and the compiled version is then run by the Python Interpreter. That version, the bytecode, is deleted when the program exits. It can also be compiled into byte code of course:

Code: Select all

python -m py_compile MyCode.py


which creates a file named "__pycache__/MyCode.cpython-37.pyc" but you'll still need the Python Interpreter to run it:

Code: Select all

python __pycache__/MyCode.cpython-37.pyc

Hello World!


This is very much how early Visual Basic applications "compiled". With the above tiny example, the source is 45 bytes and the compiled bytecode is 122 which could be classed as bloated however, a bigger example file, something from Oracle's VirtualBox installation, is 43,754 bytes as source and "only" 37,415 bytes as a compiled module. So, not really bloatware I would say. (It's still not properly compiled though, as it's still interpreted bytecode and is not compiled down to machine code.)

Python bloat is thus "in the eye of the beholder" I would say. SuperBASIC is much the same compare the typed in and SAVEd source as opposed to the "compiled" QSAVEd source. Python coding is "real" coding as much as any other language is. BASIC is for beginners - and yet, look at all the QL programs written in SuperBASIC - compiled or otherwise. It's still a real language too. (IMHO)

I do get a little annoyed at the plethora of new languages that are coming out though - there seems to be a new one every week these days. Many, most, seem to vanish just as quickly - thankfully! ;). Evolution of the fittest I expect. Maybe that's why Python still exists - it does have advantages?

While we agree that learning [Super]BASIC is a good thing, there are others who think that learning BASIC should prevent you from ever becoming a programmer. Opinions vary obviously. I taught myself BASIC by reading the Personal Computer World magazine long before I had a ZX-81, then when I got one, I had to pretty much unlearn much of it in order to fit in with ZX-Basic as was. Fun! However, I was still able to move on to Z80 Assembly, C and COBOL by the time I got to college and into a number of jobs - all of which I hasten to add, were looking for skilled people in the chosen language. Your mileage may vary of course. When ever I'm involved in recruiting in whatever company I'm working at, we definitely look for existing skills. We can do training on the job - but not for language skills, more for our standard requirements and perhaps other business functions which are specific to the company - I had to do OTJ training for Financial stuff when I worked in a software house writing HP/Credit system and also for Barclays Bank. However, if we need a C++ programmer, we don't employ a BASIC programmer and teach them C++ OTJ. People are too expensive I'm afraid.

For some reason, JavaScript does my head in. I really cannot get to grips with it - but then again, I haven't actually sat down and tried to learn it properly. Maybe one day - if/when I retire? :)


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.
stevepoole
Trump Card
Posts: 226
Joined: Mon Nov 24, 2014 2:03 pm

Re: How do you make a QL emulator?

Postby stevepoole » Tue Feb 11, 2020 2:14 pm

Hi Norman,
Thanks for the precisions about Python. Perhaps I should consider it again.
If you can do C++, javascript should be a doddle....
In 1964, very few people were able to understand or program computers.
BASIC, the 'Beginners all-purpose symbolic instruction code' was then devised to change all that. Some people state that the 'S' was in fact 'scientific', for in those days the beginners were mainly scientists..... not children !
The fact that in the seventie and eighties it was built into computers reveals its power, as a 'personal' language.
In my jobs I neeeded to do many different scientific calculations dozens of times, and Basic programs could be written in minutes, meaning that I could concentrate on input rather than formulation each time : error free results in exams !

I know people with very good formal computer education who found it very hard to get good jobs, because employers wanted people with hands-on experience of a particular field. Even though some had completed excellent programming projects in Basic or pascal...
Back in the '60s, you got jobs if your interview with the head of section was suitable. These days, as you say, the recruiters may have no idea of the job requirements..... and you may never get to see the section head !
Steve.


duncan
ROM Dongle
Posts: 34
Joined: Tue Aug 15, 2017 5:08 pm

Re: How do you make a QL emulator?

Postby duncan » Tue Feb 11, 2020 3:45 pm

Hi Steve, You wrote "And is Python that easy to use ? "

I would say yes it is especially if you have used SuperBasic before. There are magazines with example code and loads of examples on the internet.

My first and only python program, so far,I am using to connect a RS232 serial hat on a Rpi to CUPs to give wireless printing to my Q68 and Q60, a bit like the RetroPrint project.

Cheers

Duncan


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 11, 2020 3:59 pm

And for anyone looking to learn Python, and needing a free book or two, this is legal:

https://www.topfreebooks.org/?s=python

Enjoy.


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.

Who is online

Users browsing this forum: No registered users and 7 guests