gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit a270bd69979fdd039e417258ebb5438a0484ce23 parent 802c9a199e11a16d596e4b25dd67aef3c2b78c05 Author: Toxa <untoxa@mail.ru> Date: Tue, 14 Sep 2021 12:59:34 +0300 prepare for SDCC >= #12608 Diffstat:
22 files changed, 194 insertions(+), 269 deletions(-)
diff --git a/gbdk-lib/include/asm/gbz80/string.h b/gbdk-lib/include/asm/gbz80/string.h @@ -17,7 +17,7 @@ @return A pointer to dest */ -char *strcpy(char *dest, const char *src) NONBANKED __preserves_regs(b, c); +char *strcpy(char *dest, const char *src) OLDCALL __preserves_regs(b, c); /** Compares strings @@ -29,7 +29,7 @@ char *strcpy(char *dest, const char *src) NONBANKED __preserves_regs(b, c); \li 0 if __s1__ == __s2__ \li < 0 if __s1__ < __s2__ */ -int strcmp(const char *s1, const char *s2) NONBANKED __preserves_regs(b, c); +int strcmp(const char *s1, const char *s2) OLDCALL __preserves_regs(b, c); /** Copies n bytes from memory area src to memory area dest. @@ -39,7 +39,7 @@ int strcmp(const char *s1, const char *s2) NONBANKED __preserves_regs(b, c); @param src Buffer to copy from @param len Number of Bytes to copy */ -void *memcpy(void *dest, const void *src, size_t len) NONBANKED __preserves_regs(b, c); +void *memcpy(void *dest, const void *src, size_t len) OLDCALL __preserves_regs(b, c); /** Copies n bytes from memory area src to memory area dest, areas may overlap */ @@ -51,7 +51,7 @@ void *memmove (void *dest, const void *src, size_t n); @param c char value to fill with (truncated from int) @param n Number of bytes to fill */ -void *memset (void *s, int c, size_t n) NONBANKED __preserves_regs(b, c); +void *memset (void *s, int c, size_t n) OLDCALL __preserves_regs(b, c); /** Reverses the characters in a string @@ -63,7 +63,7 @@ void *memset (void *s, int c, size_t n) NONBANKED __preserves_regs(b, c); Returns: Pointer to __s__ */ -char *reverse(char *s) __preserves_regs(b, c); +char *reverse(char *s) OLDCALL __preserves_regs(b, c); /** Concatenate Strings. Appends string __s2__ to the end of string __s1__ @@ -76,7 +76,7 @@ char *reverse(char *s) __preserves_regs(b, c); Returns: Pointer to __s1__ */ -char *strcat(char *s1, const char *s2) NONBANKED; +char *strcat(char *s1, const char *s2); /** Calculates the length of a string @@ -84,7 +84,7 @@ char *strcat(char *s1, const char *s2) NONBANKED; Returns: Length of string not including the terminating `\0' character. */ -int strlen(const char *s) NONBANKED __preserves_regs(b, c); +int strlen(const char *s) OLDCALL __preserves_regs(b, c); /**Concatenate at most __n__ characters from string __s2__ onto the end of __s1__. @@ -96,7 +96,7 @@ int strlen(const char *s) NONBANKED __preserves_regs(b, c); Returns: Pointer to __s1__ */ -char *strncat(char *s1, const char *s2, int n) NONBANKED; +char *strncat(char *s1, const char *s2, int n); /** Compare strings (at most n characters): @@ -109,7 +109,7 @@ char *strncat(char *s1, const char *s2, int n) NONBANKED; \li 0 if __s1__ == __s2__ \li < 0 if __s1__ < __s2__ */ -int strncmp(const char *s1, const char *s2, int n) NONBANKED; +int strncmp(const char *s1, const char *s2, int n); /** Copy __n__ characters from string __s2__ to __s1__ @@ -126,6 +126,6 @@ int strncmp(const char *s1, const char *s2, int n) NONBANKED; Returns: Pointer to __s1__ */ -char *strncpy(char *s1, const char *s2, int n) NONBANKED; +char *strncpy(char *s1, const char *s2, int n); #endif diff --git a/gbdk-lib/include/asm/types.h b/gbdk-lib/include/asm/types.h @@ -14,6 +14,12 @@ #endif #endif +#if __SDCC_REVISION >= 12608 +#define OLDCALL __sdcccall(0) +#else +#define OLDCALL +#endif + #ifndef NONBANKED #define NONBANKED #endif diff --git a/gbdk-lib/include/asm/z80/string.h b/gbdk-lib/include/asm/z80/string.h @@ -17,7 +17,7 @@ @return A pointer to dest */ -char *strcpy(char *dest, const char *src) NONBANKED; +char *strcpy(char *dest, const char *src) OLDCALL; /** Compares strings @@ -29,7 +29,7 @@ char *strcpy(char *dest, const char *src) NONBANKED; \li 0 if __s1__ == __s2__ \li < 0 if __s1__ < __s2__ */ -int strcmp(const char *s1, const char *s2) NONBANKED; +int strcmp(const char *s1, const char *s2); /** Copies n bytes from memory area src to memory area dest. @@ -39,11 +39,11 @@ int strcmp(const char *s1, const char *s2) NONBANKED; @param src Buffer to copy from @param len Number of Bytes to copy */ -void *memcpy(void *dest, const void *src, size_t len) NONBANKED; +void *memcpy(void *dest, const void *src, size_t len) OLDCALL; /** Copies n bytes from memory area src to memory area dest, areas may overlap */ -void *memmove (void *dest, const void *src, size_t n); +void *memmove (void *dest, const void *src, size_t n) OLDCALL; /** Fills the memory region __s__ with __n__ bytes using value __c__ @@ -63,7 +63,7 @@ void *memset (void *s, int c, size_t n) __z88dk_callee; Returns: Pointer to __s__ */ -char *reverse(char *s); +char *reverse(char *s) NONBANKED; /** Concatenate Strings. Appends string __s2__ to the end of string __s1__ @@ -84,7 +84,7 @@ char *strcat(char *s1, const char *s2) NONBANKED; Returns: Length of string not including the terminating `\0' character. */ -int strlen(const char *s) NONBANKED; +int strlen(const char *s) OLDCALL; /**Concatenate at most __n__ characters from string __s2__ onto the end of __s1__. diff --git a/gbdk-lib/include/ctype.h b/gbdk-lib/include/ctype.h @@ -10,43 +10,36 @@ /** Returns TRUE if the character __c__ is a letter (a-z, A-Z), otherwise FALSE @param c Character to test */ -bool -isalpha(char c); +bool isalpha(char c); /** Returns TRUE if the character __c__ is an uppercase letter (A-Z), otherwise FALSE @param c Character to test */ -bool -isupper(char c); +bool isupper(char c); /** Returns TRUE if the character __c__ is a lowercase letter (a-z), otherwise FALSE @param c Character to test */ -bool -islower(char c); +bool islower(char c); /** Returns TRUE if the character __c__ is a digit (0-9), otherwise FALSE @param c Character to test */ -bool -isdigit(char c); +bool isdigit(char c); /** Returns TRUE if the character __c__ is a space (' '), tab (\\t), or newline (\\n) character, otherwise FALSE @param c Character to test */ -bool -isspace(char c); +bool isspace(char c); /** Returns uppercase version of character __c__ if it is a letter (a-z), otherwise it returns the input value unchanged. @param c Character to test */ -char -toupper(char c); +char toupper(char c); /** Returns lowercase version of character __c__ if it is a letter (A-Z), otherwise it returns the input value unchanged. @param c Character to test */ -char -tolower(char c); +char tolower(char c); #endif /* _CTYPE_H */ diff --git a/gbdk-lib/include/gb/bcd.h b/gbdk-lib/include/gb/bcd.h @@ -1,8 +1,8 @@ #ifndef __BCD_H_INCLUDE #define __BCD_H_INCLUDE +#include <types.h> #include <stdint.h> -#include <asm/types.h> /** @file bcd.h Support for working with BCD (Binary Coded Decimal) @@ -25,19 +25,19 @@ typedef uint32_t BCD; @param i Numeric value to convert @param value Pointer to a BCD variable to store the converted result */ -void uint2bcd(uint16_t i, BCD * value); +void uint2bcd(uint16_t i, BCD * value) OLDCALL; /** Adds two numbers in BCD format: __sour__ += __value__ @param sour Pointer to a BCD value to add to (and where the result is stored) @param value Pointer to the BCD value to add to __sour__ */ -void bcd_add(BCD * sour, const BCD * value); +void bcd_add(BCD * sour, const BCD * value) OLDCALL; /** Subtracts two numbers in BCD format: __sour__ -= __value__ @param sour Pointer to a BCD value to subtract from (and where the result is stored) @param value Pointer to the BCD value to subtract from __sour__ */ -void bcd_sub(BCD * sour, const BCD * value); +void bcd_sub(BCD * sour, const BCD * value) OLDCALL; /** Convert a BCD number into an asciiz (null terminated) string and return the length @param bcd Pointer to BCD value to convert @@ -56,6 +56,6 @@ void bcd_sub(BCD * sour, const BCD * value); \li It can also be set to the ascii value for character '0' so that the buffer is a normal string that can be passed to @ref printf. */ -uint8_t bcd2text(const BCD * bcd, uint8_t tile_offset, uint8_t * buffer); +uint8_t bcd2text(const BCD * bcd, uint8_t tile_offset, uint8_t * buffer) OLDCALL; #endif diff --git a/gbdk-lib/include/gb/bgb_emu.h b/gbdk-lib/include/gb/bgb_emu.h @@ -12,6 +12,8 @@ #ifndef __BGB_EMU_INCLUDE #define __BGB_EMU_INCLUDE +#include <types.h> + /** Macro to display a message in the BGB emulator debug message window @param message_text Quoted text string to display in the debug message window @@ -139,7 +141,7 @@ void BGB_profiler_message(); be explicitly re-cast as such when calling the function. See @ref docs_chars_varargs for more details. */ -void BGB_printf(const char *format, ...); +void BGB_printf(const char *format, ...) OLDCALL; static void * __BGB_PROFILER_INIT = &BGB_profiler_message; diff --git a/gbdk-lib/include/gb/cgb.h b/gbdk-lib/include/gb/cgb.h @@ -100,9 +100,7 @@ typedef uint16_t palette_entry_t; /**< 16 bit color entry */ @see RGB(), set_bkg_palette_entry() */ void -set_bkg_palette(uint8_t first_palette, - uint8_t nb_palettes, - palette_entry_t *rgb_data) NONBANKED; +set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, palette_entry_t *rgb_data) OLDCALL; /** Set CGB sprite palette(s). @@ -120,9 +118,7 @@ set_bkg_palette(uint8_t first_palette, @see RGB(), set_sprite_palette_entry() */ void -set_sprite_palette(uint8_t first_palette, - uint8_t nb_palettes, - palette_entry_t *rgb_data) NONBANKED; +set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, palette_entry_t *rgb_data) OLDCALL; /** Sets a single color in the specified CGB background palette. @@ -134,9 +130,7 @@ set_sprite_palette(uint8_t first_palette, */ void -set_bkg_palette_entry(uint8_t palette, - uint8_t entry, - uint16_t rgb_data); +set_bkg_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL; /** Sets a single color in the specified CGB sprite palette. @@ -147,9 +141,7 @@ set_bkg_palette_entry(uint8_t palette, @see set_sprite_palette(), RGB() */ void -set_sprite_palette_entry(uint8_t palette, - uint8_t entry, - uint16_t rgb_data); +set_sprite_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL; /** Set CPU speed to slow (Normal Speed) operation. @@ -161,7 +153,7 @@ set_sprite_palette_entry(uint8_t palette, @see cpu_fast() */ -void cpu_slow(void); +void cpu_slow(); /** Set CPU speed to fast (CGB Double Speed) operation. @@ -175,7 +167,7 @@ void cpu_slow(void); @see cpu_slow(), _cpu */ -void cpu_fast(void); +void cpu_fast(); /** Set palette, compatible with the DMG/GBP. @@ -185,10 +177,10 @@ void cpu_fast(void); \li You can check to see if @ref _cpu == @ref CGB_TYPE before using this function. */ -void set_default_palette(void); +void set_default_palette(); /** This function is obsolete */ -void cgb_compatibility(void); +void cgb_compatibility(); #endif /* _CGB_H */ diff --git a/gbdk-lib/include/gb/drawing.h b/gbdk-lib/include/gb/drawing.h @@ -30,6 +30,7 @@ #ifndef __DRAWING_H #define __DRAWING_H +#include <types.h> #include <stdint.h> /** Size of the screen in pixels */ @@ -68,8 +69,7 @@ /** Print the string 'str' with no interpretation @see gotogxy() */ -void - gprint(char *str) NONBANKED; +void gprint(char *str) OLDCALL; /** Print 16 bit __number__ in __radix__ (base) in the default font at the current text position. @@ -80,15 +80,13 @@ void The current position is advanced by the numer of characters printed. @see gotogxy() */ -void - gprintln(int16_t number, int8_t radix, int8_t signed_value); +void gprintln(int16_t number, int8_t radix, int8_t signed_value) OLDCALL; /** Print 8 bit __number__ in __radix__ (base) in the default font at the current text position. @see gprintln(), gotogxy() */ -void - gprintn(int8_t number, int8_t radix, int8_t signed_value); +void gprintn(int8_t number, int8_t radix, int8_t signed_value) OLDCALL; /** Print the string and arguments given by __fmt__ with arguments __...__ @@ -106,61 +104,50 @@ void @return Returns the number of items printed, or -1 if there was an error. @see gotogxy() */ -int8_t - gprintf(char *fmt,...) NONBANKED; +int8_t gprintf(char *fmt,...) OLDCALL; /** Old style plot - try @ref plot_point() */ -void - plot(uint8_t x, uint8_t y, uint8_t colour, uint8_t mode); +void plot(uint8_t x, uint8_t y, uint8_t colour, uint8_t mode) OLDCALL; /** Plot a point in the current drawing mode and colour at __x,y__ */ -void - plot_point(uint8_t x, uint8_t y); +void plot_point(uint8_t x, uint8_t y) OLDCALL; /** Exchanges the tile on screen at x,y with the tile pointed by src, original tile is saved in dst. Both src and dst may be NULL - saving or copying to screen is not performed in this case. */ -void - switch_data(uint8_t x, uint8_t y, uint8_t *src, uint8_t *dst) NONBANKED; +void switch_data(uint8_t x, uint8_t y, uint8_t *src, uint8_t *dst) OLDCALL; /** Draw a full screen image at __data__ */ -void - draw_image(uint8_t *data) NONBANKED; +void draw_image(uint8_t *data) OLDCALL; /** Draw a line in the current drawing mode and colour from __x1,y1__ to __x2,y2__ */ -void - line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); +void line(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) OLDCALL; /** Draw a box (rectangle) with corners __x1,y1__ and __x2,y2__ using fill mode __style__ (one of NOFILL or FILL) */ -void - box(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t style); +void box(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t style) OLDCALL; /** Draw a circle with centre at __x,y__ and __radius__ using fill mode __style__ (one of NOFILL or FILL)*/ -void - circle(uint8_t x, uint8_t y, uint8_t radius, uint8_t style); +void circle(uint8_t x, uint8_t y, uint8_t radius, uint8_t style) OLDCALL; /** Returns the current colour of the pixel at __x,y__ */ -uint8_t - getpix(uint8_t x, uint8_t y); +uint8_t getpix(uint8_t x, uint8_t y) OLDCALL; /** Prints the character __chr__ in the default font at the current text position. The current position is advanced by 1 after the character is printed. @see gotogxy() */ -void - wrtchr(char chr); +void wrtchr(char chr) OLDCALL; /** Sets the current text position to __x,y__. Note: __x__ and __y__ have units of tiles (8 pixels per unit) @see wrtchr() */ -void - gotogxy(uint8_t x, uint8_t y); +void gotogxy(uint8_t x, uint8_t y) OLDCALL; /** Set the current __foreground__ colour (for pixels), __background__ colour, and draw __mode__ */ -void color(uint8_t forecolor, uint8_t backcolor, uint8_t mode); +void color(uint8_t forecolor, uint8_t backcolor, uint8_t mode) OLDCALL; #endif /* __DRAWING_H */ diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -165,17 +165,17 @@ typedef void (*int_handler)(void) NONBANKED; Removes the VBL interrupt handler. @see add_VBL() */ -void remove_VBL(int_handler h) NONBANKED; +void remove_VBL(int_handler h) OLDCALL; /** Removes the LCD interrupt handler. @see add_LCD(), remove_VBL() */ -void remove_LCD(int_handler h) NONBANKED; +void remove_LCD(int_handler h) OLDCALL; /** Removes the TIM interrupt handler. @see add_TIM(), remove_VBL() */ -void remove_TIM(int_handler h) NONBANKED; +void remove_TIM(int_handler h) OLDCALL; /** Removes the Serial Link / SIO interrupt handler. @see add_SIO(), @see remove_VBL() @@ -189,12 +189,12 @@ void remove_TIM(int_handler h) NONBANKED; Only secondary chained SIO ISRs (added with @ref add_SIO() ) can be removed. */ -void remove_SIO(int_handler h) NONBANKED; +void remove_SIO(int_handler h) OLDCALL; /** Removes the JOY interrupt handler. @see add_JOY(), remove_VBL() */ -void remove_JOY(int_handler h) NONBANKED; +void remove_JOY(int_handler h) OLDCALL; /** Adds a V-blank interrupt handler. @@ -212,7 +212,7 @@ void remove_JOY(int_handler h) NONBANKED; Note: The default VBL is installed automatically. */ -void add_VBL(int_handler h) NONBANKED; +void add_VBL(int_handler h) OLDCALL; /** Adds a LCD interrupt handler. @@ -230,7 +230,7 @@ void add_VBL(int_handler h) NONBANKED; @see add_VBL */ -void add_LCD(int_handler h) NONBANKED; +void add_LCD(int_handler h) OLDCALL; /** Adds a timer interrupt handler. @@ -241,7 +241,7 @@ void add_LCD(int_handler h) NONBANKED; @see add_VBL @see set_interrupts() with TIM_IFLAG */ -void add_TIM(int_handler h) NONBANKED; +void add_TIM(int_handler h) OLDCALL; /** Adds a Serial Link transmit complete interrupt handler. @@ -253,7 +253,7 @@ void add_TIM(int_handler h) NONBANKED; @see send_byte, receive_byte(), add_VBL() @see set_interrupts() with SIO_IFLAG */ -void add_SIO(int_handler h) NONBANKED; +void add_SIO(int_handler h) OLDCALL; /** Adds a joypad button change interrupt handler. @@ -268,7 +268,7 @@ void add_SIO(int_handler h) NONBANKED; @see joypad(), add_VBL() */ -void add_JOY(int_handler h) NONBANKED; +void add_JOY(int_handler h) OLDCALL; /** Interrupt handler chain terminator that does __not__ wait for .STAT @@ -286,7 +286,7 @@ void add_JOY(int_handler h) NONBANKED; \endcode @see wait_int_handler() */ -void nowait_int_handler(void) NONBANKED; +void nowait_int_handler(); /** Default Interrupt handler chain terminator that waits for @@ -301,7 +301,7 @@ void nowait_int_handler(void) NONBANKED; @see nowait_int_handler() */ -void wait_int_handler(void) NONBANKED; +void wait_int_handler(); /** Cancel pending interrupts */ @@ -315,13 +315,13 @@ inline uint8_t cancel_pending_interrupts() { @see M_DRAWING, M_TEXT_OUT, M_TEXT_INOUT, M_NO_SCROLL, M_NO_INTERP */ -void mode(uint8_t m) NONBANKED; +void mode(uint8_t m) OLDCALL; /** Returns the current mode @see M_DRAWING, M_TEXT_OUT, M_TEXT_INOUT, M_NO_SCROLL, M_NO_INTERP */ -uint8_t get_mode(void) NONBANKED __preserves_regs(b, c); +uint8_t get_mode() __preserves_regs(b, c); /** GB CPU type @@ -373,7 +373,7 @@ extern volatile uint16_t sys_time; @see add_SIO(), remove_SIO() @see set_interrupts() with @ref SIO_IFLAG */ -void send_byte(void); +void send_byte(); /** Serial Link: Receive a byte from the serial port into @ref _io_in @@ -382,7 +382,7 @@ void send_byte(void); @see add_SIO(), remove_SIO() @see set_interrupts() with @ref SIO_IFLAG */ -void receive_byte(void); +void receive_byte(); /** Serial Link: Current IO Status. An OR of IO_* */ extern volatile uint8_t _io_status; @@ -547,7 +547,7 @@ __endasm; \ Uses no timers or interrupts, and can be called with interrupts disabled */ -void delay(uint16_t d) NONBANKED; +void delay(uint16_t d) OLDCALL; @@ -561,7 +561,7 @@ void delay(uint16_t d) NONBANKED; @see J_START, J_SELECT, J_A, J_B, J_UP, J_DOWN, J_LEFT, J_RIGHT */ -uint8_t joypad(void) NONBANKED __preserves_regs(b, c, h, l); +uint8_t joypad() __preserves_regs(b, c, h, l); /** Waits until at least one of the buttons given in mask are pressed. @@ -575,14 +575,14 @@ uint8_t joypad(void) NONBANKED __preserves_regs(b, c, h, l); @see joypad @see J_START, J_SELECT, J_A, J_B, J_UP, J_DOWN, J_LEFT, J_RIGHT */ -uint8_t waitpad(uint8_t mask) NONBANKED __preserves_regs(b, c); +uint8_t waitpad(uint8_t mask) OLDCALL __preserves_regs(b, c); /** Waits for the directional pad and all buttons to be released. Note: Checks in a loop that doesn't HALT at all, so the CPU will be maxed out until this call returns. */ -void waitpadup(void) NONBANKED __preserves_regs(a, b, c, d, e, h, l); +void waitpadup() __preserves_regs(a, b, c, d, e, h, l); /** Multiplayer joypad structure. @@ -608,7 +608,7 @@ typedef struct { @returns number of joypads avaliable @see joypad_ex(), joypads_t */ -uint8_t joypad_init(uint8_t npads, joypads_t * joypads); +uint8_t joypad_init(uint8_t npads, joypads_t * joypads) OLDCALL; /** Polls all avaliable joypads (for the GB and ones connected via SGB) @param joypads pointer to joypads_t structure to be filled with joypad statuses, @@ -616,7 +616,7 @@ uint8_t joypad_init(uint8_t npads, joypads_t * joypads); @see joypad_init(), joypads_t */ -void joypad_ex(joypads_t * joypads) __preserves_regs(b, c); +void joypad_ex(joypads_t * joypads) OLDCALL __preserves_regs(b, c); @@ -628,7 +628,7 @@ void joypad_ex(joypads_t * joypads) __preserves_regs(b, c); @see disable_interrupts, set_interrupts, CRITICAL */ -inline void enable_interrupts(void) __preserves_regs(a, b, c, d, e, h, l) { +inline void enable_interrupts() __preserves_regs(a, b, c, d, e, h, l) { __asm__("ei"); } @@ -644,7 +644,7 @@ inline void enable_interrupts(void) __preserves_regs(a, b, c, d, e, h, l) { @see enable_interrupts, set_interrupts, CRITICAL */ -inline void disable_interrupts(void) __preserves_regs(a, b, c, d, e, h, l) { +inline void disable_interrupts() __preserves_regs(a, b, c, d, e, h, l) { __asm__("di"); } @@ -654,12 +654,12 @@ inline void disable_interrupts(void) __preserves_regs(a, b, c, d, e, h, l) { @see enable_interrupts(), disable_interrupts() @see VBL_IFLAG, LCD_IFLAG, TIM_IFLAG, SIO_IFLAG, JOY_IFLAG */ -void set_interrupts(uint8_t flags) NONBANKED __preserves_regs(b, c, d, e); +void set_interrupts(uint8_t flags) OLDCALL __preserves_regs(b, c, d, e); /** Performs a warm reset by reloading the CPU value then jumping to the start of crt0 (0x0150) */ -void reset(void) NONBANKED; +void reset(); /** HALTs the CPU and waits for the vertical blank interrupt (VBL) to finish. @@ -671,18 +671,18 @@ void reset(void) NONBANKED; never return. If the screen is off this function returns immediately. */ -void wait_vbl_done(void) NONBANKED __preserves_regs(b, c, d, e, h, l); +void wait_vbl_done() __preserves_regs(b, c, d, e, h, l); /** Turns the display off. Waits until the VBL interrupt before turning the display off. @see DISPLAY_ON */ -void display_off(void) NONBANKED __preserves_regs(b, c, d, e, h, l); +void display_off() __preserves_regs(b, c, d, e, h, l); /** Copies data from shadow OAM to OAM */ -void refresh_OAM() NONBANKED; +void refresh_OAM(); /** Copies data from somewhere in the lower address space to part of hi-ram. @@ -690,9 +690,7 @@ void refresh_OAM() NONBANKED; @param src Area to copy from @param n Number of bytes to copy. */ -void hiramcpy(uint8_t dst, - const void *src, - uint8_t n) NONBANKED __preserves_regs(b, c); +void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL __preserves_regs(b, c); /** Turns the display back on. @@ -771,7 +769,7 @@ void hiramcpy(uint8_t dst, * @param addr address to write to * @param v value */ -void set_vram_byte(uint8_t * addr, uint8_t v) __preserves_regs(b, c); +void set_vram_byte(uint8_t * addr, uint8_t v) OLDCALL __preserves_regs(b, c); /** * Get byte from vram at given memory location @@ -779,13 +777,13 @@ void set_vram_byte(uint8_t * addr, uint8_t v) __preserves_regs(b, c); * @param addr address to read from * @return read value */ -uint8_t get_vram_byte(uint8_t * addr) __preserves_regs(b, c); +uint8_t get_vram_byte(uint8_t * addr) OLDCALL __preserves_regs(b, c); /** * Get address of X,Y tile of background map */ -uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) __preserves_regs(b, c); +uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) OLDCALL __preserves_regs(b, c); #define COMPAT_PALETTE(C0,C1,C2,C3) (((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)) @@ -812,9 +810,7 @@ inline void set_2bpp_palette(uint16_t palette) { @see set_win_data, set_tile_data */ -void set_bkg_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data) NONBANKED __preserves_regs(b, c); +void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL __preserves_regs(b, c); #define set_bkg_2bpp_data set_bkg_data /** Sets VRAM Tile Pattern data for the Background / Window using 1bpp source data @@ -833,10 +829,7 @@ void set_bkg_data(uint8_t first_tile, @see SHOW_BKG, HIDE_BKG, set_bkg_tiles */ -void set_bkg_1bit_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data, - uint8_t color) NONBANKED __preserves_regs(b, c); +void set_bkg_1bit_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t color) OLDCALL __preserves_regs(b, c); #define set_bkg_1bpp_data set_bkg_1bit_data /** Copies from Background / Window VRAM Tile Pattern data into a buffer @@ -853,9 +846,7 @@ void set_bkg_1bit_data(uint8_t first_tile, @see get_win_data, get_data */ -void get_bkg_data(uint8_t first_tile, - uint8_t nb_tiles, - uint8_t *data) NONBANKED __preserves_regs(b, c); +void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL __preserves_regs(b, c); /** Sets a rectangular region of Background Tile Map. @@ -910,11 +901,7 @@ void get_bkg_data(uint8_t first_tile, @see SHOW_BKG @see set_bkg_data, set_bkg_submap, set_win_tiles, set_tiles */ -void set_bkg_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - const uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL __preserves_regs(b, c); #define set_tile_map set_bkg_tiles @@ -946,7 +933,7 @@ void set_bkg_tiles(uint8_t x, @see SHOW_BKG @see set_bkg_data, set_bkg_tiles, set_win_submap, set_tiles */ -void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w); +void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL; #define set_tile_submap set_bkg_submap /** Copies a rectangular region of Background Tile Map entries into a buffer. @@ -967,11 +954,7 @@ void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *m @see get_win_tiles, get_bkg_tile_xy, get_tiles, get_vram_byte */ -void get_bkg_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL __preserves_regs(b, c); /** @@ -981,7 +964,7 @@ void get_bkg_tiles(uint8_t x, * @param t tile index * @return returns the address of tile, so you may use faster set_vram_byte() later */ -uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t) __preserves_regs(b, c); +uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t) OLDCALL __preserves_regs(b, c); #define set_tile_xy set_bkg_tile_xy /** @@ -990,7 +973,7 @@ uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t) __preserves_regs(b, c * @param y Y-coordinate * @return returns tile index */ -uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) __preserves_regs(b, c); +uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL __preserves_regs(b, c); /** Moves the Background Layer to the position specified in __x__ and __y__ in pixels. @@ -1029,7 +1012,7 @@ inline void scroll_bkg(int8_t x, int8_t y) { /** * Get address of X,Y tile of window map */ -uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) __preserves_regs(b, c); +uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) OLDCALL __preserves_regs(b, c); /** Sets VRAM Tile Pattern data for the Window / Background @@ -1044,9 +1027,7 @@ uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) __preserves_regs(b, c); @see set_win_tiles, set_bkg_data, set_data @see SHOW_WIN, HIDE_WIN */ -void set_win_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data) NONBANKED __preserves_regs(b, c); +void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL __preserves_regs(b, c); /** Sets VRAM Tile Pattern data for the Window / Background using 1bpp source data @@ -1060,9 +1041,7 @@ void set_win_data(uint8_t first_tile, @see set_bkg_data, set_bkg_1bit_data, set_win_data */ -void set_win_1bit_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data) NONBANKED __preserves_regs(b, c); +void set_win_1bit_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL __preserves_regs(b, c); /** Copies from Window / Background VRAM Tile Pattern data into a buffer @@ -1076,9 +1055,7 @@ void set_win_1bit_data(uint8_t first_tile, @see get_bkg_data, get_data */ -void get_win_data(uint8_t first_tile, - uint8_t nb_tiles, - uint8_t *data) NONBANKED __preserves_regs(b, c); +void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL __preserves_regs(b, c); /** Sets a rectangular region of the Window Tile Map. @@ -1112,11 +1089,7 @@ void get_win_data(uint8_t first_tile, @see SHOW_WIN, HIDE_WIN, set_win_submap, set_bkg_tiles, set_bkg_data, set_tiles */ -void set_win_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - const uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void set_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL __preserves_regs(b, c); /** Sets a rectangular area of the Window Tile Map using a sub-region @@ -1149,7 +1122,7 @@ void set_win_tiles(uint8_t x, @see SHOW_WIN, HIDE_WIN, set_win_tiles, set_bkg_submap, set_bkg_tiles, set_bkg_data, set_tiles **/ -void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w); +void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL; /** Copies a rectangular region of Window Tile Map entries into a buffer. @@ -1169,11 +1142,7 @@ void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *m @see get_bkg_tiles, get_bkg_tile_xy, get_tiles, get_vram_byte */ -void get_win_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL __preserves_regs(b, c); /** @@ -1183,7 +1152,7 @@ void get_win_tiles(uint8_t x, * @param t tile index * @return returns the address of tile, so you may use faster set_vram_byte() later */ -uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t) __preserves_regs(b, c); +uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t) OLDCALL __preserves_regs(b, c); /** @@ -1192,7 +1161,7 @@ uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t) __preserves_regs(b, c * @param y Y-coordinate * @return returns the tile index */ -uint8_t get_win_tile_xy(uint8_t x, uint8_t y) __preserves_regs(b, c); +uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL __preserves_regs(b, c); /** Moves the Window to the __x__, __y__ position on the screen. @@ -1241,9 +1210,7 @@ inline void scroll_win(int8_t x, int8_t y) { \li VBK_REG=0 indicates the first bank \li VBK_REG=1 indicates the second */ -void set_sprite_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data) NONBANKED __preserves_regs(b, c); +void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL __preserves_regs(b, c); #define set_sprite_2bpp_data set_sprite_data /** Sets VRAM Tile Pattern data for Sprites using 1bpp source data @@ -1261,9 +1228,7 @@ void set_sprite_data(uint8_t first_tile, @see SHOW_SPRITES, HIDE_SPRITES, set_sprite_tile */ -void set_sprite_1bit_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data) NONBANKED __preserves_regs(b, c); +void set_sprite_1bit_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL __preserves_regs(b, c); #define set_sprite_1bpp_data set_sprite_1bit_data /** Copies from Sprite VRAM Tile Pattern data into a buffer @@ -1278,9 +1243,7 @@ void set_sprite_1bit_data(uint8_t first_tile, Each Tile is 16 bytes, so the buffer pointed to by __data__ should be at least __nb_tiles__ x 16 bytes in size. */ -void get_sprite_data(uint8_t first_tile, - uint8_t nb_tiles, - uint8_t *data) NONBANKED __preserves_regs(b, c); +void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL __preserves_regs(b, c); /** Sprite Attributes structure @@ -1464,9 +1427,7 @@ inline void hide_sprite(uint8_t nb) { @see set_bkg_data, set_win_data, set_tile_data */ -void set_data(uint8_t *vram_addr, - const uint8_t *data, - uint16_t len) NONBANKED __preserves_regs(b, c); +void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len) OLDCALL __preserves_regs(b, c); /** Copies arbitrary data from an address in VRAM into a buffer @@ -1484,9 +1445,7 @@ void set_data(uint8_t *vram_addr, @see get_bkg_data, get_win_data */ -void get_data(uint8_t *data, - uint8_t *vram_addr, - uint16_t len) NONBANKED __preserves_regs(b, c); +void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len) OLDCALL __preserves_regs(b, c); /** Copies arbitrary data from an address in VRAM into a buffer @@ -1500,9 +1459,7 @@ void get_data(uint8_t *data, \li VBK_REG=0 indicates the first bank \li VBK_REG=1 indicates the second */ -void vmemcpy(uint8_t *dest, - uint8_t *sour, - uint16_t len) NONBANKED __preserves_regs(b, c); +void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len) OLDCALL __preserves_regs(b, c); @@ -1529,12 +1486,7 @@ void vmemcpy(uint8_t *dest, @see set_bkg_tiles, set_win_tiles */ -void set_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - uint8_t *vram_addr, - const uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL __preserves_regs(b, c); /** Sets VRAM Tile Pattern data starting from given base address without taking into account the state of LCDC bit 4. @@ -1546,10 +1498,7 @@ void set_tiles(uint8_t x, @see set_bkg_data, set_win_data, set_data */ -void set_tile_data(uint8_t first_tile, - uint8_t nb_tiles, - const uint8_t *data, - uint8_t base) NONBANKED __preserves_regs(b, c); +void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL __preserves_regs(b, c); /** Copies a rectangular region of Tile Map entries from a given VRAM Address into a buffer without taking into account the state of LCDC bit 4. @@ -1572,12 +1521,7 @@ void set_tile_data(uint8_t first_tile, @see get_bkg_tiles, get_win_tiles */ -void get_tiles(uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, - uint8_t *vram_addr, - uint8_t *tiles) NONBANKED __preserves_regs(b, c); +void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL __preserves_regs(b, c); /** Sets VRAM Tile Pattern data in the native format @@ -1596,14 +1540,14 @@ inline void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const ui Note: This function avoids writes during modes 2 & 3 */ -void init_win(uint8_t c) NONBANKED __preserves_regs(b, c); +void init_win(uint8_t c) OLDCALL __preserves_regs(b, c); /** Initializes the entire Background Tile Map with Tile Number __c__ @param c Tile number to fill with Note: This function avoids writes during modes 2 & 3 */ -void init_bkg(uint8_t c) NONBANKED __preserves_regs(b, c); +void init_bkg(uint8_t c) OLDCALL __preserves_regs(b, c); /** Fills the VRAM memory region __s__ of size __n__ with Tile Number __c__ @param s Start address in VRAM @@ -1612,7 +1556,7 @@ void init_bkg(uint8_t c) NONBANKED __preserves_regs(b, c); Note: This function avoids writes during modes 2 & 3 */ -void vmemset (void *s, uint8_t c, size_t n) NONBANKED __preserves_regs(b, c); +void vmemset (void *s, uint8_t c, size_t n) OLDCALL __preserves_regs(b, c); @@ -1624,7 +1568,7 @@ void vmemset (void *s, uint8_t c, size_t n) NONBANKED __preserves_regs(b, c); @param h Height of area to set in tiles. Range 0 - 31 @param tile Fill value */ -void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) NONBANKED __preserves_regs(b, c); +void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL __preserves_regs(b, c); #define fill_rect fill_bkg_rect /** Fills a rectangular region of Tile Map entries for the Window layer with tile. @@ -1635,6 +1579,6 @@ void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) NON @param h Height of area to set in tiles. Range 0 - 31 @param tile Fill value */ -void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) NONBANKED __preserves_regs(b, c); +void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL __preserves_regs(b, c); #endif /* _GB_H */ diff --git a/gbdk-lib/include/gb/gbdecompress.h b/gbdk-lib/include/gb/gbdecompress.h @@ -16,7 +16,7 @@ @see gb_decompress_bkg_data, gb_decompress_win_data, gb_decompress_sprite_data */ -uint16_t gb_decompress(const uint8_t * sour, uint8_t * dest) __preserves_regs(b, c); +uint16_t gb_decompress(const uint8_t * sour, uint8_t * dest) OLDCALL __preserves_regs(b, c); /** gb-decompress background tiles into VRAM @@ -28,7 +28,7 @@ uint16_t gb_decompress(const uint8_t * sour, uint8_t * dest) __preserves_regs(b, @see gb_decompress_bkg, gb_decompress_win_data, gb_decompress_sprite_data */ -void gb_decompress_bkg_data(uint8_t first_tile, const uint8_t * sour) __preserves_regs(b, c); +void gb_decompress_bkg_data(uint8_t first_tile, const uint8_t * sour) OLDCALL __preserves_regs(b, c); /** gb-decompress window tiles into VRAM @@ -43,7 +43,7 @@ void gb_decompress_bkg_data(uint8_t first_tile, const uint8_t * sour) __preserve @see gb_decompress, gb_decompress_bkg_data, gb_decompress_sprite_data */ -void gb_decompress_win_data(uint8_t first_tile, const uint8_t * sour) __preserves_regs(b, c); +void gb_decompress_win_data(uint8_t first_tile, const uint8_t * sour) OLDCALL __preserves_regs(b, c); /** gb-decompress sprite tiles into VRAM @@ -55,6 +55,6 @@ void gb_decompress_win_data(uint8_t first_tile, const uint8_t * sour) __preserve @see gb_decompress, gb_decompress_bkg_data, gb_decompress_win_data */ -void gb_decompress_sprite_data(uint8_t first_tile, const uint8_t * sour) __preserves_regs(b, c); +void gb_decompress_sprite_data(uint8_t first_tile, const uint8_t * sour) OLDCALL __preserves_regs(b, c); #endif diff --git a/gbdk-lib/include/gb/metasprites.h b/gbdk-lib/include/gb/metasprites.h @@ -61,6 +61,7 @@ #define _METASPRITES_H_INCLUDE #include <gb/hardware.h> +#include <types.h> #include <stdint.h> /** Metasprite sub-item structure @@ -91,10 +92,10 @@ extern uint8_t __current_base_tile; extern uint8_t __render_shadow_OAM; -static uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y); -static uint8_t __move_metasprite_vflip(uint8_t id, uint8_t x, uint8_t y); -static uint8_t __move_metasprite_hflip(uint8_t id, uint8_t x, uint8_t y); -static uint8_t __move_metasprite_hvflip(uint8_t id, uint8_t x, uint8_t y); +static uint8_t __move_metasprite(uint8_t id, uint8_t x, uint8_t y) OLDCALL; +static uint8_t __move_metasprite_vflip(uint8_t id, uint8_t x, uint8_t y) OLDCALL; +static uint8_t __move_metasprite_hflip(uint8_t id, uint8_t x, uint8_t y) OLDCALL; +static uint8_t __move_metasprite_hvflip(uint8_t id, uint8_t x, uint8_t y) OLDCALL; static void __hide_metasprite(uint8_t id); /** @@ -102,7 +103,7 @@ static void __hide_metasprite(uint8_t id); * @param from start OAM index * @param to finish OAM index */ -void hide_sprites_range(UINT8 from, UINT8 to) __preserves_regs(b, c); +void hide_sprites_range(UINT8 from, UINT8 to) OLDCALL __preserves_regs(b, c); /** Moves metasprite to the absolute position x and y diff --git a/gbdk-lib/include/gb/sgb.h b/gbdk-lib/include/gb/sgb.h @@ -37,7 +37,7 @@ /** Returns a non-null value if running on Super GameBoy */ -uint8_t sgb_check(void) __preserves_regs(b, c); +uint8_t sgb_check() __preserves_regs(b, c); /** Transfer a SGB packet @@ -51,6 +51,6 @@ uint8_t sgb_check(void) __preserves_regs(b, c); @see sgb_check() */ -void sgb_transfer(uint8_t * packet) __preserves_regs(b, c); +void sgb_transfer(uint8_t * packet) OLDCALL __preserves_regs(b, c); #endif /* _SGB_H */ diff --git a/gbdk-lib/include/gbdk/console.h b/gbdk-lib/include/gbdk/console.h @@ -14,19 +14,19 @@ __x__ and __y__ have units of tiles (8 pixels per unit) @see setchar() */ -void gotoxy(uint8_t x, uint8_t y); +void gotoxy(uint8_t x, uint8_t y) OLDCALL; /** Returns the current X position of the cursor. @see gotoxy() */ -uint8_t posx(void); +uint8_t posx(); /** Returns the current Y position of the cursor. @see gotoxy() */ -uint8_t posy(void); +uint8_t posy(); /** Writes out a single character at the current cursor position. @@ -35,7 +35,7 @@ uint8_t posy(void); @see gotoxy() */ -void setchar(char c); +void setchar(char c) OLDCALL; /** Clears the screen */ diff --git a/gbdk-lib/include/gbdk/far_ptr.h b/gbdk-lib/include/gbdk/far_ptr.h @@ -13,6 +13,9 @@ #ifndef __FAR_PTR_H_INCLUDE #define __FAR_PTR_H_INCLUDE +#include <types.h> +#include <stdint.h> + /** Macro to obtain a far pointer at compile-time @param ofs Memory address within the given Segment (Bank) @param seg Segment (Bank) number @@ -91,6 +94,6 @@ void __call__banked(); @returns A far pointer (type @ref FAR_PTR) */ -uint32_t to_far_ptr(void* ofs, uint16_t seg); +uint32_t to_far_ptr(void* ofs, uint16_t seg) OLDCALL; #endif diff --git a/gbdk-lib/include/gbdk/font.h b/gbdk-lib/include/gbdk/font.h @@ -6,6 +6,7 @@ #ifndef __FONT_H #define __FONT_H +#include <types.h> #include <stdint.h> /** Various flags in the font header. @@ -39,7 +40,7 @@ extern uint8_t font_ibm_fixed[]; /** Initializes the font system. Should be called before other font functions. */ -void font_init(void) NONBANKED; +void font_init(); /** Load a font and set it as the current font. @param font Pointer to a font to load (usually a gbdk font) @@ -47,7 +48,7 @@ void font_init(void) NONBANKED; @return Handle to the loaded font, which can be used with @ref font_set() @see font_init(), font_set(), gbdk_fonts */ -font_t font_load( void *font ) NONBANKED; +font_t font_load(void *font) OLDCALL; /** Set the current font. @param font_handle handle of a font returned by @ref font_load() @@ -55,7 +56,7 @@ font_t font_load( void *font ) NONBANKED; @return The previously used font handle. @see font_init(), font_load() */ -font_t font_set( font_t font_handle ) NONBANKED; +font_t font_set(font_t font_handle) OLDCALL; /* Use mode() and color() to set the font modes and colours */ @@ -72,6 +73,6 @@ struct sfont_handle { }; /** Set the current __foreground__ colour (for pixels), __background__ colour */ -void font_color(uint8_t forecolor, uint8_t backcolor); +void font_color(uint8_t forecolor, uint8_t backcolor) OLDCALL; #endif /* __FONT_H */ diff --git a/gbdk-lib/include/rand.h b/gbdk-lib/include/rand.h @@ -25,24 +25,22 @@ @see rand(), randw() */ #if defined(__PORT_gbz80) -void initrand(uint16_t seed); +void initrand(uint16_t seed) OLDCALL; #elif defined(__PORT_z80) void initrand(uint16_t seed) __z88dk_fastcall; -#else -#error Unrecognized port #endif /** Returns a random byte (8 bit) value. @ref initrand() should be used to initialize the random number generator before using rand() */ -int8_t rand(void); +int8_t rand(); /** Returns a random word (16 bit) value. @ref initrand() should be used to initialize the random number generator before using rand() */ -uint16_t randw(void); +uint16_t randw(); /** Random generator using the linear lagged additive method @@ -54,17 +52,15 @@ uint16_t randw(void); @see initrand() for suggestions about seed values, arand() */ #if defined(__PORT_gbz80) -void initarand(uint16_t seed); +void initarand(uint16_t seed) OLDCALL; #elif defined(__PORT_z80) void initarand(uint16_t seed) __z88dk_fastcall; -#else -#error Unrecognized port #endif /** Returns a random number generated with the linear lagged additive method. @ref initarand() should be used to initialize the random number generator before using arand() */ -int8_t arand(void); +int8_t arand(); #endif diff --git a/gbdk-lib/include/setjmp.h b/gbdk-lib/include/setjmp.h @@ -63,14 +63,14 @@ typedef unsigned char jmp_buf[3]; /* 1 for the stack pointer, 2 for the return a typedef unsigned char jmp_buf[RET_SIZE + SP_SIZE + BP_SIZE + SPX_SIZE + BPX_SIZE]; #endif -int __setjmp (jmp_buf); +int __setjmp (jmp_buf) OLDCALL; /* C99 might require setjmp to be a macro. The standard seems self-contradicting on this issue. */ /* However, it is clear that the standards allow setjmp to be a macro. */ #define setjmp(jump_buf) __setjmp(jump_buf) #ifndef __SDCC_HIDE_LONGJMP -_Noreturn void longjmp(jmp_buf, int); +_Noreturn void longjmp(jmp_buf, int) OLDCALL; #endif #undef RET_SIZE diff --git a/gbdk-lib/include/sms/sms.h b/gbdk-lib/include/sms/sms.h @@ -92,13 +92,13 @@ void WRITE_VDP_DATA(uint16_t data) __z88dk_fastcall __preserves_regs(b, c, d, e, @see M_TEXT_OUT, M_TEXT_INOUT, M_NO_SCROLL, M_NO_INTERP */ -void mode(uint8_t m) NONBANKED; +void mode(uint8_t m) OLDCALL; /** Returns the current mode @see M_TEXT_OUT, M_TEXT_INOUT, M_NO_SCROLL, M_NO_INTERP */ -uint8_t get_mode(void) NONBANKED; +uint8_t get_mode(); /* Interrupt flags */ /** Disable calling of interrupt service routines @@ -161,9 +161,9 @@ void remove_VBL(int_handler h) __z88dk_fastcall __preserves_regs(iyh, iyl); */ void remove_LCD(int_handler h) __z88dk_fastcall __preserves_regs(b, c, iyh, iyl); -void remove_TIM(int_handler h); -void remove_SIO(int_handler h); -void remove_JOY(int_handler h); +void remove_TIM(int_handler h) __z88dk_fastcall; +void remove_SIO(int_handler h) __z88dk_fastcall; +void remove_JOY(int_handler h) __z88dk_fastcall; /** Adds a V-blank interrupt handler. */ @@ -175,15 +175,15 @@ void add_LCD(int_handler h) __z88dk_fastcall __preserves_regs(b, c, iyh, iyl); /** Does nothing on SMS/GG */ -void add_TIM(int_handler h); +void add_TIM(int_handler h) __z88dk_fastcall; /** Does nothing on SMS/GG */ -void add_SIO(int_handler h); +void add_SIO(int_handler h) __z88dk_fastcall; /** Does nothing on SMS/GG */ -void add_JOY(int_handler h); +void add_JOY(int_handler h) __z88dk_fastcall; /** Cancel pending interrupts */ @@ -212,13 +212,13 @@ inline void scroll_bkg(int8_t x, int8_t y) { never return. If the screen is off this function returns immediately. */ -void wait_vbl_done(void) __preserves_regs(b, c, d, e, h, l, iyh, iyl); +void wait_vbl_done() __preserves_regs(b, c, d, e, h, l, iyh, iyl); /** Turns the display off. @see DISPLAY_ON */ -inline void display_off(void) { +inline void display_off() { __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_DISP_ON)); } @@ -392,7 +392,7 @@ void delay(uint16_t d) __z88dk_fastcall; /** Reads and returns the current state of the joypad. */ -uint8_t joypad(void) __preserves_regs(b, c, d, e, h, iyh, iyl); +uint8_t joypad() __preserves_regs(b, c, d, e, h, iyh, iyl); /** Waits until at least one of the buttons given in mask are pressed. */ @@ -403,7 +403,7 @@ uint8_t waitpad(uint8_t mask) __z88dk_fastcall __preserves_regs(b, c, d, e, iyh, Note: Checks in a loop that doesn't HALT at all, so the CPU will be maxed out until this call returns. */ -void waitpadup(void) __preserves_regs(b, c, d, e, iyh, iyl); +void waitpadup() __preserves_regs(b, c, d, e, iyh, iyl); /** Multiplayer joypad structure. @@ -502,15 +502,15 @@ typedef uint16_t palette_entry_t; #error Unrecognized port #endif -void set_default_palette(void); +void set_default_palette(); inline void cpu_fast() {} +void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) __z88dk_callee __preserves_regs(iyh, iyl); #define set_bkg_palette_entry set_palette_entry #define set_sprite_palette_entry(palette,entry,rgb_data) set_palette_entry(1,entry,rgb_data) -void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) __z88dk_callee __preserves_regs(iyh, iyl); +void set_palette(uint8_t first_palette, uint8_t nb_palettes, palette_entry_t *rgb_data) __z88dk_callee; #define set_bkg_palette set_palette #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data) -void set_palette(uint8_t first_palette, uint8_t nb_palettes, palette_entry_t *rgb_data) __z88dk_callee; void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) __z88dk_callee __preserves_regs(iyh,iyl); inline void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) { diff --git a/gbdk-lib/include/stdio.h b/gbdk-lib/include/stdio.h @@ -15,7 +15,7 @@ @param c Character to print */ -void putchar(char c) NONBANKED; +void putchar(char c) OLDCALL; /** Print the string and arguments given by format to stdout. @@ -37,7 +37,7 @@ void putchar(char c) NONBANKED; be explicitly re-cast as such when calling the function. See @ref docs_chars_varargs for more details. */ -void printf(const char *format, ...) NONBANKED; +void printf(const char *format, ...); /** Print the string and arguments given by format to a buffer. @@ -46,11 +46,11 @@ void printf(const char *format, ...) NONBANKED; Does not return the number of characters printed. */ -void sprintf(char *str, const char *format, ...) NONBANKED; +void sprintf(char *str, const char *format, ...); /** puts() writes the string __s__ and a trailing newline to stdout. */ -void puts(const char *s) NONBANKED; +void puts(const char *s); /** gets() Reads a line from stdin into a buffer pointed to by __s__. @@ -61,10 +61,10 @@ void puts(const char *s) NONBANKED; Returns: Buffer pointed to by __s__ */ -char *gets(char *s); +char *gets(char *s) OLDCALL; /** getchar() Reads and returns a single character from stdin. */ -char getchar(void); +char getchar() OLDCALL; #endif diff --git a/gbdk-lib/include/stdlib.h b/gbdk-lib/include/stdlib.h @@ -14,7 +14,7 @@ returned to the parent. All open streams are flushed and closed. */ -void exit(int status) NONBANKED; +void exit(int status); #if 0 /** Compatibility function. Not implemented. @@ -27,14 +27,14 @@ int getkey(void); If i is negative, returns -i; else returns i. */ -int abs(int i); +int abs(int i) OLDCALL; /** Returns the absolute value of long int __num__ @param num Long integer to obtain absolute value of */ -long labs(long num); +long labs(long num) OLDCALL; /** Converts an ASCII string to an int @@ -52,7 +52,7 @@ long labs(long num); Returns: Int value of string */ -int atoi(const char *s); +int atoi(const char *s) OLDCALL; /** Converts an ASCII string to a long. @@ -61,7 +61,7 @@ int atoi(const char *s); Returns: Long int value of string */ -long atol(const char *s); +long atol(const char *s) OLDCALL; /** Converts an int into a base 10 ASCII string. @param n Int to convert to a string @@ -71,7 +71,7 @@ long atol(const char *s); Returns: Pointer to converted string */ -char *itoa(int n, char *s, unsigned char radix); +char *itoa(int n, char *s, unsigned char radix) OLDCALL; /** Converts an unsigned int into a base 10 ASCII string. @param n Unsigned Int to convert to a string @@ -81,7 +81,7 @@ char *itoa(int n, char *s, unsigned char radix); Returns: Pointer to converted string */ -char *uitoa(unsigned int n, char *s, unsigned char radix); +char *uitoa(unsigned int n, char *s, unsigned char radix) OLDCALL; /** Converts a long into a base 10 ASCII string. @param n Long int to convert to a string @@ -91,7 +91,7 @@ char *uitoa(unsigned int n, char *s, unsigned char radix); Returns: Pointer to converted string */ -char *ltoa(long n, char *s, unsigned char radix); +char *ltoa(long n, char *s, unsigned char radix) OLDCALL; /** Converts an unsigned long into a base 10 ASCII string. @param n Unsigned Long Int to convert to a string @@ -101,7 +101,7 @@ char *ltoa(long n, char *s, unsigned char radix); Returns: Pointer to converted string */ -char *ultoa(unsigned long n, char *s, unsigned char radix); +char *ultoa(unsigned long n, char *s, unsigned char radix) OLDCALL; /** Memory allocation functions diff --git a/gbdk-lib/include/time.h b/gbdk-lib/include/time.h @@ -7,9 +7,9 @@ #include <types.h> #include <stdint.h> -#define CLOCKS_PER_SEC 60 +#define CLOCKS_PER_SEC 60 -typedef uint16_t time_t; +typedef uint16_t time_t; /** Returns an approximation of processor time used by the program in Clocks @@ -22,7 +22,7 @@ typedef uint16_t time_t; @see sys_time, time() */ -clock_t clock(void) NONBANKED; +clock_t clock(); /** Converts clock() time to Seconds diff --git a/gbdk-lib/include/types.h b/gbdk-lib/include/types.h @@ -9,17 +9,17 @@ /** Good 'ol NULL. */ -#define NULL 0 +#define NULL 0 /** A 'false' value. */ -#define FALSE 0 +#define FALSE 0 /** A 'true' value. */ -#define TRUE 1 +#define TRUE 1 /** No longer used. */ -typedef void * POINTER; +typedef void * POINTER; #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.