User Tools

Site Tools


wswan:guide:interrupt_handlers

Differences

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

Link to this comparison view

Next revision
Previous revision
wswan:guide:interrupt_handlers [2024/02/17 13:25] – created asiewswan:guide:interrupt_handlers [2025/11/07 15:14] (current) asie
Line 1: Line 1:
 ====== Writing interrupt handlers ====== ====== Writing interrupt handlers ======
- 
- 
  
 ===== C interrupt handlers ===== ===== C interrupt handlers =====
  
-For less performance-sensitive interrupts (such as the vertical blank interrupt), it is possible tow rite the relevant handlers using only C. This is done by marking the interrupt function with special attributes:+For less performance-sensitive interrupts (such as the vertical blank interrupt), it is possible to write the relevant handlers using only C. This is done by marking the interrupt function with special attributes:
  
 <code C> <code C>
Line 13: Line 11:
          
     // Acknowledge the hardware interrupt.     // Acknowledge the hardware interrupt.
-    ws_hwint_ack(HWINT_VBLANK);+    ws_int_ack(WS_INT_ACK_VBLANK);
 } }
 </code> </code>
Line 21: Line 19:
   * ''%%__far%%'' - This function is always a "far" call. This is required for interrupt functions - while all functions are "far" calls by default on ''wswan/medium'', this is not true on other subtargets.   * ''%%__far%%'' - This function is always a "far" call. This is required for interrupt functions - while all functions are "far" calls by default on ''wswan/medium'', this is not true on other subtargets.
   * ''interrupt'' - This function is an interrupt. This ensures it saves/restores all registers and that it uses ''IRET'' to return from the function.   * ''interrupt'' - This function is an interrupt. This ensures it saves/restores all registers and that it uses ''IRET'' to return from the function.
-  * ''assume_ss_data'' - This function can assume that ''SS'' points to the default data segment. This assumption holds true throughout the Wonderful toolchain. However, beware that any assembler code which modifies the location of the stack segment ''SS'' must ensure that an interrupt function with this attribute is never called during its execution.+  * ''assume_ss_data'' - This function can assume that ''SS'' points to the default data segment when it is called. This assumption holds true throughout the Wonderful toolchain's default libraries. However, beware that any assembler code which modifies the location of the stack segment ''SS'' must ensure that an interrupt function with this attribute is never called during its execution.
  
 ===== Configuring interrupt handlers ===== ===== Configuring interrupt handlers =====
Line 29: Line 27:
 <code C> <code C>
 // Set the function "vblank_int_handler" to run during vertical blank. // Set the function "vblank_int_handler" to run during vertical blank.
-ws_hwint_set_handler(HWINT_IDX_VBLANK, (ws_int_handler_t) vblank_int_handler);+ws_int_set_handler(WS_INT_VBLANK, (ws_int_handler_t) vblank_int_handler);
  
 // Enable the vertical blank hardware interrupt. // Enable the vertical blank hardware interrupt.
-ws_hwint_enable(HWINT_VBLANK);+ws_int_enable(WS_INT_ENABLE_VBLANK);
  
 // Disable the vertical blank hardware interrupt. // Disable the vertical blank hardware interrupt.
-ws_hwint_disable(HWINT_VBLANK);+ws_int_disable(WS_INT_ENABLE_VBLANK);
 </code> </code>
 +
  
wswan/guide/interrupt_handlers.1708176318.txt.gz · Last modified: by asie