Sinclair QL dithvide #2

Sinclair QL dithvide #2

Introduction

In the beginning, I thought it's not possible... I didn't find any example of setting up QL in a way that interrupt is processed while using two video rams free for user. Note: On standard QDOS, 2nd video ram is used for system variables. I got some tips how to do that at QL mailing list, but the most valuable was experimenting on real QL and looking at excellent JM ROM disassembly (from C.A.M.).

As you'll see, display driver for QL dithVide is nothing really difficult. I am sure that everyone who's a bit familiar with QL and 68k would understand this piece of code. It is "development" snapshot. You can freely use it or modify it. Of course, any feedback is welcomed.

I used GenQL (editor assembler) and MonQL (monitor, debugger).

How is it done

  1. Start supervisor mode, disable interrupt
  2. Move 32k of the system variables from $28000 to ram (at the end of the routine).
  3. Move graphic data from RAM to video ram locations ($20000 and $28000)
  4. Modify sv.plist (frame interrupt linked list) to address of flipper linked list. flipper points to one of the following routines:
    • lores - low resolution images
    • hires - high resolution images
    • mixed - mixed resolution images
  5. Enable interrupt
  6. Wait until nm_frms (number of frames) is reached
  7. Disable interrupt
  8. Restore system variables
  9. Return to QDOS.

lores and hires routines

mc_stat (master chip status register) is altered every frame interrupt in order to change displayed video ram.

mixed routine

This routine is modifying mc_stat every scan-line. Therefore there is two wait constants.

  • bg_wait - constant to wait until CPU reaches display area since beginning of the frame interrupt
  • ln_wait - constant to wait until CPU reached end of the line

These two constants needs to be modified on faster machines (GC, SGC) or slower memory expansions. Supplied constants are working on Sinclair QL + Sandy Super-Q board 512k. I didn't test it on other QL set-ups.

As soon as end of line is reached, mc_stat is changed to flip video ram and also change resolution. As soon as new frame interrupt occurs, order of video rams is altered too.

What is not done

  • CPU speed autodetection - this would enable displaying the screens on different QL configurations.
  • Keyboard detection - currently, nm_frms is used to determine how long the screen will be displayed. Better would be to get info from IPC and check "any" key response.
  • Image compression - RLE compression to save disk space.
  • Version for Minerva - it should naturally work, as 2nd video ram is not used for sys vars.

Future plans

SuperMixed mode

Implementation of display mode table. Display mode will be changed for each scan line based on defined table. This would enable to have each line in different hi-color mode (low, high, mixed).

UltraMixed mode

I tested that screen mode could be altered ~5 times on one scanline (unexpanded QL). It would mean that the display resolution/colors could be selectively defined for lines of 64 pixels long within the whole screen, but of course in fixed vertical positions. It is only improvement of SuperMixed mode, where display mode table would consist of n-items for each scan line. Number of items depends on CPU speed.

Convertor

dithVide was challenge also for writting a good tool to convert images. First pictures were converted in Photoshop and then converted into QL format using small batch in ImageJ. Later, I wrote ImageJ dithering plugin. Next step would be to add support for SuperMixed and UltraMixed modes.

Thanks

Poke, JSH, Alpha, my wife, Dilwyn Jones and people from QL mailing list who suggested advices.

Links and download

 

Link Description
Code.7z (200,1 kB) Source, assembler, debugger, sample images.
Screens.7z (419,8 kB) Some more unpublished images
Sinclair QL dithvide #1 Part #1 of dithvide article
QL dithvide Sample pictures   
screens_zip.txt (143,2 kB) Sample pictures [rename txt to zip]
Screens3_zip.txt (1,5 MB) Sample pictures [rename txt to zip]

 


Topic: Sinclair QL dithvide #2

Date: 03/08/2014

By: Marq

Subject: Minerva

Hi,

The example programs I made based on your sources seem to work fine on a stock 128k machine, but not with Minerva anymore. Maybe it has different interrupt handling?

—————

Date: 15/02/2012

By: MickH

Subject: dithvide

Would it be possible to add a .zip version of the code as there does not seem to be any way of extracting the files without losing the essential info from the executable files. Even QEmulator cannot read the 7z files but that would be OK with .zip and would provide an easy method for copying to floppy.

—————

Date: 16/04/2012

By: omega

Subject: Re: dithvide

Hi MickH,

You are right - QL native ZIP file would be much better. If anyone volunteers to make it, I am happy to upload it here.

For now, I would just recommend to LRESPR and SEXEC with 2k of stack.

—————

Date: 12/05/2009

By: Thorsten

Subject: dithvide

Hello,

This is very impressing, compliments. Do you progress with the Super or Ultra Mixed Mode? Is it possible to use the dithvide for games?

Regards
T

—————

Date: 10/09/2009

By: omega

Subject: Re: dithvide

Hi Thorsten,

this mode can be used in games. Simple screen flipping (each interrupt to switch one bank) is simple to implement and it would not add any burden. Mixed mode is tricky, it need precise CPU timing. Still possible, rather on smaller region of the screen.

_o_

—————