log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Updated RISC OS Git client sent to beta testers (News:11)
- Rougol September 2023 meeting is an informal chat (News:)
- Elesar releases an Econet adapter for RiscPC (News:3)
- London Show 2023 cancelled (News:)
- WROCC September 2023 meeting - Mark Moxon on Elite (News:3)
- WROCC September meeting is very Elite (News:)
- August 2023 News Summary (News:)
- WROCC August Newsletter Volume 41:5 reviewed (News:)
- Rougol August 2023 meeting is an informal chat (News:1)
- New Rogue game from Jereon Vermeulen (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
Site Search
 
Article archives
Acorn Arcade forums: Programming: Getting screen size from old MODE command
 
  Getting screen size from old MODE command
  MrTAToad (11:59 16/12/2012)
  Stoppers (15:51 16/12/2012)
    MrTAToad (16:51 16/12/2012)
      swirlythingy (19:32 16/12/2012)
    MrTAToad (20:26 16/12/2012)
 
Nicholas Kingsley Message #121670, posted by MrTAToad at 11:59, 16/12/2012
Member
Posts: 36
My development work has now started with relish smile

One slight oddity though - I'm setting the screen mode using the old mode value and then attempt to read the screen width and height back :

int *modeBlock;

// Old mode system
inreg.r[0]=0;
inreg.r[1]=sW;
_kernel_swi(OS_ScreenMode,&inreg,&outreg);

// Get the screen resolution
inreg.r[0]=1;
_kernel_swi(OS_ScreenMode,&inreg,&outreg);

modeBlock=(int *) outreg.r[1];

printf("Screen Width : %d Screen Height : %d\n",(int) modeBlock[1],(int) modeBlock[2]);

But for some reason screen width & height is a large negative number and not the proper screen size.

Is this a limitation of using RPCEmu or am I doing something wrong ?

By the way, I've Sourcery up and running (took a bit of effort to get it to use the correct GCC), but it does work fine now, with the expect of the library window always crashing when clicking on "Apply"

[Edited by MrTAToad at 12:08, 16/12/2012]
________
I'm back!
  ^[ Log in to reply ]
 
Simon Willcocks Message #121671, posted by Stoppers at 15:51, 16/12/2012, in reply to message #121670
Member
Posts: 302
// Get the screen resolution
inreg.r[0]=1;
_kernel_swi(OS_ScreenMode,&inreg,&outreg);

modeBlock=(int *) outreg.r[1];

printf("Screen Width : %d Screen Height : %d\n",(int) modeBlock[1],(int) modeBlock[2]);

But for some reason screen width & height is a large negative number and not the proper screen size.
PRM 5a-133: "If the current screen mode was selected by a mode number then that mode number is
returned; otherwise a pointer to a mode selector is returned."

Might OS_ReadModeVariable not be a better choice?
  ^[ Log in to reply ]
 
Nicholas Kingsley Message #121672, posted by MrTAToad at 16:51, 16/12/2012, in reply to message #121671
Member
Posts: 36
Thanks for that. It does look like OS_ReadModeVariable will be needed...
  ^[ Log in to reply ]
 
Martin Bazley Message #121677, posted by swirlythingy at 19:32, 16/12/2012, in reply to message #121672

Posts: 460
If you want to read more than one mode variable at once, you can use OS_ReadVDUVariables. Just enter a mode variable number instead of a VDU variable number.
  ^[ Log in to reply ]
 
Nicholas Kingsley Message #121679, posted by MrTAToad at 20:26, 16/12/2012, in reply to message #121671
Member
Posts: 36
That works fine - great!
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Getting screen size from old MODE command