### Build Hello World Example Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/getting-started.rst Compile the 'Hello World' example project using the 'make' command. This process generates the executable file 'bin/DEMO.8xp'. ```bash make ``` -------------------------------- ### LibLoad Launcher Code Example Source: https://github.com/ce-programming/toolchain/blob/master/src/libload/setup/setup.md An example of launcher code that initializes LibLoad by calling specific routines and handling potential errors like missing appvars. ```asm __libloadlauncher: ld hl,__libloadappvar call _Mov9ToOP1 ld a,21 ld (OP1),a __findlibload: call _ChkFindSym jp c,__notfound call _ChkInRam jp nz,__inarc call _PushOP1 call _Arc_Unarc call _PopOP1 jr __findlibload __inarc: ex de,hl ld de,9 add hl,de ld e,(hl) add hl,de inc hl inc hl inc hl ld de,__relocationstart jp (hl) __notfound: call _ClrScrn call _HomeUp ld hl,__missingappvar call _PutS call _NewLine jp _GetKey __relocationstart: ; place library jump locations and headers here ; ; ; PROGRAM CODE GOES HERE -> ; ; ; data segments __missingappvar: db "Need" __libloadappvar: db " LibLoad",0 ``` -------------------------------- ### Configure Toolchain Installation Prefix (Windows) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/contributing.rst Customize the installation directory for the CE Toolchain on Windows using the PREFIX variable with mingw32-make install. ```bash mingw32-make install PREFIX=[LOCATION] ``` -------------------------------- ### Initialize a new Git repository Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/git.rst Execute this command in your project's root directory to start tracking changes with Git. ```bash git init ``` -------------------------------- ### Configure Toolchain Installation Prefix (Linux/macOS) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/contributing.rst Customize the installation directory for the CE Toolchain using the PREFIX variable with make install. ```bash make install PREFIX=[LOCATION] ``` -------------------------------- ### Clone and Build Toolchain (Windows) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/contributing.rst Clone the toolchain repository, update submodules, and build the toolchain using mingw32-make. The toolchain is installed to C:\CEdev by default. ```bash git clone https://github.com/CE-Programming/toolchain.git cd toolchain git submodule update --init --recursive ``` ```bash mingw32-make mingw32-make install ``` -------------------------------- ### Clone and Build Toolchain (Linux/macOS) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/contributing.rst Clone the toolchain repository, update submodules, and build the toolchain. The toolchain is installed to ~/CEdev by default. ```bash git clone https://github.com/CE-Programming/toolchain.git cd toolchain git submodule update --init --recursive ``` ```bash make make install ``` -------------------------------- ### Function Vector Table Example Source: https://github.com/ce-programming/toolchain/blob/master/src/libload/setup/setup.md A sample vector table showing exported functions and their offsets within the library. Assembled code is on the left, original file on the right. ```asm 0F 00 00 - export _function_1_label 1D 00 00 - export _function_2_label ``` -------------------------------- ### Library with Single Dependency and Code Source: https://github.com/ce-programming/toolchain/blob/master/src/libload/setup/setup.md A sample library structure including a dependency on LIB1 and basic function definitions. Function offsets are calculated from the start of the dependency table. ```asm C0 4C 49 42 31 00 - - db 0C0h,"LIB1",0 01 - - - db 1 - - - - _function_1: C3 00 00 00 jp 0 - - - - _function_2: C3 03 00 00 jp 3 ``` -------------------------------- ### Embedding Font Directly in Program Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fontlibc.rst Example of creating a 'myfonts.h' file to embed a .FNT font file directly into your program's source code directory. ```c ``` -------------------------------- ### Bad Comment Example: Locating First Character Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/coding-guidelines.rst This example demonstrates a comment that provides no additional value as the code itself is self-explanatory. Prefer descriptive naming and simple code over such comments. ```c // locates the first occurrence of the character in the string void findFirstChar(string_t* str) { ... } ``` -------------------------------- ### Custom FILE Structure and Stream Definitions Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/fileio.rst Example of a custom stdio_file.h header. This redefines the FILE structure and standard streams (stdin, stdout, stderr) for custom file I/O. ```c #ifndef STDIO_FILE_H #define STDIO_FILE_H typedef struct { unsigned char slot; unsigned char eof; unsigned char err; } FILE; #define FOPEN_MAX 5 #define stdin ((FILE*)1) #define stdout ((FILE*)2) #define stderr ((FILE*)3) #endif ``` -------------------------------- ### Library Version Byte Source: https://github.com/ce-programming/toolchain/blob/master/src/libload/setup/setup.md The third byte in the library header specifies the library version. This example shows version 4. ```asm $04 ``` -------------------------------- ### C Function for Assembly Interaction Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/asm.rst Provides an example C implementation of an external function called by assembly and a test function that calls the assembly routine. ```c int external_func(int arg) { printf("external_func called with %d\n", arg); return 4321; } void test(void) { int arg = 1234; printf("calling asm_func with %d\n", arg); int ret = asm_func(arg); printf("asm_func returned %d\n", ret); } ``` -------------------------------- ### Bad Comment Example: Checking if String is Empty Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/coding-guidelines.rst This example shows a redundant comment that merely restates what the code does. Good naming and clear code are preferred over comments that explain the obvious. ```c // check if the string is empty bool isStringEmpty(string_t* str) { return str->len == 0; } ``` -------------------------------- ### Set C/C++ Compiler Flags Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Passes additional flags to the C (CFLAGS) and C++ (CXXFLAGS) compilers. Example includes enabling all warnings and optimizing for size. ```makefile CFLAGS = -Wall -Wextra -Oz CXXFLAGS = -Wall -Wextra -Oz ``` -------------------------------- ### Assembly Function Implementation Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/asm.rst An example assembly function (_asm_func) that takes an integer argument, calls an external C function, and returns a value. It demonstrates section definition, global symbol export, and external symbol declaration. ```assembly .assume adl=1 .section .text._asm_func .global _asm_func .type _asm_func, @function _asm_func: pop hl pop de push de ; de = arg push hl push de call _external_func pop de ret .extern _external_func ``` -------------------------------- ### Recommended Source File Structure Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/coding-guidelines.rst Include the corresponding header first, followed by other headers, and then system/toolchain headers. Use 'static' for internal functions. ```c #include "source.h" #include #include static void my_internal_source_function(void) { // do some stuff in here } void my_external_source_function(void) { my_internal_source_function(); // do some other stuff in here } ``` -------------------------------- ### Initialize graphx Library Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/graphx.rst Call gfx_Begin to initialize the graphx library, configuring the LCD and setting the default color palette. This must be called before using other graphx functions. ```c gfx_Begin(); ``` -------------------------------- ### Recommended Header File Structure Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/coding-guidelines.rst Use header guards and extern "C" for C++ compatibility. Declare external functions as prototypes. ```c #ifndef SOURCE_H #define SOURCE_H #include "some_other_header.h" #ifdef __cplusplus extern "C" { #endif void my_external_source_function(void); #ifdef __cplusplus } #endif #endif ``` -------------------------------- ### Replicate printf and fprintf with fputs Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/sprintf.rst Shows how to use boot_snprintf with fputs to replicate the functionality of printf and fprintf. ```c char output[50]; boot_snprintf(output, sizeof(output), format, ...); // fprintf(stdout, ...) == printf(...) fputs(output, stdout); ``` -------------------------------- ### Replicate C99 snprintf with boot_asprintf Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/sprintf.rst Demonstrates how to use boot_asprintf and strlcpy to replicate the truncating behavior of C99 snprintf. ```c char buf[20]; char *temp; boot_asprintf(&temp, format, ...); if (temp != NULL) { strlcpy(buf, temp, sizeof(buf)); free(temp); } ``` -------------------------------- ### Reimplement `outchar` Function Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/printf.rst Reimplement the `outchar` function to customize how characters are printed. This example shows a basic implementation that prints to the OS home screen. ```c void outchar(char character) { char str[2] = { character, '\0' }; os_PutStrFull(str); } ``` -------------------------------- ### Library Initialization and Cleanup Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/lcddrvce.rst The `lcd_Init` and `lcd_Cleanup` functions manage the reference-counted initialization and cleanup of the SPI configuration for the LCD controller. Multiple calls to `lcd_Init()` are permitted, and the SPI hardware is restored only after an equal number of `lcd_Cleanup()` calls. ```APIDOC ## Library Initialization and Cleanup ### Description Provides reference-counted initialization and cleanup of the SPI configuration for the LCD controller. This ensures that the SPI hardware is properly configured for LCD communication and restored to its default state when the library is no longer in use. ### Functions - **lcd_Init()** Initializes the LCD driver and its SPI configuration. This function is reference-counted, meaning it can be called multiple times. - **lcd_Cleanup()** Cleans up the LCD driver and its SPI configuration. This function must be called an equal number of times as `lcd_Init()` to fully restore the original SPI settings. ``` -------------------------------- ### Visual Studio Code: Set Compiler and Include Paths Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/ides.rst Configure IntelliSense in VS Code by specifying the compiler path and include path for the CEdev toolchain. ```text Compiler path: /home/john/CEdev/bin/ez80-clang Include path: /home/john/CEdev/include ``` -------------------------------- ### Include sys/basicusb.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/basicusb.rst Include the basic USB header file. Proper USB device support is currently under development. ```c #include ``` -------------------------------- ### Include ti/getkey.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/getkey.rst Include the necessary header file for using OS key-related functions. ```c #include ``` -------------------------------- ### Getting a Font from a Pack by Index Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fontlibc.rst Retrieves a font from a specified font pack appvar by its index. Includes essential error checking to ensure the font pointer is valid before use. ```c #include #include void main(void) { fontlib_font_t *my_font; . . /* Get the first font present in the font pack */ my_font = fontlib_GetFontByIndex("MYFONT", 0); /* This check is important! If fetching the font fails, trying to use the font will go . . . poorly. */ if (!my_font) { gfx_PrintStringXY("MYFONT appvar not found or invalid", 0, 0); return; } /* Use font for whatever */ } ``` -------------------------------- ### Enable Archiving Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Allows programs to be built for storage in the archive rather than RAM. ```makefile ARCHIVED = YES ``` -------------------------------- ### Clone an existing Git repository from GitHub Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/git.rst Download a copy of a repository from GitHub to your local machine. This command creates a new folder with the repository's name and populates it with the source files. ```bash git clone https://github.com/commandblockguy/dino-run-ce.git ``` -------------------------------- ### Include sys/power.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/power.rst Include the sys/power.h header file to access power control routines. ```c #include ``` -------------------------------- ### Manual Font Creation - Metadata Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fontlibc.rst Defines font metadata including double width, height, fixed width, and x-height. Comments can be added using a colon at the start of a line. The metadata block is terminated by 'Font data:'. ```none convfont Double width: true Height: 8 Fixed width: 6 x-height: 2 Baseline: 7 : You can make a comment by starting a line with a colon. Font data: ``` -------------------------------- ### Get Single Key Pressed Code Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/keypadc.rst Retrieve a unique key code for a single key press, similar to os_GetCSC(). It handles multi-key presses by returning 0 and ensures that repeated presses of the same key do not trigger multiple events. ```c // code by jacobly uint8_t get_single_key_pressed(void) { static uint8_t last_key; uint8_t only_key = 0; kb_Scan(); for (uint8_t key = 1, group = 7; group; --group) { for (uint8_t mask = 1; mask; mask <<= 1, ++key) { if (kb_Data[group] & mask) { if (only_key) { last_key = 0; return 0; } else { only_key = key; } } } } if (only_key == last_key) { return 0; } last_key = only_key; return only_key; } ``` -------------------------------- ### Include sys/util.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/util.rst Include the sys/util.h header file to access CE-specific utility definitions. ```c #include ``` -------------------------------- ### CLion: Configure PATH Environment Variable Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/ides.rst On macOS/Linux, set the PATH to include the CEdev bin folder by creating a .cedev.env file. ```bash PATH=/home/youruser/.cedev/bin:$PATH ``` -------------------------------- ### Create a Git commit Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/git.rst After staging files with 'git add', create a commit to save the changes. Include a descriptive message to explain what was changed. ```bash git commit -m "Some message for the commit" ``` -------------------------------- ### Specify Compression Mode Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Selects the type of program compression. Defaults to 'zx7', but 'zx0' can be used for potentially better results at the cost of longer compression time. ```makefile COMPRESSED_MODE = zx7 ``` -------------------------------- ### Enable Program Compression Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Enables the toolchain's feature to compress programs into a self-extracting executable, reducing storage size. ```makefile COMPRESSED = YES ``` -------------------------------- ### Include ti/getcsc.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/getcsc.rst Include the necessary header file to use the keyboard driver functions. ```c #include ``` -------------------------------- ### Enable Custom File I/O in Makefile Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/fileio.rst Add these lines to your Makefile to enable custom file operations. Ensure CUSTOM_FILE_FILE points to your redefined FILE structure header. ```makefile HAS_CUSTOM_FILE := YES CUSTOM_FILE_FILE := stdio_file.h ``` -------------------------------- ### Set Program Description Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Defines the program's description, recommended to be under 25 characters. This is displayed in shells like Cesium. ```makefile DESCRIPTION = "My awesome program" ``` -------------------------------- ### Include ti/python.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/python.rst Include the ti/python.h header file to access TI's Python model and module support functions. ```c #include ``` -------------------------------- ### Include libload.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/libload.rst Include the libload.h header file to use the library's functionalities. ```c #include ``` -------------------------------- ### Creating a Font Pack Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fontlibc.rst Uses the convfont utility to package multiple .fnt files into a single binary, specifying metadata like name, version, and author. The output is then converted to a hex format for use as an appvar. ```makefile # Put each of your .fnt files on this next line. # Look at the documentation for convfont for more information on font properties temp.bin: font1.fnt font2.fnt font3.fnt convfont -o fontpack -N "Font Name" -P "ASCII" -V "Some version or date" -A "Your Name" \ -D "A SHORT description of your font" \ -f font1.fnt -a 1 -b 1 -w bold -s sans-serif -s upright -s proportional \ -f font2.fnt -a 2 -b 2 -w normal -s serif -s italic \ -f font3.fnt -a 0 -b 3 -w light -s monospaced \ temp.bin # Don't forget to change font_pack_file_name on both these lines. # Set PACKNAME to the on-calculator appvar name you want font_pack_file_name.8xv: temp.bin convhex -a -v -n PACKNAME temp.bin font_pack_file_name.8xv all: font_pack_file_name.8xv ``` -------------------------------- ### Define Build Dependencies Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Use DEPS to list files that should be built by the toolchain. Define rules for these files after including the main CEdev makefile. ```makefile DEPS = $(BINDIR)/levelpack.bin include $(shell cedev-config --makefile) $(BINDIR)/levelpack.bin: $(call MKDIR,$(@D)) echo "levelpack" > $(BINDIR)/levelpack.bin ``` -------------------------------- ### Include lcddrvce.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/lcddrvce.rst Include the necessary header file for the lcddrvce library. ```c #include ``` -------------------------------- ### Build LibLoad with fasmg Source: https://github.com/ce-programming/toolchain/blob/master/src/libload/readme.md Use the flat assembler (fasmg) to build the LibLoad library from its assembly source file. ```bash fasmg libload.asm libload.8xv ``` -------------------------------- ### Define Function as Macro Source: https://github.com/ce-programming/toolchain/blob/master/src/softfloat/doc/SoftFloat-source.html When a replacement implementation is a function, define it as a macro that resolves to the same name. This allows the preprocessor to handle it. ```c #define <_function-name_> <_function-name_> ``` -------------------------------- ### Include msddrvce.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/msddrvce.rst Include the msddrvce.h header file to access the Mass Storage Device library routines. ```c #include ``` -------------------------------- ### Include intce.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/intce.rst Include the intce.h header file to access definitions and prototypes for user interrupt functions. ```c #include ``` -------------------------------- ### Specify Program Icon Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Sets the relative path to the program's icon image (16x16 pixels). ```makefile ICON = icon.png ``` -------------------------------- ### Include sys/lcd.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/lcd.rst Include the sys/lcd.h header file to access PL111 LCD controller definitions. ```c #include ``` -------------------------------- ### Include ti/flags.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/flags.rst Include the necessary header file to access TI system flags. ```c #include ``` -------------------------------- ### Include sys/rtc.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/rtc.rst Include the sys/rtc.h header file to access Real-Time Clock definitions. ```c #include ``` -------------------------------- ### Add a remote GitHub repository Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/git.rst Link your local Git repository to a new, blank repository on GitHub. Replace and with your GitHub username and repository name. ```bash git remote add origin https://github.com//.git ``` -------------------------------- ### Replace printf Functions Makefile Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/sprintf.rst Add this line to your Makefile to replace standard printf functions with the boot_sprintf implementations. ```makefile HAS_PRINTF = NO ``` -------------------------------- ### Include Compression Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/compression.rst Include the compression.h header file to access compression and decompression routines. ```c #include ``` -------------------------------- ### Include USB Driver Library Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/usbdrvce.rst Include the usbdrvce.h header file to use the USB driver library functions. ```c #include ``` -------------------------------- ### Enable Link-Time Optimization (LTO) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Enables link-time optimization, which can potentially reduce the output size of the program. ```makefile LTO = YES ``` -------------------------------- ### Include sys/timers.h Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/sys/timers.rst Include the sys/timers.h header file to access timer definitions. This header is essential for any timer-related operations. ```c #include ``` -------------------------------- ### Include TI sprintf Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/sprintf.rst Include the necessary header file for using the TI sprintf functions. ```c #include ``` -------------------------------- ### Include fileioc.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fileioc.rst Include the fileioc.h header file to use the file I/O library functions. ```c #include ``` -------------------------------- ### Include ti/info.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/info.rst Include the ti/info.h header file to access calculator information functions. ```c #include ``` -------------------------------- ### Include graphx.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/graphx.rst Include the graphx.h header file to access the library's functions and definitions. ```c #include ``` -------------------------------- ### Include TI Screen Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/screen.rst Include the ti/screen.h header file to access the screen routines. This is necessary for any program utilizing these functions. ```c #include ``` -------------------------------- ### Recommended .gitignore file for CE toolchain projects Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/git.rst This .gitignore file helps keep your Git repository clean by ignoring automatically generated files, build outputs, and temporary files. It ensures that only source files are tracked. ```bash obj/ bin/ src/gfx/*.c src/gfx/*.h src/gfx/*.8xv .DS_Store convimg.yaml.lst ``` -------------------------------- ### Include ti/ui.h Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/ui.rst Include the ti/ui.h header file to access UI routines. This is a standard C include directive. ```c #include ``` -------------------------------- ### Include TI Tokens Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/tokens.rst Include the ti/tokens.h header file to access tokenization functionalities. ```c #include ``` -------------------------------- ### Include tice.h for Backward Compatibility Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/tice.rst Include this header to maintain compatibility with code written before the header files were separated. It is intended for legacy projects only. ```c #include ``` -------------------------------- ### TI sprintf Function Signatures Source: https://github.com/ce-programming/toolchain/blob/master/docs/headers/ti/sprintf.rst Provides the function signatures for the boot_sprintf family of functions, including variants that accept va_list. ```c int boot_sprintf(char *restrict buffer, const char *restrict format, ...) int boot_vsprintf(char *restrict buffer, const char *restrict format, va_list args) int boot_snprintf(char *restrict buffer, size_t count, const char *restrict format, ...) int boot_vsnprintf(char *restrict buffer, size_t count, const char *restrict format, va_list args) int boot_asprintf(char **restrict p_buffer, const char *restrict format, ...) int boot_vasprintf(char **restrict p_buffer, const char *restrict format, va_list args) ``` -------------------------------- ### Mark libload Libraries as Optional Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Specifies a space-separated list of 'libload' libraries to be marked as optional. If a library is not present, the program will still run but calls to its functions will crash. ```makefile LIBLOAD_OPTIONAL = graphx fileioc ``` -------------------------------- ### Format Partition with FAT32 for Optimal Performance Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fatdrvce.rst Format a drive partition with FAT32, setting the cluster allocation size to the maximum allowed (128 clusters) for best performance. This command is typically used on Linux systems. ```bash mkfs.vfat -F 32 -s 128 -S 512 -v /dev/ ``` -------------------------------- ### Select Font by Style and Size Criteria Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/fontlibc.rst Automatically select a font based on specified size and style criteria. This routine helps find a suitable font from a given font pack that matches the desired attributes. ```c fontlib_font_pack_t *font_pack; fontlib_font_t *font; . . . /* Assume font_pack already points to a valid font pack. */ /* Get a 9 or 10 pixel tall bold, serif font that isn't monospaced and isn't italic. */ font = fontlib_GetFontByStyleRaw(font_pack, 9, 10, FONTLIB_BOLD, FONTLIB_BOLD, FONTLIB_SERIF, FONTLIB_MONOSPACED | FONTLIB_ITALIC); if (font) fontlib_SetFont(font, 0); ``` -------------------------------- ### Custom Graphics Conversion Command Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Override MAKE_GFX to customize the command executed by 'make gfx'. The default navigates to the graphics directory and runs 'convimg'. ```makefile MAKE_GFX = cd $(GFXDIR) && $(CONVIMG) ``` -------------------------------- ### Specify Extra Libraries Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Use EXTRA_LIBLOAD_LIBS to add extra libload (.lib) libraries during the linking phase. ```makefile EXTRA_LIBLOAD_LIBS = ``` -------------------------------- ### Function Prototype for No Arguments (C) Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/coding-guidelines.rst In C, use 'void' to indicate a function takes no arguments. 'foo()' implies it can take any number of arguments. ```c foo(void); ``` -------------------------------- ### Including the Debug Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/debugging.rst Include the `debug.h` header file to access debugging functions like `dbg_printf`. ```c #include ``` -------------------------------- ### Include Keypadc Header Source: https://github.com/ce-programming/toolchain/blob/master/docs/libraries/keypadc.rst Include the necessary header file for using the keypadc library functions. ```c #include ``` -------------------------------- ### Prefer OS LIBC Functions Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Determines whether to prefer the calculator's built-in LIBC functions. Enabling this can decrease output size by using flash-based functions. ```makefile PREFER_OS_LIBC = YES ``` -------------------------------- ### Custom Clean Commands Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Define EXTRA_CLEAN to specify additional commands to run when 'make clean' is executed. ```makefile EXTRA_CLEAN = ``` -------------------------------- ### Set Program Name Source: https://github.com/ce-programming/toolchain/blob/master/docs/static/makefile-options.rst Defines the name of the program to be stored on the calculator. ```makefile NAME = PRGM ```