From 05e820fabb7e58e18fc9d6e71e6088faf7834b7d Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 7 Feb 2023 01:47:29 -0800 Subject: [PATCH] bindings: Add more bindings --- gcc/bindings.c | 296 +++++++++++++++++++++++++++++++++++++++-------- gcc/bindings.kts | 132 +++++++++++++++++---- 2 files changed, 356 insertions(+), 72 deletions(-) diff --git a/gcc/bindings.c b/gcc/bindings.c index c029263..73ee4db 100644 --- a/gcc/bindings.c +++ b/gcc/bindings.c @@ -1,3 +1,4 @@ +// generated by bindings.kts #pragma once #include "call.h" @@ -109,14 +110,14 @@ static inline void fill_background( call(0xF0042000); } -static inline unsigned int draw_str_to_background( +static inline unsigned short draw_str_to_background( unsigned char* str, - unsigned int x, - unsigned int y, + unsigned short x, + unsigned short y, unsigned int foreground_color, unsigned int background_color ) { - unsigned int result_1; + unsigned short result_1; parameter(0, str); parameter(1, x); parameter(2, y); @@ -127,10 +128,10 @@ static inline unsigned int draw_str_to_background( return result_1; } -static inline unsigned int draw_format_str_to_background( +static inline unsigned short draw_format_str_to_background( unsigned char* str, - unsigned int x, - unsigned int y, + unsigned short x, + unsigned short y, unsigned int foreground_color, unsigned int background_color, unsigned int format_value_0, @@ -140,7 +141,7 @@ static inline unsigned int draw_format_str_to_background( unsigned int format_value_4, unsigned int format_value_5 ) { - unsigned int result_1; + unsigned short result_1; parameter(0, str); parameter(1, x); parameter(2, y); @@ -157,14 +158,14 @@ static inline unsigned int draw_format_str_to_background( return result_1; } -static inline unsigned int draw_decimal_to_background( +static inline unsigned short draw_decimal_to_background( unsigned int value, - unsigned int x, - unsigned int y, + unsigned short x, + unsigned short y, unsigned int foreground_color, unsigned int background_color ) { - unsigned int result_1; + unsigned short result_1; parameter(0, value); parameter(1, x); parameter(2, y); @@ -175,14 +176,14 @@ static inline unsigned int draw_decimal_to_background( return result_1; } -static inline unsigned int draw_hex_to_background( +static inline unsigned short draw_hex_to_background( unsigned int value, - unsigned int x, - unsigned int y, + unsigned short x, + unsigned short y, unsigned int foreground_color, unsigned int background_color ) { - unsigned int result_1; + unsigned short result_1; parameter(0, value); parameter(1, x); parameter(2, y); @@ -194,9 +195,9 @@ static inline unsigned int draw_hex_to_background( } static inline void draw_font_tile_to_background( - unsigned int tile, - unsigned int x, - unsigned int y, + unsigned char tile, + unsigned short x, + unsigned short y, unsigned int foreground_color, unsigned int background_color ) { @@ -210,8 +211,8 @@ static inline void draw_font_tile_to_background( static inline void draw_tile_to_background( unsigned int tile, - unsigned int x, - unsigned int y + unsigned short x, + unsigned short y ) { parameter(0, tile); parameter(1, x); @@ -220,8 +221,8 @@ static inline void draw_tile_to_background( } static inline void draw_pixel_to_background( - unsigned int x, - unsigned int y, + unsigned short x, + unsigned short y, unsigned int color ) { parameter(0, x); @@ -231,10 +232,10 @@ static inline void draw_pixel_to_background( } static inline void draw_filled_rectangle_to_background( - unsigned int x, - unsigned int y, - unsigned int width, - unsigned int height, + unsigned short x, + unsigned short y, + unsigned short width, + unsigned short height, unsigned int color ) { parameter(0, x); @@ -247,39 +248,164 @@ static inline void draw_filled_rectangle_to_background( // overlay jump table -static inline void fill_overlay(void) { +static inline void fill_overlay( + unsigned int color, + unsigned char overlay_number +) { + parameter(0, color); + parameter(1, overlay_number); call(0xF0043000); } -static inline void draw_str_to_overlay(void) { +static inline unsigned short draw_str_to_overlay( + unsigned char* str, + unsigned short x, + unsigned short y, + unsigned int foreground_color, + unsigned int background_color, + unsigned char overlay_number +) { + unsigned short result_1; + parameter(0, str); + parameter(1, x); + parameter(2, y); + parameter(3, foreground_color); + parameter(4, background_color); + parameter(5, overlay_number); call(0xF0043004); + ret(1, result_1); + return result_1; } -static inline void draw_format_str_to_overlay(void) { +static inline unsigned short draw_format_str_to_overlay( + unsigned char* str, + unsigned short x, + unsigned short y, + unsigned int foreground_color, + unsigned int background_color, + unsigned char overlay_number, + unsigned int format_value_0, + unsigned int format_value_1, + unsigned int format_value_2, + unsigned int format_value_3, + unsigned int format_value_4, + unsigned int format_value_5 +) { + unsigned short result_1; + parameter(0, str); + parameter(1, x); + parameter(2, y); + parameter(3, foreground_color); + parameter(4, background_color); + parameter(5, overlay_number); + parameter(10, format_value_0); + parameter(11, format_value_1); + parameter(12, format_value_2); + parameter(13, format_value_3); + parameter(14, format_value_4); + parameter(15, format_value_5); call(0xF0043008); + ret(1, result_1); + return result_1; } -static inline void draw_decimal_to_overlay(void) { +static inline unsigned short draw_decimal_to_overlay( + unsigned int value, + unsigned short x, + unsigned short y, + unsigned int foreground_color, + unsigned int background_color, + unsigned char overlay_number +) { + unsigned short result_1; + parameter(0, value); + parameter(1, x); + parameter(2, y); + parameter(3, foreground_color); + parameter(4, background_color); + parameter(5, overlay_number); call(0xF004300C); + ret(1, result_1); + return result_1; } -static inline void draw_hex_to_overlay(void) { +static inline unsigned short draw_hex_to_overlay( + unsigned int value, + unsigned short x, + unsigned short y, + unsigned int foreground_color, + unsigned int background_color, + unsigned char overlay_number +) { + unsigned short result_1; + parameter(0, value); + parameter(1, x); + parameter(2, y); + parameter(3, foreground_color); + parameter(4, background_color); + parameter(5, overlay_number); call(0xF0043010); + ret(1, result_1); + return result_1; } -static inline void draw_font_tile_to_overlay(void) { +static inline void draw_font_tile_to_overlay( + unsigned int tile, + unsigned short x, + unsigned short y, + unsigned int foreground_color, + unsigned int background_color, + unsigned char overlay_number +) { + parameter(0, tile); + parameter(1, x); + parameter(2, y); + parameter(3, foreground_color); + parameter(4, background_color); + parameter(5, overlay_number); call(0xF0043014); } -static inline void draw_tile_to_overlay(void) { +static inline void draw_tile_to_overlay( + unsigned int tile, + unsigned short x, + unsigned short y, + unsigned char overlay_number +) { + parameter(0, tile); + parameter(1, x); + parameter(2, y); + parameter(3, overlay_number); call(0xF0043018); } -static inline void draw_pixel_to_overlay(void) { +static inline void draw_pixel_to_overlay( + unsigned short x, + unsigned short y, + unsigned int color, + unsigned char overlay_number +) { + parameter(0, x); + parameter(1, y); + parameter(2, color); + parameter(3, overlay_number); call(0xF004301C); } -static inline void draw_filled_rectangle_to_overlay(void) { +static inline void draw_filled_rectangle_to_overlay( + unsigned short x, + unsigned short y, + unsigned short width, + unsigned short height, + unsigned int color, + unsigned char overlay_number +) { + parameter(0, x); + parameter(1, y); + parameter(2, width); + parameter(3, height); + parameter(4, color); + parameter(5, overlay_number); call(0xF0043020); } @@ -291,23 +417,48 @@ static inline void check_if_enabled_overlay_covers_position(void) { call(0xF0043028); } -static inline void enable_overlay(void) { +static inline void enable_overlay( + unsigned char overlay_number +) { + parameter(0, overlay_number); call(0xF004302C); } -static inline void disable_overlay(void) { +static inline void disable_overlay( + unsigned char overlay_number +) { + parameter(0, overlay_number); call(0xF0043030); } -static inline void move_overlay(void) { +static inline void move_overlay( + unsigned short x, + unsigned short y, + unsigned char overlay_number +) { + parameter(0, x); + parameter(1, y); + parameter(2, overlay_number); call(0xF0043034); } -static inline void resize_overlay(void) { +static inline void resize_overlay( + unsigned short width, + unsigned short height, + unsigned char overlay_number +) { + parameter(0, width); + parameter(1, height); + parameter(2, overlay_number); call(0xF0043038); } -static inline void set_overlay_framebuffer_pointer(void) { +static inline void set_overlay_framebuffer_pointer( + unsigned int* framebuffer_pointer, + unsigned char overlay_number +) { + parameter(0, framebuffer_pointer); + parameter(1, overlay_number); call(0xF004303C); } @@ -524,11 +675,31 @@ static inline void free_memory(void) { // window jump table -static inline void new_window(void) { +static inline void new_window( + unsigned char* window_struct, + unsigned char* title_str, + unsigned short width, + unsigned short height, + unsigned short x, + unsigned short y, + unsigned char* menu_bar_struct, + unsigned char* first_widget +) { + parameter(0, window_struct); + parameter(1, title_str); + parameter(2, width); + parameter(3, height); + parameter(4, x); + parameter(5, y); + parameter(6, menu_bar_struct); + parameter(7, first_widget); call(0x00000C10); } -static inline void destroy_window(void) { +static inline void destroy_window( + unsigned char* window_struct +) { + parameter(0, window_struct); call(0x00000C14); } @@ -540,23 +711,47 @@ static inline void get_next_window_event(void) { call(0x00000C1C); } -static inline void draw_title_bar_to_window(void) { +static inline void draw_title_bar_to_window( + unsigned char* window_struct +) { + parameter(0, window_struct); call(0x00000C20); } -static inline void move_window(void) { +static inline void move_window( + unsigned short x, + unsigned short y, + unsigned char* window_struct +) { + parameter(0, x); + parameter(1, y); + parameter(2, window_struct); call(0x00000C24); } -static inline void fill_window(void) { +static inline void fill_window( + unsigned int color, + unsigned char* window_struct +) { + parameter(0, color); + parameter(1, window_struct); call(0x00000C28); } -static inline void get_window_overlay_number(void) { +static inline unsigned short get_window_overlay_number( + unsigned char* window_struct +) { + unsigned short result_0; + parameter(0, window_struct); call(0x00000C2C); + ret(0, result_0); + return result_0; } -static inline void start_dragging_window(void) { +static inline void start_dragging_window( + unsigned char* window_struct +) { + parameter(0, window_struct); call(0x00000C30); } @@ -564,8 +759,11 @@ static inline void new_messagebox(void) { call(0x00000C34); } -static inline void get_active_window_struct(void) { +static inline unsigned int* get_active_window_struct(void) { + unsigned int* result_0; call(0x00000C38); + ret(0, result_0); + return result_0; } // VFS jump table diff --git a/gcc/bindings.kts b/gcc/bindings.kts index 248e9c9..af1ee2b 100755 --- a/gcc/bindings.kts +++ b/gcc/bindings.kts @@ -111,6 +111,7 @@ class Function(val address: UInt, val name: String) { val source = StringBuilder() +source.append("// generated by bindings.kts\n") source.append("#pragma once\n") source.append("\n") source.append("#include \"call.h\"\n") @@ -202,16 +203,16 @@ define(0xF0042000U, "fill_background") { } define(0xF0042004U, "draw_str_to_background") { parameter(Byte.ref, "str") - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "foreground_color") parameter(Word, "background_color") - returns(1, Word) + returns(1, Half) } define(0xF0042008U, "draw_format_str_to_background") { parameter(Byte.ref, "str") - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "foreground_color") parameter(Word, "background_color") parameter(10, Word, "format_value_0") @@ -220,82 +221,148 @@ define(0xF0042008U, "draw_format_str_to_background") { parameter(13, Word, "format_value_3") parameter(14, Word, "format_value_4") parameter(15, Word, "format_value_5") - returns(1, Word) + returns(1, Half) } define(0xF004200CU, "draw_decimal_to_background") { parameter(Word, "value") - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "foreground_color") parameter(Word, "background_color") - returns(1, Word) + returns(1, Half) } define(0xF0042010U, "draw_hex_to_background") { parameter(Word, "value") - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "foreground_color") parameter(Word, "background_color") - returns(1, Word) + returns(1, Half) } define(0xF0042014U, "draw_font_tile_to_background") { - parameter(Word, "tile") - parameter(Word, "x") - parameter(Word, "y") + parameter(Byte, "tile") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "foreground_color") parameter(Word, "background_color") } define(0xF0042018U, "draw_tile_to_background") { parameter(Word, "tile") - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") } define(0xF004201CU, "draw_pixel_to_background") { - parameter(Word, "x") - parameter(Word, "y") + parameter(Half, "x") + parameter(Half, "y") parameter(Word, "color") } define(0xF0042020U, "draw_filled_rectangle_to_background") { - parameter(Word, "x") - parameter(Word, "y") - parameter(Word, "width") - parameter(Word, "height") + parameter(Half, "x") + parameter(Half, "y") + parameter(Half, "width") + parameter(Half, "height") parameter(Word, "color") } comment("overlay jump table") define(0xF0043000U, "fill_overlay") { + parameter(Word, "color") + parameter(Byte, "overlay_number") } define(0xF0043004U, "draw_str_to_overlay") { + parameter(Byte.ref, "str") + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "foreground_color") + parameter(Word, "background_color") + parameter(Byte, "overlay_number") + returns(1, Half) } define(0xF0043008U, "draw_format_str_to_overlay") { + parameter(Byte.ref, "str") + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "foreground_color") + parameter(Word, "background_color") + parameter(Byte, "overlay_number") + parameter(10, Word, "format_value_0") + parameter(11, Word, "format_value_1") + parameter(12, Word, "format_value_2") + parameter(13, Word, "format_value_3") + parameter(14, Word, "format_value_4") + parameter(15, Word, "format_value_5") + returns(1, Half) } define(0xF004300CU, "draw_decimal_to_overlay") { + parameter(Word, "value") + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "foreground_color") + parameter(Word, "background_color") + parameter(Byte, "overlay_number") + returns(1, Half) } define(0xF0043010U, "draw_hex_to_overlay") { + parameter(Word, "value") + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "foreground_color") + parameter(Word, "background_color") + parameter(Byte, "overlay_number") + returns(1, Half) } define(0xF0043014U, "draw_font_tile_to_overlay") { + parameter(Word, "tile") + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "foreground_color") + parameter(Word, "background_color") + parameter(Byte, "overlay_number") } define(0xF0043018U, "draw_tile_to_overlay") { + parameter(Word, "tile") + parameter(Half, "x") + parameter(Half, "y") + parameter(Byte, "overlay_number") } define(0xF004301CU, "draw_pixel_to_overlay") { + parameter(Half, "x") + parameter(Half, "y") + parameter(Word, "color") + parameter(Byte, "overlay_number") } define(0xF0043020U, "draw_filled_rectangle_to_overlay") { + parameter(Half, "x") + parameter(Half, "y") + parameter(Half, "width") + parameter(Half, "height") + parameter(Word, "color") + parameter(Byte, "overlay_number") } define(0xF0043024U, "check_if_overlay_covers_position") { } define(0xF0043028U, "check_if_enabled_overlay_covers_position") { } define(0xF004302CU, "enable_overlay") { + parameter(Byte, "overlay_number") } define(0xF0043030U, "disable_overlay") { + parameter(Byte, "overlay_number") } define(0xF0043034U, "move_overlay") { + parameter(Half, "x") + parameter(Half, "y") + parameter(Byte, "overlay_number") } define(0xF0043038U, "resize_overlay") { + parameter(Half, "width") + parameter(Half, "height") + parameter(Byte, "overlay_number") } define(0xF004303CU, "set_overlay_framebuffer_pointer") { + parameter(Word.ref, "framebuffer_pointer") + parameter(Byte, "overlay_number") } define(0xF0043040U, "get_unused_overlay") { } @@ -428,26 +495,45 @@ define(0x00000B14U, "free_memory") { comment("window jump table") define(0x00000C10U, "new_window") { + parameter(Byte.ref, "window_struct") + parameter(Byte.ref, "title_str") + parameter(Half, "width") + parameter(Half, "height") + parameter(Half, "x") + parameter(Half, "y") + parameter(Byte.ref, "menu_bar_struct") + parameter(Byte.ref, "first_widget") } define(0x00000C14U, "destroy_window") { + parameter(Byte.ref, "window_struct") } define(0x00000C18U, "new_window_event") { } define(0x00000C1CU, "get_next_window_event") { } define(0x00000C20U, "draw_title_bar_to_window") { + parameter(Byte.ref, "window_struct") } define(0x00000C24U, "move_window") { + parameter(Half, "x") + parameter(Half, "y") + parameter(Byte.ref, "window_struct") } define(0x00000C28U, "fill_window") { + parameter(Word, "color") + parameter(Byte.ref, "window_struct") } define(0x00000C2CU, "get_window_overlay_number") { + parameter(Byte.ref, "window_struct") + returns(Half) } define(0x00000C30U, "start_dragging_window") { + parameter(Byte.ref, "window_struct") } define(0x00000C34U, "new_messagebox") { } define(0x00000C38U, "get_active_window_struct") { + returns(Word.ref) } comment("VFS jump table")