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
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- RISC OS London Show Report 2024 (News:1)
- Announcing the TIB 2024 Advent Calendar (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- RISCOSbits releases a new laptop solution (News:)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
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: Using *FX from within C
 
  Using *FX from within C
  Cauchy (16:30 5/4/2013)
  Raeddie (04:42 6/4/2013)
    Cauchy (12:42 6/4/2013)
  msww (07:58 6/4/2013)
 
John O'Meara Message #122279, posted by Cauchy at 16:30, 5/4/2013
Member
Posts: 43
Hi,
I can call *Cat and *Time from within C by using the system() function,like; system("Time");, and it does the job, but system("FX\x00"); fails to display the OS and version and its date as *FX 0 does.
Then I wrote the following code piece:
void OSByte0(void)
{
_kernel_swi_regs regs;
regs.r[0] = 0;
regd.r[1] = 0;
_kernel_swi(OS_Byte, &regs, &regs);
}
Which I think is the same as *FX0, and ran that, and the same result as with system("FX\x00"); nothing. Anyone any ideas on what I am doing wrong in both cases? Thanks in advance.
  ^[ Log in to reply ]
 
Holger Palmroth Message #122283, posted by Raeddie at 04:42, 6/4/2013, in reply to message #122279
Member
Posts: 58
"FX\x00" is "FX" followed by a zero byte. You want "FX0", all in plain ASCII, no fancy escape sequences involved. wink
  ^[ Log in to reply ]
 
Matthew Wightman Message #122284, posted by msww at 07:58, 6/4/2013, in reply to message #122279
Member
Posts: 4
Then I wrote the following code piece:
void OSByte0(void)
{
_kernel_swi_regs regs;
regs.r[0] = 0;
regd.r[1] = 0;
_kernel_swi(OS_Byte, &regs, &regs);
}
Which I think is the same as *FX0
According to the documentation for OS_Byte 0 , it works by returning that information as an error. Thus the return value from _kernel_swi will be a pointer to a _kernel_error containing the message you are after.
  ^[ Log in to reply ]
 
John O'Meara Message #122285, posted by Cauchy at 12:42, 6/4/2013, in reply to message #122283
Member
Posts: 43
Thanks for the reply.
calling like this: system("FX0"); to get the effect of *FX 0. Still the same problem; no display is outputed. Edit. Actually it seems as if it works with g++ but not with Castle's C compiler. Also I got OSByte0() working thanks for that too.

[Edited by Cauchy at 17:27, 6/4/2013]
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Using *FX from within C