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
- WROCC Newsletter Volume 41:11 reviewed (News:)
- WROCC March 2024 meeting o... Hughes and Peter Richmond (News:1)
- Rougol March 2024 meeting on monday with Bernard Boase (News:)
- Drag'n'Drop 13i2 edition reviewed (News:)
- South-West Show 2024 talks (News:4)
- February 2024 News Summary (News:1)
- Next developer fireside chat (News:)
- DDE31d released (News:)
- South-West Show 2024 Report (News:)
- South-West Show 2024 in pictures (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
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