Article # 205, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
What is the _inline macro (or what is CHANGE_SEGMENT)?
Q. What is "_inline"? It used to be in the irFaxMod sample app and it doesn't compile under Borland C++. or I've seen some code that has the words CHANGE_SEGMENT and RESET_SEGMENT. What are they used for? A. The _inline macro is a HighC directive to produce assembly code in the middle of your C code. You can replace it with the equivalent asm directive in Borland C++. Here is an example: #define PUSH_DS _inline( 0x1e ) /* push ds */ replace the above line with: #define PUSH_DS asm { push ds }; Although, in that particular usage in IrFaxMod where ds is set up to point to the geode's own dgroup, it's better to use the CHANGE_SEGMENT and RESET_SEGMENT macros, defined like so: #define CHANGE_SEGMENT word wTemp; asm { mov wTemp, ds }; GeodeLoadDGroup( GeodeGetCodeProcessHandle() ) #define RESET_SEGMENT asm { mov ds, wTemp } Using CHANGE_SEGMENT stores the current DGROUP segment in the wTemp variable, and loads DS with the library's dgroup. RESET_SEGMENT restores the app's DGROUP segment. Use the macros like so: CHANGE_SEGMENT; /* code here */ RESET_SEGMENT;