git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/include/gb/hblankcpy.h

      1 #ifndef __HBLANKCPY_H_INCLUDE__
      2 #define __HBLANKCPY_H_INCLUDE__
      3 
      4 #include <stdint.h>
      5 
      6 /** HBlank stack copy routine
      7     @param sour    Source address to copy from
      8     @param count   Number of 16 byte chunks to copy
      9 
     10     Performs the required STAT_REG, IE_REG, IF_REG manipulation
     11     when called and restores STAT_REG and IE_REG on exit
     12     (unlike @ref hblank_cpy_vram()).
     13 
     14     Before calling:
     15     - Set the destination using @ref hblank_copy_destination
     16     - Interrupts must be disabled
     17 
     18     @see hblank_cpy_vram, hblank_copy_destination, hblank_copy
     19 */
     20 void hblank_copy_vram(const uint8_t * sour, uint8_t count);
     21 
     22 /** HBlank stack copy routine
     23     @param sour    Source address to copy from
     24     @param count   Number of 16 byte chunks to copy
     25 
     26     Unlike @ref hblank_copy_vram() does not perform the required
     27     STAT_REG, IE_REG, IF_REG manipulation, nor does it restore
     28     STAT_REG and IE_REG on exit.
     29 
     30     Before calling:
     31     - Set the destination using @ref hblank_copy_destination
     32     - Interrupts must be properly configured
     33     - Interrupts must be disabled
     34 
     35     @see hblank_copy_vram, hblank_copy_destination, hblank_copy
     36 */
     37 void hblank_cpy_vram(const uint8_t * sour, uint8_t count);
     38 
     39 extern uint8_t * hblank_copy_destination; /**< Destination address for hblank copy routine */
     40 
     41 /** HBlank stack copy routine (must be called with interrupts disabled!)
     42     @param dest destination pointer
     43     @param sour source pointer
     44     @param size number of bytes to copy (rounded to 16-byte chunks)
     45 
     46     Performs a fast vram safe copy of data during HBlank.
     47 */
     48 inline void hblank_copy(uint8_t * dest, const uint8_t * sour, uint16_t size) {
     49     hblank_copy_destination = dest;
     50     hblank_copy_vram(sour, size >> 4);
     51 }
     52 
     53 #endif

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.