How do you make a QL emulator?

Discussion and advice about emulating the QL on other machines.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Post by NormanDunbar »

Morning Marcel,

I never really liked flex/bison to be honest. I tried - but didn't succeed.


The first book is just going to production, and has its own web page at https://www.apress.com/gp/book/9781484257890 but the content changes from time to time. Its about 400 of my A4 pages, plus index, and is a complete "dissassembly" of the Arduino Language plus how the hardware works and how the two work together.

The second is still top secret! But on a similar subject.

Writing it, the first, started in earnest in June 2018 when I decided to collect my notes into one eBook for my benefit. Then I thought that others might be interested, maybe. I figured that I'd try to publish with three publishers and if that didn't pan out, I'd give it away.

No Starch loved it, but it's not on their market at the moment, Apress snapped it up. :D

Normally you send them a proposal about what you will write, they accept, you sign a contract and write to a deadline. I can't do that.

I wrote it first. The rest was much as above but they wanted the chapters reorganised so I had to renumber every figure, table and listing, plus the cross references - my writing utility, AsciiDoctor, doesn't do that. (I'm using Lyx/LaTeX for book 2).

The only change I had to make after the technical review was one reference to a figure had the wrong number!

Now the production team are converting my pdf files to Apress book layout and changing my correct spellings to Americanisms!

Will I make a fortune? No. Will I do book 3? Probably not - I don't have a subject. Was it fun? Too right it was! :D


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: How do you make a QL emulator?

Post by stevepoole »

Hi,
Without QP2, I would never have been able to finish many QL programs. The SGC was just too slow for 3D animation. We need emulators..... and QPC2 has just been oh, so bug-free !
Norman mentions his CPORT rewrite : CPort is a stepping stone to recode superbasic into 'C', for PCs, but these days the language of choice to my mind is Javascript, which runs on any system...
I mentioned the Atari-Amiga 'AOZstudio' in another posting, which converts Basic into javascript, but this system requires an API of 16GB, too big for my laptop. It is also not yet configured for standard Basic, but to my mind has great potential....
At 71, I find the idea of learning Intel assembler daunting, but 'QL > Javascript' code would run considerably faster if coded in such assembly language.....
I still wonder how on earth Marcel managed to learn Intel assembler, especially as he was so young ?
QL Basics are still great for prototyping programs, but the QL does need an 'AOZ-type' transpiler to get code mainstream. If you ever wrote C++ or Javascript code, you will know exactly why BASIC is the ideal prototyping language.... QL Forever !
Regards,
Steve Poole.


User avatar
Ruptor
Gold Card
Posts: 418
Joined: Fri Dec 20, 2019 2:23 pm
Location: London

Re: How do you make a QL emulator?

Post by Ruptor »

Hi Steve
stevepoole wrote:If you ever wrote C++ or Javascript code, you will know exactly why BASIC is the ideal prototyping language.... QL Forever !
I don't understand most of what you guys have been discussing however due to the myriad of different systems and languages it does back up the view that there has been a lot of work done in code over the last 50 years but not much progress. I still get syntax error or worse when I leave a ';' off the end of a line. There has been a lot of money made out of making the code bigger needing bigger computing power to run it for the computer and OS makers but not much progress. WIndows for work groups was 10 Mb on seven floppies and Windows 10 is 10 Gb requiring a flash drive. :roll: I agree the QL basic and Quill office suit did everything Mr average needs but by now we should not be writing code the computers should be doing it from our designs on one common system. It doesn't seem like anybody is interested in doing it perhaps due to protectionism but progress always makes jobs and work. Machine code was dead slow so assembler came along then Algol & Fortran driven by profits appeared and progress was lost to profit making where Pascal improved on Algol and the Americans came up with C for crap as their alternative and we were stuffed. Perhaps you guys writing high level languages can explain. Why is there no interest in having computers do the coding? I know the design entry stage looks complicated to get it in to a form that a computer can code but once done software generation would explode and be available to everybody. :)


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

Re: How do you make a QL emulator?

Post by NormanDunbar »

Ruptor wrote:Machine code was dead slow so assembler came along then Algol & Fortran driven by profits appeared and progress was lost to profit making where Pascal improved on Algol and the Americans came up with C for crap as their alternative and we were stuffed.
When I was at college, back in the 1980s (yes, I'm an old git! :D ) the talk back then was "a competent programmer will create, on average, 10 lines of debugged code, per day". So, given that 10 lines of debugged C or Pascal or Fortran or whatever contains a huge number of assembly level instructions, it's no wonder they wanted to get away from Assembler.

Machine code, back then - and I have done it - was setting up the mainframe (or whatever - for me, it was an old mainframe) switches on the front panel to get it to boot itself up. Tedious to say the least.

You seem a little against making profits? I wonder why? I don't think that higher level languages were developed for profit reasons, myself, I suggest they were invented to make things more efficient - those 10 lines of debugged code again! However, I would be interested in your sources.

Ruptor wrote:Why is there no interest in having computers do the coding? I know the design entry stage looks complicated to get it in to a form that a computer can code but once done software generation would explode and be available to everybody. :)
I write in high level languages, because it's easier than assembly language. I write in assembly because I like it and it's fun. But if I need to get something done, I do it in SuperBASIC, or C68 on the QL, C/C++ for the AVR microcontroller I play with, or BASH/C/C++ or PL/SQL at work, depending on what I need to do. If I write in assembler for any of that I'm either showing off (!) or I need the low level access and speed.

In the past I have written a lot of commercial code using a code generator. It was called Compuware from a company called Compuserve. It worked. It worked reasonably well in fact. But you have to work the the limits of that language, and to be honest, the only code it wrote was the database access parts - I still had to write the logic.

Filetab was another code generator. I built a truth table as my source code and it wrote the code to do what was needed. It too worked - but I was still writing some code to get it to do the needful.

I wrote a code generator to product SCL (System Control Language) scripts and Cobol programs for the ICL 29xx and 39xx series of mainframes back in the 1980s after college. They worked fine too - but the users still have to write the main code.

There was talk back in those days that soon programmers would be redundant as computers would eventually write all the code for everyone "at the touch of a button". Well, that never happened did it? Equally, Nuclear Fusion is just "10 years up the road" - they've been saying that for years too.

So, you want a computer to write code? Well, they are doing it now. You write in C or C++ and compile it - the compiler will write the Assembly language source for you. This is how it is, no matter what the code writer you need to create or use, someone will still have to write some sort of source code or program requirements description (and don't get me started of user's requirements - I had one once which simply said "write a program to produce invoices". I kid you not, that was it!) to input to the code generator to have it produce something that may or may not match up with what was requested or even, what was needed.

With no offence intended, you are living in a dream world if you think that computers will write code "just like that" any time soon, if at all ever. Software generation is pretty much already available to the masses - over 30 million Raspberry Pis have been sold, and counting. Python is installed and almost anyone can learn Python, I've even done some myself - and I'm still an old git! :D


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How do you make a QL emulator?

Post by NormanDunbar »

PS.
Ruptor wrote:I don't understand most of what you guys have been discussing however due to the myriad of different systems and languages it does back up the view that there has been a lot of work done in code over the last 50 years but not much progress. I still get syntax error or worse when I leave a ';' off the end of a line.
Yes, well, if you are learning to speak Spanish, for example, you need to learn that language's syntax and foibles. The same is true of C, PASCAL and other languages that desire a semicolon to mark the end of a statement. Even when you learned Arithmetic at school, you had rules to follow - BODMAS etc (Brackets, Of, Multiply, Divide, Add, Subtract) get the priorities wrong and your answer would be incorrect. That's how you know that:

Code: Select all

6 + 2 * 2
gives the answer 10 and not 16. (At least you do if I worked that out correctly! ;) )

The parser is doing what it was told to do, there is a rule for a statement which says that each statement will begin with a keyword, for example, and have these parameters, and will end with a semicolon.

The parser gets tokens (words, symbols etc that make up the language tokens) from the lexer, and checks the rules to see what it has been given. If something is not right in what you have typed, you get told off by the parser and hopefully, given a decent enough error message that helps you understand where you make the error.


Cheers,
Norm.
Last edited by NormanDunbar on Mon Feb 10, 2020 2:59 pm, edited 1 time in total.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
Pr0f
QL Wafer Drive
Posts: 1298
Joined: Thu Oct 12, 2017 9:54 am

Re: How do you make a QL emulator?

Post by Pr0f »

I quite like assembler - for code close to the hardware I find it far easier to read.

I remember back in the 80's our analyst programmers were getting excited about 4GL's - but a lot of them struggled to write half way decent PL1 programs, and very few of them seem to think in a structrued manner. Higher level languages should in theory promote a more structured approach - but you will always get people who write atrocious code and poor documentation.

I like to program PIC's, and a while back a company called Forest Electronics came up with a RAD tool that was pretty much drag and drop the elements you wanted in the hardware onto your chip, and the tool would link in a whole load of prewritten assembler with all the correct hardware config done for you . You literally only had to write the 'main' program body, it meant very quick turnaround on something like an alarm lock with keypad and 7 segment display, or a voltmeter. Sadly gone by the wayside and no support for all those enhanced mid range pics with all their goodies on board.

I've even seen mind mapping tools that can generate code and test scenarios to go with it.


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: How do you make a QL emulator?

Post by mk79 »

stevepoole wrote:At 71, I find the idea of learning Intel assembler daunting, but 'QL > Javascript' code would run considerably faster if coded in such assembly language.....
No don't ever code in Intel assembler. As a novice you will never beat a modern compiler. And even as an expert it has become very difficult.
I still wonder how on earth Marcel managed to learn Intel assembler, especially as he was so young ?
Just read a book. Assembler is a very primitive language. That makes it not difficult to learn but difficult to write. I've probably written some 100.000+ lines of assembler in my days and I'm quite fed up with it.
QL Basics are still great for prototyping programs, but the QL does need an 'AOZ-type' transpiler to get code mainstream. If you ever wrote C++ or Javascript code, you will know exactly why BASIC is the ideal prototyping language....
Python is pretty much the new Basic now.

Marcel


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

Re: How do you make a QL emulator?

Post by NormanDunbar »

mk79 wrote:Just read a book. Assembler is a very primitive language.
Here are a few that you can legally download for free - https://www.topfreebooks.org/?s=assembly+language - the Randal Hyde one (http://www.plantation-productions.com/W ... index.html) I already own, it's 900+ pages of sheer unbridled hell. On the latter link you will find versions for Windows 32 bit, Linux 32 bit and DOS 16 bit. Take your pick - and when you have read it, you will agree with Marcel's comments on the matter. ;)

have fun.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: How do you make a QL emulator?

Post by pjw »

Ruptor wrote:Why is there no interest in having computers do the coding?
Just be glad computers cant (yet) do their own coding. They day that happens the best we
can hope for is theyll use us for batteries! If you want to scare yourself shitless on the
subject, read Nick Bostrom's excellent book Superintelligence!
For the rest of us, those who can, code for profit, those who cant, code for fun ;)


Per
dont be happy. worry
- ?
User avatar
Ruptor
Gold Card
Posts: 418
Joined: Fri Dec 20, 2019 2:23 pm
Location: London

Re: How do you make a QL emulator?

Post by Ruptor »

mk79 wrote:I've probably written some 100.000+ lines of assembler in my days and I'm quite fed up with it.
Me too and a classic example of zero progress.
mk79 wrote:Python is pretty much the new Basic now.
Another person reinventing the wheel. Why?
Pr0f wrote:Higher level languages should in theory promote a more structured approach - but you will always get people who write atrocious code and poor documentation.
I was taught structured programming but that is a dirty word amongst the object orientated crowd. The thing is my code fits in on chip memory and the OOP code doesn't anyway that is what happened when the high level experts tried to show me how good OOP was even with every aspect of optimisation applied. :lol:
Pr0f wrote:I like to program PIC's, and a while back a company called Forest Electronics came up with a RAD tool that was pretty much drag and drop the elements you wanted in the hardware onto your chip, and the tool would link in a whole load of prewritten assembler with all the correct hardware config done for you.
Yes I use PICs too and this was like visual coding systems for GUIs. Why can't the high level programmers take the next step perhaps because they don't think like engineers? Engineers pushed it from machine code to assembler then on to pascal but after that computer science was invented and progress took a different route. Perhaps I should have used the word root instead since after the high level language invention things branched out like ivy and went everywhere except forwards. Maybe a design driven coding system is what I should do to tinker. The tools of Lazarus and FPC are there to do it and I can actually use them unlike visual C & C++ or is the latest fashion to make money c# I lost track. :roll:


Post Reply