Changes

FIOLIB

3,229 bytes added, 19:05, 3 June 2015
With [[Category:C]][[Category:Extended RAM Software]][[Category:FutureOS]][[Category:Programming]][[Category:Programming software]]The '''FIOLIB''' is like a strongly expanded IOLIB library, it's needed to use the programming [[:Category:C|language C]] for [[FutureOS]] it also possible to use C as a programming language. There is a are [[CP/M version ]] versions of Small-C and also Windows-based cross-compilers of the C language. You have to use Use FIOLIB.C instead of IOLIB.C. becase The FIOLIB.C contains all needed C functions to use FutureOS system-calls.
You can use take a normal C program compile it, assemble it, link the object-code with FIOLIB (an and all other needed libraries) and , then add a header to the *.COM file with COMFU.COM.  To start such an C-program under FutureOS you have to start the RUNC-environmentpreviously. RUNC expands the features of FIOLIB. With RUNC it is possible to store functions in E-expansion RAM, leaving more main memory free for C applications.
<pre>
Converts character to upper case.
</pre>
 
 
This is a small example program, that shows how to use the '''FIOLIB''':
 
<pre>
/*
 
FTEST.C - 03.02.2005 - 174 Lines
 
FTEST.C is to show how to write programs for
the Amstrad CPC under FutureOS in Small-C.
 
Compile (under CP/M):
 
A>cc -M ftest
A>zmac ftest=ftest
A>zlink ftest=fiolib,ftest,printf1
A>comfu ftest
 
COMFU.COM converts FTEST.COM to FTEST.SMC
by appending an 128 byte FutureOS header.
 
 
Start (under FutureOS):
 
RUN the RUNC.64K file, then
RUN any .SMC application, like FTEST.SMC (this here)
 
*/
 
 
#include fiolib.h
#include printf1.h
 
main()
{
 
char s[80];
int n,l,h;
 
mode(1);
pen1(1);
ink(16,068);
 
plot(270,040);
plot(279,043);
plot(288,046);
plot(297,049);
plot(306,052);
plot(315,055);
 
move(018,180);
draw(306,153);
 
pen1(2);
 
draw(072,135);
 
plot(270,033);
plot(279,028);
plot(288,024);
plot(297,021);
plot(306,019);
plot(315,018);
 
move(009,009);
draw(019,192);
move(029,009);
draw(039,192);
move(049,009);
draw(059,192);
move(069,009);
draw(079,192);
move(089,009);
draw(099,192);
move(109,009);
draw(119,192);
move(129,009);
draw(139,192);
move(149,009);
draw(159,192);
 
move(160,100);
circle(12);
move(200,110);
circle(18);
move(240,120);
circle(24);
move(280,130);
circle(30);
 
pen1(1);
 
printf("Hello, world\n\nThis is a test");
printf(" for the\nCPC Small-C library\n");
printf("\nby TFM of FutureSoft\n");
 
pen1(2);
printf("\nlet's write ... in pen 2\n");
printf("\nLook at variables H and L: high=%d, low=%d\n",h,l);
 
pen1(3);
printf("\nPress a KEY to continue\n");
getchar();
 
pen1(0);
printf("\nHi, this is a number: %d\n",12345);
 
pen1(1);
puts("This is a 0 terminated string.");
printf("\nPress any key to show 64 x 32 mode 2");
 
getkey(&n);
 
mode(2);
s64x32();
 
pen2(2);
printf("The pressed KEY was: %d\n",n);
 
pen2(3);
printf("\nPress a key again");
 
getkey(&n);
 
pen2(4);
printf("\nThe pressed KEY was: %d\n",n);
 
move(018,198);
draw(504,180);
draw(072,153);
 
printf("\nNow the screen has 64 columns");
printf(" in every line.....................");
 
pen2(1);
printf("And there are 99 lines");
 
pen2(0);
printf("\nAnd there are 32 lines");
 
locate(36,9);
printf("X <-- function: LOCATE(36,9)\n\n");
 
puts("Please enter a text string: ");
gets(s);
 
puts("\n\n\nAnd now edit the string: ");
edst(s);
 
printf("\n\n\nPress any key to resize to 80 x 25 mode 2\n\n");
 
plot(190,090);
plot(199,093);
plot(208,096);
plot(217,099);
plot(226,102);
plot(235,105);
 
plot(190,081);
plot(199,082);
plot(208,083);
plot(217,084);
plot(226,085);
plot(235,086);
 
move(160,100);
circle(12);
move(200,110);
circle(18);
move(240,120);
circle(24);
move(280,130);
circle(30);
 
getchar();
 
cls();
s80x25();
ink(16,084);
 
printf("Well, that's the END for today...\n\n");
 
}
</pre>
 
 
== Weblinks ==
* FIOLIB and demo applications: http://futureos.cpc-live.com/files/FIO.zip
* How to start a Small C program under FutuerOS using the RUNC framework: http://www.youtube.com/watch?v=6vWZeZpNYjg
2,002
edits