<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.sizecoding.org/index.php?action=history&amp;feed=atom&amp;title=Sinclair_QL</id>
		<title>Sinclair QL - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.sizecoding.org/index.php?action=history&amp;feed=atom&amp;title=Sinclair_QL"/>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=Sinclair_QL&amp;action=history"/>
		<updated>2026-04-28T04:31:01Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.0</generator>

	<entry>
		<id>http://www.sizecoding.org/index.php?title=Sinclair_QL&amp;diff=1864&amp;oldid=prev</id>
		<title>Superogue at 13:22, 6 December 2025</title>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=Sinclair_QL&amp;diff=1864&amp;oldid=prev"/>
				<updated>2025-12-06T13:22:51Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:22, 6 December 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Spectrum &lt;/del&gt;QL ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Sinclair &lt;/ins&gt;QL ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The Sinclair QL (for Quantum Leap) is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The Sinclair QL (for Quantum Leap) is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It was aimed at the serious home user and professional and executive users markets from small to medium-sized businesses and higher educational establishments, but failed to achieve commercial success.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;It was aimed at the serious home user and professional and executive users markets from small to medium-sized businesses and higher educational establishments, but failed to achieve commercial success.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Superogue</name></author>	</entry>

	<entry>
		<id>http://www.sizecoding.org/index.php?title=Sinclair_QL&amp;diff=1863&amp;oldid=prev</id>
		<title>Superogue: Created page with &quot;== Spectrum QL == The Sinclair QL (for Quantum Leap) is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum. It was aimed...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=Sinclair_QL&amp;diff=1863&amp;oldid=prev"/>
				<updated>2025-12-06T13:22:32Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Spectrum QL == The Sinclair QL (for Quantum Leap) is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum. It was aimed...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Spectrum QL ==&lt;br /&gt;
The Sinclair QL (for Quantum Leap) is a personal computer launched by Sinclair Research in 1984, as an upper-end counterpart to the ZX Spectrum.&lt;br /&gt;
It was aimed at the serious home user and professional and executive users markets from small to medium-sized businesses and higher educational establishments, but failed to achieve commercial success.&lt;br /&gt;
The Sinclair QL uses a Motorola 68008.CPU with 32-bit internal data registers, but an 8-bit external data bus.&lt;br /&gt;
&lt;br /&gt;
=== Setting up ===&lt;br /&gt;
* Assembler: VASM&lt;br /&gt;
* Emulator(s): Q-emulator ( http://www.terdina.net/ql/winql.html )&lt;br /&gt;
* Tool(s): Mdvtool (create MDV images)&lt;br /&gt;
* Hardware: Sinclair QL machine or Spectrum Next running the QL core&lt;br /&gt;
&lt;br /&gt;
In order to test the final result one can use a floppy-disk replace replacement or Qubide interface to load files from SD card.&lt;br /&gt;
&lt;br /&gt;
=== Loader ===&lt;br /&gt;
To load content from a folder or MDV image, you need both the binary and a basic loader, similar to platforms like the ZX Spectrum and CPC, create a file called BOOT in the output folder with the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
10 PROGRAM=RESPR(512)&lt;br /&gt;
15 LBYTES &amp;quot;MDV1_CODE&amp;quot;,PROGRAM&lt;br /&gt;
20 CALL PROGRAM&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now copy your intro code as CODE into the same output folder and Q-Emulator should be able to pick everything up automatically and load the code. You can link the folder directly from the Q-emulator or generate a MDV image using mdvtool for distribution.&lt;br /&gt;
&lt;br /&gt;
=== Memory map ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
$00000 	Onboard 48k Rom 	&lt;br /&gt;
$0C000 	16K Rom Cartridge 	&lt;br /&gt;
$10000 	Onboard I/O 	&lt;br /&gt;
$18000 	(R) RTC byte 0 / (W) RTC Reset&lt;br /&gt;
$18001 	(R) RTC byte 1 / (W) RTC Step&lt;br /&gt;
$18002 	(R) RTC byte 2 / (W) Transmit control&lt;br /&gt;
$18003 	(R) RTC byte 3 / (W) IPC link control&lt;br /&gt;
$18020 	(R) Microdrive/RS232c status / (W) Microdrive control&lt;br /&gt;
$18021 	(R) Interrupt/IPC status / (W) Interrupt control&lt;br /&gt;
$18022 	(R) Microdrive Track 1 / (W) Microdrive / RS232C data&lt;br /&gt;
$18023 	(R) Microdrive Track 2 / (W) Display control&lt;br /&gt;
$18063 	Screen Mode S---C-O- On Colordepth Screenpage&lt;br /&gt;
$20000 	Screen 1 	Screen Ram&lt;br /&gt;
$28000 	Screen 2 /&lt;br /&gt;
System 	system (systemvars*)&lt;br /&gt;
$2847C 	System stack pointer*&lt;br /&gt;
$28E00 	Base of Common Heap*&lt;br /&gt;
$2BC00 	Free area*&lt;br /&gt;
$30000 	Running Programs 	Free area&lt;br /&gt;
$37200 	Basic area*&lt;br /&gt;
$38000 	User Stack pointer*&lt;br /&gt;
$38000 	Prog data*&lt;br /&gt;
$40000 	Add on ram (up to 512k) 	&lt;br /&gt;
$C0000 	Add on peripherals 	&lt;br /&gt;
$E0000 	Add on Rom (up to 128k) 	&lt;br /&gt;
$FFFFF 	End of address space&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Video display ===&lt;br /&gt;
There are two possible screen modes, configured by bit 3 of port $18063&lt;br /&gt;
&lt;br /&gt;
setting a 0 give 4 colors at 512x256 with Black,Red,Green and White&lt;br /&gt;
setting a 1 give 8 colors at 256x256 with Black,  R, G B, C, M, Y and White&lt;br /&gt;
&lt;br /&gt;
The Screen is directly memory mapped from $20000-$28000, There is no palette - the colors are fixed.&lt;br /&gt;
&lt;br /&gt;
==== Vsync ====&lt;br /&gt;
Port $18021 bit 3 will go high (1) when Vsync starts, then we need to write a 1 to that same bit at the same port to clear the Vsync event.&lt;br /&gt;
Therefore, in effect we can write 255 to port $18021, then read from $18021 until it's nonzero to get the Vsync event.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
 move.b #%11111111, $18021     ; Clear interrupt bits&lt;br /&gt;
waitvbl:&lt;br /&gt;
 move.b $18021,d0            ; Read in interrupt state&lt;br /&gt;
 tst.b d0                    ; Wait for an interrupt&lt;br /&gt;
 beq waitvbl&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Before using Screen2 ====&lt;br /&gt;
Since the Screen2 area is mapped to the system, we need to add the following code at the start of the program to be able&lt;br /&gt;
to make use of it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
 trap #0&lt;br /&gt;
 ori #0700,sr&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or alternatively move the stack manually &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
 move.l  #$40000-4,sp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Swapping screens ====&lt;br /&gt;
To swap between the two screens via hardware, we need to swap the buffer pointer and set the screen register accordingly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
resetScreens:&lt;br /&gt;
 move.l  #$20000,screenpointer1&lt;br /&gt;
 move.l  #$28000,screenpointer2&lt;br /&gt;
 move.b  #8,scr&lt;br /&gt;
 move.b  #0,scr+1&lt;br /&gt;
 move.b  #8,$18063&lt;br /&gt;
 rts&lt;br /&gt;
&lt;br /&gt;
swapscreens: &lt;br /&gt;
 lea  screenpointer1,a0 ; get screen ptr address&lt;br /&gt;
 move.l  (a0),d0         ; save it&lt;br /&gt;
 move.l  4(a0),(a0)+     ; rotate screenbuffers&lt;br /&gt;
 move.l  d0,(a0)         ; write back&lt;br /&gt;
 lea     scr,a0          ; get flipbit&lt;br /&gt;
 move.b  (a0),$18063     ; write flipbit&lt;br /&gt;
 eor.b   #128,(a0)       ; flip the bit&lt;br /&gt;
 rts&lt;br /&gt;
&lt;br /&gt;
scr: dc.b    8,0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Copying and clearing the screen ====&lt;br /&gt;
As an alternative to swapping the screenpointers, here is some compact, but slow, code to copy over the contents from screen2 to screen1 and clear the screen2.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
 lea $28000,a0       ; screen2&lt;br /&gt;
 lea $20000,a1       ; screen1	&lt;br /&gt;
 move.l a0,a2&lt;br /&gt;
 move.w  #256*32,d0&lt;br /&gt;
swappage: &lt;br /&gt;
 move.l   (a2),(a1)+&lt;br /&gt;
 clr.l   (a2)+&lt;br /&gt;
 dbf     d0,swappage&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Plotting to screen ====&lt;br /&gt;
While there are a few rom/trap routines that allow you to draw primitives, these are quite expensive to setup and clunky to use.&lt;br /&gt;
So its best to draw into the screenmemory directly, using the following plot routines provided by gigabates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
; plot pixel&lt;br /&gt;
; a0 = screen,  d0 = x, d1 = y, d2 = color index 0-7&lt;br /&gt;
plot:&lt;br /&gt;
 lsl.w   #6,d1           ; y byte&lt;br /&gt;
 moveq   #3,d3           ; x pixel shift&lt;br /&gt;
 and.w   d0,d3&lt;br /&gt;
 add.w   d3,d3&lt;br /&gt;
 asr.w   #2,d0           ; x byte&lt;br /&gt;
 add.w   d0,d1           ; total bytes&lt;br /&gt;
 add.w   d1,d1           ; to word offset&lt;br /&gt;
 lsl.b   #6,d2&lt;br /&gt;
 bcc     .noGreen&lt;br /&gt;
 add.w   #$8000,d2&lt;br /&gt;
.noGreen:&lt;br /&gt;
 lsr.w   d3,d2           ; shift scrambled color to px pos&lt;br /&gt;
 or.w    d2,(a0,d1)&lt;br /&gt;
 rts &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sound ===&lt;br /&gt;
The Spectrum QL has 2 channels of internal beeped sound, or AY support via an extension board.&lt;br /&gt;
&lt;br /&gt;
Speaker Sound commands have to be passed via the Bios, using the same kind of commands as with the keyboard.&lt;br /&gt;
You need to adjust the Pitch settings to change the sound, and you can change the randomness bits to make the sound distorted, It seems it's not possible to change the volume!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
move.l #$11,d0			; set sound command&lt;br /&gt;
lea .sounddata,a3		; load sound message payload pointer to a3&lt;br /&gt;
trap #1				; call dosound&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Additional Resources ===&lt;br /&gt;
* [https://demozoo.org/productions/?platform=95 Sinclair QL demoscene productions]&lt;br /&gt;
* [https://ia600804.us.archive.org/9/items/SinclairQLHomepage/docs/manuals/qltm.pdf QL Technical Guide]&lt;br /&gt;
* [https://www.chibiakumas.com/68000/sinclairql.php 68008 Assembly programming for the Sinclair QL]&lt;br /&gt;
* [https://dilwyn.qlforum.co.uk/  Sinclair QL Pages]&lt;br /&gt;
* [http://www.terdina.net/ql/winql.html Q_emulator]&lt;/div&gt;</summary>
		<author><name>Superogue</name></author>	</entry>

	</feed>