Commit graph

677 commits

Author SHA1 Message Date
Lokathor 27f95bb2a3 (cargo-release) version 0.4.1 2021-04-19 10:56:19 -06:00
Lokathor 9e8349c82e
palettes and oam (#137) 2021-04-16 15:01:38 -06:00
Lokathor d93facbaf4 fix wrapping math errors. Part of https://github.com/rust-console/gba/issues/129 2021-04-11 18:00:18 -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 0d21b4c899 add an example using the keypad. 2021-04-10 09:19:25 -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 12823a8b58 (cargo-release) start next development iteration 0.4.1-alpha.0 2021-04-09 00:13:58 -06:00
Lokathor d0d802d231 (cargo-release) version 0.4.0 2021-04-09 00:13:58 -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 8efef6ebc5
No more old book stuff (#123)
* stop with the book, we should focus on the crate.

* Update README.md

* Update README.md
2021-04-05 18:11:42 -06:00
Lokathor 99f80d2b9a update to release voladdress-0.4 2021-03-31 20:53:47 -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
Lokathor 7b2a067aad
move to a tri-license (adds Zlib and MIT options) (#116) 2021-03-01 08:36:39 -07: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
Lokathor a1e1b4d320
prevent building the book
we might restore this later, but for now, no book.
2021-02-23 00:16:37 -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
Neil P 263f7909de
Switch to Github Actions (#105)
- Remove travis ci config
- Add Github action for CI
2021-02-12 20:36:06 -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 af98b63aa1
Add a pre-link-args-crt entry
Per discussion/findings in https://github.com/rust-console/gba/issues/90
2020-01-22 12:25:20 -07:00
bors[bot] 35e9857dcc
Merge #88
88: crt0.s removed redundant lines, added comments r=Lokathor a=felixjones

The flags of `cpsr_cf` are left untouched, so `cpsr_c` is used instead.

Line 102 was redundant:
```asm
bic r2, r2, #0x1F
orr r2, r2, #0x1F
```
Now it explicitly switches from incoming IRQ mode to system mode.

The same type of explicit switch is done for system mode to IRQ mode (only clearing bits necessary), however the IRQ mode bits are or'd also just-in-case the user has modified `cpsr_c` in their IRQ handler.

The IRQ disable bit is also set, again, just in-case the user changed it.

Hopefully I've managed to communicate the behaviour in the ASM comments.

Co-authored-by: Felix Jones <felix@felixjones.co.uk>
2019-09-19 02:34:12 +00:00
Felix Jones 09a7c73004 crt0.s removed redundant instructions and added more asm comments 2019-09-17 23:25:51 +01:00
bors[bot] 898fbdadd0 Merge #85
85: Add __IRQ_HANDLER from hello_magic.rs to setup doc r=Lokathor a=Dhs92

Looks like the docs weren't updated when the example was.

Co-authored-by: Alex <forehand.alex@gmail.com>
2019-07-30 06:47:07 +00:00
Alex 478b0ecb0e
Add __IRQ_HANDLER from hello_magic.rs to setup doc
Looks like the docs weren't updated when the example was.
2019-07-29 23:43:26 -07:00
bors[bot] f66ccba442 Merge #84
84: Remove unnecessary branch instruction in crt0 r=Lokathor a=ketsuban

I noticed a while ago that the BEQ instruction wasn't actually doing anything because I forgot the difference between SUB and SUBS (the latter sets condition flags). Moreover, I don't need a BEQ in the first place since ARM instructions are inherently conditional; it's not a huge deal, but it improves performance for this early code because the pipeline stays nice and full.

Co-authored-by: Thomas Winwood <twwinwood@gmail.com>
2019-06-04 20:56:49 +00:00
Thomas Winwood 4d3a287c6b Remove unnecessary branch instruction in crt0 2019-06-04 21:25:57 +01:00
bors[bot] 038b887235 Merge #82
82: Remove dependency on gbafix r=Lokathor a=ketsuban

As per #80 this is the minimum you have to do to remove gbafix from the toolchain. I ended up doing this myself so that I could load the ELF binary directly into no$gba and use its excellent debugger.

There's no reason for the "main unit code" to ever change (the `0x96` byte before it is a fixed value) but changing the game title, game code, maker code, device type or software version will necessitate recalculating the complement check, and I didn't feel like working out if I could get the assembler to do that for me.

Co-authored-by: Thomas Winwood <twwinwood@gmail.com>
2019-06-04 06:39:02 +00:00
Thomas Winwood 016d9a577d Remove dependency on gbafix 2019-06-02 13:27:35 +01:00
bors[bot] 738301d47c Merge #81
81: Two small tweaks to crt0.s r=Lokathor a=ketsuban

* The use of r3 in the block which copies the .data section into IWRAM is unnecessary.
* The return label in the IRQ handler doesn't need to be global.

Co-authored-by: Thomas Winwood <twwinwood@gmail.com>
2019-05-09 15:09:30 +00:00
Thomas Winwood fe1d75efc5
Two small tweaks to crt0.s
* The use of r3 in the block which copies the .data section into IWRAM is unnecessary.
* The return label in the IRQ handler doesn't need to be global.
2019-05-09 15:08:11 +01:00
bors[bot] 7b79d012b4 Merge #76
76: typo fix r=Lokathor a=Lokathor



Co-authored-by: Lokathor <zefria@gmail.com>
2019-03-30 22:54:44 +00:00
Lokathor 9491249089 typo 2019-03-06 19:41:03 -07:00
bors[bot] 629a85ccf5 Merge #74
74: Update IME to be `u16` sized, avoid newtype_enum r=Lokathor a=Lokathor

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.

Co-authored-by: Lokathor <zefria@gmail.com>
2019-02-15 05:17:51 +00: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
bors[bot] eb157e00dc Merge #71
71: Dev merge (testing bors) r=Lokathor a=Lokathor



Co-authored-by: Lokathor <zefria@gmail.com>
2019-02-15 04:44:16 +00:00
Lokathor c1a272edce no approvals! 2019-02-14 21:33:06 -07:00
Lokathor 529d41d57a push push 2019-02-14 21:32:29 -07:00
Lokathor f95281c708 bors setup 2019-02-14 21:30:51 -07:00