Sinclair QL dithvide #2
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
- Start supervisor mode, disable interrupt
- Move 32k of the system variables from $28000 to ram (at the end of the routine).
- Move graphic data from RAM to video ram locations ($20000 and $28000)
- 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
- Enable interrupt
- Wait until nm_frms (number of frames) is reached
- Disable interrupt
- Restore system variables
- 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.
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.
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).
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.
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.
Poke, JSH, Alpha, my wife, Dilwyn Jones and people from QL mailing list who suggested advices.
Links and download
|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]|