cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

08_faq.md (6577B)


      1@page docs_faq Frequently Asked Questions (FAQ)
      2
      3@anchor toolchain_faq 
      4
      5# General
      6  - How can sound effects be made?
      7    - The simplest way is to use the Game Boy sound hardware directly. See the @ref examples_sound_sample "Sound Example" for a way to test out sounds on the hardware.
      8    - Further discussion on using the Sound Example rom can be found in the ZGB wiki. Note that some example code there is ZGB specific and not part of the base GBDK API: https://github.com/Zal0/ZGB/wiki/Sounds <!-- -->
      9
     10# Graphics and Resources
     11  - How do I use a tile map when its tiles don't start at index zero?
     12    - The two main options are:
     13      - Use @ref set_bkg_based_tiles(), @ref set_bkg_based_submap(), @ref set_win_based_tiles(), @ref set_win_based_submap() and provide a tile origin offset.
     14      - Use @ref utility_png2asset with `-tile_origin` to create a map with the tile index offsets built in.
     15      <!-- -->  
     16
     17# ROM Header Settings
     18  - How do I set the ROM's title?
     19    - Use the @ref makebin `-yn` flag. For example with @ref lcc `-Wm-yn"MYTITLE"` or with @ref makebin directly `-yn "MYTITLE"`. The maximum length is up to 15 characters, but may be shorter.
     20    - See "0134-0143 - Title" in @ref Pandocs for more details. <!-- -->  
     21
     22  @anchor faq_gb_type_header_setting
     23  - How do I set SGB, Color only and Color compatibility in the ROM header?
     24    - Use the following @ref makebin flags. Prefix them with `-Wm` if using @ref lcc.
     25      - `-yc` : GameBoy Color compatible
     26      - `-yC` : GameBoy Color only
     27      - `-ys` : Super GameBoy compatible <!-- -->  
     28
     29  - How do I set the ROM @ref MBC type, and what MBC values are available to use with the `-yt` @ref makebin flag?
     30    - See @ref setting_mbc_and_rom_ram_banks <!-- -->  
     31
     32# Errors / Compiling / Toolchain
     33  @anchor faq_sdcc_peephole_instruction_error
     34  - What does `z80instructionSize() failed to parse line node, assuming 999 bytes` mean?
     35    - This is a known issue with SDCC Peephole Optimizer parsing and can be ignored. A bug report has been filed for it. <!-- -->  
     36
     37  @anchor faq_bank_overflow_errors
     38  - What do these kinds of warnings / errors mean?
     39    `WARNING: possibly wrote twice at addr 4000 (93->3E)`
     40    `Warning: Write from one bank spans into the next. 7ff7 -> 8016 (bank 1 -> 2)`
     41    - You may have a overflow in one of your ROM banks. If there is more data allocated to a bank than it can hold it then will spill over into the next bank. The warnings are generated by @ref ihxcheck during conversion of an .ihx file into a ROM file.
     42
     43      See the section @ref docs_rombanking_mbcs for more details about how banks work and what their size is. You may want to use a tool such as @ref romusage to calculate the amount of free and used space. <!-- -->  
     44
     45  @anchor faq_error_mbc_size
     46  - What does `error: size of the buffer is too small` mean?
     47    - Your program is using more banks than you have configured in the toolchain.
     48      Either the MBC type was not set, or the number of banks or MBC type should be changed to provide more banks. 
     49
     50      See the section @ref setting_mbc_and_rom_ram_banks for more details. <!-- -->  
     51
     52  - What do the following kinds of warnings / errors mean?
     53    `info 218: z80instructionSize() failed to parse line node, assuming 999 bytes`
     54    - This is a known issue with SDCC, it should not cause actual problems and you can ignore the warning. <!-- -->  
     55
     56  - Why is the compiler so slow, or why did it suddenly get much slower?
     57    - This may happen if you have large initialized arrays declared without the `const` keyword. It's important to use the const keyword for read-only data. See @ref const_gbtd_gbmb and @ref const_array_data <!-- -->  
     58
     59  - What flags should be enabled for debugging?
     60    - You can use the @ref lcc_debug "lcc debug flag" <!-- -->  
     61
     62  - Is it possible to generate a debug symbol file (`.sym`) compatible with the @ref bgb emulator?
     63    - Yes, turn on `.noi` output (LCC argument: `-Wl-j` or `-debug` and then use `-Wm-yS` with LCC (or `-yS` with makebin directly). <!-- -->  
     64
     65  - How do I move the start of the `DATA` section and the `Shadow OAM` location?
     66    - The default locations are: `_shadow_OAM=0xC000` and 240 bytes after it `_DATA=0xC0A0`
     67    - So, for example, if you wanted to move them both to start 256(0x100) bytes later, use these command line arguments for LCC:
     68      - To change the Shadow OAM address: `-Wl-g_shadow_OAM=0xC100`
     69      - To change the DATA address (again, 240 bytes after the Shadow OAM): `-Wl-b_DATA=0xc1a0`
     70     <!-- -->  
     71
     72
     73# API / Utilities
     74  - Is there a list of all functions in the API?
     75    - [Functions](globals_func.html)
     76    - [Variables](globals_vars.html) <!-- -->  
     77
     78  - Can I use the `float` type to do floating point math?
     79    - There is no support for 'float' in GBDK-2020.
     80    - Instead consider some form of `fixed point` math (including the @ref fixed_point_type "fixed" type included in GBDK). <!-- -->  
     81
     82  - Why are 8 bit numbers not printing correctly with printf()?
     83    - To correctly pass chars/uint8s for printing, they must be explicitly re-cast as such when calling the function. See @ref docs_chars_varargs for more details.  <!-- -->  
     84
     85  - How can maps larger than 32x32 tiles be scrolled? & Why is the map wrapping around to the left side when setting a map wider than 32 tiles with set_bkg_data()?
     86    - The hardware Background map is 32 x 32 tiles. The screen viewport that can be scrolled around that map is 20 x 18 tiles. In order to scroll around within a much larger map, new tiles must be loaded at the edges of the screen viewport in the direction that it is being scrolled. @ref set_bkg_submap can be used to load those rows and columns of tiles from the desired sub-region of the large map.
     87    - See the "Large Map" example program and @ref set_bkg_submap().
     88    - Writes that exceed coordinate 31 of the Background tile map on the x or y axis will wrap around to the Left and Top edges. <!-- -->  
     89
     90  - When using gbt_player with music in banks, how can the current bank be restored after calling gbt_update()? (since it changes the currently active bank without restoring it).
     91    - See @ref banking_current_bank "restoring the current bank" <!-- -->  
     92
     93  - How can CGB palettes and other sprite properties be used with metasprites?
     94    - See @ref metasprite_and_sprite_properties "Metasprites and sprite properties" <!-- -->  
     95
     96  - Weird things are happening to my sprite colors when I use png2asset and metasprites. What's going on and how does it work?
     97    - See @ref utility_png2asset for details of how the conversion process works.
     98