Line 136:
Line 136:
== LCD Source Framebuffer Setup ==
== LCD Source Framebuffer Setup ==
+
+
All of these registers must be accessed with 32bit operations regardless of the registers' actual bit size.
+
{| class="wikitable" border="1"
{| class="wikitable" border="1"
! Offset
! Offset
−
! Length
! Name
! Name
! Comments
! Comments
|-
|-
| 0x00
| 0x00
−
| 4
+
| Pixel clock
−
| Pixel timer (not pixel clock)
+
| Higher values are slower, 12bits.
−
| Higher values are slower, min. 0x1C1, bitmask 0xFFF
+
+
Setting this value too low will make the screen not be able to sync any pixels other than a single one from the wrong location. The lowest the screen can handle is 0x1C1, with rare glitching.
|-
|-
| 0x04
| 0x04
−
| 4
+
| HBlank timer(?)
−
| HDispStart(?)
+
| Seems to determine the horizontal blanking interval.
−
| Values 0xD1-0x1C1 inclusive are valid (except 2DS bottom screen)
+
−
min. 0xD1, bitmask 0xFFF
+
+
Setting this to lower than <code>HTotal - HDisp</code> will make the screen not catch up with the scanlines, some will be skipped, some will be misaligned.
+
+
Setting this to higher than <code>HTotal - HDisp</code> will make the displayed image misaligned to the right.
+
+
Setting this to higher than <code>HTotal</code> seems to make the horizontal synchronization never happen.
|-
|-
| 0x08
| 0x08
−
| 4
| ?
| ?
| must be >= REG#0x00
| must be >= REG#0x00
|-
|-
| 0x0C
| 0x0C
−
| 4
| ?
| ?
| must be >= REG#0x08
| must be >= REG#0x08
|-
|-
| 0x10
| 0x10
−
| 4
+
| ???
−
| VAdjustGranule(?) or VBackPorch(?)
+
| Some sort of delay in signal, probably in the pixel clock
−
−
or
−
VAdjust(2DS bottom screen)
−
−
−
Seems to offset pixels relative to someting
−
−
(last row of pixels blitted increases by this amount;
−
−
setting this to lower than 2 will kill the screen timing)
−
| Finetune vertical pixel offset(blur screen), 0x1C2 max = half pixel
−
−
or (2DS)
−
offset the bottom screen (0 to kill top screen, 0x1C2 max on bottom screen)
|-
|-
| 0x14
| 0x14
−
| 4
+
| HBlank length(?)
−
| HStartMin(?) (poor 2DS emulation)
+
| ??? Seems to offset the screen to the left if this value is high enough, but can glitch out the syncing on the bottom screen
−
| if this value is bigger than some value then it'll trim the first (value - this value) pixels from every line
−
−
default value is 0xCF
|-
|-
| 0x18
| 0x18
−
| 4
| ???
| ???
| should be < REG#0x10
| should be < REG#0x10
|-
|-
| 0x20
| 0x20
−
| 4
| HFrontPorch(?)
| HFrontPorch(?)
| ??? the screen gets vertically offset with wrap-around
| ??? the screen gets vertically offset with wrap-around
Line 200:
Line 187:
|-
|-
| 0x24
| 0x24
−
| 4
| HSync timer?
| HSync timer?
|
|
|-
|-
| 0x28
| 0x28
−
| 4
| VDispStart(?) or VFrontPorch
| VDispStart(?) or VFrontPorch
|
|
|-
|-
| 0x30
| 0x30
−
| 4
| VTotal
| VTotal
| Total amount of vertical scanlines
| Total amount of vertical scanlines
|-
|-
| 0x34
| 0x34
−
| 4
| VDisp(?)
| VDisp(?)
| Total amonut of vertical scanlines displayed (only for top screen it seems like)
| Total amonut of vertical scanlines displayed (only for top screen it seems like)
|-
|-
| 0x44
| 0x44
−
| 4
| ???
| ???
| similar functionality to 0x10
| similar functionality to 0x10
|-
|-
| 0x4C
| 0x4C
−
| 4
| Overscan filler color
| Overscan filler color
|
|
|-
|-
| 0x50
| 0x50
−
| 4
| Horizontal position counter
| Horizontal position counter
| read-only
| read-only
|-
|-
| 0x54
| 0x54
−
| 4
| Horizontal scanline (HBlank) counter
| Horizontal scanline (HBlank) counter
| read-only
| read-only
|-
|-
| 0x5C
| 0x5C
−
| 4
| ???
| ???
| low u16: framebuffer width
| low u16: framebuffer width
Line 246:
Line 224:
|-
|-
| 0x60
| 0x60
−
| 4
| ???
| ???
| low u16: timing data(?)
| low u16: timing data(?)
Line 252:
Line 229:
|-
|-
| 0x64
| 0x64
−
| 4
| ???
| ???
| low u16: unknown
| low u16: unknown
Line 258:
Line 234:
|-
|-
| 0x68
| 0x68
−
| 4
| Framebuffer A first address
| Framebuffer A first address
| For top screen, this is the left eye 3D framebuffer.
| For top screen, this is the left eye 3D framebuffer.
|-
|-
| 0x6C
| 0x6C
−
| 4
| Framebuffer A second address
| Framebuffer A second address
| For top screen, this is the left eye 3D framebuffer.
| For top screen, this is the left eye 3D framebuffer.
|-
|-
| 0x70
| 0x70
−
| 4
| Framebuffer format
| Framebuffer format
| Bit0-15: framebuffer format, bit16-31: unknown
| Bit0-15: framebuffer format, bit16-31: unknown
|-
|-
| 0x78
| 0x78
−
| 4
| Framebuffer select
| Framebuffer select
| Bit0: which framebuffer to display, bit1-7: unknown
| Bit0: which framebuffer to display, bit1-7: unknown
|-
|-
| 0x80
| 0x80
−
| 4
| Color lookup table index select
| Color lookup table index select
| 8bits, write-only
| 8bits, write-only
|-
|-
| 0x84
| 0x84
−
| 4
| Color lookup table indexed element
| Color lookup table indexed element
| Contains the value of the color lookup table indexed by the above register, 24bits, RGB8 (0x00BBGGRR)
| Contains the value of the color lookup table indexed by the above register, 24bits, RGB8 (0x00BBGGRR)
Line 289:
Line 259:
|-
|-
| 0x90
| 0x90
−
| 4
| Framebuffer stride
| Framebuffer stride
| Distance in bytes between the start of two framebuffer rows (must be a multiple of 8).
| Distance in bytes between the start of two framebuffer rows (must be a multiple of 8).
|-
|-
| 0x94
| 0x94
−
| 4
| Framebuffer B first address
| Framebuffer B first address
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.
|-
|-
| 0x98
| 0x98
−
| 4
| Framebuffer B second address
| Framebuffer B second address
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.
| For top screen, this is the right eye 3D framebuffer. Unused for bottom screen.