| www.retrosoftware.co.uk http://www.retrosoftware.co.uk/forum/ |
|
| Shadow screens http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=576 |
Page 1 of 1 |
| Author: | FrancisL [ Thu Jan 27, 2011 3:53 pm ] |
| Post subject: | Shadow screens |
Hi there, I'm looking for a way to allow a program to know it is running on a BBC that has access to shadow screens. Thanks in advance! Kind regards, Francis |
|
| Author: | MartinB [ Sat Jan 29, 2011 1:17 am ] |
| Post subject: | Re: Shadow screens |
Hi Francis It's not actually that straightforward but this should perhaps cover it... Code: 10 REM * SHADOW DETECTOR * 20 : 25 SHAD=FALSE 30 OS%=FNhost 40 IF OS%>1 SHAD=FNstate-1 50 IF SHAD PRINT"SHADOW ON" ELSE PRINT"NO SHADOW AVAILABLE" 998 END 999 : 1000 DEFFNhost 1010 A%=0:X%=1 1020 =(USR(&FFF4)AND&FF00)DIV256 2000 DEFFNstate 2010 A%=&EF:X%=0:Y%=&FF 2020 =(USR(&FFF4)AND&FF00)DIV256 By line 50 we have the boolean SHAD set true if shadow ram is present and is enabled or false if there is no shadow ram present or it is present but is disabled. Couple of things, the first test is simply ruling out an Elk or a Model B but it is possible to have shadow ram on a B if (for example) an Aries B32 board is fitted. If that edge case worries you I can check how to test for these B expansions. (Although if such a ram expansion causes the OS to report as a Master then we're ok.) Also, I don't know if the Compact or ET have shadow ram? If no for both, line 40 should be changed to... 40 IF OS%>1 AND OS%< 4 SHAD=FNstate-1 ...which will then only consider a B+ (64 or 128) or a Master 128 for test 2. If either or both do have shadow ram then line 40 needs to be modified to include one or both for the second test where an ET will return OS%=4 from test 1 and a Compact will return OS%=5. Any use? |
|
| Author: | PaulA [ Sat Jan 29, 2011 12:06 pm ] |
| Post subject: | Re: Shadow screens |
MartinB wrote: Also, I don't know if the Compact or ET have shadow ram? If no for both, line 40 should be changed to... They both do, the SRAM utils are on the ET, just the help files are missing. |
|
| Author: | FrancisL [ Sat Jan 29, 2011 5:54 pm ] |
| Post subject: | Re: Shadow screens |
Thanks for that Martin. Do I really need to check what the host machine is though? I would have assumed that just checking for the shadow memory being available was enough. Kind regards, Francis |
|
| Author: | FrancisL [ Sat Jan 29, 2011 6:42 pm ] |
| Post subject: | Re: Shadow screens |
Hmm... I found that I had to change line 40 to the following for it to work: Code: 40 IF OS%>1 SHAD=FNstate On BeebEm if I typed "P. FNstate" at the prompt I would get a 0 for the BBC B setting and 1 for the BBC Master. Kind regards, Francis |
|
| Author: | MartinB [ Sat Jan 29, 2011 7:44 pm ] |
| Post subject: | Re: Shadow screens |
I think I slightly misunderstood what you were after and I'm not as familiar with Masters etc. as I am with the Model B Anyway, if you leave the utility as I posted but add line... 35 IF OS%>1 THEN *SHADOW ...then the subsequent report will be correct for the relevant machines and shadow will be used for any new sreen Mode regardless. I thought perhaps you were trying to see what state the machine was in rather than control the state. You do need to eliminate the Elk and the B because they will return 0 for the second test simply because they don't support the call and this will a give an incorrect TRUE result. Also, now I'm including the *SHADOW command we have to skip the Elk and Beeb to avoid a Bad Command error. You might then not even need the second test I suppose but I don't know if shadow can be turned off by some other stealth means! |
|
| Author: | FrancisL [ Sat Jan 29, 2011 8:26 pm ] |
| Post subject: | Re: Shadow screens |
Thanks Martin. To explain what I am trying to do: my aim is to see if a program could assess if it could use shadow screens and if so allow the user to optionally use something like a MODE 128 screen instead of MODE 7. Kind regards, Francis |
|
| Author: | PaulA [ Mon Jan 31, 2011 3:59 am ] |
| Post subject: | Re: Shadow screens |
If you just want to use shadow screen modes, and don't care about the detection part, there is an easier way. Code: m=7:REM desired mode P. ~(128+m) > 87 then use that number thusly: Code: Mode &87 On model B it just ignores the &8 part. |
|
| Author: | FrancisL [ Mon Jan 31, 2011 10:19 am ] |
| Post subject: | Re: Shadow screens |
Thanks Paul. I do need for my program to be able to detect the presence of shadow RAM otherwise the user would get a bad mode error on a BBC B if they tried to use a 20k screen mode. Kind regards, Francis |
|
| Author: | jgharston [ Fri Feb 04, 2011 5:54 pm ] |
| Post subject: | Re: Shadow screens |
FrancisL wrote: I do need for my program to be able to detect the presence of shadow RAM otherwise the user would get a bad mode error on a BBC B if they tried to use a 20k screen mode. So, you need to know before trying to change screen mode. I often use: MODE &83:IF HIMEM>&7FFF:MODE &80 In general, no code should try to detect the presence of features, they should just go ahead and try to use them, and not use the features if the features are not selected, and you certainly must not Stalinistically say "there is no way product X, which is the only one I have any experience of, can possible ever ever have the features I'm looking for, so I prohibit the user from even trying" Electron can have shadow screen. BBC B can have shadow screen. *Any* BBC serial computer can have shadow screen, real-time clock, MODE 7, serial port, ADC, printer port. Just use the call to try to use it and respond to the "doesn't exist" return value if it doesn't exist. |
|
| Page 1 of 1 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|