C--: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Cic (talk | contribs)
m C MinusMinus moved to C--
Cic (talk | contribs)
Fixed the headers
Line 1: Line 1:
==C--==
This page is about Sphinx Full C--, not about [http://www.cminusminus.org/index.html C--], the portable assembly language.
This page is about Sphinx Full C--, not about [http://www.cminusminus.org/index.html C--], the portable assembly language.


Sphinx Full C-- language is in between the [[C|C language]] and x86-assembly. It is a very neat computer language and the Shinx Full C-- compiler allows to produce (and mix) 16 bit and 32 bit code for real and protected modes.
Sphinx Full C-- language is in between the [[C|C language]] and x86-assembly. It is a very neat computer language and the Shinx Full C-- compiler allows to produce (and mix) 16 bit and 32 bit code for real and protected modes.


===Pros===
==Pros==
* good for writing real mode x86 operating systems;
* good for writing real mode x86 operating systems;
* good for writing TSR programs for DOS
* good for writing TSR programs for DOS
Line 14: Line 13:
* relatively easy to port from and to C-with-assembly.
* relatively easy to port from and to C-with-assembly.


===Cons===
==Cons==
* not portable; it is very closely tied to the x86 assembly;
* not portable; it is very closely tied to the x86 assembly;
* is developed by few developers, the community is small; has less users than gcc so more may have more bugs;
* is developed by few developers, the community is small; has less users than gcc so more may have more bugs;
Line 28: Line 27:
Early versions of [[User:Adek336|panaLiX]] used Sphinx Full C--.
Early versions of [[User:Adek336|panaLiX]] used Sphinx Full C--.


===Examples===
==Examples==
byte x = 0b01001;
byte x = 0b01001;
word y;
word y;
Line 34: Line 33:
#define THIS_A_DEFINITION 123
#define THIS_A_DEFINITION 123


====Take over interrupt====
===Take over interrupt===
dword old0x21 = {};
dword old0x21 = {};
interrupt int0x21()
interrupt int0x21()
Line 79: Line 78:
ESBYTE[0x1b8005]= 127;
ESBYTE[0x1b8005]= 127;


====read, write====
===read, write===
void PRINTF()
void PRINTF()
{
{
Line 135: Line 134:
}
}


====Disk IO====
===Disk IO===
byte readDisk(byte drive, head, sector, track, howmany; word segm, offs)
byte readDisk(byte drive, head, sector, track, howmany; word segm, offs)
int err;
int err;
Line 242: Line 241:
}
}


====Enable Protected Mode====
===Enable Protected Mode===
...
...
?code32 false
?code32 false
Line 283: Line 282:
@setup_pic(0x20, 0x28);
@setup_pic(0x20, 0x28);
...
...





These snippets may seem a bit spaghetti code, but not because of some language defficiency but because I didn't look very far for them snippets.
These snippets may seem a bit spaghetti code, but not because of some language defficiency but because I didn't look very far for them snippets.


===References===
==References==
* [http://c--sphinx.narod.ru/indexe.htm the compilers website]
* [http://c--sphinx.narod.ru/indexe.htm the compilers website]