├── examples ├── bios │ ├── intr_wait │ │ ├── reference.png │ │ ├── data │ │ │ └── random.bin │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── math_div │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test-sdl2.lua │ │ ├── test-gba.lua │ │ └── source │ │ │ └── main.c │ ├── math_sqrt │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── math_arctan │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── math_arctan2 │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test-sdl2.lua │ │ ├── test-gba.lua │ │ └── source │ │ │ └── main.c │ ├── math_divmod │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test-sdl2.lua │ │ ├── test-gba.lua │ │ └── source │ │ │ └── main.c │ ├── bios_bitunpack │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── bios_checksum │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── bios_decompress │ │ ├── reference.png │ │ ├── data │ │ │ ├── main_c_rl.bin │ │ │ ├── main_c_diff_8.bin │ │ │ ├── main_c_huff_4.bin │ │ │ ├── main_c_huff_8.bin │ │ │ ├── main_c_lz77_8.bin │ │ │ ├── main_c_diff_16.bin │ │ │ └── main_c_lz77_16.bin │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── assets.sh │ └── CMakeLists.txt ├── dma │ ├── basic_dma │ │ ├── reference.png │ │ ├── data │ │ │ └── random.bin │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ ├── assets.sh │ │ └── source │ │ │ └── main.c │ ├── invalid_dma │ │ ├── data │ │ │ └── random.bin │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ ├── assets.sh │ │ └── source │ │ │ └── main.c │ ├── dma_interrupts │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── hblank_dma_repeat │ │ ├── reference.png │ │ ├── graphics │ │ │ └── city.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── vblank_dma_repeat │ │ ├── reference.png │ │ ├── graphics │ │ │ └── city.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── vblank_hblank_dma │ │ ├── reference.png │ │ ├── data │ │ │ └── random.bin │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── hblank_no_during_vblank │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── CMakeLists.txt │ └── assets.sh ├── sound │ ├── umod │ │ ├── reference-gba.wav │ │ ├── audio │ │ │ ├── helicopter.wav │ │ │ ├── laser2_1.wav │ │ │ └── kaos_och_dekadens.mod │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── licenses │ │ │ ├── laser2_1.txt │ │ │ ├── kaos_och_dekadens.txt │ │ │ ├── helicopter.txt │ │ │ └── mod-archive-faq.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── gbt_player │ │ ├── audio │ │ │ └── template.s3m │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ ├── assets.sh │ │ └── source │ │ │ └── main.c │ ├── global_psg │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── basic_psg_ch1 │ │ ├── reference-gba.png │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.png │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── basic_psg_ch2 │ │ ├── reference-gba.png │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.png │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── basic_psg_ch3 │ │ ├── reference-gba.png │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.png │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── basic_psg_ch4 │ │ ├── reference-gba.png │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.png │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── basic_sound_dma │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── psg_dma_combined │ │ ├── reference-gba.wav │ │ ├── reference-sdl2.wav │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── assets.sh │ └── CMakeLists.txt ├── graphics │ ├── mosaic │ │ ├── reference.png │ │ ├── graphics │ │ │ ├── city.png │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── windows │ │ ├── reference.png │ │ ├── graphics │ │ │ ├── city.png │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── priorities │ │ ├── reference.png │ │ ├── graphics │ │ │ ├── city.png │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── text_console │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── background_window │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── city.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── special_effects │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── reference-3.png │ │ ├── graphics │ │ │ ├── city.png │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── background_affine │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── city.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── mode3_framebuffer │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── mode4_framebuffer │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── mode5_framebuffer │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── sprite_affine_16col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── sprite_regular_16col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ ├── ball_red.png │ │ │ └── ball_green.png │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── sprite_lowlevel_16col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── ball.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── sprite_lowlevel_256col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── ball.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── sprite_regular_256col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── ball.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ ├── assets.sh │ │ └── source │ │ │ └── main.c │ ├── background_regular_16col │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── city.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── CMakeLists.txt │ └── assets.sh ├── input │ ├── all_input │ │ ├── reference-1.png │ │ ├── reference-2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── simple_input │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── input_interrupt │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── source │ │ │ └── main.c │ │ └── test.lua │ └── CMakeLists.txt ├── other │ ├── maths_trig │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── save_sram │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test-2.lua │ │ ├── test-1.lua │ │ └── source │ │ │ └── main.c │ ├── version_check │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── waitcnt_value │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── assert_disabled │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── assert_enabled │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── test.lua │ │ ├── CMakeLists.txt │ │ └── source │ │ │ └── main.c │ ├── cpp_example │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── iwram_ewram_sections │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── source │ │ │ ├── arm_code.c │ │ │ ├── ewram_code.c │ │ │ ├── iwram_code.c │ │ │ └── thumb_code.c │ │ └── test.lua │ └── CMakeLists.txt ├── timers │ ├── timer_cascade │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── timer_interrupt │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── timer_cascade_all │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ └── CMakeLists.txt ├── interrupts │ ├── nested_irqs │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── hblank_irq_handler │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── graphics │ │ │ └── city.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── assets.sh │ ├── multiple_irqs │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── vcount_irq_handler │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── hblank_vcount_lines │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── test.lua │ │ └── source │ │ │ └── main.c │ ├── CMakeLists.txt │ └── assets.sh ├── CMakeLists.txt └── assets.sh ├── unittests ├── sound │ ├── wave_ram │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ └── CMakeLists.txt ├── bios │ ├── swi_copy │ │ ├── reference-gba.png │ │ ├── reference-sdl2.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── soundbias │ │ ├── CMakeLists.txt │ │ └── source │ │ │ └── main.c │ └── CMakeLists.txt ├── sram │ ├── sram_autosave │ │ ├── reference.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── test-2.lua │ │ ├── CMakeLists.txt │ │ ├── test-1.lua │ │ └── source │ │ │ └── main.c │ ├── sram_read_write │ │ ├── reference.png │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ └── CMakeLists.txt ├── maths │ ├── CMakeLists.txt │ └── error_trig │ │ └── CMakeLists.txt ├── interrupts │ ├── vbl_hbl_vcount_line_order │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── reference.png │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── test.lua │ ├── vbl_hbl_vcount_handler_priority │ │ ├── gba │ │ │ └── CMakeLists.txt │ │ ├── sdl2 │ │ │ └── CMakeLists.txt │ │ ├── reference.png │ │ ├── CMakeLists.txt │ │ └── test.lua │ └── CMakeLists.txt ├── CMakeLists.txt └── cmake │ └── unittest.cmake ├── tools ├── CMakeLists.txt ├── bin2c │ └── CMakeLists.txt └── pngmatch │ └── CMakeLists.txt ├── .gitignore ├── .gitmodules ├── cmake └── runcommands.cmake ├── assets.sh ├── licenses └── mit.txt └── CMakeLists.txt /examples/bios/intr_wait/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/intr_wait/reference.png -------------------------------------------------------------------------------- /examples/bios/math_div/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/math_div/reference.png -------------------------------------------------------------------------------- /examples/bios/math_sqrt/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/math_sqrt/reference.png -------------------------------------------------------------------------------- /examples/dma/basic_dma/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/basic_dma/reference.png -------------------------------------------------------------------------------- /examples/sound/umod/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/umod/reference-gba.wav -------------------------------------------------------------------------------- /examples/bios/intr_wait/data/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/intr_wait/data/random.bin -------------------------------------------------------------------------------- /examples/bios/math_arctan/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/math_arctan/reference.png -------------------------------------------------------------------------------- /examples/bios/math_arctan2/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/math_arctan2/reference.png -------------------------------------------------------------------------------- /examples/bios/math_divmod/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/math_divmod/reference.png -------------------------------------------------------------------------------- /examples/dma/basic_dma/data/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/basic_dma/data/random.bin -------------------------------------------------------------------------------- /examples/dma/invalid_dma/data/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/invalid_dma/data/random.bin -------------------------------------------------------------------------------- /examples/graphics/mosaic/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mosaic/reference.png -------------------------------------------------------------------------------- /examples/graphics/windows/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/windows/reference.png -------------------------------------------------------------------------------- /examples/input/all_input/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/input/all_input/reference-1.png -------------------------------------------------------------------------------- /examples/input/all_input/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/input/all_input/reference-2.png -------------------------------------------------------------------------------- /examples/other/maths_trig/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/maths_trig/reference.png -------------------------------------------------------------------------------- /examples/other/save_sram/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/save_sram/reference.png -------------------------------------------------------------------------------- /examples/sound/umod/audio/helicopter.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/umod/audio/helicopter.wav -------------------------------------------------------------------------------- /examples/sound/umod/audio/laser2_1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/umod/audio/laser2_1.wav -------------------------------------------------------------------------------- /examples/sound/umod/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/umod/reference-sdl2.wav -------------------------------------------------------------------------------- /unittests/sound/wave_ram/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/sound/wave_ram/reference.png -------------------------------------------------------------------------------- /examples/bios/bios_bitunpack/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_bitunpack/reference.png -------------------------------------------------------------------------------- /examples/bios/bios_checksum/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_checksum/reference.png -------------------------------------------------------------------------------- /examples/dma/dma_interrupts/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/dma_interrupts/reference.png -------------------------------------------------------------------------------- /examples/dma/invalid_dma/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/invalid_dma/reference-gba.png -------------------------------------------------------------------------------- /examples/graphics/mosaic/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mosaic/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/priorities/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/priorities/reference.png -------------------------------------------------------------------------------- /examples/input/simple_input/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/input/simple_input/reference.png -------------------------------------------------------------------------------- /examples/other/version_check/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/version_check/reference.png -------------------------------------------------------------------------------- /examples/other/waitcnt_value/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/waitcnt_value/reference.png -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | add_subdirectory(pngmatch) 6 | -------------------------------------------------------------------------------- /unittests/bios/swi_copy/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/bios/swi_copy/reference-gba.png -------------------------------------------------------------------------------- /unittests/bios/swi_copy/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/bios/swi_copy/reference-sdl2.png -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/sram/sram_autosave/reference.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build output 2 | *.elf 3 | *.gba 4 | *.sav 5 | build/ 6 | built_assets/ 7 | lib/ 8 | 9 | # Vim swap files 10 | *.swp 11 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/reference.png -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/hblank_dma_repeat/reference.png -------------------------------------------------------------------------------- /examples/dma/invalid_dma/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/invalid_dma/reference-sdl2.png -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/vblank_dma_repeat/reference.png -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/vblank_hblank_dma/reference.png -------------------------------------------------------------------------------- /examples/graphics/windows/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/windows/graphics/city.png -------------------------------------------------------------------------------- /examples/input/input_interrupt/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/input/input_interrupt/reference.png -------------------------------------------------------------------------------- /examples/other/assert_disabled/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/assert_disabled/reference.png -------------------------------------------------------------------------------- /examples/other/assert_enabled/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/assert_enabled/reference.png -------------------------------------------------------------------------------- /examples/other/cpp_example/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/cpp_example/reference-gba.png -------------------------------------------------------------------------------- /examples/other/cpp_example/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/cpp_example/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/gbt_player/audio/template.s3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/gbt_player/audio/template.s3m -------------------------------------------------------------------------------- /examples/sound/gbt_player/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/gbt_player/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/gbt_player/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/gbt_player/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/global_psg/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/global_psg/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/global_psg/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/global_psg/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/timers/timer_cascade/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/timers/timer_cascade/reference.png -------------------------------------------------------------------------------- /examples/timers/timer_interrupt/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/timers/timer_interrupt/reference.png -------------------------------------------------------------------------------- /unittests/sram/sram_read_write/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/sram/sram_read_write/reference.png -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/data/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/vblank_hblank_dma/data/random.bin -------------------------------------------------------------------------------- /examples/graphics/mosaic/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mosaic/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/graphics/priorities/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/priorities/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/text_console/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/text_console/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/text_console/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/text_console/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/windows/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/windows/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch1/reference-gba.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch1/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch1/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch1/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch2/reference-gba.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch2/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch2/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch2/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch3/reference-gba.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch3/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch3/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch3/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch4/reference-gba.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch4/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch4/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_psg_ch4/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/umod/audio/kaos_och_dekadens.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/umod/audio/kaos_och_dekadens.mod -------------------------------------------------------------------------------- /examples/sound/umod/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/umod/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade_all/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/timers/timer_cascade_all/reference.png -------------------------------------------------------------------------------- /unittests/bios/soundbias/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_unittest() 6 | -------------------------------------------------------------------------------- /unittests/maths/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | add_subdirectory(error_trig) 6 | -------------------------------------------------------------------------------- /unittests/maths/error_trig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_unittest() 6 | -------------------------------------------------------------------------------- /unittests/sound/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(wave_ram) 6 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_rl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_rl.bin -------------------------------------------------------------------------------- /examples/bios/intr_wait/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/intr_wait/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_arctan/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/math_div/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/math_div/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/math_sqrt/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/math_sqrt/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/hblank_dma_repeat/graphics/city.png -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/hblank_no_during_vblank/reference.png -------------------------------------------------------------------------------- /examples/dma/invalid_dma/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/invalid_dma/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/dma/vblank_dma_repeat/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/background_window/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_window/reference.png -------------------------------------------------------------------------------- /examples/graphics/mosaic/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/mosaic/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mosaic/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/graphics/mosaic/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/priorities/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/priorities/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/graphics/special_effects/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/special_effects/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/special_effects/reference-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/reference-3.png -------------------------------------------------------------------------------- /examples/graphics/windows/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/windows/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/windows/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/input/all_input/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/input/all_input/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/nested_irqs/reference-gba.png -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/nested_irqs/reference-sdl2.png -------------------------------------------------------------------------------- /examples/other/cpp_example/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/maths_trig/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/save_sram/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/save_sram/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_sound_dma/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/basic_sound_dma/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/gbt_player/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/global_psg/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/reference-gba.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/psg_dma_combined/reference-gba.wav -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/reference-sdl2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/sound/psg_dma_combined/reference-sdl2.wav -------------------------------------------------------------------------------- /examples/sound/umod/licenses/laser2_1.txt: -------------------------------------------------------------------------------- 1 | Name: Shots 2 | Author: Gumichan01 3 | License: CC-BY-SA-3.0 4 | 5 | https://opengameart.org/content/shots 6 | -------------------------------------------------------------------------------- /unittests/bios/swi_copy/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /unittests/bios/swi_copy/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /unittests/sound/wave_ram/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /unittests/sound/wave_ram/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_bitunpack/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_bitunpack/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_checksum/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_checksum/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_diff_8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_diff_8.bin -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_huff_4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_huff_4.bin -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_huff_8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_huff_8.bin -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_lz77_8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_lz77_8.bin -------------------------------------------------------------------------------- /examples/bios/bios_decompress/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_arctan/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/dma_interrupts/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/dma_interrupts/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_affine/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/background_affine/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_affine/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode3_framebuffer/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode3_framebuffer/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode4_framebuffer/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode4_framebuffer/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/reference-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode5_framebuffer/reference-1.png -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/reference-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/mode5_framebuffer/reference-2.png -------------------------------------------------------------------------------- /examples/graphics/priorities/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/priorities/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/priorities/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/graphics/priorities/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_affine_16col/reference.png -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_regular_16col/reference.png -------------------------------------------------------------------------------- /examples/graphics/text_console/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/windows/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/input/input_interrupt/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/input/simple_input/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/input/simple_input/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/hblank_irq_handler/reference.png -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/multiple_irqs/reference-gba.png -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/multiple_irqs/reference-sdl2.png -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/vcount_irq_handler/reference.png -------------------------------------------------------------------------------- /examples/other/assert_disabled/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/assert_enabled/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/assert_enabled/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/cpp_example/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/maths_trig/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/version_check/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/version_check/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/waitcnt_value/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/waitcnt_value/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/sound/gbt_player/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/global_psg/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_interrupt/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /unittests/sram/sram_read_write/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_diff_16.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_diff_16.bin -------------------------------------------------------------------------------- /examples/bios/bios_decompress/data/main_c_lz77_16.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/bios/bios_decompress/data/main_c_lz77_16.bin -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_affine/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/background_window/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_window/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_window/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/graphics/special_effects/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_lowlevel_16col/reference.png -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_lowlevel_256col/reference.png -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_regular_256col/reference.png -------------------------------------------------------------------------------- /examples/graphics/text_console/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/input/input_interrupt/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/hblank_vcount_lines/reference.png -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/assert_disabled/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/reference-gba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/iwram_ewram_sections/reference-gba.png -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/reference-sdl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/other/iwram_ewram_sections/reference-sdl2.png -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/sound/umod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio() 7 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade_all/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade_all/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/timers/timer_interrupt/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /unittests/sram/sram_read_write/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_div/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_regular_16col/reference.png -------------------------------------------------------------------------------- /examples/graphics/background_window/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/special_effects/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/graphics/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_lowlevel_16col/graphics/ball.png -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/graphics/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_regular_256col/graphics/ball.png -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/interrupts/hblank_irq_handler/graphics/city.png -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/other/save_sram/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_sram() 7 | -------------------------------------------------------------------------------- /examples/sound/global_psg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio() 7 | -------------------------------------------------------------------------------- /examples/bios/bios_checksum/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/intr_wait/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/math_arctan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/math_sqrt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/dma_interrupts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/invalid_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/graphics/city.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/background_regular_16col/graphics/city.png -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/mosaic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_affine_16col/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/graphics/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_lowlevel_256col/graphics/ball.png -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/graphics/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_regular_16col/graphics/ball_red.png -------------------------------------------------------------------------------- /examples/graphics/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/input/simple_input/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/cpp_example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/maths_trig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio() 7 | -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio() 7 | -------------------------------------------------------------------------------- /unittests/bios/swi_copy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_line_order/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_line_order/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/interrupts/vbl_hbl_vcount_line_order/reference.png -------------------------------------------------------------------------------- /unittests/sound/wave_ram/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/bios_bitunpack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/priorities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_affine_16col/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/graphics/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/examples/graphics/sprite_regular_16col/graphics/ball_green.png -------------------------------------------------------------------------------- /examples/input/all_input/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/input/input_interrupt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/assert_disabled/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/version_check/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/waitcnt_value/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/timers/timer_interrupt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_line_order/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /unittests/sram/sram_read_write/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 50 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(50) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/background_window/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/text_console/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio_screenshot() 7 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio_screenshot() 7 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio_screenshot() 7 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_audio_screenshot() 7 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade_all/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /unittests/bios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(soundbias) 6 | add_subdirectory(swi_copy) 7 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_handler_priority/gba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_gba() 6 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_handler_priority/sdl2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | example_build_sdl2() 6 | -------------------------------------------------------------------------------- /examples/bios/math_arctan/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/math_div/test-sdl2.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/math_sqrt/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/dma_interrupts/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 50 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(50) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/invalid_dma/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/graphics/mosaic/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_three_screenshots() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/windows/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/other/maths_trig/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/bios/swi_copy/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_handler_priority/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntonioND/ugba-testing/HEAD/unittests/interrupts/vbl_hbl_vcount_handler_priority/reference.png -------------------------------------------------------------------------------- /unittests/sound/wave_ram/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/sram/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(sram_autosave) 6 | add_subdirectory(sram_read_write) 7 | -------------------------------------------------------------------------------- /examples/bios/bios_bitunpack/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/bios_checksum/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/test-sdl2.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/test-sdl2.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 20 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(20) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_two_screenshots() 7 | -------------------------------------------------------------------------------- /examples/graphics/priorities/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/nested_irqs/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 60 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(60) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/other/assert_disabled/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/other/assert_enabled/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/other/cpp_example/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | 5 | screenshot() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /examples/other/version_check/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/other/waitcnt_value/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_line_order/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /unittests/sram/sram_read_write/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 60 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(120) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(60) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/background_window/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/multiple_irqs/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 60 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(60) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_handler_priority/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | define_example() 6 | unittest_screenshot() 7 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 20 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(20) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 20 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(20) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 40 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(40) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(10) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/other/assert_enabled/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | define_example() 6 | enable_debug_example() 7 | unittest_screenshot() 8 | -------------------------------------------------------------------------------- /examples/sound/gbt_player/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2022 Antonio Niño Díaz 4 | 5 | define_example() 6 | example_add_define(GBT_USE_LIBUGBA) 7 | unittest_audio() 8 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_line_order/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 40 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(40) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/test-2.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames and takes a screenshot. 2 | 3 | run_frames_and_pause(10) 4 | 5 | screenshot() 6 | 7 | exit() 8 | 9 | return 0 10 | -------------------------------------------------------------------------------- /examples/sound/umod/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records 2 seconds of audio and compares them with the reference 2 | 3 | wav_record_start() 4 | run_frames_and_pause(120) 5 | wav_record_end() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /unittests/interrupts/vbl_hbl_vcount_handler_priority/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 40 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(40) 4 | screenshot() 5 | exit() 6 | 7 | return 0 8 | -------------------------------------------------------------------------------- /examples/input/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | add_subdirectory(all_input) 6 | add_subdirectory(input_interrupt) 7 | add_subdirectory(simple_input) 8 | -------------------------------------------------------------------------------- /examples/sound/gbt_player/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records 2 seconds of audio and compares them with the reference 2 | 3 | wav_record_start() 4 | run_frames_and_pause(120) 5 | wav_record_end() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /examples/sound/basic_sound_dma/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records 1 second of audio and compares it with the reference 2 | 3 | wav_record_start() 4 | run_frames_and_pause(60) 5 | wav_record_end() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /unittests/interrupts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(vbl_hbl_vcount_handler_priority) 6 | add_subdirectory(vbl_hbl_vcount_line_order) 7 | -------------------------------------------------------------------------------- /examples/sound/umod/licenses/kaos_och_dekadens.txt: -------------------------------------------------------------------------------- 1 | Name: Kaos och dekadens 2 | Author: Nightbeat 3 | License: Mod Archive Distribution license 4 | 5 | https://modarchive.org/index.php?request=view_by_moduleid&query=113319 6 | -------------------------------------------------------------------------------- /examples/timers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(timer_cascade) 6 | add_subdirectory(timer_cascade_all) 7 | add_subdirectory(timer_interrupt) 8 | -------------------------------------------------------------------------------- /examples/bios/math_div/test-gba.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | -- This test takes about 2 seconds to draw the pattern 4 | run_frames_and_pause(120) 5 | screenshot() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/test-gba.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | -- This test takes about 2 seconds to draw the pattern 4 | run_frames_and_pause(120) 5 | screenshot() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/test-gba.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot and exits. 2 | 3 | -- This test takes about 2 seconds to draw the pattern 4 | run_frames_and_pause(120) 5 | screenshot() 6 | exit() 7 | 8 | return 0 9 | -------------------------------------------------------------------------------- /examples/bios/intr_wait/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 60 frames, presses START, takes a screenshot and 2 | -- exits. 3 | 4 | run_frames_and_pause(60) 5 | keys_hold("START") 6 | 7 | run_frames_and_pause(5) 8 | 9 | screenshot() 10 | exit() 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/sound/global_psg/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button 2 | -- and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(295) 8 | wav_record_end() 9 | exit() 10 | 11 | return 0 12 | -------------------------------------------------------------------------------- /examples/sound/psg_dma_combined/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button 2 | -- and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(235) 8 | wav_record_end() 9 | exit() 10 | 11 | return 0 12 | -------------------------------------------------------------------------------- /unittests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | include(cmake/unittest.cmake) 6 | 7 | add_subdirectory(bios) 8 | add_subdirectory(interrupts) 9 | add_subdirectory(maths) 10 | add_subdirectory(sound) 11 | add_subdirectory(sram) 12 | -------------------------------------------------------------------------------- /examples/interrupts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(hblank_irq_handler) 6 | add_subdirectory(hblank_vcount_lines) 7 | add_subdirectory(multiple_irqs) 8 | add_subdirectory(nested_irqs) 9 | add_subdirectory(vcount_irq_handler) 10 | -------------------------------------------------------------------------------- /examples/sound/umod/licenses/helicopter.txt: -------------------------------------------------------------------------------- 1 | Name: Helicopter Sounds 2 | Author: aquinn 3 | License: CC0-1.0 4 | 5 | https://opengameart.org/content/helicopter-sounds 6 | 7 | Note: This file has been modified to be a 8-bit 1-channel WAV. Only the first SFX of the 8 | multiple present in the MP3 file has been saved to the WAV file. 9 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch1/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button, 2 | -- takes a screenshot, and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(295) 8 | wav_record_end() 9 | screenshot() 10 | exit() 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch2/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button, 2 | -- takes a screenshot, and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(295) 8 | wav_record_end() 9 | screenshot() 10 | exit() 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch3/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button, 2 | -- takes a screenshot, and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(195) 8 | wav_record_end() 9 | screenshot() 10 | exit() 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/sound/basic_psg_ch4/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that records a few seconds of audio while holding the START button, 2 | -- takes a screenshot, and exits. 3 | 4 | wav_record_start() 5 | run_frames_and_pause(5) 6 | keys_hold("START") 7 | run_frames_and_pause(295) 8 | wav_record_end() 9 | screenshot() 10 | exit() 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(bios) 6 | add_subdirectory(dma) 7 | add_subdirectory(graphics) 8 | add_subdirectory(input) 9 | add_subdirectory(interrupts) 10 | add_subdirectory(sound) 11 | add_subdirectory(timers) 12 | add_subdirectory(other) 13 | -------------------------------------------------------------------------------- /tools/bin2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | cmake_minimum_required(VERSION 3.15) 6 | project(bin2c) 7 | 8 | add_executable(bin2c bin2c.c) 9 | 10 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") 11 | target_compile_options(bin2c PRIVATE -Wformat-truncation=0) 12 | endif() 13 | -------------------------------------------------------------------------------- /examples/interrupts/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd hblank_irq_handler && bash assets.sh) 17 | 18 | exit 0 19 | -------------------------------------------------------------------------------- /examples/sound/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd gbt_player && bash assets.sh) 17 | (cd umod && bash assets.sh) 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/source/arm_code.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | #include 6 | 7 | ARM_CODE uint32_t divide_arm(uint32_t a, uint32_t b) 8 | { 9 | uint32_t y = 0; 10 | 11 | while (a > b) 12 | { 13 | a -= b; 14 | y++; 15 | } 16 | 17 | return y; 18 | } 19 | -------------------------------------------------------------------------------- /examples/bios/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd bios_decompress && bash assets.sh) 17 | (cd intr_wait && bash assets.sh) 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /examples/dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(basic_dma) 6 | add_subdirectory(dma_interrupts) 7 | add_subdirectory(hblank_dma_repeat) 8 | add_subdirectory(hblank_no_during_vblank) 9 | add_subdirectory(invalid_dma) 10 | add_subdirectory(vblank_dma_repeat) 11 | add_subdirectory(vblank_hblank_dma) 12 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/source/ewram_code.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | #include 6 | 7 | EWRAM_CODE uint32_t divide_ewram(uint32_t a, uint32_t b) 8 | { 9 | uint32_t y = 0; 10 | 11 | while (a > b) 12 | { 13 | a -= b; 14 | y++; 15 | } 16 | 17 | return y; 18 | } 19 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/source/iwram_code.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | #include 6 | 7 | IWRAM_CODE uint32_t divide_iwram(uint32_t a, uint32_t b) 8 | { 9 | uint32_t y = 0; 10 | 11 | while (a > b) 12 | { 13 | a -= b; 14 | y++; 15 | } 16 | 17 | return y; 18 | } 19 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/source/thumb_code.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | #include 6 | 7 | THUMB_CODE uint32_t divide_thumb(uint32_t a, uint32_t b) 8 | { 9 | uint32_t y = 0; 10 | 11 | while (a > b) 12 | { 13 | a -= b; 14 | y++; 15 | } 16 | 17 | return y; 18 | } 19 | -------------------------------------------------------------------------------- /examples/other/save_sram/test-2.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, presses up 5 times, and then takes a 2 | -- screenshot. 3 | 4 | run_frames_and_pause(10) 5 | 6 | for i = 1, 5, 1 7 | do 8 | keys_hold("UP") 9 | run_frames_and_pause(2) 10 | keys_release("UP") 11 | run_frames_and_pause(2) 12 | end 13 | 14 | screenshot() 15 | 16 | exit() 17 | 18 | return 0 19 | -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | # This test only makes sense in the SDL2 port because there is no autosave every 6 | # N seconds on a real GBA, SRAM is simply preserved with the battery of the 7 | # cartridge. 8 | set(BUILD_GBA_INTERNAL FALSE) 9 | 10 | define_example() 11 | unittest_sram() 12 | -------------------------------------------------------------------------------- /examples/other/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(assert_disabled) 6 | add_subdirectory(assert_enabled) 7 | add_subdirectory(cpp_example) 8 | add_subdirectory(iwram_ewram_sections) 9 | add_subdirectory(maths_trig) 10 | add_subdirectory(save_sram) 11 | add_subdirectory(version_check) 12 | add_subdirectory(waitcnt_value) 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "umod-player"] 2 | path = umod-player 3 | url = https://github.com/AntonioND/umod-player 4 | [submodule "giibiiadvance"] 5 | path = giibiiadvance 6 | url = https://github.com/AntonioND/giibiiadvance 7 | [submodule "libugba"] 8 | path = libugba 9 | url = https://github.com/AntonioND/libugba 10 | [submodule "SuperFamiconv"] 11 | path = SuperFamiconv 12 | url = https://github.com/Optiroc/SuperFamiconv 13 | -------------------------------------------------------------------------------- /examples/bios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | add_subdirectory(bios_bitunpack) 6 | add_subdirectory(bios_checksum) 7 | add_subdirectory(bios_decompress) 8 | add_subdirectory(intr_wait) 9 | add_subdirectory(math_arctan) 10 | add_subdirectory(math_arctan2) 11 | add_subdirectory(math_div) 12 | add_subdirectory(math_divmod) 13 | add_subdirectory(math_sqrt) 14 | -------------------------------------------------------------------------------- /examples/sound/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(basic_sound_dma) 6 | add_subdirectory(basic_psg_ch1) 7 | add_subdirectory(basic_psg_ch2) 8 | add_subdirectory(basic_psg_ch3) 9 | add_subdirectory(basic_psg_ch4) 10 | add_subdirectory(gbt_player) 11 | add_subdirectory(global_psg) 12 | add_subdirectory(psg_dma_combined) 13 | add_subdirectory(umod) 14 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot, presses the START 2 | -- button to enable background wraparound and to move and rotate the 3 | -- background, and takes another screenshot. 4 | 5 | run_frames_and_pause(30) 6 | screenshot("screenshot-1.png") 7 | keys_hold("START") 8 | 9 | run_frames_and_pause(5) 10 | screenshot("screenshot-2.png") 11 | 12 | exit() 13 | 14 | return 0 15 | -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 80 frames, takes a screenshot, presses the START 2 | -- button to enable background wraparound and to move and rotate the 3 | -- background, and takes another screenshot. 4 | 5 | run_frames_and_pause(80) 6 | screenshot("screenshot-1.png") 7 | keys_hold("START") 8 | 9 | run_frames_and_pause(5) 10 | screenshot("screenshot-2.png") 11 | 12 | exit() 13 | 14 | return 0 15 | -------------------------------------------------------------------------------- /examples/graphics/mode4_framebuffer/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 60 frames, takes a screenshot, presses the START 2 | -- button to enable background wraparound and to move and rotate the 3 | -- background, and takes another screenshot. 4 | 5 | run_frames_and_pause(60) 6 | screenshot("screenshot-1.png") 7 | keys_hold("START") 8 | 9 | run_frames_and_pause(5) 10 | screenshot("screenshot-2.png") 11 | 12 | exit() 13 | 14 | return 0 15 | -------------------------------------------------------------------------------- /examples/graphics/mode5_framebuffer/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 80 frames, takes a screenshot, presses the START 2 | -- button to enable background wraparound and to move and rotate the 3 | -- background, and takes another screenshot. 4 | 5 | run_frames_and_pause(80) 6 | screenshot("screenshot-1.png") 7 | keys_hold("START") 8 | 9 | run_frames_and_pause(5) 10 | screenshot("screenshot-2.png") 11 | 12 | exit() 13 | 14 | return 0 15 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot, presses A to 2 | -- show the results screen, takes a screenshot and exits. 3 | 4 | run_frames_and_pause(120) 5 | -- This screenshot is used as reference when the test fails, it isn't used for 6 | -- the test checks. 7 | screenshot("timer-values.png") 8 | keys_hold("A") 9 | 10 | run_frames_and_pause(5) 11 | 12 | screenshot() 13 | exit() 14 | 15 | return 0 16 | -------------------------------------------------------------------------------- /examples/timers/timer_interrupt/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 70 frames, takes a screenshot, presses A to 2 | -- show the results screen, takes a screenshot and exits. 3 | 4 | run_frames_and_pause(70) 5 | -- This screenshot is used as reference when the test fails, it isn't used for 6 | -- the test checks. 7 | screenshot("timer-values.png") 8 | keys_hold("A") 9 | 10 | run_frames_and_pause(5) 11 | 12 | screenshot() 13 | exit() 14 | 15 | return 0 16 | -------------------------------------------------------------------------------- /examples/other/iwram_ewram_sections/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 100 frames, takes a screenshot, presses A to 2 | -- show the results screen, takes a screenshot and exits. 3 | 4 | run_frames_and_pause(100) 5 | -- This screenshot is used as reference when the test fails, it isn't used for 6 | -- the test checks. 7 | screenshot("timer-values.png") 8 | keys_hold("A") 9 | 10 | run_frames_and_pause(5) 11 | 12 | screenshot() 13 | exit() 14 | 15 | return 0 16 | -------------------------------------------------------------------------------- /examples/timers/timer_cascade_all/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 120 frames, takes a screenshot, presses A to 2 | -- show the results screen, takes a screenshot and exits. 3 | 4 | run_frames_and_pause(80) 5 | -- This screenshot is used as reference when the test fails, it isn't used for 6 | -- the test checks. 7 | screenshot("timer-values.png") 8 | keys_hold("A") 9 | 10 | run_frames_and_pause(5) 11 | 12 | screenshot() 13 | exit() 14 | 15 | return 0 16 | -------------------------------------------------------------------------------- /examples/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd bios && bash assets.sh) 17 | (cd dma && bash assets.sh) 18 | (cd graphics && bash assets.sh) 19 | (cd interrupts && bash assets.sh) 20 | (cd sound && bash assets.sh) 21 | 22 | exit 0 23 | -------------------------------------------------------------------------------- /examples/dma/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd basic_dma && bash assets.sh) 17 | (cd hblank_dma_repeat && bash assets.sh) 18 | (cd invalid_dma && bash assets.sh) 19 | (cd vblank_dma_repeat && bash assets.sh) 20 | (cd vblank_hblank_dma && bash assets.sh) 21 | 22 | exit 0 23 | -------------------------------------------------------------------------------- /examples/other/save_sram/test-1.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, presses start, and then presses up 10 2 | -- times. 3 | 4 | run_frames_and_pause(10) 5 | 6 | keys_hold("START") 7 | run_frames_and_pause(2) 8 | keys_release("START") 9 | run_frames_and_pause(2) 10 | 11 | for i = 1, 10, 1 12 | do 13 | keys_hold("UP") 14 | run_frames_and_pause(2) 15 | keys_release("UP") 16 | run_frames_and_pause(2) 17 | end 18 | 19 | screenshot("intermediate.png") 20 | 21 | exit() 22 | 23 | return 0 24 | -------------------------------------------------------------------------------- /examples/graphics/special_effects/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 30 frames, takes a screenshot and exits. 2 | 3 | run_frames_and_pause(30) 4 | screenshot("screenshot-1.png") 5 | 6 | keys_hold("SELECT") 7 | run_frames_and_pause(3) 8 | keys_release("SELECT") 9 | run_frames_and_pause(3) 10 | 11 | screenshot("screenshot-2.png") 12 | 13 | keys_hold("SELECT") 14 | run_frames_and_pause(3) 15 | keys_release("SELECT") 16 | run_frames_and_pause(3) 17 | 18 | screenshot("screenshot-3.png") 19 | 20 | exit() 21 | 22 | return 0 23 | -------------------------------------------------------------------------------- /tools/pngmatch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | add_executable(pngmatch pngmatch.c) 6 | 7 | # libpng is required 8 | 9 | if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") 10 | find_package(libpng REQUIRED 1.6) 11 | 12 | target_link_libraries(pngmatch PRIVATE png) 13 | else() 14 | find_package(PNG REQUIRED 1.6) 15 | 16 | target_link_libraries(pngmatch PRIVATE ${PNG_LIBRARIES}) 17 | target_include_directories(pngmatch PRIVATE ${PNG_INCLUDE_DIRS}) 18 | endif() 19 | -------------------------------------------------------------------------------- /examples/graphics/text_console/test.lua: -------------------------------------------------------------------------------- 1 | -- Test that runs a program for 10 frames, takes a screenshot, presses some 2 | -- buttons to change the console output on the screen, and takes another 3 | -- screenshot. 4 | 5 | run_frames_and_pause(10) 6 | screenshot("screenshot-1.png") 7 | keys_hold("B") 8 | 9 | run_frames_and_pause(3) 10 | keys_release("B") 11 | keys_hold("SELECT") 12 | 13 | run_frames_and_pause(3) 14 | keys_release("SELECT") 15 | 16 | run_frames_and_pause(3) 17 | screenshot("screenshot-2.png") 18 | 19 | exit() 20 | 21 | return 0 22 | -------------------------------------------------------------------------------- /examples/input/all_input/test.lua: -------------------------------------------------------------------------------- 1 | -- Press some keys, release keys, repeat... and take screenshots 2 | 3 | run_frames_and_pause(5) 4 | 5 | keys_hold("B", "START", "LEFT", "DOWN", "L") 6 | 7 | run_frames_and_pause(10) 8 | 9 | keys_release("B", "START", "LEFT", "DOWN", "L") 10 | keys_hold("A", "SELECT", "RIGHT", "UP", "R") 11 | 12 | run_frames_and_pause(10) 13 | 14 | screenshot("screenshot-1.png") 15 | 16 | keys_hold("B", "START", "LEFT", "DOWN", "L") 17 | keys_release("A", "SELECT", "RIGHT", "UP", "R") 18 | 19 | run_frames_and_pause(10) 20 | 21 | screenshot("screenshot-2.png") 22 | 23 | exit() 24 | 25 | return 0 26 | -------------------------------------------------------------------------------- /examples/input/simple_input/test.lua: -------------------------------------------------------------------------------- 1 | -- Press some keys, release keys, repeat... and take screenshot 2 | 3 | run_frames_and_pause(30) 4 | keys_hold("B", "START") 5 | 6 | run_frames_and_pause(3) 7 | keys_hold("L", "DOWN", "RIGHT") 8 | keys_release("B", "START") 9 | 10 | run_frames_and_pause(3) 11 | keys_hold("R", "UP", "LEFT") 12 | keys_release("L", "DOWN", "RIGHT") 13 | 14 | run_frames_and_pause(3) 15 | keys_hold("A", "SELECT") 16 | keys_release("R", "UP", "LEFT") 17 | 18 | run_frames_and_pause(3) 19 | keys_release("A", "SELECT") 20 | 21 | run_frames_and_pause(3) 22 | screenshot() 23 | 24 | exit() 25 | 26 | return 0 27 | -------------------------------------------------------------------------------- /examples/sound/gbt_player/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert music 23 | 24 | mkdir ${OUT_DIR}/audio 25 | 26 | S3M2GBT=s3m2gbt.py 27 | 28 | python3 ${S3M2GBT} \ 29 | --input audio/template.s3m \ 30 | --name template \ 31 | --output ${OUT_DIR}/audio/template.c \ 32 | --instruments 33 | 34 | # Done! 35 | 36 | exit 0 37 | -------------------------------------------------------------------------------- /examples/bios/intr_wait/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert data 23 | 24 | cp -r data built_assets 25 | 26 | # Convert binary files generated by other stages 27 | 28 | for dir in $(find ${OUT_DIR} -type d) 29 | do 30 | for f in $(find $dir -maxdepth 1 -iname *.bin) 31 | do 32 | ${BIN2C} "$f" "$dir" 33 | done 34 | done 35 | 36 | # Done! 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert data 23 | 24 | cp -r data built_assets 25 | 26 | # Convert binary files generated by other stages 27 | 28 | for dir in $(find ${OUT_DIR} -type d) 29 | do 30 | for f in $(find $dir -maxdepth 1 -iname *.bin) 31 | do 32 | ${BIN2C} "$f" "$dir" 33 | done 34 | done 35 | 36 | # Done! 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /examples/dma/invalid_dma/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert data 23 | 24 | cp -r data built_assets 25 | 26 | # Convert binary files generated by other stages 27 | 28 | for dir in $(find ${OUT_DIR} -type d) 29 | do 30 | for f in $(find $dir -maxdepth 1 -iname *.bin) 31 | do 32 | ${BIN2C} "$f" "$dir" 33 | done 34 | done 35 | 36 | # Done! 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /examples/bios/bios_decompress/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert data 23 | 24 | cp -r data built_assets 25 | 26 | # Convert binary files generated by other stages 27 | 28 | for dir in $(find ${OUT_DIR} -type d) 29 | do 30 | for f in $(find $dir -maxdepth 1 -iname *.bin) 31 | do 32 | ${BIN2C} "$f" "$dir" 33 | done 34 | done 35 | 36 | # Done! 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /examples/dma/vblank_hblank_dma/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert data 23 | 24 | cp -r data built_assets 25 | 26 | # Convert binary files generated by other stages 27 | 28 | for dir in $(find ${OUT_DIR} -type d) 29 | do 30 | for f in $(find $dir -maxdepth 1 -iname *.bin) 31 | do 32 | ${BIN2C} "$f" "$dir" 33 | done 34 | done 35 | 36 | # Done! 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /examples/graphics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | add_subdirectory(background_affine) 6 | add_subdirectory(background_regular_16col) 7 | add_subdirectory(background_window) 8 | add_subdirectory(mode3_framebuffer) 9 | add_subdirectory(mode4_framebuffer) 10 | add_subdirectory(mode5_framebuffer) 11 | add_subdirectory(mosaic) 12 | add_subdirectory(priorities) 13 | add_subdirectory(special_effects) 14 | add_subdirectory(sprite_affine_16col) 15 | add_subdirectory(sprite_lowlevel_16col) 16 | add_subdirectory(sprite_lowlevel_256col) 17 | add_subdirectory(sprite_regular_16col) 18 | add_subdirectory(sprite_regular_256col) 19 | add_subdirectory(text_console) 20 | add_subdirectory(windows) 21 | -------------------------------------------------------------------------------- /unittests/bios/soundbias/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Test that checks that the emulated BIOS function SoundBias() is working as 6 | // expected on real hardware. 7 | 8 | #include 9 | 10 | uint32_t get_bias_level(void) 11 | { 12 | return (REG_SOUNDBIAS & 0x3FE) >> 1; 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | UGBA_InitHeadless(&argc, &argv); 18 | 19 | SWI_SoundBias(0); 20 | if (get_bias_level() != 0) 21 | return 1; 22 | 23 | for (uint32_t i = 1; i < 0x2000; i <<= 1) 24 | { 25 | SWI_SoundBias(i); 26 | if (get_bias_level() != 0x100) 27 | return 1; 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /cmake/runcommands.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | cmake_minimum_required(VERSION 3.15) 6 | 7 | macro(exec_check command) 8 | message(VERBOSE "${command}") 9 | 10 | # This macro gets a string as an argument. It is needed to split it into 11 | # program and arguments for execute_process() 12 | string(REPLACE " " ";" CMD_LIST ${command}) 13 | 14 | execute_process(COMMAND ${CMD_LIST} RESULT_VARIABLE RESULT_CODE) 15 | 16 | if(RESULT_CODE) 17 | message(FATAL_ERROR "Error: ${command}") 18 | endif() 19 | endmacro() 20 | 21 | if(NOT "${CMD1}" STREQUAL "") 22 | exec_check(${CMD1}) 23 | endif() 24 | if(NOT "${CMD2}" STREQUAL "") 25 | exec_check(${CMD2}) 26 | endif() 27 | if(NOT "${CMD3}" STREQUAL "") 28 | exec_check(${CMD3}) 29 | endif() 30 | -------------------------------------------------------------------------------- /examples/interrupts/vcount_irq_handler/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that shows how to use the VCOUNT interrupt. 6 | 7 | #include 8 | 9 | void vbl_handler(void) 10 | { 11 | MEM_BACKDROP_COLOR = RGB15(31, 0, 0); 12 | } 13 | 14 | void vcount_handler(void) 15 | { 16 | MEM_BACKDROP_COLOR = RGB15(0, 0, 31); 17 | } 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | UGBA_Init(&argc, &argv); 22 | 23 | // Enable interrupts 24 | IRQ_SetHandler(IRQ_VBLANK, vbl_handler); 25 | IRQ_SetHandler(IRQ_VCOUNT, vcount_handler); 26 | IRQ_Enable(IRQ_VBLANK); 27 | IRQ_Enable(IRQ_VCOUNT); 28 | IRQ_SetReferenceVCOUNT(100); 29 | 30 | DISP_ModeSet(0); 31 | 32 | while (1) 33 | SWI_VBlankIntrWait(); 34 | } 35 | -------------------------------------------------------------------------------- /examples/graphics/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | (cd background_affine && bash assets.sh) 17 | (cd background_regular_16col && bash assets.sh) 18 | (cd background_window && bash assets.sh) 19 | (cd mosaic && bash assets.sh) 20 | (cd priorities && bash assets.sh) 21 | (cd special_effects && bash assets.sh) 22 | (cd sprite_affine_16col && bash assets.sh) 23 | (cd sprite_lowlevel_16col && bash assets.sh) 24 | (cd sprite_lowlevel_256col && bash assets.sh) 25 | (cd sprite_regular_16col && bash assets.sh) 26 | (cd sprite_regular_256col && bash assets.sh) 27 | (cd windows && bash assets.sh) 28 | 29 | exit 0 30 | -------------------------------------------------------------------------------- /examples/sound/umod/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | # Convert music 23 | 24 | mkdir ${OUT_DIR}/audio 25 | 26 | ${UMOD_PACKER} \ 27 | ${OUT_DIR}/audio/umod_pack.bin \ 28 | ${OUT_DIR}/audio/umod_pack_info.h \ 29 | audio/*.mod \ 30 | audio/*.wav 31 | 32 | # Convert binary files generated by other stages 33 | 34 | for dir in $(find ${OUT_DIR} -type d) 35 | do 36 | for f in $(find $dir -maxdepth 1 -iname *.bin) 37 | do 38 | ${BIN2C} "$f" "$dir" 39 | done 40 | done 41 | 42 | # Done! 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /examples/other/waitcnt_value/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Test that checks the value of WAITCNT after initializing the library. 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | UGBA_Init(&argc, &argv); 15 | 16 | REG_WAITCNT = UGBA_FlashcartOptimizedWaitstates(); 17 | 18 | // Display results 19 | 20 | IRQ_Enable(IRQ_VBLANK); 21 | 22 | DISP_ModeSet(0); 23 | 24 | CON_InitDefault(); 25 | 26 | char string[50]; 27 | snprintf(string, sizeof(string), 28 | "WAITCNT: 0x%" PRIX16 "\n" 29 | "SuperCard SD: %s", 30 | REG_WAITCNT, 31 | (REG_WAITCNT == WAITCNT_SCSD) ? "Detected" : "Not detected"); 32 | CON_Print(string); 33 | 34 | while (1) 35 | SWI_VBlankIntrWait(); 36 | } 37 | -------------------------------------------------------------------------------- /examples/sound/gbt_player/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2022 Antonio Niño Díaz 4 | 5 | // Example of playing music with GBT Player: 6 | // 7 | // https://github.com/AntonioND/gbt-player 8 | 9 | #include 10 | 11 | #include "gbt_player.h" 12 | 13 | extern const uint8_t *template[]; 14 | 15 | void vbl_handler(void) 16 | { 17 | gbt_update(); 18 | } 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | UGBA_Init(&argc, &argv); 23 | 24 | IRQ_SetHandler(IRQ_VBLANK, vbl_handler); 25 | IRQ_Enable(IRQ_VBLANK); 26 | 27 | DISP_ModeSet(0); 28 | 29 | CON_InitDefault(); 30 | 31 | CON_Print("GBT Player example"); 32 | 33 | // The sound hardware needs to be enabled to write to any other register. 34 | SOUND_MasterEnable(1); 35 | 36 | gbt_play(template, 0); 37 | 38 | while (1) 39 | SWI_VBlankIntrWait(); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /examples/other/assert_disabled/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Test custom assert macro. 6 | 7 | #include 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | UGBA_Init(&argc, &argv); 12 | 13 | IRQ_Init(); 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(0); 17 | 18 | CON_InitDefault(); 19 | 20 | CON_Print("This goes before the asserts.\n"); 21 | 22 | UGBA_Assert(sizeof(uint32_t) == 4); 23 | 24 | // The following is needed so that the filename is consistent in every 25 | // environment (__FILE__ uses the absolute path if the build system passes 26 | // an absolute path to the compiler). Don't do this in your own code. 27 | #line 25 "main.c" 28 | UGBA_Assert(sizeof(uint32_t) == 10); 29 | 30 | CON_Print("This goes after the asserts.\n"); 31 | 32 | while (1) 33 | SWI_VBlankIntrWait(); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /examples/other/assert_enabled/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Test custom assert macro. 6 | 7 | #include 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | UGBA_Init(&argc, &argv); 12 | 13 | IRQ_Init(); 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(0); 17 | 18 | CON_InitDefault(); 19 | 20 | CON_Print("This goes before the asserts.\n"); 21 | 22 | UGBA_Assert(sizeof(uint32_t) == 4); 23 | 24 | // The following is needed so that the filename is consistent in every 25 | // environment (__FILE__ uses the absolute path if the build system passes 26 | // an absolute path to the compiler). Don't do this in your own code. 27 | #line 25 "main.c" 28 | UGBA_Assert(sizeof(uint32_t) == 10); 29 | 30 | CON_Print("This goes after the asserts.\n"); 31 | 32 | while (1) 33 | SWI_VBlankIntrWait(); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | # Paths to tools 10 | 11 | export SUPERFAMICONV=${PWD}/SuperFamiconv/bin/superfamiconv 12 | export BIN2C=${PWD}/tools/bin2c/build/bin2c 13 | export UMOD_PACKER=${PWD}/umod-player/build/packer/umod_packer 14 | 15 | # Build tools 16 | 17 | if [ ! -d "${BIN2C}" ]; then 18 | pushd tools/bin2c 19 | rm -rf build ; mkdir build ; cd build 20 | cmake .. 21 | make -j`nproc` 22 | popd 23 | fi 24 | 25 | if [ ! -d "${SUPERFAMICONV}" ]; then 26 | pushd SuperFamiconv 27 | make -j`nproc` 28 | popd 29 | fi 30 | 31 | if [ ! -d "${UMOD_PACKER}" ]; then 32 | pushd umod-player 33 | rm -rf build ; mkdir build ; cd build 34 | cmake .. 35 | make -j`nproc` 36 | popd 37 | fi 38 | 39 | # Run child scripts 40 | 41 | (cd examples && bash assets.sh) 42 | 43 | # Done! 44 | 45 | exit 0 46 | -------------------------------------------------------------------------------- /examples/bios/bios_checksum/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that shows how to identify the device type based on the BIOS checksum 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | UGBA_Init(&argc, &argv); 15 | 16 | IRQ_Enable(IRQ_VBLANK); 17 | 18 | DISP_ModeSet(0); 19 | 20 | CON_InitDefault(); 21 | 22 | const char *type = "Unknown"; 23 | 24 | uint32_t sum = SWI_GetBiosChecksum(); 25 | if (sum == SWI_CHECKSUM_GBA) 26 | type = "GBA, GBA SP, GB Micro"; 27 | else if (sum == SWI_CHECKSUM_NDS) 28 | type = "NDS, 3DS in NDS mode"; 29 | 30 | char text[100]; 31 | snprintf(text, sizeof(text), "Checksum: 0x%08" PRIX32 "\nType: %s", 32 | sum, type); 33 | CON_Print(text); 34 | 35 | while (1) 36 | SWI_VBlankIntrWait(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/test-1.lua: -------------------------------------------------------------------------------- 1 | -- Test that resets the saved value, increases it by 10, takes a screenshot and 2 | -- waits for the autosave to save it to disk, increases it by 10 again but 3 | -- crashes the program before autosave has a chance to save it. 4 | 5 | run_frames_and_pause(10) 6 | 7 | keys_hold("START") 8 | run_frames_and_pause(2) 9 | keys_release("START") 10 | run_frames_and_pause(2) 11 | 12 | for i = 1, 10, 1 13 | do 14 | keys_hold("UP") 15 | run_frames_and_pause(2) 16 | keys_release("UP") 17 | run_frames_and_pause(2) 18 | end 19 | 20 | run_frames_and_pause(180) 21 | 22 | screenshot("saved.png") 23 | 24 | for i = 1, 10, 1 25 | do 26 | keys_hold("UP") 27 | run_frames_and_pause(2) 28 | keys_release("UP") 29 | run_frames_and_pause(2) 30 | end 31 | 32 | screenshot("not-saved.png") 33 | 34 | -- Trigger crash/forced exit 35 | keys_hold("SELECT") 36 | 37 | run_frames_and_pause(60) 38 | 39 | -- This shouldn't be reached 40 | exit() 41 | 42 | return 0 43 | -------------------------------------------------------------------------------- /examples/input/input_interrupt/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that shows how to set up the keypad interrupt 6 | 7 | #include 8 | 9 | void keypad_handler_any(void); 10 | 11 | void keypad_handler_all(void) 12 | { 13 | CON_Print("A and B pressed\n"); 14 | 15 | IRQ_SetHandler(IRQ_KEYPAD, keypad_handler_any); 16 | KEYS_IRQEnablePressedAny(KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN); 17 | } 18 | 19 | void keypad_handler_any(void) 20 | { 21 | IRQ_SetHandler(IRQ_KEYPAD, keypad_handler_all); 22 | KEYS_IRQEnablePressedAll(KEY_A | KEY_B); 23 | 24 | CON_Print("Direction pressed\n"); 25 | } 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | UGBA_Init(&argc, &argv); 30 | 31 | IRQ_Enable(IRQ_VBLANK); 32 | IRQ_Enable(IRQ_KEYPAD); 33 | 34 | DISP_ModeSet(0); 35 | 36 | CON_InitDefault(); 37 | 38 | IRQ_SetHandler(IRQ_KEYPAD, keypad_handler_all); 39 | KEYS_IRQEnablePressedAll(KEY_A | KEY_B); 40 | 41 | while (1) 42 | SWI_VBlankIntrWait(); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /licenses/mit.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2015, 2019-2020 Antonio Niño Díaz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /examples/bios/math_sqrt/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that plots y = sqrt(x) scaled to match the screen size. 6 | 7 | #include 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | UGBA_Init(&argc, &argv); 12 | 13 | IRQ_Enable(IRQ_VBLANK); 14 | 15 | DISP_ModeSet(3); 16 | DISP_LayersEnable(0, 0, 1, 0, 0); 17 | 18 | REG_BG2PA = 1 << 8; 19 | REG_BG2PB = 0 << 8; 20 | REG_BG2PC = 0 << 8; 21 | REG_BG2PD = 1 << 8; 22 | 23 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 24 | 25 | uint32_t zero = 0; 26 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 27 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 28 | 29 | uint32_t max_x = GBA_SCREEN_W * 256; 30 | uint32_t max_y = SWI_Sqrt(max_x); 31 | float scale_y = (float)GBA_SCREEN_H / (float)max_y; 32 | 33 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 34 | { 35 | uint16_t y = SWI_Sqrt(x * 256) * scale_y; 36 | 37 | framebuffer[y * GBA_SCREEN_W + x] = RGB15(31, 0, 0); 38 | } 39 | 40 | while (1) 41 | SWI_VBlankIntrWait(); 42 | } 43 | -------------------------------------------------------------------------------- /examples/graphics/text_console/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | UGBA_Init(&argc, &argv); 10 | 11 | IRQ_Enable(IRQ_VBLANK); 12 | 13 | DISP_ModeSet(0); 14 | 15 | CON_InitDefault(); 16 | 17 | CON_Print("This is a text string"); 18 | 19 | CON_CursorSet(10, 10); 20 | CON_Print("At 10, 10"); 21 | 22 | CON_CursorSet(20, 12); 23 | CON_Print("This is a much longer string that wraps around and is\n" 24 | "split into lines\n"); 25 | 26 | while (1) 27 | { 28 | SWI_VBlankIntrWait(); 29 | 30 | KEYS_Update(); 31 | 32 | uint16_t keys = KEYS_Pressed(); 33 | 34 | if (keys & KEY_B) 35 | { 36 | CON_Print("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" 37 | "11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); 38 | } 39 | 40 | if (keys & KEY_A) 41 | { 42 | CON_Print("\n\n\n\n"); 43 | } 44 | 45 | if (keys & KEY_SELECT) 46 | { 47 | CON_CursorSet(28, 19); 48 | CON_Print("@"); 49 | } 50 | } 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /examples/bios/math_arctan2/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that plots angle = arctan2(x, y). It needs to use color to draw it as 6 | // it isn't practical to generate a 3D plot. 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | UGBA_Init(&argc, &argv); 13 | 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(3); 17 | DISP_LayersEnable(0, 0, 1, 0, 0); 18 | 19 | REG_BG2PA = 1 << 8; 20 | REG_BG2PB = 0 << 8; 21 | REG_BG2PC = 0 << 8; 22 | REG_BG2PD = 1 << 8; 23 | 24 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 25 | 26 | uint32_t zero = 0; 27 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 28 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 29 | 30 | for (uint16_t y = 0; y < GBA_SCREEN_H; y++) 31 | { 32 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 33 | { 34 | int16_t xdelta = x - (GBA_SCREEN_W / 2); 35 | int16_t ydelta = y - (GBA_SCREEN_H / 2); 36 | 37 | uint16_t val = SWI_ArcTan2(xdelta, ydelta) >> 1; 38 | 39 | framebuffer[y * GBA_SCREEN_W + x] = val; 40 | } 41 | } 42 | 43 | while (1) 44 | SWI_VBlankIntrWait(); 45 | } 46 | -------------------------------------------------------------------------------- /examples/bios/math_div/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that plots value = x / y. It needs to use color to draw it as it 6 | // isn't practical to generate a 3D plot. 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | UGBA_Init(&argc, &argv); 13 | 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(3); 17 | DISP_LayersEnable(0, 0, 1, 0, 0); 18 | 19 | REG_BG2PA = 1 << 8; 20 | REG_BG2PB = 0 << 8; 21 | REG_BG2PC = 0 << 8; 22 | REG_BG2PD = 1 << 8; 23 | 24 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 25 | 26 | uint32_t zero = 0; 27 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 28 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 29 | 30 | for (uint16_t y = 0; y < GBA_SCREEN_H; y++) 31 | { 32 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 33 | { 34 | int32_t xdelta = x - (GBA_SCREEN_W / 2); 35 | int32_t ydelta = y - (GBA_SCREEN_H / 2); 36 | 37 | if (ydelta == 0) 38 | continue; 39 | 40 | int32_t val = SWI_Div(xdelta << 16, ydelta); 41 | 42 | framebuffer[y * GBA_SCREEN_W + x] = val >> 8; 43 | } 44 | } 45 | 46 | while (1) 47 | SWI_VBlankIntrWait(); 48 | } 49 | -------------------------------------------------------------------------------- /examples/bios/math_divmod/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that plots value = x % y. It needs to use color to draw it as it 6 | // isn't practical to generate a 3D plot. 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | UGBA_Init(&argc, &argv); 13 | 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(3); 17 | DISP_LayersEnable(0, 0, 1, 0, 0); 18 | 19 | REG_BG2PA = 1 << 8; 20 | REG_BG2PB = 0 << 8; 21 | REG_BG2PC = 0 << 8; 22 | REG_BG2PD = 1 << 8; 23 | 24 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 25 | 26 | uint32_t zero = 0; 27 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 28 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 29 | 30 | for (uint16_t y = 0; y < GBA_SCREEN_H; y++) 31 | { 32 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 33 | { 34 | int32_t xdelta = x - (GBA_SCREEN_W / 2); 35 | int32_t ydelta = y - (GBA_SCREEN_H / 2); 36 | 37 | if (ydelta == 0) 38 | continue; 39 | 40 | int32_t val = SWI_DivMod(xdelta, ydelta); 41 | 42 | framebuffer[y * GBA_SCREEN_W + x] = val << 2; 43 | } 44 | } 45 | 46 | while (1) 47 | SWI_VBlankIntrWait(); 48 | } 49 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_16col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 16 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/ball.png \ 35 | --out-data ball_palette.bin \ 36 | --out-image ball_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --in-image ${GRAPHICS}/ball.png \ 44 | --in-palette ball_palette.bin \ 45 | --out-data ball_tiles.bin \ 46 | --verbose 47 | 48 | popd 49 | 50 | # Convert binary files generated by other stages 51 | 52 | for dir in $(find built_assets -type d) 53 | do 54 | for f in $(find $dir -maxdepth 1 -iname *.bin) 55 | do 56 | ${BIN2C} "$f" "$dir" 57 | done 58 | done 59 | 60 | # Done! 61 | 62 | exit 0 63 | -------------------------------------------------------------------------------- /examples/graphics/sprite_lowlevel_256col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 256 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/ball.png \ 35 | --out-data ball_palette.bin \ 36 | --out-image ball_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 8 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --in-image ${GRAPHICS}/ball.png \ 44 | --in-palette ball_palette.bin \ 45 | --out-data ball_tiles.bin \ 46 | --verbose 47 | 48 | popd 49 | 50 | # Convert binary files generated by other stages 51 | 52 | for dir in $(find built_assets -type d) 53 | do 54 | for f in $(find $dir -maxdepth 1 -iname *.bin) 55 | do 56 | ${BIN2C} "$f" "$dir" 57 | done 58 | done 59 | 60 | # Done! 61 | 62 | exit 0 63 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 256 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/ball.png \ 35 | --out-data ball_palette.bin \ 36 | --out-image ball_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 8 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --in-image ${GRAPHICS}/ball.png \ 44 | --in-palette ball_palette.bin \ 45 | --out-data ball_tiles.bin \ 46 | --verbose 47 | 48 | popd 49 | 50 | # Convert binary files generated by other stages 51 | 52 | for dir in $(find built_assets -type d) 53 | do 54 | for f in $(find $dir -maxdepth 1 -iname *.bin) 55 | do 56 | ${BIN2C} "$f" "$dir" 57 | done 58 | done 59 | 60 | # Done! 61 | 62 | exit 0 63 | -------------------------------------------------------------------------------- /examples/input/input_interrupt/test.lua: -------------------------------------------------------------------------------- 1 | -- Press some keys, release keys, repeat... and take screenshot 2 | 3 | -- This isn't enough to trigger the interrupt of A+B 4 | run_frames_and_pause(2) 5 | keys_hold("A") 6 | 7 | run_frames_and_pause(2) 8 | keys_release("A") 9 | 10 | -- This isn't the condition the program is waiting for 11 | run_frames_and_pause(2) 12 | keys_hold("RIGHT") 13 | 14 | run_frames_and_pause(2) 15 | keys_release("RIGHT") 16 | 17 | -- Trigger A+B interrupt 18 | run_frames_and_pause(2) 19 | keys_hold("A", "B") 20 | 21 | run_frames_and_pause(2) 22 | keys_release("A", "B") 23 | 24 | -- Trigger direction pad interrupt 25 | run_frames_and_pause(2) 26 | keys_hold("UP") 27 | 28 | run_frames_and_pause(2) 29 | keys_release("UP") 30 | 31 | -- Trigger A+B interrupt 32 | run_frames_and_pause(2) 33 | keys_hold("A", "B") 34 | 35 | run_frames_and_pause(2) 36 | keys_release("A", "B") 37 | 38 | -- Trigger direction pad interrupt with another button 39 | run_frames_and_pause(2) 40 | keys_hold("RIGHT") 41 | 42 | run_frames_and_pause(2) 43 | keys_release("RIGHT") 44 | 45 | -- Trigger A+B interrupt 46 | run_frames_and_pause(2) 47 | keys_hold("A", "B") 48 | 49 | run_frames_and_pause(2) 50 | keys_release("A", "B") 51 | 52 | -- This button isn't part of the direction pad 53 | run_frames_and_pause(2) 54 | keys_hold("START") 55 | 56 | run_frames_and_pause(2) 57 | keys_release("START") 58 | 59 | run_frames_and_pause(2) 60 | screenshot() 61 | 62 | exit() 63 | 64 | return 0 65 | -------------------------------------------------------------------------------- /examples/other/maths_trig/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | // Example that plots y = sin(x) and y = cos(x) scaled to match the screen size. 6 | 7 | #include 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | UGBA_Init(&argc, &argv); 12 | 13 | IRQ_Enable(IRQ_VBLANK); 14 | 15 | DISP_ModeSet(3); 16 | DISP_LayersEnable(0, 0, 1, 0, 0); 17 | 18 | REG_BG2PA = 1 << 8; 19 | REG_BG2PB = 0 << 8; 20 | REG_BG2PC = 0 << 8; 21 | REG_BG2PD = 1 << 8; 22 | 23 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 24 | 25 | uint32_t zero = 0; 26 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 27 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 28 | 29 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 30 | { 31 | int32_t screen_h_half = GBA_SCREEN_H / 2; 32 | 33 | { 34 | // Draw two full waves 35 | int32_t sine = FP_Sin(x * FP_2_PI * 2 / GBA_SCREEN_W); 36 | int32_t y = screen_h_half - 1 - ((sine * screen_h_half) >> 16); 37 | framebuffer[y * GBA_SCREEN_W + x] = RGB15(31, 0, 0); 38 | } 39 | 40 | { 41 | // Draw two full waves 42 | int32_t cosine = FP_Cos(x * FP_2_PI * 2 / GBA_SCREEN_W); 43 | int32_t y = screen_h_half - 1 - ((cosine * screen_h_half) >> 16); 44 | 45 | framebuffer[y * GBA_SCREEN_W + x] = RGB15(0, 31, 0); 46 | } 47 | } 48 | 49 | while (1) 50 | SWI_VBlankIntrWait(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/dma/hblank_no_during_vblank/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // This shows that the HBL DMA isn't triggered during the VBL period. 6 | 7 | #include 8 | 9 | #include 10 | 11 | // Buffer with enough space for the scanlines of 2 full screen refreshes 12 | // (including VBL period, in case the emulator/library is buggy). 13 | uint16_t dst_buffer[230 * 2]; 14 | 15 | #define PTR_REG_VCOUNT ((const uint16_t *)PTR_REG_16(OFFSET_VCOUNT)) 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | UGBA_Init(&argc, &argv); 20 | 21 | // Enable interrupts. This is needed for SWI_VBlankIntrWait() to work. 22 | IRQ_Enable(IRQ_VBLANK); 23 | 24 | SWI_VBlankIntrWait(); 25 | 26 | DMA_Transfer(0, PTR_REG_VCOUNT, &(dst_buffer[0]), 2, 27 | DMACNT_DST_INCREMENT | DMACNT_SRC_FIXED | 28 | DMACNT_TRANSFER_16_BITS | DMACNT_START_HBLANK | 29 | DMACNT_REPEAT_ON); 30 | 31 | SWI_VBlankIntrWait(); 32 | 33 | SWI_VBlankIntrWait(); 34 | 35 | DMA_Stop(0); 36 | 37 | DISP_ModeSet(0); 38 | 39 | CON_InitDefault(); 40 | 41 | for (int i = 0; i < 18; i++) 42 | { 43 | char str[10]; 44 | snprintf(str, sizeof(str), "%3d ", dst_buffer[i]); 45 | CON_Print(str); 46 | } 47 | 48 | CON_Print("\n...\n\n"); 49 | 50 | for (int i = 150 ; i < 230; i++) 51 | { 52 | char str[10]; 53 | snprintf(str, sizeof(str), "%3d ", dst_buffer[i]); 54 | CON_Print(str); 55 | } 56 | 57 | while (1) 58 | SWI_VBlankIntrWait(); 59 | } 60 | -------------------------------------------------------------------------------- /examples/other/save_sram/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Example of how to save data in SRAM. This example lets you modify the first 6 | // byte of SRAM, and it displays its value on the screen. If you close the 7 | // example and reopen it, it will still hold the value it had when the example 8 | // was closed. 9 | 10 | #include 11 | 12 | #include 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | UGBA_Init(&argc, &argv); 17 | 18 | IRQ_Enable(IRQ_VBLANK); 19 | 20 | DISP_ModeSet(0); 21 | 22 | CON_InitDefault(); 23 | 24 | CON_Print("Saved value: 0x"); 25 | uint8_t *sram = MEM_SRAM; 26 | 27 | while (1) 28 | { 29 | char str[10]; 30 | snprintf(str, sizeof(str), "%02X", sram[0]); 31 | CON_CursorSet(15, 0); 32 | CON_Print(str); 33 | 34 | KEYS_Update(); 35 | 36 | uint16_t keys_pressed = KEYS_Pressed(); 37 | 38 | if (keys_pressed & KEY_UP) 39 | { 40 | uint8_t value; 41 | SRAM_Read(&value, sram, sizeof(uint8_t)); 42 | value++; 43 | SRAM_Write(sram, &value, sizeof(uint8_t)); 44 | } 45 | if (keys_pressed & KEY_DOWN) 46 | { 47 | uint8_t value; 48 | SRAM_Read(&value, sram, sizeof(uint8_t)); 49 | value--; 50 | SRAM_Write(sram, &value, sizeof(uint8_t)); 51 | } 52 | 53 | if (keys_pressed & KEY_START) 54 | { 55 | uint8_t value = 0; 56 | SRAM_Write(sram, &value, sizeof(uint8_t)); 57 | } 58 | 59 | SWI_VBlankIntrWait(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/bios/math_arctan/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that plots y = arctan(x) scaled to match the screen size. The usable 6 | // part of the function is inside the green vertical lines. 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | UGBA_Init(&argc, &argv); 13 | 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(3); 17 | DISP_LayersEnable(0, 0, 1, 0, 0); 18 | 19 | REG_BG2PA = 1 << 8; 20 | REG_BG2PB = 0 << 8; 21 | REG_BG2PC = 0 << 8; 22 | REG_BG2PD = 1 << 8; 23 | 24 | uint16_t *framebuffer = BG_Mode3FramebufferGet(); 25 | 26 | uint32_t zero = 0; 27 | size_t size = GBA_SCREEN_W * GBA_SCREEN_H * sizeof(uint16_t); 28 | SWI_CpuFastSet_Fill32(&zero, framebuffer, size); 29 | 30 | for (uint16_t y = 0; y < GBA_SCREEN_H; y++) 31 | { 32 | uint16_t division = GBA_SCREEN_W / (3 * 2); 33 | 34 | framebuffer[y * GBA_SCREEN_W + division * 2] = RGB15(0, 31, 0); 35 | framebuffer[y * GBA_SCREEN_W + division * 4] = RGB15(0, 31, 0); 36 | } 37 | 38 | for (uint16_t x = 0; x < GBA_SCREEN_W; x++) 39 | { 40 | int16_t tan = x - (GBA_SCREEN_W / 2); 41 | tan = (tan << 14) / (GBA_SCREEN_W / 2); 42 | tan *= 3; // This makes it so that the graph shows out-of-bounds values 43 | uint16_t y = (GBA_SCREEN_H / 2) + (SWI_ArcTan(tan) >> 7); 44 | 45 | // Skip if out of bounds 46 | if (y >= GBA_SCREEN_H) 47 | continue; 48 | 49 | framebuffer[y * GBA_SCREEN_W + x] = RGB15(31, 0, 0); 50 | } 51 | 52 | while (1) 53 | SWI_VBlankIntrWait(); 54 | } 55 | -------------------------------------------------------------------------------- /examples/input/simple_input/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that prints on the screen the keys that are pressed or released by 6 | // the user. 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | UGBA_Init(&argc, &argv); 13 | 14 | IRQ_Enable(IRQ_VBLANK); 15 | 16 | DISP_ModeSet(0); 17 | 18 | CON_InitDefault(); 19 | 20 | while (1) 21 | { 22 | SWI_VBlankIntrWait(); 23 | 24 | KEYS_Update(); 25 | 26 | uint16_t keys_pressed = KEYS_Pressed(); 27 | uint16_t keys_released = KEYS_Released(); 28 | 29 | struct { 30 | const char *name; 31 | uint16_t mask; 32 | } keyinfo[10] = { 33 | { "A", KEY_A }, 34 | { "B", KEY_B }, 35 | { "SELECT", KEY_SELECT }, 36 | { "START", KEY_START }, 37 | { "RIGHT", KEY_RIGHT }, 38 | { "LEFT", KEY_LEFT }, 39 | { "UP", KEY_UP }, 40 | { "DOWN", KEY_DOWN }, 41 | { "R", KEY_R }, 42 | { "L", KEY_L }, 43 | }; 44 | 45 | for (int i = 0; i < 10; i++) 46 | { 47 | if (keys_pressed & keyinfo[i].mask) 48 | { 49 | CON_Print("\n"); 50 | CON_Print(keyinfo[i].name); 51 | CON_Print(" pressed"); 52 | } 53 | if (keys_released & keyinfo[i].mask) 54 | { 55 | CON_Print("\n"); 56 | CON_Print(keyinfo[i].name); 57 | CON_Print(" released"); 58 | } 59 | } 60 | } 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /examples/other/version_check/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that shows how to check if the version of the shared library is 6 | // compatible with the one that the program was built against. 7 | 8 | #include 9 | 10 | #include 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | UGBA_Init(&argc, &argv); 15 | 16 | IRQ_Enable(IRQ_VBLANK); 17 | 18 | DISP_ModeSet(0); 19 | 20 | CON_InitDefault(); 21 | 22 | // Normally this would go at the beginning of the program, before 23 | // UGBA_Init() 24 | 25 | if (UGBA_VersionIsCompatible(LIBUGBA_VERSION)) 26 | CON_Print("Success\n"); 27 | else 28 | CON_Print("Failed\n"); 29 | 30 | // Different patch version: Should succeed 31 | if (UGBA_VersionIsCompatible(LIBUGBA_VERSION + (1 << 0))) 32 | CON_Print("Success\n"); 33 | else 34 | CON_Print("Failed\n"); 35 | 36 | // Different minor version (lower than the library): Should succeed 37 | if (UGBA_VersionIsCompatible(LIBUGBA_VERSION - (1 << 8))) 38 | CON_Print("Success\n"); 39 | else 40 | CON_Print("Failed\n"); 41 | 42 | // Different minor version (higher than the library): Should fail 43 | if (UGBA_VersionIsCompatible(LIBUGBA_VERSION + (1 << 8))) 44 | CON_Print("Failed\n"); 45 | else 46 | CON_Print("Success\n"); 47 | 48 | // Different major version: Should fail 49 | if (UGBA_VersionIsCompatible(LIBUGBA_VERSION + (1 << 16))) 50 | CON_Print("Failed\n"); 51 | else 52 | CON_Print("Success\n"); 53 | 54 | while (1) 55 | SWI_VBlankIntrWait(); 56 | } 57 | 58 | -------------------------------------------------------------------------------- /unittests/cmake/unittest.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | function(define_unittest) 6 | 7 | # Get name of the folder we are in 8 | # -------------------------------- 9 | 10 | get_filename_component(EXECUTABLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 11 | 12 | # Define toolchain 13 | # ---------------- 14 | 15 | ugba_toolchain_sdl2() 16 | 17 | # Define executable name 18 | # ---------------------- 19 | 20 | add_executable(${EXECUTABLE_NAME}) 21 | 22 | # Set compiler and linker options 23 | # ------------------------------- 24 | 25 | compiler_flags_sdl2(${EXECUTABLE_NAME}) 26 | linker_flags_sdl2(${EXECUTABLE_NAME}) 27 | 28 | # Link with libugba and other system libraries 29 | # -------------------------------------------- 30 | 31 | target_link_libraries(${EXECUTABLE_NAME} libugba) 32 | 33 | if(NOT WIN32) 34 | target_link_libraries(${EXECUTABLE_NAME} -lm) 35 | endif() 36 | 37 | # Add source code files 38 | # --------------------- 39 | 40 | # Macro that searches all the source files in the specified directory in 41 | # 'dir' and saves them in 'var' 42 | macro(search_source_files dir var) 43 | file(GLOB ${var} CONFIGURE_DEPENDS ${dir}/*.c ${dir}/*.h) 44 | endmacro() 45 | 46 | search_source_files(source FILES_SOURCE) 47 | 48 | target_sources(${EXECUTABLE_NAME} PRIVATE ${FILES_SOURCE}) 49 | 50 | # Define CMake test 51 | # ----------------- 52 | 53 | add_test(NAME ${EXECUTABLE_NAME}_unittest 54 | COMMAND ${EXECUTABLE_NAME} 55 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 56 | ) 57 | 58 | endfunction() 59 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_256col/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | // Example of how to load 256-color sprites 6 | 7 | #include 8 | 9 | #include "graphics/ball_palette_bin.h" // Autogenerated from ball.png 10 | #include "graphics/ball_tiles_bin.h" 11 | 12 | // This defines the tile index where the data of the ball is loaded in tile VRAM 13 | #define BALL_TILES_BASE (16) 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | UGBA_Init(&argc, &argv); 18 | 19 | // Enable interrupts. This is needed for SWI_VBlankIntrWait() to work. 20 | IRQ_Enable(IRQ_VBLANK); 21 | 22 | // Set object attributes 23 | // --------------------- 24 | 25 | OBJ_RegularInit(0, 32, 32, OBJ_SIZE_32x32, 26 | OBJ_256_COLORS, 0, BALL_TILES_BASE); 27 | 28 | // Load the palettes 29 | // ----------------- 30 | 31 | VRAM_OBJPalette256Copy(ball_palette_bin, ball_palette_bin_size); 32 | 33 | // Load the tiles 34 | // -------------- 35 | 36 | VRAM_OBJTiles256Copy(ball_tiles_bin, ball_tiles_bin_size, BALL_TILES_BASE); 37 | 38 | // Turn on the screen 39 | // ------------------ 40 | 41 | // The mode doesn't matter here, it only affects the backgrounds. This is 42 | // just an arbitrary value. 43 | DISP_ModeSet(0); 44 | 45 | // Turn on the rendering of sprites. 46 | DISP_LayersEnable(0, 0, 0, 0, 1); 47 | 48 | // Enable 1D mapping. Check "8.2.1. The sprite mapping mode" in the 49 | // following link for more information: 50 | // https://www.coranac.com/tonc/text/regobj.htm#sec-tiles 51 | DISP_Object1DMappingEnable(1); 52 | 53 | while (1) 54 | SWI_VBlankIntrWait(); 55 | } 56 | -------------------------------------------------------------------------------- /examples/dma/hblank_dma_repeat/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 10 \ 32 | --colors 16 \ 33 | --color-zero FF00FF \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 512 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba \ 52 | --bpp 4 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 64 --map-height 64 \ 57 | --split-width 64 --split-height 64 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/dma/vblank_dma_repeat/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 10 \ 32 | --colors 16 \ 33 | --color-zero FF00FF \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 512 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba \ 52 | --bpp 4 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 64 --map-height 64 \ 57 | --split-width 64 --split-height 64 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/graphics/background_window/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 10 \ 32 | --colors 16 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 512 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba \ 52 | --bpp 4 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 64 --map-height 64 \ 57 | --split-width 64 --split-height 64 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_irq_handler/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 10 \ 32 | --colors 16 \ 33 | --color-zero FF00FF \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 512 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba \ 52 | --bpp 4 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 64 --map-height 64 \ 57 | --split-width 64 --split-height 64 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/graphics/background_affine/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 256 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 8 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 256 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba_affine \ 52 | --bpp 8 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 32 --map-height 32 \ 57 | --split-width 32 --split-height 32 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/graphics/background_regular_16col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 10 \ 32 | --colors 16 \ 33 | --color-zero FF00FF \ 34 | --in-image ${GRAPHICS}/city.png \ 35 | --out-data city_palette.bin \ 36 | --out-image city_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --max-tiles 512 \ 44 | --in-image ${GRAPHICS}/city.png \ 45 | --in-palette city_palette.bin \ 46 | --out-data city_tiles.bin \ 47 | --no-flip \ 48 | --verbose 49 | 50 | ${SUPERFAMICONV} map \ 51 | --mode gba \ 52 | --bpp 4 \ 53 | --tile-width 8 --tile-height 8 \ 54 | --tile-base-offset 0 \ 55 | --palette-base-offset 0 \ 56 | --map-width 64 --map-height 64 \ 57 | --split-width 64 --split-height 64 \ 58 | --in-image ${GRAPHICS}/city.png \ 59 | --in-palette city_palette.bin \ 60 | --in-tiles city_tiles.bin \ 61 | --out-data city_map.bin \ 62 | --no-flip \ 63 | --verbose 64 | 65 | popd 66 | 67 | # Convert binary files generated by other stages 68 | 69 | for dir in $(find built_assets -type d) 70 | do 71 | for f in $(find $dir -maxdepth 1 -iname *.bin) 72 | do 73 | ${BIN2C} "$f" "$dir" 74 | done 75 | done 76 | 77 | # Done! 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /examples/graphics/sprite_affine_16col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 16 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/ball_red.png \ 35 | --out-data ball_red_palette.bin \ 36 | --out-image ball_red_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --in-image ${GRAPHICS}/ball_red.png \ 44 | --in-palette ball_red_palette.bin \ 45 | --out-data ball_red_tiles.bin \ 46 | --verbose 47 | 48 | ${SUPERFAMICONV} palette \ 49 | --mode gba \ 50 | --palettes 1 \ 51 | --colors 16 \ 52 | --color-zero 000000 \ 53 | --in-image ${GRAPHICS}/ball_green.png \ 54 | --out-data ball_green_palette.bin \ 55 | --out-image ball_green_palette.png \ 56 | --verbose 57 | 58 | ${SUPERFAMICONV} tiles \ 59 | --mode gba \ 60 | --bpp 4 \ 61 | --tile-width 8 --tile-height 8 \ 62 | --in-image ${GRAPHICS}/ball_green.png \ 63 | --in-palette ball_green_palette.bin \ 64 | --out-data ball_green_tiles.bin \ 65 | --verbose 66 | 67 | popd 68 | 69 | # Convert binary files generated by other stages 70 | 71 | for dir in $(find built_assets -type d) 72 | do 73 | for f in $(find $dir -maxdepth 1 -iname *.bin) 74 | do 75 | ${BIN2C} "$f" "$dir" 76 | done 77 | done 78 | 79 | # Done! 80 | 81 | exit 0 82 | -------------------------------------------------------------------------------- /examples/graphics/sprite_regular_16col/assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-only 4 | # 5 | # Copyright (c) 2021-2022, Antonio Niño Díaz 6 | 7 | set -e 8 | 9 | SCRIPT=`realpath $0` 10 | IN=`dirname $SCRIPT` 11 | 12 | echo "" 13 | echo "[*] Converting ${IN}..." 14 | echo "" 15 | 16 | # Prepare destination folder 17 | 18 | OUT_DIR=built_assets 19 | rm -rf ${OUT_DIR} 20 | mkdir ${OUT_DIR} 21 | 22 | GRAPHICS="${PWD}/graphics" 23 | 24 | # Convert graphics 25 | 26 | mkdir ${OUT_DIR}/graphics 27 | pushd ${OUT_DIR}/graphics 28 | 29 | ${SUPERFAMICONV} palette \ 30 | --mode gba \ 31 | --palettes 1 \ 32 | --colors 16 \ 33 | --color-zero 000000 \ 34 | --in-image ${GRAPHICS}/ball_red.png \ 35 | --out-data ball_red_palette.bin \ 36 | --out-image ball_red_palette.png \ 37 | --verbose 38 | 39 | ${SUPERFAMICONV} tiles \ 40 | --mode gba \ 41 | --bpp 4 \ 42 | --tile-width 8 --tile-height 8 \ 43 | --in-image ${GRAPHICS}/ball_red.png \ 44 | --in-palette ball_red_palette.bin \ 45 | --out-data ball_red_tiles.bin \ 46 | --verbose 47 | 48 | ${SUPERFAMICONV} palette \ 49 | --mode gba \ 50 | --palettes 1 \ 51 | --colors 16 \ 52 | --color-zero 000000 \ 53 | --in-image ${GRAPHICS}/ball_green.png \ 54 | --out-data ball_green_palette.bin \ 55 | --out-image ball_green_palette.png \ 56 | --verbose 57 | 58 | ${SUPERFAMICONV} tiles \ 59 | --mode gba \ 60 | --bpp 4 \ 61 | --tile-width 8 --tile-height 8 \ 62 | --in-image ${GRAPHICS}/ball_green.png \ 63 | --in-palette ball_green_palette.bin \ 64 | --out-data ball_green_tiles.bin \ 65 | --verbose 66 | 67 | popd 68 | 69 | # Convert binary files generated by other stages 70 | 71 | for dir in $(find built_assets -type d) 72 | do 73 | for f in $(find $dir -maxdepth 1 -iname *.bin) 74 | do 75 | ${BIN2C} "$f" "$dir" 76 | done 77 | done 78 | 79 | # Done! 80 | 81 | exit 0 82 | -------------------------------------------------------------------------------- /examples/interrupts/hblank_vcount_lines/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Example that makes sure that the HBL and VCOUNT interrupts happen in every 6 | // scanline, even the VBL scanlines. 7 | 8 | #include 9 | 10 | #include 11 | 12 | struct { 13 | int hbl_flag; 14 | int vcount_flag; 15 | } line_info[256]; 16 | 17 | void hbl_handler(void) 18 | { 19 | line_info[REG_VCOUNT].hbl_flag = 1; 20 | } 21 | 22 | void vcount_handler(void) 23 | { 24 | uint16_t vcount = REG_VCOUNT; 25 | 26 | line_info[vcount].vcount_flag = 1; 27 | 28 | if (vcount == 227) 29 | IRQ_SetReferenceVCOUNT(0); 30 | else 31 | IRQ_SetReferenceVCOUNT(vcount + 1); 32 | } 33 | 34 | int main(int argc, char *argv[]) 35 | { 36 | UGBA_Init(&argc, &argv); 37 | 38 | // Enable interrupts 39 | IRQ_SetHandler(IRQ_HBLANK, hbl_handler); 40 | IRQ_SetHandler(IRQ_VCOUNT, vcount_handler); 41 | IRQ_Enable(IRQ_VBLANK); 42 | IRQ_Enable(IRQ_HBLANK); 43 | IRQ_Enable(IRQ_VCOUNT); 44 | 45 | SWI_VBlankIntrWait(); 46 | SWI_VBlankIntrWait(); 47 | SWI_VBlankIntrWait(); 48 | 49 | IRQ_Disable(IRQ_HBLANK); 50 | IRQ_Disable(IRQ_VCOUNT); 51 | 52 | // Set the display to mode 0 so that all backgrounds are in regular mode, 53 | // and turn on background 0. 54 | DISP_ModeSet(0); 55 | DISP_LayersEnable(1, 0, 0, 0, 0); 56 | 57 | CON_InitDefault(); 58 | 59 | for (int i = 0; i < 256; i++) 60 | { 61 | char text[10]; 62 | snprintf(text, sizeof(text), "%d", line_info[i].hbl_flag); 63 | CON_Print(text); 64 | } 65 | CON_Print("\n"); 66 | 67 | for (int i = 0; i < 256; i++) 68 | { 69 | char text[10]; 70 | snprintf(text, sizeof(text), "%d", line_info[i].vcount_flag); 71 | CON_Print(text); 72 | } 73 | CON_Print("\n"); 74 | 75 | while (1) 76 | { 77 | SWI_VBlankIntrWait(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /examples/graphics/mode3_framebuffer/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example of how to use the framebuffer in video mode 3. 6 | 7 | #include 8 | 9 | void update_affine_matrix(int x, int y, int angle) 10 | { 11 | bg_affine_src bg_src_start = { 12 | x << 8, y << 8, 13 | 0, 0, 14 | 1 << 8, 1 << 8, 15 | angle << 8 16 | }; 17 | 18 | bg_affine_dst bg_dst; 19 | 20 | SWI_BgAffineSet(&bg_src_start, &bg_dst, 1); 21 | 22 | BG_AffineTransformSet(2, &bg_dst); 23 | } 24 | 25 | int main(int argc, char *argv[]) 26 | { 27 | UGBA_Init(&argc, &argv); 28 | 29 | IRQ_Enable(IRQ_VBLANK); 30 | 31 | DISP_ModeSet(3); 32 | DISP_LayersEnable(0, 0, 1, 0, 0); 33 | 34 | uint16_t *vram = BG_Mode3FramebufferGet(); 35 | 36 | for (int j = 0; j < GBA_SCREEN_H; j++) 37 | { 38 | for (int i = 0; i < GBA_SCREEN_W; i++) 39 | { 40 | uint16_t r = i & 0x1F; 41 | uint16_t g = j & 0x1F; 42 | uint16_t b = (i + j) & 0x1F; 43 | 44 | uint16_t color = RGB15(r, g, b); 45 | 46 | vram[240 * j + i] = color; 47 | } 48 | } 49 | 50 | int x = 0, y = 0; 51 | int angle = 0; 52 | 53 | update_affine_matrix(x, y, angle); 54 | 55 | while (1) 56 | { 57 | SWI_VBlankIntrWait(); 58 | 59 | KEYS_Update(); 60 | 61 | uint16_t keys = KEYS_Held(); 62 | 63 | if (keys & KEY_UP) 64 | y++; 65 | else if (keys & KEY_DOWN) 66 | y--; 67 | 68 | if (keys & KEY_RIGHT) 69 | x--; 70 | else if (keys & KEY_LEFT) 71 | x++; 72 | 73 | if (keys & KEY_L) 74 | angle++; 75 | else if (keys & KEY_R) 76 | angle--; 77 | 78 | if (keys & KEY_START) 79 | { 80 | angle = 30; 81 | x = 30; 82 | y = 30; 83 | } 84 | 85 | update_affine_matrix(x, y, angle); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /examples/dma/basic_dma/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Test that checks that different copy functions work, including DMA and BIOS. 6 | 7 | #include 8 | 9 | #include 10 | 11 | // File generated with: 12 | // head -c 16K random.bin 13 | 14 | #include "data/random_bin.h" 15 | 16 | // 16 K buffer aligned to at least 32 bit (for DMA copies) 17 | static uint64_t buffer[(16 * 1024) / sizeof(uint64_t)]; 18 | 19 | static void verify_copy(void) 20 | { 21 | if (memcmp(&(buffer[0]), &(random_bin[0]), random_bin_size) == 0) 22 | CON_Print("passed\n"); 23 | else 24 | CON_Print("failed\n"); 25 | 26 | memset(&(buffer[0]), 0, random_bin_size); 27 | } 28 | 29 | int main(int argc, char *argv[]) 30 | { 31 | int ret; 32 | 33 | UGBA_Init(&argc, &argv); 34 | 35 | IRQ_Enable(IRQ_VBLANK); 36 | 37 | DISP_ModeSet(0); 38 | 39 | CON_InitDefault(); 40 | 41 | CON_Print("memcpy(): "); 42 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 43 | verify_copy(); 44 | 45 | CON_Print("SWI_CpuSet_Copy16(): "); 46 | SWI_CpuSet_Copy16(&(random_bin[0]), &(buffer[0]), random_bin_size); 47 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 48 | verify_copy(); 49 | 50 | CON_Print("SWI_CpuSet_Copy32(): "); 51 | SWI_CpuSet_Copy32(&(random_bin[0]), &(buffer[0]), random_bin_size); 52 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 53 | verify_copy(); 54 | 55 | CON_Print("DMA_Copy16(3): "); 56 | ret = DMA_Copy16(3, &(random_bin[0]), &(buffer[0]), random_bin_size); 57 | if (ret != 0) 58 | CON_Print("[***] "); 59 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 60 | verify_copy(); 61 | 62 | CON_Print("DMA_Copy32(3): "); 63 | ret = DMA_Copy16(3, &(random_bin[0]), &(buffer[0]), random_bin_size); 64 | if (ret != 0) 65 | CON_Print("[***] "); 66 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 67 | verify_copy(); 68 | 69 | while (1) 70 | SWI_VBlankIntrWait(); 71 | 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /examples/dma/invalid_dma/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Test that checks that invalid copies from ROM trigger an error message. 6 | 7 | #include 8 | 9 | #include 10 | 11 | #ifdef __GBA__ 12 | 13 | // File generated with: 14 | // head -c 16K random.bin 15 | 16 | #include "data/random_bin.h" 17 | 18 | // 16 K buffer aligned to at least 32 bit (for DMA copies) 19 | static uint64_t buffer[(16 * 1024) / sizeof(uint64_t)]; 20 | 21 | static void verify_copy(void) 22 | { 23 | if (memcmp(&(buffer[0]), &(random_bin[0]), random_bin_size) == 0) 24 | CON_Print("passed\n"); 25 | else 26 | CON_Print("failed\n"); 27 | 28 | memset(&(buffer[0]), 0, random_bin_size); 29 | } 30 | 31 | #endif // __GBA__ 32 | 33 | int main(int argc, char *argv[]) 34 | { 35 | UGBA_Init(&argc, &argv); 36 | 37 | IRQ_Enable(IRQ_VBLANK); 38 | 39 | DISP_ModeSet(0); 40 | 41 | CON_InitDefault(); 42 | 43 | #ifdef __GBA__ 44 | int ret; 45 | 46 | // The following tests should fail as only DMA3 can read the ROM. However, 47 | // the tests will pass on PC because it has no notion of ROM/EWRAM/IWRAM. 48 | 49 | CON_Print("DMA_Copy32(0): "); 50 | ret = DMA_Copy16(0, &(random_bin[0]), &(buffer[0]), random_bin_size); 51 | if (ret == 0) 52 | CON_Print("[***] "); 53 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 54 | verify_copy(); 55 | 56 | CON_Print("DMA_Copy32(1): "); 57 | ret = DMA_Copy16(1, &(random_bin[0]), &(buffer[0]), random_bin_size); 58 | if (ret == 0) 59 | CON_Print("[***] "); 60 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 61 | verify_copy(); 62 | 63 | CON_Print("DMA_Copy32(2): "); 64 | ret = DMA_Copy16(2, &(random_bin[0]), &(buffer[0]), random_bin_size); 65 | if (ret == 0) 66 | CON_Print("[***] "); 67 | memcpy(&(buffer[0]), &(random_bin[0]), random_bin_size); 68 | verify_copy(); 69 | 70 | #else 71 | 72 | CON_Print("Test skipped"); 73 | 74 | #endif // __GBA__ 75 | 76 | while (1) 77 | SWI_VBlankIntrWait(); 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /examples/input/all_input/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | // Example that shows the behaviour of different key states. It is slowed down 6 | // to 1/10 of the regular refresh rate so that the "pressed" and "released" 7 | // states can be seen (if not they would only last for 1/60 of a second!). 8 | 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | UGBA_Init(&argc, &argv); 14 | 15 | IRQ_Enable(IRQ_VBLANK); 16 | 17 | DISP_ModeSet(0); 18 | 19 | CON_InitDefault(); 20 | 21 | int frame = 0; 22 | 23 | while (1) 24 | { 25 | SWI_VBlankIntrWait(); 26 | 27 | // Sample state of keys once every 10 frames so that the effects on the 28 | // screen are slowed down enough for the user to see. 29 | 30 | if (frame == 0) 31 | KEYS_Update(); 32 | 33 | frame++; 34 | if (frame == 10) 35 | frame = 0; 36 | 37 | uint16_t keys_pressed = KEYS_Pressed(); 38 | uint16_t keys_held = KEYS_Held(); 39 | uint16_t keys_released = KEYS_Released(); 40 | 41 | struct { 42 | const char *name; 43 | uint16_t mask; 44 | } keyinfo[10] = { 45 | { "A", KEY_A }, 46 | { "B", KEY_B }, 47 | { "SELECT", KEY_SELECT }, 48 | { "START", KEY_START }, 49 | { "RIGHT", KEY_RIGHT }, 50 | { "LEFT", KEY_LEFT }, 51 | { "UP", KEY_UP }, 52 | { "DOWN", KEY_DOWN }, 53 | { "R", KEY_R }, 54 | { "L", KEY_L }, 55 | }; 56 | 57 | for (int i = 0; i < 10; i++) 58 | { 59 | CON_CursorSet(0, i); 60 | CON_Print(keyinfo[i].name); 61 | 62 | CON_CursorSet(10, i); 63 | if (keys_pressed & keyinfo[i].mask) 64 | CON_Print("P"); 65 | else 66 | CON_Print(" "); 67 | 68 | if (keys_held & keyinfo[i].mask) 69 | CON_Print("H"); 70 | else 71 | CON_Print(" "); 72 | 73 | if (keys_released & keyinfo[i].mask) 74 | CON_Print("R"); 75 | else 76 | CON_Print(" "); 77 | } 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /unittests/sram/sram_autosave/source/main.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2021 Antonio Niño Díaz 4 | 5 | // Example code that saves data to SRAM to test the autosave feature. This test 6 | // is only built for SDL2, not for GBA, as it doesn't make sense to test the 7 | // behaviour of autosave on the GBA. On SDL2 there is a delay of N seconds 8 | // between each autosave, so it is possible to test how it behaves. On the GBA 9 | // values are saved right away after they are written. 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | UGBA_Init(&argc, &argv); 19 | 20 | IRQ_Enable(IRQ_VBLANK); 21 | 22 | DISP_ModeSet(0); 23 | 24 | CON_InitDefault(); 25 | 26 | CON_Print("Saved value: 0x"); 27 | uint8_t *sram = MEM_SRAM; 28 | 29 | while (1) 30 | { 31 | char str[10]; 32 | snprintf(str, sizeof(str), "%02X", sram[0]); 33 | CON_CursorSet(15, 0); 34 | CON_Print(str); 35 | 36 | KEYS_Update(); 37 | 38 | uint16_t keys_pressed = KEYS_Pressed(); 39 | 40 | if (keys_pressed & KEY_UP) 41 | { 42 | uint8_t value; 43 | SRAM_Read(&value, sram, sizeof(uint8_t)); 44 | value++; 45 | SRAM_Write(sram, &value, sizeof(uint8_t)); 46 | } 47 | if (keys_pressed & KEY_DOWN) 48 | { 49 | uint8_t value; 50 | SRAM_Read(&value, sram, sizeof(uint8_t)); 51 | value--; 52 | SRAM_Write(sram, &value, sizeof(uint8_t)); 53 | } 54 | 55 | if (keys_pressed & KEY_START) 56 | { 57 | uint8_t value = 0; 58 | SRAM_Write(sram, &value, sizeof(uint8_t)); 59 | } 60 | 61 | // Normally, when the SDL2 builds exit (with exit() or by pressing ESC) 62 | // the contents of SRAM are saved. During the initialization of the 63 | // library, atexit() is called with a function that saves the contents 64 | // of SRAM to the saved file. 65 | // 66 | // _Exit() skips all the functions that should be called because of 67 | // atexit(). This means that exiting with _Exit() simulates a crash in 68 | // the program that would prevent saving normally. 69 | if (keys_pressed & KEY_SELECT) 70 | _Exit(0); 71 | 72 | SWI_VBlankIntrWait(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /examples/sound/umod/licenses/mod-archive-faq.txt: -------------------------------------------------------------------------------- 1 | Original site: https://modarchive.org/index.php?faq-licensing 2 | 3 | =============================================================================== 4 | 5 | Licensing Modules and Copyright 6 | 7 | - Who owns the copyrights to the modules? 8 | 9 | The composers do - unless the Public Domain license attribution has been 10 | specifically attributed in which case you are free to do with the module 11 | whatever you like. 12 | 13 | - Can I use a module of modarchive.org in my game/application/etc...? 14 | 15 | If the module in question has license deeds attributed to it, please refer to 16 | those. 17 | 18 | Otherwise, the only way to be genuinely fair to the artist who's music you want 19 | to use is to contact them and get their permission. We can't grant permissions 20 | on their behalf. Period. 21 | 22 | - Can I redistribute the module in its original unmodified form? 23 | 24 | Yes. All uploads to the site are governed by an upload agreement of which one of 25 | the terms is the right to redistribute the original unmodified module file. This 26 | does not cover inclusion in a packed/bundled application or game. See previous 27 | item. 28 | 29 | - The contact information isn't in the module, what can I do to contact the 30 | artist? 31 | 32 | You can try using the modarchive.org forums, specifically the Wanted: forum. 33 | Search the Internet, do some homework. If you fail to find the necessary 34 | information then you are pretty much out of luck. 35 | 36 | - I can't get in contact with an artist who's music I want to use, what now? 37 | 38 | It's up to you how you proceed. We will not condone illegal use of someone's 39 | works, but if you still wish to continue to use that particular piece of music 40 | in your project, then you take on those risks yourself. 41 | 42 | If your project is small and free (non commercial) then it's wise to give clear 43 | and concise due credit to the artist in your production. If your production is 44 | for commercial purposes then you are technically left with no other choice than 45 | to find a different module where the artist has attributed a compatible license, 46 | or is contactable - or go out on a limb and ask to have someone compose a custom 47 | module for your project. 48 | 49 | - Where can I find the license attribution information on a module? 50 | 51 | Look on a module's information page, there is a section dedicated to the License 52 | Attribution information. 53 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # Copyright (c) 2020-2022 Antonio Niño Díaz 4 | 5 | cmake_minimum_required(VERSION 3.15) 6 | project(ugba) 7 | enable_language(CXX C ASM) 8 | 9 | set(CMAKE_C_STANDARD 11) 10 | set(CMAKE_C_EXTENSIONS OFF) 11 | set(CMAKE_C_STANDARD_REQUIRED ON) 12 | 13 | # Detect if this project is a submodule 14 | # ------------------------------------- 15 | 16 | get_directory_property(PROJECT_HAS_PARENT PARENT_DIRECTORY) 17 | set(PROJECT_IS_SUBMODULE ${PROJECT_HAS_PARENT}) 18 | 19 | # Build options 20 | # ------------- 21 | 22 | option(USE_DEVKITARM "Use devkitARM to build GBA binaries" ON) 23 | 24 | # Add libugba submodule 25 | # --------------------- 26 | 27 | set(LUA_INTERPRETER_ENABLED ON CACHE BOOL "") 28 | add_subdirectory(libugba) 29 | 30 | # Look for an ARM toolchain 31 | # ------------------------- 32 | 33 | if(NOT "${BUILD_GBA}" STREQUAL OFF) 34 | if("${ARM_GCC_PATH}" STREQUAL "") 35 | message(STATUS "ugba-testing: GBA toolchain not specified") 36 | ugba_search_toolchain_gba(BUILD_GBA) 37 | else() 38 | message(STATUS "ugba-testing: GBA toolchain has been specified") 39 | set(BUILD_GBA ON) 40 | endif() 41 | endif() 42 | 43 | if(BUILD_GBA) 44 | message(STATUS "ugba-testing: GBA toolchain: ${ARM_GCC_PATH}") 45 | endif() 46 | 47 | # Save it to a regular variable so that it can be disabled per-folder. 48 | set(BUILD_GBA_INTERNAL "${BUILD_GBA}") 49 | 50 | # Add testing 51 | # ----------- 52 | 53 | enable_testing() 54 | 55 | add_subdirectory(tools) 56 | 57 | # GiiBiiAdvance is needed for unit tests 58 | 59 | get_filename_component(GIIBIIADVANCE_PATH "giibiiadvance" ABSOLUTE) 60 | 61 | if(EXISTS "${GIIBIIADVANCE_PATH}/.git") 62 | set(ENABLE_CAMERA OFF CACHE BOOL "") 63 | add_subdirectory(${GIIBIIADVANCE_PATH} giibiiadvance) 64 | else() 65 | message(FATAL_ERROR "Git submodules not initialized." 66 | "Please run `git submodule update --init --recursive`") 67 | endif() 68 | 69 | # UMOD Player is needed by the tests that use it 70 | 71 | get_filename_component(UMOD_PLAYER_PATH "umod-player" ABSOLUTE) 72 | 73 | if(EXISTS "${UMOD_PLAYER_PATH}/.git") 74 | add_subdirectory(${UMOD_PLAYER_PATH}) 75 | else() 76 | message(FATAL_ERROR "Git submodules not initialized." 77 | "Please run `git submodule update --init --recursive`") 78 | endif() 79 | 80 | include(cmake/compiler_flags.cmake) 81 | include(cmake/example.cmake) 82 | 83 | # Add tests 84 | # --------- 85 | 86 | add_subdirectory(examples) 87 | add_subdirectory(unittests) 88 | --------------------------------------------------------------------------------