Monday 12 May 2014

Blog post written with QL SuperBASIC

(The text below was written entirely as a Sinclair QL SuperBASIC program, as an experiment to see how this computer from 1984 could be used for writing, without using a dedicated word processor application. At the same time, the text goes to describe the approach I took. I have not edited out or removed any typos or repetition, as they can indicate challenges in the approach. The mechanical paragraph division is also quite telling. The images and captions have been added in the Blogger.)

One of these, in case you forgot.


I have previously suggested that the Sinclair QL is unique among the earlier home micros in that it might not need apps for rudimentary tasks. I made crude experiments with 3D 'modelling' and extrapolated that it might be a viable approach were the QL more powerful.

I did think however that this was mostly because the old BASIC-enabled micros were good as a graphic notepad, but for many other tasks the approach would not do. Now I'm beginning to feel that at least for writing, the QL superbasic might offer some ways in to writing.

It struck me that the QL might be easily used for producing text, without resorting to a word processing package. Obviously, there might be limits to the length of text that could be reasonably produced, but then again my modelling experiments were not professional quality either.

Such a project might go two ways. I could try to write a small text editor that would store the written text into memeory. Or I coold write the text as a program. I went for the latter, as it seemed to me more in the 'Spirit of QL', needs less programming talent, and frankly, might be the more powerful approach.

The Approach

The root idea is simplistic. One might take any old BASIC-equipped computer and type text into REM lines. I could then say this was what I was looking for: a way to produce text without an editor. Yet, with the QL, I was looking for something a bit more flexible.

I've taken the notion that the paragraph is the defining unit of text, and built a program around it. A paragraph, when thought out well, carries through a single idea from its' presentation to a closure, preparing for the next. I defined a PARAGRAPH proccedure which simply takes a text string as an input. The procedure then prints the text, tabbed and separated with a line from other paragraphs.

Preparing to edit The Approach subheading, consisting of three paragraphs.
A paragraph is a suitably short unit of text to be handled in the slow SuperBASIC console. Even then, the few sentences need to be written quite unhesitatingly into a finished condition, because editing the middle and the beginning of the paragraph easily becomes too slow.

Structuring the text

The text body could be a list of PARAGRAPH lines, but it is also useful to have some control over the entirety of the text. For this purpose, I made each text subheading into a named procedure, such as INTRO, APPROACH and STRUCTURE.

The procedure definitions at the heart of the program. The variable CH indicates the desired channel. CH=1 would send the text to screen.
Each of these procedures are made from a heading line and a few paragraphs. The HEADING is another procedure, which simply prints the intended heading name and a separating line. So, when the program is RUN, the text will flow from top to bottom, separated with the appropriate subheadings.

However, the best use for these structuring procedures is that from the console they display a particular portion of text. It is better than using the LIST command in conjunction with line numbers. Now, INTRO can be used to view the introduction, APPROACH the middle part and so on and on.

Listing the The Approach subheading using APPROACH procedure.
I tended to keep each section below such a length that it would about fit the Sinclair QL screen in 80 column mode. This way, a portion could be seen at a glance. This of course limits the kind of texts that are meaningful to produce in this manner. CTRL+F5 can be used for pausing the overlong text, though.

Experiences during writing

I noticed there was still a need to contain each heading into a simple to grasp system of line numbers, so I could use a LIST command to explore the section under writing. I put each of the headings 100 lines apart, so a simple LIST 100 TO 200 would give the introduction, for example.

Although the paragraph and heading system could be used for shifting chunks of text into different order, I still found it most effective to write the text mostly in the order it was needed. I had very little need to change the location of written text. It was more likely I could write 'in between' existing text using a new PARAGRAPH line. 

I have shown the way text can be easily produced and viewed, but there is still the need to store the text into a proper ASCII file. For this purpose, some more programming is needed. (But not much.) The procedures that use a PRINT command text, ought to print to a channel. This way, the channel can be a file or a serial output.

Concluding remarks

I hope the above works as a kind of a proof-of-concept for showing that the QL could be used for text editing purposes even without a dedicated app. The SuperBASIC lends enough power to structure the text beyond the most immediate editing capabilities.

The part of the listing that describes the entire text structure. RUN would then list the whole text.

Again, this experience can be extrapolated, asking the question, what if QL was much more powerful and flexible? This kind of approach to text creation might be more interesting and challenging that the kind of WYSIWYG processors we nowadays have.

Admittedly, the writing process was somewhat more cumbersome than even a simple current text editor might afford. But command lines also give something that the more direct approaches do not. Invoking the different portions through commands gave a sense of control and somewhat exotic feel to the writing process.

Another caveat here is that the writing genre here supports the approach I've used. If I needed to more heavily edit the existing text, or mold new ideas, I might find this way a bit too slow. Also, fiction might be a bit cumbersome to write.

Then again, the QL gives an added bonus of absolute focus to the task, which is nowadays easily lost among the clutter of internet browsers, multiple windows and social media. I'm only left with the QL keyboard, nothing else to do but to produce the text. If I need to pre-plan the text, I do it on paper or inside my head. No messing about with stream-of-though within a text editor.

I'm looking forward to experimenting further with the Sinclair QL SuperBASIC to explore what kind of productive areas it might be applied to.

Thursday 8 May 2014


Here are some of my very first experiences with QL-SD card reader for Sinclair QL, the Most Interesting Computer in the World. This is a recent solution, designed by Peter Graf and manufactured by Paul Veltjens. It allows to bypass the dreadful Microdrive and gives a larger capacity drive image for loading and saving files.

The device is very straightforward and it's also really simple to install. Although it is a kind of a prototype, the device appears quite well thought out and clean. No soldering or messing with the QL: You only need to open the QL and replace a couple of chips.

Lazy man's install. The card reader is intended to replace one of the Microdrives.

The manual is extremely well written and helpful, but I'll summarize the process anyway.

  • Backup the files that already exist on the SD to your PC/Mac/Linux. From the included folder, unpack a suitable sized drive image (Such as QL_128K_BDI.BIN if you have unexpanded QL) and rename it to QL_BDI.BIN. Copy it on the card top directory, overwriting the previous file. Put the card back in the reader.
  • Open the QL case (leave in the two screws below the microdrives, and oh, be careful with your keyboard membranes).
  • Remove the two ROM chips from the QL and insert the QL-SD ROM chip. I found the chip somewhat tight to insert. The pins are a bit short, so make sure the chip is firmly in place.
  • It's possible to replace the physical microdrive with the reader so that the card sticks out neatly from the existing drive opening. The circuit board has ready-made holes for this.

What you should see after a succesful installation.
Then, off you go. Turning on the QL brings up the Minerva logo, and you have a possibility to bypass the reader. Minerva is one of those improved ROM thingies, which holds overall enhancements over the original QL ROMs. The default setup also boots to the Toolkit II extension, which longtime QL users swear is "absolutely necessary". The TK2 helps with directory structures, networking, multitasking and offers a plethora of handy new commands. But if you need to make the boot slightly faster and save some memory, the Toolkit can be made optional.

A bit sad thing here is that the unexpanded QL can only really handle 3MB drive images. This can't be helped. But let's not despair, that's still more than 35 microdrive cartridges! (And from what I get modern memory expansion options are soon arriving.) But anyway, it all depends what you want to do with your QL. For now, I'm quite happy to mess around with the SuperBASIC and fiddling with the boot file.
Toolkit II loaded, listing multitasking jobs
As I have two QLs, I'm interested in the possibilities for using the second QL as a "pure" vanilla machine, connected to the QL-SD boosted computer. So far, I had no luck in using the Toolkit II FSERVE command for setting up a file server, which would have been cool. I did load and run the Toolkit via LBYTES to the second QL, though. The network loading seems to quit altogether after I activate the Toolkit II. This may be due to memory, Toolkit II or it's just something I don't yet understand about the syntax. It's probably nothing to do with the QL-SD per se as the network works fine without the TK2.

The QL-SD appears a very good solution for SD card reading, something I've been waiting to happen for QL for some time. I can only hope these will be available in the future too.