Commit graph

209 commits

Author SHA1 Message Date
Lokathor d446837abe begin tiled mode docs. 2022-10-07 20:52:26 -06:00
Lokathor e07372084f move video module into a folder/mod.rs 2022-10-07 20:52:05 -06:00
Lokathor 9452e94a1b enough docs for the moment. 2022-10-07 00:28:30 -06:00
Lokathor 587536b317 dma docs 2022-10-07 00:27:27 -06:00
Lokathor 930ce2cdb8 docs. 2022-10-06 22:53:59 -06:00
Lokathor 7ada0fa8e9 fix text screenblock dimensions. 2022-10-06 22:10:56 -06:00
Lokathor 0438d06c15 docs 2022-10-06 17:23:41 -06:00
Lokathor 1fbf3077ac irqfn fix 2022-10-06 17:23:20 -06:00
Lokathor ff16e0bbc6 test out BitUnpack, fix bugs. 2022-10-06 17:14:34 -06:00
Lokathor 8bd4dfa939 signature fix 2022-10-05 00:09:14 -06:00
Lokathor 1834876cb7 move readme explanation into the crate docs. 2022-10-04 23:57:13 -06:00
Lokathor 2b9133a158 docs. 2022-10-04 23:03:52 -06:00
Lokathor 76310047c2 docs 2022-10-04 21:56:11 -06:00
Lokathor 2c3198aadc provide some builtin art. 2022-10-04 19:50:40 -06:00
Lokathor 50343253f2 remove macros 2022-10-04 19:50:20 -06:00
Lokathor da46fe5df1 BitUnPack 2022-10-04 19:50:02 -06:00
Lokathor c7ac655ecc more screenblock stuff. 2022-09-27 19:53:27 -06:00
Lokathor d9649bc2d5 dma helper. 2022-09-27 19:53:12 -06:00
Lokathor 10e8df8e82 comments 2022-09-27 18:07:17 -06:00
Lokathor 546b6e782e adds mgba logging support. 2022-09-27 17:57:09 -06:00
Lokathor e31f796375 temporarily do not provide our own aeabi divisions 2022-09-27 11:20:05 -06:00
Lokathor bf853b71d6
v0.7.0-remake (#168)
* Literally clear the repo to nothing for starters

* The screen color changes with key presses

There's enough code here that the screen color can change when you press the keys. Right now it's most all unsafe code directly in the example file. The strange thing is that llvm is making us define atomic helper functions when it's not supposed to do that, so we need to investigate more before proceeding too much.

* can't tell if this is broken or if mgba is busted on mac

* unix dumper

* don't panic

* oops

* GbaCell into its own file, also i had broken the rt irq handler.

* closer to an acceptable demo.

* make IrqFn into just an alias.

* wrap most current mmio types.

* more stuff

* Use paste to remove a whole bunch of repetition (#166)

* gba cells are "unwind safe", they can't be in a bad intermediate state, that's the point

* Once again we must thank Yandros for saving us from ourselves.

* assembly updates.

* oops

* finish video MMIO basics, no docs yet.

* small note.

* simplify asm irq handler stack usage.

* ewram support.

* more cell stuff.

* Remove the non-Zlib dependency, sorry Sp00ph :(

* add proper dma support.

* small docs improvement.

* bitmap and oam declarations

* more macros

* single bit constants will be extremely useful

* add `IntrWait`

* rename for clarity

* improvements

* use the new constant

* improve sound support

* timers

* key support

* add a prelude module.

* fix doc

* more and more assembly (mem fns will need global_asm probably)

* more comments.

* comment updates.

* readme

* more video support, and put IrqFn alias into interrupts module.

* finish working in the EABI code.

* CI config.

* funding file.

* rustc plz inline these functions when you can :3

* "rt0" is unnecessarily cryptic

* overhaul the readme.

* phrasing

Co-authored-by: Sp00ph <61327188+Sp00ph@users.noreply.github.com>
2022-09-27 10:40:05 -06:00
Lokathor 5c5081ddc4
fix a critical typo 2022-01-10 15:40:11 -07:00
Matt L 093146fd8a
Using asm and global_asm from core::arch module. (#157)
* Using asm and global_asm from core::arch module.

* Commenting out some broken code with higher registers.
2022-01-01 21:54:46 -07:00
ShinySaana 42e2836507
Use half-word write for WAITCNT access (#160)
Fixes Stub I/O warning in mGBA.
2022-01-01 12:40:21 -07:00
Lokathor b93589b8ac docs fix. 2021-11-11 20:07:22 -07:00
Lokathor 7df5f4737f
should work now (Nightly e4ca1662f 2021-05-22) (#149) 2021-05-23 19:07:26 -06:00
Alissa Rao 144dada16b
Added sound master control registers to mmio_addresses. (#144)
* Added sound master control registers to mmio_addresses.

* Merge FifioEnable into SoundStatus, reduce struct sizes.

* Rename SOUND_CHANNEL_CTL to something a bit simpler.
2021-05-23 16:41:11 -06:00
Hpmason ec0ca7d804
Add RNG (#142)
* Add random

* Add GBA random example

* switch macro_export to pub(crate)

* rename u32_to_u32 macro

* remove useless pub use

* Comment out extra u32 to u16 macro

* Comment random_color example

* formatting

* More commenting

* Add/fix some docs

* Fix some doc links

* Remove use of u64
- Halve bit widths where u64 was used

* Add Gen32::next_color()
2021-05-17 12:22:51 -06:00
Alissa Rao 2956493be9
Sets an initial WAITCNT in rsrt0.S (#147) 2021-05-17 12:00:05 -06:00
Alissa Rao 093edc703f
Bitfield fixes (#146)
* Fix incorrect bit for `chained_counting` field in TimerControl.

* Fixes incorrect bitfield manipulation math in mmio_types.
2021-05-17 11:50:42 -06:00
Lokathor 127f31ecf2 fix macros. 2021-05-01 19:45:55 -06:00
Lokathor 6a709689ed this is the commit that gave the ICE. 2021-05-01 18:38:52 -06:00
Lokathor 9e8349c82e
palettes and oam (#137) 2021-04-16 15:01:38 -06:00
Lokathor e595270bfe fix irq example, part of https://github.com/rust-console/gba/issues/129 2021-04-11 17:41:08 -06:00
Lokathor 6e6f4be709 fix color constructor, part of https://github.com/rust-console/gba/issues/129 2021-04-10 09:13:05 -06:00
Lokathor 703c837a21 Closes https://github.com/rust-console/gba/issues/86 2021-04-09 00:08:00 -06:00
Lokathor 9bca85264f Closes https://github.com/rust-console/gba/issues/70 2021-04-09 00:06:52 -06:00
Lokathor fd3a308e8a
remove proc macro usage and finish out the mmio (#125)
* .

* more updates, much more to do soon.

* hello world works again.

* fix key interrupts.

* remove the old book

* don't forget timers.

* we can just use search, duh.

* cleanup

* more bios

* finished most mmio, finished bios.

* dump some old macros that shouldn't have been pub to begin with.

* Update README.md

* for now, just make this a u16

* timers

* fix hello_world

* timer fix

* docs on timers

* block resetting work ram for now.

* put preserves_flags on bios calls as appropriate

* add a code page 437 tile sheet.

* docs.

* sound :( it's all bad but we'll fix it in 0.5

* move most backup files back into the lib.

* CI might work now?

* fix up non-serial examples.

* oops, gotta check out the repo.

* readme.
2021-04-08 23:57:30 -06:00
Lokathor 3bcd64f28c
update to voladdress-0.4 (#120)
* update to voladdress-0.4 (via git)

* restore the imports rust-analyzer told me to break.
2021-03-31 20:22:42 -06:00
Joshua Barretto c375b5ac7a
Added .iwram section (#118)
* Added .iwram section

* Use the same section for .data and .text_iwram
2021-02-28 12:09:49 -07:00
Alissa Rao 40ced658f3
Properly finish documentation for the save module. (#119) 2021-02-27 10:05:39 -07:00
Alissa Rao 79099d807b
Adds support for reading/writing to save media. (#109)
* Write some of the basic infrastructure for SRAM support.

* Implement battery-backed SRAM.

* Implement non-Atmel Flash chips.

* Implement support for Atmel Flash SRAM chips.

* Implement EEPROM support, various refactorings to SRAM system.

* Replace Save API with one based more cleanly on the flash chip API.

* Run rustfmt on new save media code.

* Improve test_savegame and fix remaining bugs caught by the changes.

* Proofreading on comments/documentation for save module.

* Fix addresses for read/verify routines in save::flash.

* Rebase save_api onto current master.
2021-02-22 23:19:37 -07:00
Alissa Rao 8bfa1a228a
Adds support for NO$GBA's debugging API. (#108)
* Implement a debugging interface that allows the use of debugging on multiple emulators.

* Implement NO$GBA debugging interface.

* Run rustfmt on new debug code.

* Fix the debug module not compiling on non-ARM systems.

* Don't error (and just silently truncate) on messages that are too long.
2021-02-22 23:19:14 -07:00
Alissa Rao 2aa59bb341
Implement a sync API for working with global mutable state. (#107)
* Add IntelliJ workspace files to the .gitignore.

* Add a simple make_example script for Linux.

* Create a `sync` module with many GBA-specific sync utilties.

* Fix overflow error in debug mode in the hello_world crate.

* Fixes to DMA.

* Code cleanup for the sync module.

* Run rustfmt on new sync code.

* Fix up some names and documentation in the sync module.

* Add a few changes suggested by thomcc for the locks.

* Added needed compiler fences to `InitOnce::try_get`.
* Change the error in `RawMutex::raw_unlock` to better reflect the cause.

* Add a proper issue link to the __sync_synchronize hack.

* Disable interrupts during `InitOnce::try_get`.

* Fix some bad wording in the comments for `InitOnce::try_get`

* Use the new target in `cfg` checks to see if we're on GBA.

* Change registers used for transfer_align4_arm for the different target.

* Cleanup on sync_api changes for the target change.
2021-02-21 16:57:26 -07:00
Neil P 5114f89448
Simplify build process (#106)
* Simplify build process

- Remove dependencies on DevkitPro
- Use linker similarly to min-gba
- Update cargo.toml so that dev builds will build
- Update cargo config so that std builds can run without the linker for
  testing purposes
- Update CI flow to remove xbuild dependency

* Add windows toolchain install

* Add windows section to toolchain install instructions
2021-02-20 11:49:40 -07:00
Sp00ph 5a3bf4630d
Fix previous PR (#102)
* Add a `get_screen_block` function. This simplifies working with tiles as currently there is no easy way to manipulate single tiles using `SCREEN_BASE_BLOCKS`

* Fix import
2021-01-25 12:47:27 -07:00
Sp00ph 5ac6ebb1f7
Add a get_screen_block function. This simplifies working with tiles as currently there is no easy way to manipulate single tiles using SCREEN_BASE_BLOCKS (#101) 2021-01-25 11:54:33 -07:00
Michael Mogenson 00897a0657
SioSerial improvements (#100)
Make a few improvements to the SioSerial struct:
- Have init() return Self. It's more ergonomic to create and initialize
the empty struct in one call.
- Enable FIFO. The GBA has a 4-byte UART FIFO. This makes it less
likely to lose received bytes.
- Derive Clone on SioSerial so it can be split and shared with an
interrupt.
- Derive Debug on SioError so results can be unwrapped.
2021-01-12 14:42:56 -07:00
Michael Mogenson d52d627113
Remove cargo-xbuild dev dependency (#95)
* Remove cargo-xbuild dev dependency

As of Rust nightly 2020-07-15, we can set the default build target
and build-std feature of cargo instead of relying on cargo-xbuild.

Since the thumbv4-non-agb target is the default for all cargo commands,
change the Rust snippets in Makefile.toml to cross-platform duckscript.

The only uglyness we're left with is running the unit tests. We want to
build and run the tests on the host archetecture. Create three platform
overrides for Mac, Windows, Linux and set flags to override the default
target triple and build-std option.

* remove uneeded attribute

From cargo: "the feature `cfg_target_vendor` has been stable since
1.33.0 and no longer requires an attribute to enable"
2021-01-12 14:41:51 -07:00
Sp00ph 6deff3d49e
Fix Mod4::write (#99)
Fixes issue #98
2020-12-29 18:52:12 -07:00
Michael Mogenson 51c870281c
Add Serial and GPIO registers and implement embedded_hal traits (#96)
* Add Serial and GPIO registers and implement embedded_hal traits

Use VolAddress and phantom_fields to populate the SIOCNT, RCNT, and
SIODATA8 registers. Implement embedded_hal serial traits around an empty
SioSerial struct.

Hide serial read and write traits behind a "serial" feature flag
to make embedded-hal and nb dependencies optional.

* UART echo example

Enable the serial feature for this example. Provide a pinout
diagram to assist people with wiring up a USB to UART adapter.
2020-12-26 11:28:07 -07:00
Michael Mogenson b354dca479
Fix address of IF register (#97)
GBATEK has the IF register at address 0x04000202.
2020-12-24 10:10:16 -07:00
Nicola Papale 1696c66b1b
Use RFC 2873 asm syntax (#93)
The new syntax is way safer and more ergonomic. In fact, it renders
obsolete some of the warnings in the docs related to the use of `asm!`.
2020-06-14 01:22:59 -06:00
Lokathor 9491249089 typo 2019-03-06 19:41:03 -07:00
Lokathor ac031627c8 Update IME to be u16 sized, avoid newtype_enum
newtype_enum makes an enum, but an enum can be UB if it's no a valid bit pattern. We should avoid having registers mapped to enum types.
2019-02-14 22:11:23 -07:00
Lokathor 3b688b907c Get all the code lined up 2019-02-14 19:39:34 -07:00
Lokathor 89b7cc0eaa Merge branch 'dev' into lokathor 2019-02-14 19:17:02 -07:00
Lokathor 273a8bd676 commit the changes 2019-02-14 19:16:09 -07:00
Ian Pickering 0d654032bb Add module for interrupt request (IRQ) handling 2019-02-13 17:08:57 -08:00
Ian Pickering dc2127b2ce Fix incorrect opcode of VBlankIntrWait BIOS function
It should be `swi 0x05` instead of `swi 0x04`.
2019-02-13 17:06:18 -08:00
Lokathor d43c66c0d9 new lib file 2019-02-13 01:47:25 -07:00
Lokathor 9e7937b956 tag TODOs in docs 2019-02-13 01:46:47 -07:00
Lokathor 5d89414c13 Update the Mode 3/4/5 abstractions 2019-02-13 01:45:48 -07:00
Lokathor 61218d99f2 Update mGBA usage, stuff it in a macros module 2019-02-13 01:45:23 -07:00
Lokathor 2ca888b572 Fix rustfmt to get things a little more compact 2019-02-12 10:00:16 -07:00
Lokathor 2929076e55 jump to 120
Picking this because it makes the `hello_magic.rs` lines all stay on one line.
2019-02-12 09:42:17 -07:00
Lokathor b67bdc80a1 io registers lesson, +cargo fmt with lin length down to 100 2019-02-11 21:59:17 -07:00
Lokathor da6ce44345 shouldn't this be pub? 2019-02-09 14:35:48 -07:00
Lokathor 84a4b4b89b Explain this better because even I forgot 2019-02-09 12:50:00 -07:00
Lokathor fc642c064d Convert to using the recently split off voladdress lib 2019-02-05 00:47:06 -07:00
Lokathor dcd7e40b15 Start towards 0.4 2019-02-04 20:25:40 -07:00
Lokathor c933e43dd6 mgba 0.7 came out! 2019-02-02 00:20:38 -07:00
Lokathor ddf6593f8b Delete the builtins module
The `__clzsi2` function is now part of the compiler-builtins crate, so it's part of all of Rust.
2019-02-01 23:36:17 -07:00
Lokathor ed7f830ad4 fix to work with latest nightly. 2019-01-12 21:06:38 -07:00
Lokathor 0fb9994131 IWRAM fix 2019-01-12 13:42:18 -07:00
Lokathor a1e35a9ed1 Merge branch 'master' into lokathor 2019-01-12 13:38:16 -07:00
Lokathor bc10122d58 admonish people to stay updated 2019-01-12 13:35:56 -07:00
Lokathor 0e363477b7 mGBA output wasn't resetting its length used 2019-01-12 13:34:43 -07:00
Eevee (Evelyn Woods) 91d40f0c5b Make ObjectAttributes's and AffineParameters's fields public 2019-01-08 18:20:08 -07:00
Eevee (Evelyn Woods) cdd4a3d109 Fix addresses for BG1HOFS and BG1VOFS 2019-01-08 17:23:11 -07:00
Lokathor 8ff32b0304 Update bios module to just build on x86
the actual functions are all unimplemented!() but oh well
2019-01-02 22:43:52 -07:00
Lokathor f825d78e71 More registers! 2018-12-31 16:28:20 -07:00
Lokathor 4217a2b795 add sound 2018-12-31 01:07:33 -07:00
Lokathor d62fbae4f0 more const! 2018-12-30 23:29:58 -07:00
Lokathor dfca52a079 newtype_enum, and other updates 2018-12-29 22:39:53 -07:00
Lokathor 4c7ec468d0 Modules and newtypes, joy! 2018-12-29 20:17:48 -07:00
Lokathor 6466a53475 Move to the phantom_fields! proc-macro 2018-12-29 00:06:08 -07:00
Lokathor bee2d16a5b More docs, and also less no-docs warnings 2018-12-27 23:34:12 -07:00
Lokathor f99da154e8 minor fixes 2018-12-27 23:22:48 -07:00
Lokathor e475253dcf small cleanups 2018-12-27 11:51:53 -07:00
Lokathor 147a2bc45c better vram, still not the best 2018-12-27 11:51:35 -07:00
Lokathor e10491eb8c OAM module 2018-12-27 11:51:07 -07:00
Lokathor cc8d4376f8 Add timer support 2018-12-27 01:05:21 -07:00
Lokathor 72bbe412b6 clearer module organization 2018-12-26 23:13:10 -07:00
Lokathor 6271614335 backgrounds and OAM start 2018-12-26 20:19:53 -07:00
Lokathor 01ac3ec09e travisCI fix 2018-12-25 23:52:30 -07:00
Lokathor d6a6301815 CLOSE to another release 2018-12-25 23:19:16 -07:00
Lokathor 0f1fa8269f More tiled data types 2018-12-25 16:46:01 -07:00
Lokathor c440be7467 reduce the use visibility 2018-12-25 16:45:51 -07:00