diff --git a/README.md b/README.md index 2cecd2d..ba5cc22 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ do this stuff. dots as well as other support files: * crt0.s * linker.ld - * thumbv4-none-eabi.json + * thumbv4-nintendo-agb.json * build.rs 5) Run `arm-none-eabi-as crt0.s -o crt0.o` to build the `crt0.s` into a `crt0.o` @@ -38,7 +38,7 @@ do this stuff. `build.bat` file it's set to simply run every single time because it's a cheap enough operation. -6) Build with `cargo xbuild --target thumbv4-none-eabi.json` +6) Build with `cargo xbuild --target thumbv4-nintendo-agb.json` * The file extension is significant, and `cargo xbuild` takes it as a flag to compile dependencies with the same sysroot, so you can include crates normally. Well, crates that can run inside a GBA at least (Which means they @@ -47,7 +47,7 @@ do this stuff. helpful because it has debug symbols). 7) Also you can patch up the output to be a "real" ROM file: - * `arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/debug/gbatest target/output.gba` + * `arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/debug/gbatest target/output.gba` * `gbafix target/output.gba` 8) Alternately, you can use the provided `build.bat` file (or write a similar diff --git a/book/src/ch0/index.md b/book/src/ch0/index.md index 8aac0ac..4bda9fd 100644 --- a/book/src/ch0/index.md +++ b/book/src/ch0/index.md @@ -37,8 +37,10 @@ Now you'll need some particular files each time you want to start a new project. You can find them in the root of the [rust-console/gba repo](https://github.com/rust-console/gba). -* `thumbv4-none-eabi.json` describes the overall GBA to cargo-xbuild so it knows - what to do. +* `thumbv4-nintendo-agb.json` describes the overall GBA to cargo-xbuild so it + knows what to do. This is actually a somewhat made up target name since + there's no official target name, but this is the best name to pick based on + [how target names are decided](https://wiki.osdev.org/Target_Triplet). * `crt0.s` describes some ASM startup stuff. If you have more ASM to place here later on this is where you can put it. You also need to build it into a `crt0.o` file before it can actually be used, but we'll cover that below. @@ -55,7 +57,7 @@ Once you've got something to build, you perform the following steps: might as well do it every time so that you never forget to because it's a practically instant operation. -* `cargo xbuild --target thumbv4-none-eabi.json` +* `cargo xbuild --target thumbv4-nintendo-agb.json` * This builds your Rust source. It accepts _most of_ the normal options, such as `--release`, and options, such as `--bin foo` or `--examples`, that you'd expect `cargo` to accept. @@ -81,7 +83,7 @@ emulators can also do it. However, if you want a "real" ROM that works in all emulators and that you could transfer to a flash cart there's a little more to do. -* `arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba` +* `arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba` * This will perform an [objcopy](https://linux.die.net/man/1/objcopy) on our program. Here I've named the program `arm-none-eabi-objcopy`, which is what devkitpro calls their version of `objcopy` that's specific to the GBA in the @@ -95,7 +97,7 @@ transfer to a flash cart there's a little more to do. `cargo` arranges stuff in the `target/` directory, and between RLS and `cargo doc` and stuff it gets kinda crowded, so it goes like this: * Since our program was built for a non-local target, first we've got a - directory named for that target, `thumbv4-none-eabi/` + directory named for that target, `thumbv4-nintendo-agb/` * Next, the "MODE" is either `debug/` or `release/`, depending on if we had the `--release` flag included. You'll probably only be packing release mode programs all the way into GBA roms, but it works with either mode. diff --git a/book/src/ch1/the_display_control.md b/book/src/ch1/the_display_control.md index 21c66d6..3109c5f 100644 --- a/book/src/ch1/the_display_control.md +++ b/book/src/ch1/the_display_control.md @@ -43,9 +43,11 @@ locations on the screen. ## CGB Mode -Bit 3 is read only. It's on if you're running in CGB mode. Since we're making -GBA games you'd think that it'll never be on at all, but I guess you can change -it with BIOS stuff. Still, basically not an important bit. +Bit 3 is effectively read only. Technically it can be flipped using a BIOS call, +but when you write to the display control normally it won't write to this bit, +so we'll call it effectively read only. + +This bit is on if the CPU is in CGB mode. ## Page Flipping diff --git a/build.bat b/build.bat index 5dfac51..01f4336 100644 --- a/build.bat +++ b/build.bat @@ -3,12 +3,12 @@ arm-none-eabi-as crt0.s -o crt0.o @rem Build all examples, both debug and release -cargo xbuild --examples --target thumbv4-none-eabi.json -cargo xbuild --examples --target thumbv4-none-eabi.json --release +cargo xbuild --examples --target thumbv4-nintendo-agb.json +cargo xbuild --examples --target thumbv4-nintendo-agb.json --release @echo Packing examples into ROM files... @for %%I in (.\examples\*.*) do @( echo %%~nI - arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/release/examples/%%~nI target/example-%%~nI.gba >nul + arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/release/examples/%%~nI target/example-%%~nI.gba >nul gbafix target/example-%%~nI.gba >nul ) diff --git a/docs/ch0/index.html b/docs/ch0/index.html index 434256a..5cba0db 100644 --- a/docs/ch0/index.html +++ b/docs/ch0/index.html @@ -169,7 +169,7 @@ cargo will figure it all out for you.
You can find them in the root of the rust-console/gba repo.thumbv4-none-eabi.json
describes the overall GBA to cargo-xbuild so it knows
+thumbv4-nintendo-agb.json
describes the overall GBA to cargo-xbuild so it knows
what to do.crt0.s
describes some ASM startup stuff. If you have more ASM to place here
later on this is where you can put it. You also need to build it into a
@@ -190,7 +190,7 @@ practically instant operation.cargo xbuild --target thumbv4-none-eabi.json
cargo xbuild --target thumbv4-nintendo-agb.json
--release
, and options, such as --bin foo
or --examples
, that you'd
@@ -219,7 +219,7 @@ emulators can also do it.
transfer to a flash cart there's a little more to do.
arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba
arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba
arm-none-eabi-objcopy
, which is what
@@ -235,7 +235,7 @@ bare memory dump of the program.cargo doc
and stuff it gets kinda crowded, so it goes like this:
thumbv4-none-eabi/
thumbv4-nintendo-agb/
debug/
or release/
, depending on if we had
the --release
flag included. You'll probably only be packing release
mode programs all the way into GBA roms, but it works with either mode.thumbv4-none-eabi.json
describes the overall GBA to cargo-xbuild so it knows
+thumbv4-nintendo-agb.json
describes the overall GBA to cargo-xbuild so it knows
what to do.crt0.s
describes some ASM startup stuff. If you have more ASM to place here
later on this is where you can put it. You also need to build it into a
@@ -202,7 +202,7 @@ practically instant operation.cargo xbuild --target thumbv4-none-eabi.json
cargo xbuild --target thumbv4-nintendo-agb.json
--release
, and options, such as --bin foo
or --examples
, that you'd
@@ -231,7 +231,7 @@ emulators can also do it.
transfer to a flash cart there's a little more to do.
arm-none-eabi-objcopy -O binary target/thumbv4-none-eabi/MODE/BIN_NAME target/ROM_NAME.gba
arm-none-eabi-objcopy -O binary target/thumbv4-nintendo-agb/MODE/BIN_NAME target/ROM_NAME.gba
arm-none-eabi-objcopy
, which is what
@@ -247,7 +247,7 @@ bare memory dump of the program.cargo doc
and stuff it gets kinda crowded, so it goes like this:
thumbv4-none-eabi/
thumbv4-nintendo-agb/
debug/
or release/
, depending on if we had
the --release
flag included. You'll probably only be packing release
mode programs all the way into GBA roms, but it works with either mode.