Commit graph

91 commits

Author SHA1 Message Date
Lokathor d09d880eab fix the merge mixup 2022-12-04 16:45:24 -07:00
Lokathor 8385504db6
Remove usage of global_asm (#175)
* message

* finish memory function re-arrangement.
2022-12-04 16:44:27 -07:00
Lokathor eb5995bf1d make the inliner checker into a generic asm checker. 2022-12-04 16:44:08 -07:00
Lokathor 5de0f5e9f2 cleanup, make MIR inlining work in dev 2022-12-01 19:13:31 -07:00
lokathor 6ba28c5347 we can make a little cyan guy show up on the screen. 2022-11-28 16:33:47 -07:00
Lokathor d412ee7779 instruction inline example. 2022-11-04 16:17:49 -06:00
Lokathor a7ac5d508a fix affine stuff. 2022-10-24 14:38:38 -06:00
Lokathor 2ecf62e06e i think the debug finally works right? 2022-10-22 20:12:49 -06:00
Lokathor 39c48bc462 aligned bytes, Closes: https://github.com/rust-console/gba/issues/79 2022-10-18 09:44:23 -06:00
Lokathor ab806bc9d6 we can pass in a bigger than necessary region. 2022-10-13 20:36:56 -06:00
Lokathor 5c40787c7b ln 2022-10-13 20:20:57 -06:00
Lokathor 90aa01d205 make the default cga font easier to unpack. 2022-10-13 20:19:39 -06:00
Lokathor 5059ceb7d4 try to keep the ideas of the addresses for blocks and the block data itself separate. 2022-10-13 19:41:29 -06:00
Lokathor 342d8fc25a cleanup 2022-10-09 12:32:14 -06:00
Lokathor 335d8c0455 first draft of an unpack wrapper, we probably want to use VolRegion or similar 2022-10-09 12:21:23 -06:00
Lokathor 1af762bde6 make the tile layout during const time. 2022-10-09 01:40:26 -06:00
Lokathor 1f79340c28 going back and forth on this, let's try calling it text mode for a while 2022-10-07 22:16:54 -06:00
Lokathor 710d35e207 begin improving the VRAM interface 2022-10-07 20:52:50 -06:00
Lokathor 64ab0f05f0 make the demo do a little more. 2022-10-06 22:11:13 -06:00
Lokathor 0840f9a6f7 update example 2022-10-06 17:23:32 -06:00
Lokathor ff16e0bbc6 test out BitUnpack, fix bugs. 2022-10-06 17:14:34 -06:00
Lokathor c3aa7591b2 i forgot we're not using this any more. 2022-09-27 17:58:06 -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
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
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 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 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
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
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 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
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 0f031e6435 bitmap video explanation 2019-02-14 21:18:21 -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 d15168068b Add __IRQ_HANDLER symbol to hello_magic example
The hello_magic example does not depend on the gba crate, but the crt0
now assumes that the symbol for the interrupt handler which is defined
in it will be present, as interrupts ought to be handled in some
manner. If neither the symbol or the crate are added then the linker
will give an error, but if anything in the gba crate is used also then
the symbol will be brought in, so defining it manually also would
cause a duplicate definition error. In the future something like
cortex-m-rt's `exception!` macro could be used to better document how
to define this symbol (all their examples depend on at least one
symbol from their runtime library, so they don't have this problem).
2019-02-13 18:27:27 -08:00
Ian Pickering 0d654032bb Add module for interrupt request (IRQ) handling 2019-02-13 17:08:57 -08:00
Lokathor c360c2dce4 example updates 2019-02-13 01:47:12 -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 6466a53475 Move to the phantom_fields! proc-macro 2018-12-29 00:06:08 -07:00
Lokathor f99da154e8 minor fixes 2018-12-27 23:22:48 -07:00