130 Commits

Author SHA1 Message Date
Toxa
ad37422496 SMS/GG/MSX: improve get_bkg_xy_addr() performance 2026-03-16 16:18:31 +03: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
Toxa
33139f4345 minor style 2025-07-21 11:46:54 +03:00
Toxa
99c2e580b7 GG: rename the "not interrupt" link port control bit 2025-07-19 23:11:39 +03:00
Toxa
bd99d4ce69 SMS/GG: Timer interrupt emulation 2025-02-24 23:02:36 +03:00
Toxa
2d32eedb6e SMS/GG: Improve metasprite clipping by Y, change coordinate type to signed int16 2024-12-17 22:39:10 +03:00
bbbbbr
cd9be14784 Export _vbl_done for z80 platforms as well
- Also fix incorrect flag state comment for gb version
2024-10-23 03:05:34 -07:00
Toxa
ac368f922e SMS/GG: fix joypad()/waitpad()/waitpadup() definitions; add delay required for reading the 3 and 6-button Genesis controller in waitpad()/waitpadup() for the SMS 2024-05-09 15:41:48 +03:00
bbbbbr
ea8ff534b3 Docs: 4.3.0: first pass at Release Notes, Changelog, Migration notes 2024-05-06 00:38:56 -07:00
Michel Iwaniec
350c221b22 Changes in response to PR review:
* Name change for consistency with other platforms: _system_bits -> _SYSTEM
* Add _SYSTEM extern to msx.h and sms.h
* Make all platforms have SYSTEM_60HZ and 0x00 and SYSTEM_50HZ as 0x01
* Make _SYSTEM have uint8_t type instead of UBYTE
2024-04-28 17:55:32 +01:00
Michel Iwaniec
9f8103ad4d NES: Add PAL support
* Add new zeropage variable _system_bits to indicate NTSC/PAL/Dendy system
* Modify init code to detect NTSC/PAL/Dendy via cycle counting, storing result in _system_bits
* Modify fake-LCD-ISR delays in NMI handler to accommodate PAL timings

Cross-platform:
* Change existing SYSTEM_NTSC / SYSTEM_PAL defines in sms.h to SYSTEM_60HZ / SYSTEM_50HZ, and copy them to gb.h / nes.h / msx.h
* Add new cross-platform function get_system for all ports, to query whether running on a 60Hz or 50Hz system
* Add minimal cross-platform display_system example to exercise get_system
2024-04-28 00:54:55 +01:00
Toxa
ccc8ed1bf6 SMS/GG refactor joypad polling: support 3 and 6 button controller in joypad() 2024-04-26 11:33:48 +03:00
Toxa
7d8b5bdb05 SMS/GG: add game gear ports definitions to hardware.h, also into the sms/global.s assembly definitions 2024-04-25 11:12:49 +03:00
Toxa
55725d6810 SMS/GG/MSX Z80 implementation for the bcd.h functions 2024-04-15 21:27:09 +03:00
Toxa
c4c174d593 SMS/GG/MSX __WRITE_VDP_REG_UNSAFE VDP access macro while interrupts are disabled, for use in the ISR handlers, for instance 2024-03-30 16:23:31 +03:00
Toxa
d96ef1e829 SMS/GG/MSX refactor the VDP access because of this: https://sourceforge.net/p/sdcc/bugs/3721/ the side effect of the refactor is that almost any VDP manipulation within the user ISR will allow interrupt nesting which is potentially quite dangerous 2024-03-30 14:40:42 +03:00
Toxa
b8fbff77f8 SMS/GG use attribute wrapper definitions 2024-03-29 17:51:41 +03:00
Toxa
de1bd7b473 define SET_BORDER_COLOR() macro for all platforms 2024-03-28 16:20:39 +03:00
Toxa
34053c6bbe SMS/GG working S_PAL() macro; synchronize MSX header with the SMS header 2024-03-27 00:32:01 +03:00
Toxa
c82b0732a1 define S_BANK tile attribute for the Game Boy (CGB) and the SMS/GG 2024-03-27 00:16:59 +03:00
Toxa
96f4b2c7f7 SMS/GG/MSX DIV_REG emulation for the Z80 systems, may be useful for seeding RNG 2024-03-25 14:30:59 +03:00
Toxa
b0a36f5bcd SMS/GG: optimize native tile data loading routines 2024-03-14 19:23:35 +03:00
Toxa
4d647100c7 SMS/GG: support SHOW_SPRITES/HIDE_SPRITES macros (no hiding midframe) 2024-03-08 19:55:21 +03:00
bbbbbr
f9be57c39f Merge pull request #628 from bbbbbr/docs/4_2_next
Docs: set_palette() for SMS/GG, clarify display_off behavior for GB and NES
2024-03-03 04:14:12 -08:00
bbbbbr
35c687f23d Docs: set_palette() for SMS/GG, clarify display_off behavior for GB and NES 2024-03-03 04:03:36 -08:00
Toxa
a702abdbfb SMS/GG: missing include sms.h in the sms/metasprites.h 2024-02-22 14:45:46 +03:00
Toxa
ff3a77fe65 SMS/GG: fix scroll_sprite() function 2024-01-17 19:22:37 +03:00
Toxa
53445a6b8e remove legacy types from the metasprites api 2024-01-03 22:05:36 +03:00
bbbbbr
2e435bf7c0 Merge pull request #486 from Adam-Shea/develop
Updated documentation for set_sprite_prop()
2023-10-02 23:52:43 -07:00
Toxa
6377b7f944 SMS/GG: add R5_SAT_0x1F00 definition for the R5 value controlling SAT position in VRAM, fix fonts cross-platform example 2023-09-10 14:06:53 +03:00
Toxa
1fc142964e SMS/GG: ability to move VDP SAT and name table to other locations by writing to VDP R2 and VDP R5; set name table to 0x1800 and SAT to 0x1F00 by default to free up some sprite tile space 2023-09-09 12:02:04 +03:00
Toxa
b5869f7eb0 SMS: swap buttons A and B to match game boy buttons 2023-08-08 23:54:04 +03:00
Toxa
39ef74f653 SMS: metasprite clipping on the screen edges by X coordinate; update functions to match the new calling convention 2023-08-08 19:41:06 +03:00
bbbbbr
d5f16c367e Merge pull request #558 from bbbbbr/docs_4_2_0
Docs: 4.2.0 updates + update undefs for platform header files
2023-07-28 03:21:50 -07:00
bbbbbr
f979379b67 Update console un-defines in main port platform files 2023-07-28 02:52:06 -07:00
Michel Iwaniec
fdafcc09ae * Add missing const for sms and msx functions 2023-07-25 15:02:07 +01:00
Michel Iwaniec
863d24725b Add set_bkg_native_data / set_sprite_native_data functions to allow using native tile format with set_bkg_data / set_sprite_data functionality
* Update gbdk-lib/include/gb/gb.h to forward set_bkg_native_data / set_sprite_native_data to set_bkg_data / set_sprite_data functions
* Update gbdk-lib/include/sms/sms.h to forward set_bkg_native_data / set_sprite_data to set_bkg_4bpp_data / set_sprite_4bpp_data
* Add implementation for set_bkg_native_data / set_sprite_native_data in gbdk-lib/libc/targets/mos6502/nes/set_native_data.s
* Update gbdk-lib/include/nes/nes.h to include function declarations for set_bkg_native_data / set_sprite_native_data
* Update gbdk-lib/inlcude/nes/nes.h to implement set_native_tile_data in terms of set_bkg_native_data / set_sprite_native_data
* Update gbdk-lib/inlcude/nes/nes.h to implement set_tile_data in terms of set_bkg_data / set_sprite_data
* Remove old (/broken for indirect mode) code for set_tile_data / set_native_tile_data from set_data.s / set_native_data.s
* Update png2asset to include NES among the supported PackModes
* Update examples/cross-platform/logo .meta file to specify NES PackFormat for NES build
* Update examples/cross-platform/large_map Makefile to specify NES PackFormat for NES build
2023-07-21 01:35:40 +01:00
Michel Iwaniec
c4621b8c0f Add support functions for setting an individual map attribute
* Add dedicated NES function set_bkg_attribute_xy_nes16x16 for setting an individual (shadow) attribute in gbdk-lib/libc/targets/mos6502/nes/set_attribute.s
* Add inline adapter NES function set_bkg_attribute_xy, which calls set_bkg_attribute_xy_nes16x16
* Change NES functionality to call _flush_shadow_attributes from wait_vbl_done
* Remove calls to _flush_shadow_attributes in set_bkg_attributes and set_bkg_submap_attributes
* Add dedicated SMS/GG function set_attribute_xy in gbdk-lib/libc/targets/z80/set_tile.s
* Add inline adapter GBC function set_bkg_attribute_xy in gbdk-lib/include/gb/gb.h
2023-07-17 19:46:44 +01:00
Adam Shea
083bf4a078 updated docs for other systems 2023-03-20 17:43:33 +00:00
bbbbbr
ea6e9d4a8c Docs: Update metasprite info for base_props parameter
- Centralize long desription in GB header file, link others to it
2023-03-01 23:41:52 -08:00
bbbbbr
0604e99eed Docs: 4.2
- more details for for new metasprite functions
- GB: more details for BGP/OBP0/OBP1
- Remove some trailing spaces in metasprite headers
- Re-add Obsolete keyword to pre-deprecated functions
- Entries for release notes, migration notes
2023-02-22 01:45:02 -08:00
bbbbbr
ab02f7a43a Docs: 4.2
- Add note about initializing SRAM
- Add CGB section to Supported Consoles with overview, api links and list of examples (@anchor using_cgb_features)
- Initial note 4.2 migration and release notes
- API doc improvements
2023-02-17 00:23:41 -08:00
Toxa
83d4744729 fix most of the "function declarator with no prototype" warnings 2023-02-06 01:24:16 +03:00
Michel Iwaniec
cef2138cef SMS: Add attribute setting compatibility functions
* Add wrapper functions set_bkg_attributes / set_bkg_submap_attributes to sms.h
* Update png2asset to always output a #define that makes attribute map equal tile map when attributes are not generated
* Update examples/cross-platform/logo to use set_bkg_attributes unconditionally
2023-01-14 22:57:41 +00:00
Michel Iwaniec
3ec33defb7 Cross-platform metasprite flipping support:
* Change sms_metasprites to have 4 permutations for flipping combinations, using a generic macro for function bodies
* Change examples/cross-platform/metasprites to duplicate uploaded tiles by X and Y depending on HARDWARE_SPRITE_CAN_FLIP_X/Y defines
* Change examples/cross-platform/metasprites to use 8x8 sprites, to make all duplicated tiles fit tile memory on sms/gg
* Remove hide / show metasprite functionality in examples/cross-platform/metasprites
* Move rotation to A button, to make compatible with 2-button SMS joypad
2022-12-08 21:42:14 +00:00
Michel Iwaniec
93cec8d24a Rename HARDWARE_SPRITE_CAN_FLIP_* defines to align with new flipx/flipy naming
* HARDWARE_SPRITE_CAN_FLIP_H -> HARDWARE_SPRITE_CAN_FLIP_X
* HARDWARE_SPRITE_CAN_FLIP_V -> HARDWARE_SPRITE_CAN_FLIP_Y
2022-11-30 23:44:53 +00:00
Toxa
585b1e3cdb refactor metasprite functions, add offset for the sprite properties 2022-11-29 22:46:45 +03:00
Toxa
b0d77a5cd1 vsync() alias for wait_vbl_done() 2022-11-29 21:43:36 +03:00
Michel Iwaniec
6f2fa3c361 png2asset: Make props in generated metasprites cross-platform
* Update printing of METASPR_ITEM in png2asset to extract X/Y flip and palette number, print them as symbolic names S_FLIPX, S_FLIPY and S_PAL(...)
* (...and adjust output formatting to one METASPR_ITEM per line, for better readability)
* Add #define for S_PAL to gb.h, nes.h, msx.h and sms.h
* Remove "TODO:" comments from gbdk-lib/libc/targets/mos6502/nes/metasprites.s
2022-11-27 15:20:24 +00:00
Michel Iwaniec
17e56b4c72 NES: Add metasprite flipping support
* Add metasprite variants move_metasprite_hflip, move_metasprite_vflip and move_metasprite_hvflip to gbdk-lib/libc/targets/mos6502/nes/metasprites.s
* Add HARDWARE_SPRITE_CAN_FLIP_H / HARDWARE_SPRITE_CAN_FLIP_V defines to nes.h / gb.h / sms.h / sms.h, to allow cross-platform info on HW sprite flip support
* Update examples/cross-platform/metasprites/src/metasprites.c to use flipped metasprites when available on platform
* Delete old gb-specific examples/gb/metasprites, in favor of cross-platform version
2022-11-20 22:22:41 +00:00