38 Commits

Author SHA1 Message Date
3338b611c1 aica: initial working example
This plays 10 seconds of PCM audio via the AICA ARM CPU.
2024-02-29 16:51:25 +08:00
5b696f7c0d aica: initial register definitions 2024-02-28 21:37:26 +08:00
10d17d3c98 example: add gdrom_iso9660
This combines my iso9660 parsing code, with all of the prior gdrom packet
interface / command code.

The example, on real Dreamcast hardware, displays the first 2048 bytes [1] of every
file in the root directory on the serial console.

[1] or the size of the file, whichever is smaller
2024-02-27 00:28:39 +08:00
41b707e75d gdrom: add gdrom_bits 2024-02-26 18:04:23 +08:00
c95182081a gdrom: add gdrom_command_packet_format.hpp
This re-uses most of the code from the ta_parameter_format
generator--this was factored out to "generic_sparse_struct.py".
2024-02-26 15:31:40 +08:00
d622ee04a7 regs/gen: factor out read_input to a new module, csv_input 2024-02-26 14:19:05 +08:00
5a32d6816b common.mk: fully parameterize scramble rule 2024-02-25 14:00:40 +08:00
c851070604 gdrom: add gdrom register definitions 2024-02-24 17:04:39 +08:00
38b4dda6ab software_ta: gouraud shading experiment 2024-02-24 09:31:21 +08:00
59708cc3cf examples: add software_ta 2024-02-23 23:47:43 +08:00
aed943ccad heart: duplicate pi declaration 2024-02-23 15:27:16 +08:00
511d99563d maple_bus_commands: zero-sized structs should be zero sized
From the GCC manual.

> GCC permits a C structure to have no members:

struct empty {
};

> The structure has size zero. In C++, empty structures are part of the
> language. G++ treats empty structures as if they had a single member of type
> char.

I was not aware of the different behavior in C++.

This fixes every maple example--most were broken for multiple reasons, including
this one.

This also enables SH4 caching. This includes linking code/data into the P1
area (previously this was not the case).

The maple examples (which indeed involve much use of DMA) require much work to
successfully work with the operand and copyback caches. The vibration example
currently is the most complete, though I should consider more on how I want to
structure maple response operand cache invalidation more generally.
2024-02-02 22:05:10 +08:00
dcb9f36120 sh7091_bits.ods: partial
Notably missing is:

- BSC (PDTRA / PCTRA)

This also updates a handful of files to use the new sh7091_bits.hpp.
2024-01-01 23:43:06 +08:00
0b6c650ebd common.mk: add headless csv build rule 2024-01-01 00:58:10 +08:00
e8aea009c6 example: add heart
I originally planned to make this a render-to-texture demo, but this
is fairly interesting by itself.
2023-12-31 20:19:41 +08:00
de76c0bed2 ta_parameter_format: generate TA parameter formats from csv
This replaces all handwritten TA parameter format structures with
automatically generated structures.

All valid TA parameter formats are now declared.
2023-12-30 18:55:09 +08:00
4bb04a0362 example: add maple_analog
Also adds the incomplete modifier_volume example.

This also adds vec2 for UV coordinates, and obj_to_cpp has been
modified to parse vertex texture coordinates from obj files.
2023-12-30 10:53:39 +08:00
e340c3ca02 example: add icosphere 2023-12-24 17:48:20 +08:00
befedb9d38 example: add lighted cube
This also copy-pastes all of the math headers I originally wrote in
saturn-examples.
2023-12-24 16:24:27 +08:00
3b7e1eaef8 example: implement font_outline
This still needs to be cleaned up, particularly to properly pass the
texture size around--there are a few unnecessary '128x256' magic
numbers scattered in the code.
2023-12-22 00:03:52 +08:00
5c2b45b70d example: refresh
All examples work again, except macaw_multipass--this never worked
entirely, so I'm not worried about fixing it at the moment.
2023-12-17 22:45:52 +08:00
59f8c1b3ff cube: a perspective cube 2023-12-17 17:04:34 +08:00
5a9790daf1 examples: add font example 2023-12-17 02:03:42 +08:00
2689ad4011 example: add maple_controller
This broke maple_wink. I have not yet found why this happened.
2023-12-15 17:13:53 +08:00
c5078cb030 example: add translucency example
The macaw_multipass example does not work on real hardware.
2023-12-14 20:57:44 +08:00
25e299feba new "example" directory
This is a reshuffling of filenames, extensions, paths, make rules,
just because I felt like it.
2023-12-12 21:50:39 +08:00
855cbba403 maple: write data to a VMU display
This draws a smiley-face bitmap to a VMU display on port 1.
2023-12-11 18:07:05 +08:00
f1a32d0719 maple: send a 'device request' command
On an emulator, the receive buffer is filled with the correct/expected
data for 'device status'.

I found this experiment useful:

- it revealed a bug in my register struct generator code (the
  maple_if-related registers were not at the correct offsets)

- it validates my understanding about endianness-swapping between the
  maple bus and the SH4
2023-12-09 01:31:34 +08:00
6cebd0ce90 ta_parameter: TA parameter initialization experiment
This also includes an example for generating a quad primitive. In
flycast, this is very obviously rendered as two triangles. On real
hardware, this appears to be a "native" quad.
2023-12-07 00:46:43 +08:00
9610c428bd draw a textured triangle strip
This draws a nice macaw texture in a square-shaped triangle
strip. The square is then rotated around the y-axis.

I dealt with myriad bugs while experimenting with this, all of them
entirely my fault:

- macaw texture colors were incorrect because GIMP was exporting raw
  RGB data in gamma-corrected sRGB space, whereas the Dreamcast is in
  linear color space.

- macaw texture colors were incorrect because I truncated color values
  to the least significant rather than most significant bits.

- macaw rotation around the Y axis caused the macaw texture to
  distort, stretch and recurse in interesting and unexpected ways. This
  was caused by sending Z values in the wrong coordinate space (Z)
  contrast to what is expected by the Dreamcast (1/z). Reordering
  z-coordinate operations so that the reciprocal is computed last
  resolved this.

- macaw rotation around the Y axis caused the macaw texture to warp
  unexpectedly, but only on real hardware. This was caused by
  unnecessarily negating Z coordinate values.

Behavior for each of the Z-coordinate issues differed between Flycast
and real Dreamcast hardware.

I also did several tests related to SH4 cache behavior, particularly
related to the "copy-back" mode. I verified copy-back behavior on a
real dreamcast, and experimented with the operand cache write-back
instruction, "ocbwb".

In particular, when the `scene` buffer is access from cacheable
memory, e.g: the P1 area, and CCR__CB is enabled, DMA from physical
memory to the TA FIFO polygon converter will fail because the scene
data has not yet been written to physical memory yet. `ocbwb` can be
used to "write back" scene from the SH4 operand cache to physical
memory--only the latter is visible from the CH2-DMA perspective.
2023-12-06 21:18:14 +08:00
b99722a6df _bits: use more bits generated from spreadsheets
This rearranges scene.cpp to a file organization that more closely
follows which code is responsible for what area of (hardware)
initialization.

All TA and CORE register accesses now use the new ta_bits.h and
core_bits.h, respectively.
2023-12-05 00:16:38 +08:00
963aa75990 scene: rotating triangle
This now works on real dreamcast hardware.
2023-12-04 09:53:27 +08:00
bc0b94b437 dummy read from serial before starting serial transfer 2023-12-02 13:35:42 +08:00
ff2dcc7d71 draw 1 triangle 2023-11-30 10:02:49 +08:00
060977091d ip.lds: .text.sg.* input section references
The input section names changed from .text. to .text.sg. when the sg object
files were moved to the sg directory.
2023-10-28 10:17:34 -07:00
329ada55f1 add code loading and test program
This was used to troubleshoot video output and framebuffer
configuration registers.
2023-10-16 19:24:51 +00:00
2bcf1aedef cache: clear all instruction/operand caches 2023-10-12 09:43:54 -07:00
327e57a520 initial cd image build system 2023-10-11 18:49:58 +00:00