423 Commits

Author SHA1 Message Date
Toxa
ff0e55bd3b GB/SMS/GG: remove obsolete EMU_profiler_message() support which caused problems when building with --debug and have no sense anymore 2026-02-04 19:23:36 +03:00
Michel Iwaniec
dd7aa961a5 Remove duplicated line from text_advanced_dialogue example 2025-12-20 17:52:23 +00:00
bbbbbr
4bc924a4ae examples: rle compress: convert and compress map at build time
- Doesn't seem to be an easy way to do cross platform incbin paths with the C preprocessor, so using /obj/all
2025-12-04 03:26:38 -08:00
bbbbbr
65f033ac5e Examples: fix some missing compile.bat
- Add missing target to some makefiles
- Fix megaduck and cross-platform folders not in list of folders to process
2025-11-26 23:33:38 -08:00
bbbbbr
c9c1249ff8 Examples: new sram bank pragma example
- Minor related docs updates
2025-11-26 16:06:10 -08:00
bbbbbr
1e1a7cc415 Docs: explanation of new dataseg pragma and sfr for HRAM vars (#827) 2025-10-30 03:07:13 -07:00
Toxa
9fd48a77a9 EXAMPLES: GB: HRAM variable allocation example 2025-10-28 19:30:09 +03:00
bbbbbr
b0c35d6b35 Examples: gb-rand: minor improvements (#823)
- fast modulo alternative
- triangle and bell curve distributions per discord chat
- modernized makefile
2025-10-16 02:29:45 -07:00
bbbbbr
f4f2cecf2c Platformer example: remove flag -keep_duplicate_tiles (#817)
- Flag should not be there since the map conversion does not have the flag enabled and if there are duplicate tiles in the source tileset the tile numbering gets scrambled
- Also fix incorrect comment
2025-09-15 12:15:38 -07:00
Toxa
d59bd395a8 SMS/GG: fix parameter order on the set_tile_submap/set_tile_submap_compat 2025-09-12 15:37:28 +03:00
bbbbbr
4c038c8743 png2asset: fix broken transparency for SGB borders with more than one 16 color palette #810
- For SGB palettes there is 1 transparent color (0) which should be the first and then 15 opaque colors.
- In cases where more than SGB palette is generated, png2asset was failsing to force the transparent color as the first color for any additional palettes.
2025-08-17 16:46:44 -07:00
bbbbbr
23b4f7162b Example: Sound: write length value when length bit enabled and triggering channel 2025-08-13 02:30:43 -07:00
bbbbbr
ed9c9af5ab Duck: add Single pass printer example 2025-08-11 17:20:31 -07:00
Panagiotis Georgiadis
8849193ffc Add slash between GBDK_HOME and bin path in example Makefiles (#806) (drpaneas)
- Addresses https://github.com/gbdk-2020/gbdk-2020/issues/805
2025-08-11 11:43:47 -07:00
Rodrigo
a49c9b6fe0 Fix text_advanced_dialogue example and manual line break support 2025-07-31 15:18:31 -03:00
Toxa
7d0e389183 EXAMPLES: minor improvements to the scroller example 2025-07-21 18:14:10 +03:00
Toxa
7d64b490f4 Merge branch 'develop' of https://github.com/gbdk-2020/gbdk-2020 into develop 2025-07-21 13:36:29 +03:00
Toxa
fb8d8b8506 EXAMPLES: refactor the cross-platform scroller example 2025-07-21 13:36:17 +03:00
bbbbbr
884aca3113 Merge pull request #798 from bbbbbr/examples/mbc5_rumble_changes
Examples: MBC5 rumble improvements
2025-07-21 03:28:20 -07:00
Toxa
9bc0c38eec EXAMPLES: SMS: the NMI handler example 2025-07-20 00:58:20 +03:00
bbbbbr
4cc12e2f73 Examples: MBC5 rumble improvements
- Readme note about SRAM bank changes
- Adjustable duration and intensity (with display)
- VBL handler to update outside of main loop
- Cancel option
- Specific duty cycles based on cart testing (shorter cycle times to make it less lumpy, tuned intensity levels)
2025-07-19 01:54:48 -07:00
bbbbbr
32123ded27 Merge pull request #789 from EV3lindaboi/develop (MBC5 Rumble)
Rumble Pak example
2025-07-18 13:33:04 -07:00
bbbbbr
0e7a3639c8 Examples: gbprinter: megaduck link port pinout 2025-07-18 12:33:27 -07:00
bbbbbr
ff16680856 Merge pull request #796 from bbbbbr/examples/missing_gbdk_debug
Examples: MBC3 and 7: Add missing GBDK_DEBUG check to Makefiles
2025-07-18 12:04:59 -07:00
bbbbbr
6d56a2bc6b Examples: Add missing GBDK_DEBUG check to Makefiles
- Also remove commented out MegaDuck flags that were copy and pasted
2025-07-18 12:03:52 -07:00
Toxa
ba6eb00496 EXAMPLES: Convert GBPrinter example to cross-platform (Game Boy/Mega Duck/Game Gear) 2025-07-18 14:11:40 +03:00
VL2M_STUDIO
3be1173afa Is this one good? 2025-07-10 12:01:22 +03:00
VL2M_STUDIO
4531d5eb2b Remake 2025-06-17 09:00:32 +03:00
VL2M_STUDIO
f18da7e1b7 Added Rumble Pak example 2025-06-16 19:44:06 +03:00
Michel Iwaniec
62de8abb87 NES: Add support for various tilemap layout (mirroring) configurations (#783)
* NES: Add support for various tilemap layout (mirroring) configurations

- Introduce platform configuration, mainly to define tilemap layout NES_TILEMAP_[F|H|V|S] in platform_cfg.s
  + Add NES_TILEMAP_S|H|V|F setting for tilemap layout, and hard-code to NES_TILEMAP_S for now
  + Add NES_LOMEM setting to enable current default of using part of stack instead of BSS for attribute shadow buffer
  + Edit Makefile to copy platform_cfg.s (if it exists) to platform directory after build

- Updates to attribute shadow buffer and dirty bits:
  + Add NUM_NT define for number of nametables used by a layout, and AT_SHADOW_WIDTH/_HEIGHT to denote the variable dimensions
  + Add convenience defines NT_2W / NT_2H to quickly test whether tilemap layout is two screens wide / high
  + Define _attribute_shadow and _attribute_row/_column_dirty in terms of NUM_NT
  + Update flush_attributes to support all layouts
  + Update get_bkg_xy_addr / set_bkg_tile_xy to support all layouts
  + Update set_bkg_attribute_xy[_nes16x16] to support all layouts
  + Update set_bkg_attributes[_nes16x16] to support all layouts, and correctly wrap to next AT in both directions
  + Update set_bkg_submap_attributes[_nes16x16] to support all layouts
  + Update set_bkg_submap to support all layouts, and contain common inner subroutine .set_bkg_common
  + Replace set_bkg_tiles with simpler implementation calling .set_bkg_common, and correctly wraps to next NT in both directions
  + Add set_bkg_based_tiles / set_bkg_based_submap implementations using the new common subroutine

- Updates to C include files:
  + Define DEVICE_SCREEN_BUFFER_WIDTH/_HEIGHT based on NES_TILEMAP_ setting, doubling high-level size of WIDTH / HEIGHT conditionally
  + Add typedefs scroll_x_t / scroll_y_t as uint8_t or uint16_t based on NES_TILEMAP_ setting
  + Make move_bkg use scroll_x/y_t typedefs, set 9th scroll bit in shadow_PPUCTRL where needed, and compensate for 239->0 y wrapping

- Updates to examples:
  + Update large_map example to use platform-agnostic settings for scroll wrapping and offset
  + Update rle_map to use a uint16_t for scroll position, to support NES_TILEMAP_H and NES_TILEMAP_F settings
2025-05-19 12:44:45 +01:00
bbbbbr
05adfffd33 Merge pull request #776 from bbbbbr/example/mbc7_note
Example: MBC7: note typos
2025-05-09 22:46:06 -07:00
bbbbbr
43b633b27f Example: MBC7: note typos 2025-05-09 12:24:05 -07:00
bbbbbr
71a2398278 Merge pull request #775 from bbbbbr/example/mbc7_note
Examples: MBC7 GBC 2x speed note
2025-05-09 12:10:15 -07:00
bbbbbr
bdf9b231d6 Examples: MBC7 GBC 2x speed note 2025-05-09 12:09:26 -07:00
Michel Iwaniec
5acc7cfbae NES: Improve TIMER interrupt emulation (#774)
- Move TIM ISR emulation to dedicated function .tim_emulation and dedicated file timer_isr.s

- Make TIM ISR emulation save entirety of ALL_REGTEMPS_BEGIN to ALL_REGTEMPS_END

- Improve emulation to allow average TIM rate to be faster compared to vblank rate

- Add support for consistent average TIM rate on PAL, for a less system-dependent timer

- Add support for different base dividers defined by GB-like TAC_REG variable

- Add defines values for "vblank parity mode" to global.s and nes.h

- Update crt0 init code to set TMA_REG to vblank parity mode correctly for PAL/Dendy

- Update documentation, describing the improved GB TIM emulation and vblank parity mode

- Update cross-platform IRQ example to better showcase the emulation
2025-05-06 11:40:17 +01:00
bbbbbr
048a98b2ec Examples: MBC3: generate compile.bat 2025-05-02 12:02:12 -07:00
bbbbbr
deb42cb19d Examples: Typewriter: fix example string typo 2025-04-28 16:38:23 -07:00
bbbbbr
0f073ab408 Docs: text changelog, other minor updates 2025-04-25 00:04:39 -07:00
Michel Iwaniec
03613b5550 NES: Make sure TIM ISR handlers are thread-safe (#760)
* NES: Make sure TIM ISR handlers are thread-safe

- Backup and restore REGTEMP area when calling TIM ISR in vblank

- Update irq example to use #pragma nooverlay for tim handler

- Add warning and explanation about having to use #pragma for TIM handlers in NES section of docs

- Add @anchor to docs, and a code example for #pragma nooverlay

- Update irq.c with `#pragma nooverlay` only being applied if NINTENDO_NES is defined

- Add more detailed comment of `#pragma nooverlay` in irq.c

- Add reference to docs in gb.h

- Add similar reference to nes.h
2025-04-22 08:36:41 +01:00
bbbbbr
f3fb780113 Examples: Game Boy: Minimal MBC3 RTC example 2025-04-18 00:26:03 -07:00
bbbbbr
29ce435727 Merge pull request #756 from bbbbbr/example_mbc7accel_compilebat
examples: mbc7 acceleromerter: add missing batch file target
2025-04-03 04:21:25 -07:00
bbbbbr
3248d3056e examples: mbc7 acceleromerter: add missing batch file target 2025-04-03 04:20:48 -07:00
Michel Iwaniec
ac571c1dab NES: Align coordinates and scanline counting in LCD ISR implementation with GB, add SCX / SCY / LYC defines (#755)
NES: Align coordinates and scanline counting in LCD ISR implementation with GB, add SCX / SCY / LYC defines

- Change definition of _lcd_scanline to be -1 less than current, aligning with GB LYC register

- Change definition of _bkg_scroll_y to match GB's SCY, being relative to current scanline

- Refactor do_hblank_writes, delay_fractional and delay_to_scanline subroutines in crt0

- Add "#define LYC_REG" and "#define LY_REG" as aliases of _lcd_scanline

- Add #defines for SCX and SCY to alias _bkg_scroll_x / _bkg_scroll_y shadow variables

- Change text scroller example to use LYC_REG / SCX / SCY instead of _lcd_scanline / move_bkg, remove redundant #ifdefs

- Add subtle shake in y direction to text scroller example, to check that GB / NES coordinates match

- Update "From Game Boy to NES" section's descriptions of LCD handlers

- Update "Migrating to new GBDK versions" with a short description of bkg_scroll_y changing from absolute to relative Y coordinates for 4.4.0
2025-03-30 23:43:39 +01:00
bbbbbr
a2aa923973 Merge pull request #749 from bbbbbr/megaduck/laptop_io_updates
MegaDuck: Updated on duck laptop IO commands, expose a few vars
- Printer command labeled and some query commands for the init result
- Run cart command labeled
2025-03-13 01:59:15 -07:00
bbbbbr
692aec8b2d MegaDuck: Updated on duck laptop IO commands, expose a few vars
- Printer command labeled and some query commands for the init result
- Run cart command labeled
2025-03-13 01:55:39 -07:00
Michel Iwaniec
37186a5b7a NES: Timer interrupt emulation + support for set_interrupts(...)
- Add add_TIM / remove_TIM functions to nes.h

- Refactor implementation in lcd.s to support add_TIM / remove_TIM

- Add TMA_REG / TIMA_REG / TAC_REG vars to emulate GB hardware timer register

- Add call to TIM function at end of NMI handler in crt0.s, and make it use TMA_REG / TIMA_REG vars

- Add implementation for set_interrupts in lcd.s, replacing JMP instruction with RTS when disabled

- Enable NES target in examples/cross-platform/irq and replace delay(1000) call with 60 vsyncs

- Update examples/cross-platform/scroller and examples/cross-platform/irq to use set_interrupts

- Update documentation to describe use-cases and limitations of TIM handler
2025-03-09 03:07:44 +00:00
bbbbbr
330d45aee6 Example: EmuDebug: fix register addition getting treated as dereferencing pointer in bgb and emulicious 2025-03-06 18:50:14 -08:00
Toxa
e8c732dfe0 Merge branch 'develop' of https://github.com/gbdk-2020/gbdk-2020 into develop 2025-02-24 23:02:47 +03:00
Toxa
bd99d4ce69 SMS/GG: Timer interrupt emulation 2025-02-24 23:02:36 +03:00
bbbbbr
459dbfbff4 Docs: EMU_printf: Note %c vars should not be cast when passing
- Improve EMU_printf in example with more detailed version
2025-01-23 01:48:47 -08:00