User Tools

Site Tools


wswan:guide:c_assembly

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wswan:guide:c_assembly [2024/02/29 18:55] asiewswan:guide:c_assembly [2025/08/15 14:43] (current) – [Useful macros] asie
Line 19: Line 19:
   - Include the libws library's definitions. This library supports being included in an assembler, and provides hardware-related defines - such as I/O port names and masks.   - Include the libws library's definitions. This library supports being included in an assembler, and provides hardware-related defines - such as I/O port names and masks.
   - Tell the assembler to emit 16-bit code; this is useful as the GNU assembler supports all kinds of x86 code, including 32-bit and 64-bit.   - Tell the assembler to emit 16-bit code; this is useful as the GNU assembler supports all kinds of x86 code, including 32-bit and 64-bit.
-  - Tell the assembler to emit 80186 code; this unlocks some additional 80186-exclusive opcodes supported on the NEC V30MZ+  - Tell the assembler to emit 80186 code; this unlocks some additional 80186-exclusive opcodes supported on the NEC V30MZ.
   - Tell the assembler to emit Intel-syntax assembly; this is entirely optional, but the examples for external assembly files in this guide all make use of the Intel syntax, as opposed to the default AT&T syntax used in inline assembly.   - Tell the assembler to emit Intel-syntax assembly; this is entirely optional, but the examples for external assembly files in this guide all make use of the Intel syntax, as opposed to the default AT&T syntax used in inline assembly.
  
Line 31: Line 31:
 ===== Useful macros ===== ===== Useful macros =====
  
-''wonderful.h'' provides some useful macros:+''wonderful.h'' (via ''ia16.h''provides some useful macros:
  
-  * **WF_PLATFORM_CALL** - for portability between code models, you can use this macro in place of the ''call'' instruction to call C functions. +  * **IA16_CALL** - for portability between code models, you can use this macro in place of the ''call'' instruction to call C functions. 
-  * **WF_PLATFORM_JMP** - for portability between code models, you can use this macro in place of the ''jmp'' instruction to jump to C functions. +  * **IA16_JMP** - for portability between code models, you can use this macro in place of the ''jmp'' instruction to jump to C functions. 
-  * **WF_PLATFORM_RET** - for portability between code models, you can use this macro in place of the ''ret'' isntruction to return from a C-called function. +  * **IA16_RET** - for portability between code models, you can use this macro in place of the ''ret'' isntruction to return from a C-called function. 
-  * **WF_PLATFORM_CALL_STACK_OFFSET(x)** - for portability between code models, you can use this macro to get a stack offset with the function return address accounted for. For exapmle, in a "near" code model, ''WF_PLATFORM_CALL_STACK_OFFSET(10)'' returns ''12'', but in a "far" code model, it returns ''14''.+  * **IA16_CALL_STACK_OFFSET(x)** - for portability between code models, you can use this macro to get a stack offset with the function return address accounted for. For exapmle, in a "near" code model, ''IA16_CALL_STACK_OFFSET(10)'' returns ''12'', but in a "far" code model, it returns ''14''.
wswan/guide/c_assembly.1709232938.txt.gz · Last modified: by asie