Switching screen modes

Anything QL Software or Programming Related.
Post Reply
User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Switching screen modes

Post by bwinkel67 »

So I can do the following in BASIC to switch between TV and Monitor mode (in JSU):

Code: Select all

POKE 163890,2
NEW
In Digital C SE I can do the poke as follows:

Code: Select all

char *mem;

mem = _makerel(0x28032L)
mem[0]=2;
How do I do the NEW? Haven't looked through appropriate trap call...will I find it there?


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

Re: Switching screen modes

Post by mk79 »

NEW deletes the program and redraws the Basic windows. You're not in Basic, what exactly should happen? If you want to redraw your own C windows, just do a Border/Clear call on them.


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Switching screen modes

Post by bwinkel67 »

mk79 wrote:NEW deletes the program and redraws the Basic windows. You're not in Basic, what exactly should happen? If you want to redraw your own C windows, just do a Border/Clear call on them.
If I do that in BASIC (i.e. change border and clear nothing happens whereas with NEW the screen mode changes from TV mode to Monitor mode and on my JSU rom it switches from NTSC to PAL. I've also tried MODE and again, nothing. So NEW seems to do something on top of that that causes the computer to refresh.

I suppose another question, sometimes a program forces the screen mode and with a JSU rom that means my display switches resolution (on a CRT TV that's more than just changing window configurations since the signal becomes unstable in Monitor mode). Besides changing the value at address 163890, what else does a running program do to basically repeat what happens during F1 vs F2 bootup.


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

Re: Switching screen modes

Post by mk79 »

Ah, now I get your problem. Use MT.DMOD trap to change your screen mode, don‘t poke it in the system variables. That should have the desired effect.


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Switching screen modes

Post by bwinkel67 »

mk79 wrote:Ah, now I get your problem. Use MT.DMOD trap to change your screen mode, don‘t poke it in the system variables. That should have the desired effect.
That did the trick. Unfortunately it didn't work for my purpse...I was hoping the program that was running would yield time to my exec'ed process so I could kick screen resolution back to TV mode but the program below never ran. I'll have to go and debug that other program instead to see if I can undo the screen switch. I did that with Tank Busters almost 30 years ago and found out where it was forcing the screen switch so I could run it on my US TV back then...think I must have used Qmon for that since I own it.

Code: Select all

#include stdio_h

long key[8] = {0X0};
long ret[8];

main()
{
   char *mem;

   pause(2700);
   key[0]=16;  /* 0x10 -- $10 */
   key[2]=2;
   trap1(key,ret);
}


Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Switching screen modes

Post by Derek_Stewart »

mk79 wrote:Ah, now I get your problem. Use MT.DMOD trap to change your screen mode, don‘t poke it in the system variables. That should have the desired effect.
Hi,

This is the correc tprocedure to chnage the QL Screen Mode, as just poking the System Variables will chnage the Screen Mode as required, but the operating system will not register the screen mode change, causing a conflicit.

This is mentioned most good QL technical books.


Regards,

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

Re: Switching screen modes

Post by mk79 »

Derek_Stewart wrote:This is the correc tprocedure to chnage the QL Screen Mode, as just poking the System Variables will chnage the Screen Mode as required, but the operating system will not register the screen mode change, causing a conflicit.

This is mentioned most good QL technical books.
Yes. But to be pedantic, changing the system variables does nothing per se. What the NEW command however does is re-setting the mode by first reading it and then setting it again, presumably to get a free re-initialization of its windows. The hardware doesn't allow reading the actual mode, so the value written in the system variable is used instead. This is where the mode change happens in this case. But it's seldom a good idea to just go and write stuff to the variables, many times there is a better way.


Post Reply