a general note: unless otherwise stated, there is no "cost" to using any feature. i.e. it will not lower the framerate or disable access to other features. you can basically enable every feature, change every setting on every scanline, etc. with the only investment being the time it takes to actually configure graphics ram. otherwise the fdp is basically branchless
BEIcccciiiip
hccc cccv tttt tttt

Clipping

there are four global clipping intervals, each consisting of a left and right value. each layer (with sprite groups sharing clip settings) has the following clip settings:

layer enable
(idk if this counts as clipping but it's near the others)
global clip invert
invert all clipping
clip plane enable
1 = enabled
clip plane mode
0 = hide inside, 1 = hide outside
(todo)

to help you get your bearings, here is an overview of the layout of graphics ram: (todo: baby mode table)

There are four playfields consisting of a 32x32 or 64x32 grid of 16x16px tiles.

Playfield Tile

Address (normal)

⋯,0,0,1,0,pf:3,y:5,x:5,-:2

Address (extend mode)

⋯,0,0,1,pf:3,y:5,x:6,-:2
pf
playfield id
0,1,2,3
regular playfield data
4,5
alternate data for playfields 2 and 3
y
y index (0-31)
x
x index (0-31 or 0-64)

Data

h,v,chr2:2,bpp:2,bs,palette:9,character:16
character
0:16
character id (lower bits)
palette
16:9
palette id (0⋯511)
bs
25:1
blend select
bpp
26:2
texture bit planes (bits per pixel select)
0
4bpp
1
5bpp
2
?
3
6bpp
chr2
28:2
character id (upper bits)
v
30:1
1
vertical flip
h
31:1
1
horizontal flip

the pivot layer is a 64x64 grid of 8x8 tiles, which gets its textures from RAM instead of ROM. it can either be in "text mode" (where the texture is looked up based on the tile's id) or "pixel mode" (where each cell has a unique texture, whose address depends on its position in the grid, effectively giving you a 512x256 bitmap, though the pixels are in a weird order)

Pivot Tile

Address

⋯,0,1,1,1,0,y:6,x:6,-
y
y index (0-63)
x
x index (0-63)

Data

h,pal:6,v,chr:8
chr
character id (0-255)
v
1
vertical flip
pal
palette id (0-63)
h
1
horizontal flip

Pivot Texture

Address (Text Mode)

⋯,0,1,1,1,1,chr:8,-:5
chr
character id (0-255)

Address (Pixel Mode)

⋯,1,b,x:6,y:5,-:5
b
pivot pixel bank (set in lineram)
x
tile x index (0-63)
y
tile y index (0-31; top and bottom halves of the pivot layer use same textures in pixel mode)

Data (×8)

b:4,b:4,b:4,b:4,b:4,b:4,b:4,b:4
b
data for 1 pixel describe the bit order better - maybe we need a separate page for bitmap formats because they are all different

pixel mode is similar to text mode, but the data for each tile is fetched based on the tile's position rather than the tile index in the text data.

common layer properties

display enable
0
off
1
on
(todo: hm does disabling turn off the updating of y position based on zoom?)
priority
0-15. higher = above other things. two layers with the same priority can cause a conflict.
clip invert
0
normal
1
inverted
clip plane enable ×4
one per clip plane
0
off
1
on
clip plane mode ×4
one per clip plane
0
hide inside
1
hide outside
blend mode
which half-pixel(s) to contribute to. encoding varies by layer
blend select
which of the 2 possible blend values will be used for a given half-pixel
mosaic enable
0
off
1
on

note: lineram section 0 is missing its first 2 subsections (0.0 "4000" and 0.1 "4200"), so per-line y scroll adjust and alternate tilemap are only available on playfields 2 and 3.

Lineram Section 0.2 "4400" - “Colscroll”, Alt Tilemap, Clip Bits

1R,1L,0R,0L,?:2,alt,yscroll:9
yscroll
playfield 2: y scroll adjust data format
alt
playfield 2: tile data location
0
normal
1
alternate (tilemap number+2)
0L
clip plane 0 left (upper bit)
0R
clip plane 0 right (upper bit)
1L
clip plane 1 left (upper bit)
1R
clip plane 1 right (upper bit)

Lineram Section 0.3 "4600"

(same as 0.3, but for playfield 3 and clip planes 2 and 3)

Lineram Section 1.0 "5000" - Clip Plane Values

right:8,left:8
left
clip plane 0 left (lower bits)
data format
right
clip plane 0 right (lower bits)

Lineram Section 1.1 "5200"

(same as 1.0, but for clip plane 1)

Lineram Section 1.2 "5400"

(same as 1.0, but for clip plane 2)

Lineram Section 1.3 "5600"

(same as 1.0, but for clip plane 3)

Lineram Section 2.0 "6000" - Misc Blending, Pivot Mode

B,?,P,?,o,b,p,h,s3:2,s2:2,s1:2,s0:2
sn
sprite group n: blend mode (note 0 and 3 are swapped)
0
neither
1
left
2
right
3
both
h
highcolor layer: blend value select
p
pivot: blend value select
b
background color: blend value select
o
tilemap infinite vertical stretch?
P
pivot: mode
0
text
1
pixel
B
pivot: pixel data location
0
$620000 (conflicts with lineram)
1
$630000

Lineram Section 2.1 "6200" - Blend Alpha Values

left1:4,left0:4,right1:4,right0:4
right0
right half-pixel, blend select = 0
alpha = clamp((15-value)/8, 0, 1)
$0-$7
100%
$B
50%
$F
0%
right1
right half-pixel, blend select = 1
left0
left half-pixel, blend select = 0
left1
left half-pixel, blend select = 1

Lineram Section 2.2 "6400" - Mosaic and Fda Settings

fda:2,b,?,S,g,h,s,mosaic:4,p3,p2,p1,p0
pn
playfield n: mosaic enable
mosaic
mosaic strength: samples every [16−m] pixels
s
sprites: mosaic enable
h
hicolor layer: mosaic enable
g
shadow mode alternate: if shadow mode is enabled, changes its behavior figure this out
S
"shadow mode": if 2 layers have neighboring priorities and the lower one is non-empty, the upper layer's palette is altered: 4th bit of the color index (i.e. the 0th bit of the palette id) is set to 1 - todo: this may be different depending on the bpp setting
notes: this effect is done separately for every half pixel (this effect is probably implemented inside the priority cell array, unlike everything else). note: the background color layer (as well as priority conflicts) count as empty pixels
b
fda: horizontal blur
0
blurred
1
normal
fda
fda mode
0
15-bit rgb format (legacy mode)
1
normal mode
2
no blending, display half-pixels separately (debug mode?)
3
invalid? first pixel repeats all the way across

Lineram Section 2.3 "6600" - Background Color

.:3,color:13
color
background color: color index

Lineram Section 3.0 "7000" - Highcolor Layer Blending

bm:2,E,I,c3,c2,c1,c0,i3,i2,i1,i0,prio:4
prio
highcolor layer: priority (0-15)
in
highcolor layer: clip plane n mode
cn
highcolor layer: clip plane n enable
I
highcolor layer: clip invert
E
highcolor layer: enable
bm
highcolor layer: blend mode
0
both
1
right?
2
right?
3
right?
figure out what 1,2,3 do

Lineram Section 3.1 "7200" - Pivot Layer Blending

bm,?,E,I,c3,c2,c1,c0,i3,i2,i1,i0,prio:4
prio
pivot: priority (0-15)
in
pivot: clip plane n mode
cn
pivot: clip plane n enable
I
pivot: clip invert
E
pivot: enable
bm
pivot: blend mode (note different interpretation than elsewhere)
0
both
1
left

Lineram Section 3.2 "7400" - Sprite Blending

s3,s2,s1,s0,?,?,E,I,c3,c2,c1,c0,i3,i2,i1,i0
in
sprites: clip plane n mode
cn
sprites: clip plane n enable
I
sprites: clip invert
E
sprites: enable
sn
sprite group n: blend select

Lineram Section 3.3 "7600" - Sprite Priorities

prio3:4,prio2:4,prio1:4,prio0:4
prion
sprite group n: priority

Lineram Section 4.0 "8000" - Playfield 0 Zoom

hzoom:8,vzoom:8
vzoom
playfield 0: vertical zoom
factor = 1 / (zoom/128)
$00
∞×
$40
2×
$80
1×
$C0
0.667×
$FF
0.502×
hzoom
playfield 0: horizontal zoom
factor = 1 / (1 - zoom/256)
$00
1×
$40
1.333×
$80
2×
$C0
4×
$FF
256×

Lineram Section 4.1 "8200" - Playfield 1 Zoom

hzoom:8,vzoom:8
vzoom
playfield 3*: vertical zoom
*bug: playfields 1 and 3 have their vertical zooms swapped
hzoom
playfield 1: horizontal zoom

Lineram Section 4.2 "8400" - Playfield 2 Zoom

hzoom:8,vzoom:8
vzoom
playfield 2: vertical zoom
hzoom
playfield 2: horizontal zoom

Lineram Section 4.3 "8600" - Playfield 3 Zoom

hzoom:8,vzoom:8
vzoom
playfield 1*: vertical zoom
hzoom
playfield 3: horizontal zoom

Lineram Section 5.0 "9000" - Playfield 0 Palette Adjust

.:10,palette:6
palette
playfield 0: added to the palette of all tiles

Lineram Section 5.1 "9200"

(same as 5.0, but for playfield 1)

Lineram Section 5.2 "9400"

(same as 5.0, but for playfield 2)

Lineram Section 5.3 "9600"

(same as 5.0, but for playfield 3)

Lineram Section 6.0 "A000" - "Rowscroll"

xscroll:16
xscroll
playfield 0: x scroll adjust (same format as global scroll)

Lineram Section 7.0 "B000" - Playfield 0 Blending

bm:2,E,I,c3,c2,c1,c0,i3,i2,i1,i0,prio:4
prio
playfield 0: priority (0-15)
in
playfield 0: clip plane n mode
cn
playfield 0: clip plane n enable
I
playfield 0: clip invert
E
playfield 0: enable
bm
playfield 0: blend mode
0
both
1
left
2
right
3
neither

Lineram Section 7.2 "B200"

(same as 7.0, but for playfield 1)

Sprite List Entry

Address

⋯,0,0,bank:2,index:10,f:3,-
bank
bank (set by command)
index
sprite id
field
field number

Field 0

chr:16
chr
character id (lower bits)

Field 1

yzoom:8,xzoom:8
xzoom
horizontal zoom
scale = 1 - zoom/256
$00
1×
$40
0.75×
$80
0.5×
$C0
0.25×
$FF
0.004×
yzoom
vertical zoom (same format)

Field 2

i:2,s:2,x:12
x
x position (signed int, pixels)
s
set scrolls from position value (happens first)
0
neither
1
local
2
global
3
both
i
adjust position
0 or 2
add both scrolls
1
add global scroll
3
none

Field 3

c,.:3,y:12
y
y position (signed int, pixels)
c
1
command mode

Field 4

x:2,?,y,M,p,v,h,pal:8
pal
palette id (0-255)
h
horizontal flip
v
vertical flip
p
palette lock
1
reuse previous palette
0
use new palette
M
"multi" - this bit affects the next sprite not the current one
0
read zoom value, and update block origin from given position
1
don't
y
y tessellation control (where to place sprite)
0
at block origin (if M was 0, this will be the given position)
1
south of prev sprite
x
x tessellation control (where to place sprite)
0
at the given position
1
same as prev sprite
2* or 3
right of prev sprite
*2 is the same as 3, but the first row is rendered at the wrong position for some reason

Field 5 (always, affects current sprite)

.:8,fmt:4,?,?,chr2:2
chr2
character id (upper bits) - this might be more than 2 bits
fmt
bitmap format - affects the order of pixels loaded from rom?

Field 5 (additional effects in command mode, sets persistent settings)

?,?,k,j,?,b1,g,f,?,a:3,?,?,t,b0
b0
lower bit of bank
t
? supposedly disables clearing framebuffer but seems to be something else
a
? affects visiblity of sprites or something
f
sets palettes to 0(?), and then adds some garbage pixels around the sprites which do a palette offset? not sure where these come from, they seem consistent?
g
similar to f but different
b1
upper bit of bank
j
changes video signal (causes us to lose sync, but definitely still outputting a picture)
k
flipscreen

Field 6

j,.:5,dest:10
dest
jump destination (next sprite index to process)
j
1
do a jump
0
increment index normally