SCREEN1 = SYSVAR @ JSROM

Anything QL Software or Programming Related.
Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: SCREEN1 = SYSVAR @ JSROM

Post by Derek_Stewart »

Hi,

I wrote some SuperBASIC extensions for Minerva to copy screen0 to screen1 or screen1 to screen0 using the Minerva fast copy vector.

I also wrote a extension to clear the second screen.

To implement this on a non-Minerva machine would require a copy routine which I seem to remember was detailed in a M68K programming book.
Last edited by Derek_Stewart on Tue Mar 12, 2024 4:27 pm, edited 2 times in total.


Regards,

Derek
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: SCREEN1 = SYSVAR @ JSROM

Post by tofro »

tcat wrote: I was hoping to divert some of the QDOS drawing routines to screen1 from within machine code.
As I read somewhere, long word channel ID encodes screen{0,1}, possible?
None of the original QDOS drawing routines could actually draw to screen 1. And I doubt they can be made to do so from the outside. Even worse they can't be told to leave the top few scanlines alone...

DIY toolkit contains a number of fast graphics routines for mode 4 and 8 that could relatively easy be made to be dual-screen aware.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SCREEN1 = SYSVAR @ JSROM

Post by tcat »

Hi,

@Derek, these might be usefull, I was also hoping to do equally fast animation using dual screens, that is at 50/60Hz, as I believe that is the idea of having two screens.

@Tobias, thank you, will start looking into DIY toolkit.

Many thanks
Tomas


Nasta
Gold Card
Posts: 443
Joined: Sun Feb 12, 2012 2:02 am
Location: Zapresic, Croatia

Re: SCREEN1 = SYSVAR @ JSROM

Post by Nasta »

Why not check out Minerva? It's already designed to work with 2 screens and in fact the con driver linkage block can be modified to generate graphics in the second screen - in fact, in theory, anywhere in memory. It's fairly easy to look at the two screens as a larger 512 x 512 bitmap and then use it simply.


User avatar
Outsoft
Super Gold Card
Posts: 695
Joined: Sat Apr 19, 2014 1:30 pm
Location: Italy
Contact:

Re: SCREEN1 = SYSVAR @ JSROM

Post by Outsoft »

Great Tomas!!!

It want to use the second screen on original equipment ;)

Is hard but not for him!!!


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

Re: SCREEN1 = SYSVAR @ JSROM

Post by mk79 »

Nasta wrote:Why not check out Minerva? It's already designed to work with 2 screens and in fact the con driver linkage block can be modified to generate graphics in the second screen - in fact, in theory, anywhere in memory.
Actually starting with (IIRC) JS all graphics routines obey sd_scrb, which is the base of the screen area. My PTR_GEN versions use this to implement background I/O, the OS drawing routines actually draw into offscreen memory if the window is buried. This is also the reason PTR_GEN is not compatible anymore with AH-ROM etc. Still I don't understand what's the point in making this work with QDOS instead of Minerva.


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SCREEN1 = SYSVAR @ JSROM

Post by tcat »

Hi Marcel,

Yes, you are probably right. My QL ventures are that of a hobbyist. I seem to fall into that category of QL users, keeping original h/w, with extra ram only, still runing earlier s/w, that is 1980's computing for me, though sometimes imperfect.

Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SCREEN1 = SYSVAR @ JSROM

Post by tcat »

Hi,

I have started this simple PLOT routine, so far calculating word screen address for X,Y co-ordinate system, that borrows from A.Pennel's book.

Code: Select all


; Simple plotting in mode 4/8
; ===========================

; From CALL in SuperBASIC

; PLOT4 - CALL [start],[x],[y],[col]
; PLOT8 - CALL [start+2],[x],[y],[col]
; on entry        D1=X coordinate
;                 D2=Y coordinate
;                 D3=Colour
; on exit         [start+4].l=debug output

; NOTE 
; Std QL screen is organised by words in 4/8 modes
; 512x256, 8 pixels per word, 128 bytes per line
; 256x256, 4 pixels per word, 128 bytes per line


start    bra.s    plot4             ;Mode 4
         bra.s    plot8             ;Mode 8
out      ds.l     1                 ;output

; Screen address calculation
acalc    movea.l  #$20000,a0        ;Screen start
         move.w   d1,d4             ;d4=x coord
         move.w   d2,d5             ;d5=y coord
         ext.l    d5                ;extend y long
* TODO determine mode
mode4    lsr.w    #2,d4             ;d4=x/4 bytes across
mode8   ;lsr.w    #1,d4             ;d4=x/2 bytes across
         andi.l   #$007e,d4         ;d4=0,2..126 even
         adda.l   d4,a0             ;a0=a0+x bytes
         lsl.w    #7,d5             ;d5=y*128
         adda.l   d5,a0             ;a0=a0+y lines
         lea      out,a1            ;result to out
;        move.l   d4,(a1)           ;d4 - debug
         move.l   a0,(a1)           ;a0 - debug
         rts                        ;done

plot4    bsr.s    acalc
         bra.s    exit
plot8    bsr.s    acalc
        ;bra.s    exit

; All complete
exit     clr.l    d0                ;No error code
         rts                        ;Return to BASIC

         end
Both modes have 64 words across line, MODE4, 8 pixels per word, while MODE8, 4 pixels per word. So in hires `X' goes from 0 .. 511, while lowres `X' goes from 0 .. 255.

But SuperBASIC manual states lowres `X' also going from 0 .. 511, but pixels count by two?

Tomas


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

Re: SCREEN1 = SYSVAR @ JSROM

Post by mk79 »

Nothing wrong with being a hobbyist. But as far as I can see the option is to either completely take over the QL as Tobias described (some of the best games do this) or use Minerva which has perfectly fine screen1 capability. I just don't see the point in doing this work while QDOS is running and thus seeing the garbage from the system variables in the upper part of the screen.

Also, re-inventing the wheel to see how it works is perfectly fine ;) But as I said most if not all ROMs support sd_scrb. This means you can just open a screen channel, adjust sd_scrb of the channel to whatever screen you're currently using and then use the normal draw operations. You just need the address of the channel definition block (e.g. using CHAN_BASE from my https://www.kilgus.net/smsqe/sbasic-too ... lkit-chan/ toolkit).

Code: Select all

cdb = CHAN_BASE(#1)
POKE_L cdb+50,131072+32768
LINE 0,0 TO 50,50
But SuperBASIC manual states lowres `X' also going from 0 .. 511, but pixels count by two?
Pixels are double width so there are no "odd" pixels in the logical scale.


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SCREEN1 = SYSVAR @ JSROM

Post by tcat »

Hi Marcel,

I will give `CHAN_BASE' a try, but I am now eager to try something of my own, as usual. Taking over `QDOS' as suggested, also already experimented in`dithvide' dual screen driver.

I wonder if I could at all, code some basic raster operations to be called, while `QDOS' is stopped. This exercise will keep me going for some time.

To be finally tested in screen switching, always drawing to non active screen. Leaving return path to `QDOS' and sysvars open for exit.

Tomas


Post Reply