27#define B8_PPU_ADDR (0xffff8000)
28#define B8_PPU_EXEC _B8_REG(B8_PPU_ADDR + 0x00)
29#define B8_PPU_STAT _B8_REG(B8_PPU_ADDR + 0x04)
30#define B8_PPU_INTCTRL _B8_REG(B8_PPU_ADDR + 0x08)
31#define B8_PPU_RESOLUTION _B8_REG(B8_PPU_ADDR + 0x0c)
33#define B8_PPU_CMD_NOP (0x00)
34#define B8_PPU_CMD_FLUSH (0x01)
35#define B8_PPU_CMD_ENABLE (0x02)
36#define B8_PPU_CMD_RECT (0x10)
37#define B8_PPU_CMD_POLY (0x11)
38#define B8_PPU_CMD_SPRITE (0x12)
39#define B8_PPU_CMD_SETPAL (0x13)
40#define B8_PPU_CMD_SETPHYPAL (0x14)
41#define B8_PPU_CMD_BG (0x15)
42#define B8_PPU_CMD_SCISSOR (0x16)
43#define B8_PPU_CMD_VIEWOFFSET (0x17)
44#define B8_PPU_CMD_LOADIMG (0x20)
45#define B8_PPU_CMD_LINE (0x21)
46#define B8_PPU_CMD_JMP (0xf0)
47#define B8_PPU_CMD_HALT (0xff)
49#define B8_PPU_COLOR_BLACK (0)
50#define B8_PPU_COLOR_DARK_BLUE (1)
51#define B8_PPU_COLOR_DARK_PURPLE (2)
52#define B8_PPU_COLOR_DARK_GREEN (3)
53#define B8_PPU_COLOR_BROWN (4)
54#define B8_PPU_COLOR_DARK_GREY (5)
55#define B8_PPU_COLOR_LIGHT_GREY (6)
56#define B8_PPU_COLOR_WHITE (7)
57#define B8_PPU_COLOR_RED (8)
58#define B8_PPU_COLOR_ORANGE (9)
59#define B8_PPU_COLOR_YELLOW (10)
60#define B8_PPU_COLOR_GREEN (11)
61#define B8_PPU_COLOR_BLUE (12)
62#define B8_PPU_COLOR_LAVENDER (13)
63#define B8_PPU_COLOR_PINK (14)
64#define B8_PPU_COLOR_LIGHT_PEACH (15)
67 B8_BLACK = B8_PPU_COLOR_BLACK,
68 B8_DARK_BLUE = B8_PPU_COLOR_DARK_BLUE,
69 B8_DARK_PURPLE = B8_PPU_COLOR_DARK_PURPLE,
70 B8_DARK_GREEN = B8_PPU_COLOR_DARK_GREEN,
71 B8_BROWN = B8_PPU_COLOR_BROWN,
72 B8_DARK_GREY = B8_PPU_COLOR_DARK_GREY,
73 B8_LIGHT_GREY = B8_PPU_COLOR_LIGHT_GREY,
74 B8_WHITE = B8_PPU_COLOR_WHITE,
75 B8_RED = B8_PPU_COLOR_RED,
76 B8_ORANGE = B8_PPU_COLOR_ORANGE,
77 B8_YELLOW = B8_PPU_COLOR_YELLOW,
78 B8_GREEN = B8_PPU_COLOR_GREEN,
79 B8_BLUE = B8_PPU_COLOR_BLUE,
80 B8_LAVENDER = B8_PPU_COLOR_LAVENDER,
81 B8_PINK = B8_PPU_COLOR_PINK,
82 B8_LIGHT_PEACH = B8_PPU_COLOR_LIGHT_PEACH,
87#define B8_PPU_EXEC_START (0x1)
94#define B8_PPU_BG_WRAP_CLAMP (0x00)
101#define B8_PPU_BG_WRAP_CLAMP_TO_EDGE (0x01)
108#define B8_PPU_BG_WRAP_REPEAT (0x02)
112#define PACKED_ALIGNED1 __attribute__((__packed__,aligned(1)))
113#define PACKED_ALIGNED4 __attribute__((__packed__,aligned(4)))
371#define B8_PPU_MAX_WTILE (64)
379#define B8_PPU_MAX_HTILE (64)
796#define B8_PPU_CMD_ENABLE_CULLING_OF_POLYGONS (1<<0)
b8PpuPoly * b8PpuPolyAlloc(b8PpuCmd *cmd_)
Allocates and initializes a polygon drawing command in the PPU command buffer.
Definition ppu.c:152
struct _b8PpuCmd b8PpuCmd
Structure representing a PPU command buffer for the BEEP-8 system.
b8PpuSetpal * b8PpuSetpalAlloc(b8PpuCmd *cmd_)
Allocates and initializes a SETPAL command in the PPU command buffer.
Definition ppu.c:62
void b8PpuCmdSetBuff(b8PpuCmd *cmd_, u32 *buff_, u32 bytesize_)
Sets the buffer for PPU commands.
Definition ppu.c:11
b8PpuLoadimg * b8PpuLoadimgAllocZ(b8PpuCmd *cmd_, u32 otz)
Allocates and initializes an image loading command in the PPU command buffer with a specified Z-order...
Definition ppu.c:302
b8PpuLoadimg * b8PpuLoadimgAlloc(b8PpuCmd *cmd_)
Allocates and initializes an image loading command in the PPU command buffer.
Definition ppu.c:294
void b8PpuPushFrontOT(b8PpuCmd *cmd_, u32 otz_, void *prim_)
Adds a primitive to the front of the Ordering Table (OT) at the specified Z-value.
Definition ppu.c:353
b8PpuLine * b8PpuLineAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a line drawing command in the PPU command buffer with a specified Z-order,...
Definition ppu.c:186
b8PpuFlush * b8PpuFlushAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a flush command in the PPU command buffer with a specified Z-order.
Definition ppu.c:241
b8PpuPoly * b8PpuPolyAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a polygon drawing command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:160
struct PACKED_ALIGNED4 _b8PpuLoadimg b8PpuLoadimg
Structure representing an image loading command for the PPU (Pixel Processing Unit).
b8PpuBg * b8PpuBgAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a background drawing command in the PPU command buffer with a specified Z-o...
Definition ppu.c:140
b8PpuSprite * b8PpuSpriteAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a sprite drawing command in the PPU command buffer with a specified Z-order...
Definition ppu.c:50
b8PpuHalt * b8PpuHaltAlloc(b8PpuCmd *cmd_)
Allocates and initializes a halt command in the PPU command buffer.
Definition ppu.c:253
b8PpuSprite * b8PpuSpriteAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a sprite drawing command in the PPU command buffer with a specified Z-order...
Definition ppu.c:56
b8PpuHalt * b8PpuHaltAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a halt command in the PPU command buffer with a specified Z-order.
Definition ppu.c:261
b8PpuViewoffset * b8PpuViewoffsetAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a view offset command in the PPU command buffer with a specified Z-order,...
Definition ppu.c:206
struct PACKED_ALIGNED4 _b8PpuSprite b8PpuSprite
Structure representing a sprite drawing command for the PPU (Pixel Processing Unit).
b8PpuViewoffset * b8PpuViewoffsetAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a view offset command in the PPU command buffer with a specified Z-order.
Definition ppu.c:200
struct PACKED_ALIGNED4 _b8PpuFlush b8PpuFlush
Structure representing a flush command for the PPU (Pixel Processing Unit).
void b8PpuEnableVblankInterrupt(void)
Enables the V-blank interrupt for the PPU.
Definition ppu.c:108
b8PpuLoadimg * b8PpuLoadimgAllocZPB(b8PpuCmd *cmd_, u32 otz)
Allocates and initializes an image loading command in the PPU command buffer with a specified Z-order...
Definition ppu.c:308
b8PpuJmp * b8PpuJmpAlloc(b8PpuCmd *cmd_, u32 *cpuaddr_)
Allocates and initializes a PPU jump command.
Definition ppu.c:314
b8PpuBg * b8PpuBgAlloc(b8PpuCmd *cmd_)
Allocates and initializes a background drawing command in the PPU command buffer.
Definition ppu.c:132
b8PpuScissor * b8PpuScissorAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a scissor (clipping) command in the PPU command buffer with a specified Z-o...
Definition ppu.c:126
struct PACKED_ALIGNED4 _b8PpuBg b8PpuBg
Structure representing a background configuration command for the PPU (Pixel Processing Unit).
b8PpuEnable * b8PpuEnableAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes an enable/disable command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:282
struct PACKED_ALIGNED4 _b8PpuScissor b8PpuScissor
Structure representing a scissor (clipping) command for the PPU (Pixel Processing Unit).
b8PpuNop * b8PpuNopAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a no-operation (NOP) command in the PPU command buffer with a specified Z-o...
Definition ppu.c:220
struct PACKED_ALIGNED4 _b8PpuLine b8PpuLine
Structure representing a line drawing command for the PPU (Pixel Processing Unit).
b8PpuEnable * b8PpuEnableAlloc(b8PpuCmd *cmd_)
Allocates and initializes an enable/disable command in the PPU command buffer.
Definition ppu.c:273
void b8PpuExec(b8PpuCmd *cmd_)
Executes the PPU commands stored in the buffer.
Definition ppu.c:101
struct PACKED_ALIGNED4 _b8PpuRect b8PpuRect
Structure representing a rectangle drawing command for the PPU (Pixel Processing Unit).
b8PpuPoly * b8PpuPolyAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a polygon drawing command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:166
b8PpuRect * b8PpuRectAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a rectangle drawing command in the PPU command buffer with a specified Z-or...
Definition ppu.c:29
void b8PpuCmdPush(b8PpuCmd *cmd_, u32 word_)
Pushes a command word onto the PPU command buffer.
Definition ppu.c:16
b8PpuNop * b8PpuNopAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a no-operation (NOP) command in the PPU command buffer with a specified Z-o...
Definition ppu.c:226
void b8PpuClearOT(b8PpuCmd *cmd_, u32 *ot_, u32 *ot_prev_, u32 num_)
Allocates and initializes an Ordering Table (OT) for the PPU commands.
Definition ppu.c:327
b8PpuNop * b8PpuNopAlloc(b8PpuCmd *cmd_)
Allocates and initializes a no-operation (NOP) command in the PPU command buffer.
Definition ppu.c:212
b8PpuSetpal * b8PpuSetpalAllocZPB(b8PpuCmd *cmd_, u32 otz, u8 flush)
Allocates and initializes a palette setting command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:88
struct PACKED_ALIGNED4 _b8PpuViewoffset b8PpuViewoffset
Structure representing a view offset command for the PPU (Pixel Processing Unit).
b8PpuLine * b8PpuLineAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a line drawing command in the PPU command buffer with a specified Z-order.
Definition ppu.c:180
b8PpuSetpal * b8PpuSetpalAllocZ(b8PpuCmd *cmd_, u32 otz, u8 flush)
Allocates and initializes a palette setting command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:76
struct PACKED_ALIGNED4 _b8PpuSetpal b8PpuSetpal
Structure representing a palette setting command for the PPU (Pixel Processing Unit).
b8PpuSprite * b8PpuSpriteAlloc(b8PpuCmd *cmd_)
Allocates and initializes a sprite drawing command in the PPU command buffer.
Definition ppu.c:41
void b8PpuPushBackOT(b8PpuCmd *cmd_, u32 otz_, void *prim_)
Adds a primitive to the end of the Ordering Table (OT) at the specified Z-value.
Definition ppu.c:367
b8PpuRect * b8PpuRectAlloc(b8PpuCmd *cmd_)
Allocates and initializes a rectangle drawing command in the PPU command buffer.
Definition ppu.c:21
void b8PpuVsyncWait(void)
Waits for the next V-blank interval.
Definition ppu.c:390
void b8PpuReset(void)
Resets the PPU system.
Definition ppu.c:385
struct PACKED_ALIGNED4 _b8PpuHalt b8PpuHalt
Structure representing a halt command for the PPU (Pixel Processing Unit).
struct PACKED_ALIGNED4 _b8PpuJmp b8PpuJmp
Structure representing a jump command for the PPU (Pixel Processing Unit).
b8PpuViewoffset * b8PpuViewoffsetAlloc(b8PpuCmd *cmd_)
Allocates and initializes a view offset command in the PPU command buffer.
Definition ppu.c:192
struct PACKED_ALIGNED4 _b8PpuPoly b8PpuPoly
Structure representing a polygon drawing command for the PPU (Pixel Processing Unit).
b8PpuScissor * b8PpuScissorAllocZ(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a scissor (clipping) command in the PPU command buffer with a specified Z-o...
Definition ppu.c:120
b8PpuFlush * b8PpuFlushAlloc(b8PpuCmd *cmd_)
Allocates and initializes a flush command in the PPU command buffer.
Definition ppu.c:232
b8PpuBg * b8PpuBgAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a background drawing command in the PPU command buffer with a specified Z-o...
Definition ppu.c:146
b8PpuHalt * b8PpuHaltAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a halt command in the PPU command buffer with a specified Z-order,...
Definition ppu.c:267
struct PACKED_ALIGNED4 _b8PpuEnable b8PpuEnable
Structure representing an enable/disable command for the PPU (Pixel Processing Unit).
b8PpuScissor * b8PpuScissorAlloc(b8PpuCmd *cmd_)
Allocates and initializes a scissor (clipping) command in the PPU command buffer.
Definition ppu.c:112
b8PpuEnable * b8PpuEnableAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes an enable/disable command in the PPU command buffer with a specified Z-orde...
Definition ppu.c:288
b8PpuLine * b8PpuLineAlloc(b8PpuCmd *cmd_)
Allocates and initializes a line drawing command in the PPU command buffer.
Definition ppu.c:172
void b8PpuGetResolution(u32 *ww, u32 *hh)
Gets the current screen resolution.
Definition ppu.c:394
b8PpuRect * b8PpuRectAllocZPB(b8PpuCmd *cmd_, u32 otz_)
Allocates and initializes a rectangle drawing command in the PPU command buffer with a specified Z-or...
Definition ppu.c:35
struct PACKED_ALIGNED1 _b8PpuBgTile b8PpuBgTile
Structure representing a background tile for the PPU (Pixel Processing Unit).
Peripheral register map definitions for the BEEP-8 system.
Structure representing a background configuration command for the PPU (Pixel Processing Unit).
Definition ppu.h:384
unsigned htile
Definition ppu.h:385
signed upix
Definition ppu.h:394
unsigned wtile
Definition ppu.h:387
signed vpix
Definition ppu.h:393
unsigned na0
Definition ppu.h:386
unsigned na2
Definition ppu.h:398
unsigned code
Definition ppu.h:389
unsigned uwrap
Definition ppu.h:397
unsigned na1
Definition ppu.h:388
unsigned vwrap
Definition ppu.h:396
b8PpuBgTile * cpuaddr
Definition ppu.h:391
Structure representing a background tile for the PPU (Pixel Processing Unit).
Definition ppu.h:357
unsigned XTILE
Definition ppu.h:359
unsigned HFP
Definition ppu.h:361
unsigned YTILE
Definition ppu.h:358
unsigned VFP
Definition ppu.h:360
unsigned PAL
Definition ppu.h:362
Structure representing a PPU command buffer for the BEEP-8 system.
Definition ppu.h:120
u32 * sp
Definition ppu.h:123
u32 * tail
Definition ppu.h:124
u32 * ot
Definition ppu.h:126
u32 otnum
Definition ppu.h:128
u32 * buff
Definition ppu.h:121
u32 bytesize
Definition ppu.h:122
Structure representing an enable/disable command for the PPU (Pixel Processing Unit).
Definition ppu.h:782
unsigned na0
Definition ppu.h:784
unsigned cul
Definition ppu.h:783
unsigned code
Definition ppu.h:785
Structure representing a flush command for the PPU (Pixel Processing Unit).
Definition ppu.h:687
unsigned na0
Definition ppu.h:690
unsigned pal
Definition ppu.h:688
unsigned img
Definition ppu.h:689
unsigned code
Definition ppu.h:691
Structure representing a halt command for the PPU (Pixel Processing Unit).
Definition ppu.h:728
unsigned na0
Definition ppu.h:729
unsigned code
Definition ppu.h:730
Structure representing a jump command for the PPU (Pixel Processing Unit).
Definition ppu.h:915
unsigned cpuaddr4
Definition ppu.h:916
unsigned code
Definition ppu.h:917
Structure representing a line drawing command for the PPU (Pixel Processing Unit).
Definition ppu.h:487
signed y1
Definition ppu.h:496
unsigned code
Definition ppu.h:491
signed x1
Definition ppu.h:497
signed y0
Definition ppu.h:493
signed x0
Definition ppu.h:494
unsigned width
Definition ppu.h:489
unsigned na0
Definition ppu.h:490
unsigned pal
Definition ppu.h:488
Structure representing an image loading command for the PPU (Pixel Processing Unit).
Definition ppu.h:846
unsigned na7
Definition ppu.h:865
unsigned na1
Definition ppu.h:852
unsigned trnhtile
Definition ppu.h:860
unsigned na6
Definition ppu.h:863
unsigned na3
Definition ppu.h:856
unsigned srcwtile
Definition ppu.h:853
unsigned na5
Definition ppu.h:861
unsigned na8
Definition ppu.h:867
unsigned srcytile
Definition ppu.h:855
unsigned na4
Definition ppu.h:858
unsigned trnwtile
Definition ppu.h:862
unsigned code
Definition ppu.h:848
unsigned dstytile
Definition ppu.h:864
unsigned dstxtile
Definition ppu.h:866
unsigned srcxtile
Definition ppu.h:857
unsigned na2
Definition ppu.h:854
const u8 * cpuaddr
Definition ppu.h:850
unsigned na0
Definition ppu.h:847
Structure representing a polygon drawing command for the PPU (Pixel Processing Unit).
Definition ppu.h:437
unsigned na0
Definition ppu.h:439
signed y1
Definition ppu.h:445
unsigned pal
Definition ppu.h:438
signed y2
Definition ppu.h:448
signed x1
Definition ppu.h:446
signed y0
Definition ppu.h:442
unsigned code
Definition ppu.h:440
signed x2
Definition ppu.h:449
signed x0
Definition ppu.h:443
Structure representing a rectangle drawing command for the PPU (Pixel Processing Unit).
Definition ppu.h:168
unsigned code
Definition ppu.h:171
unsigned na
Definition ppu.h:170
signed y
Definition ppu.h:173
signed x
Definition ppu.h:174
unsigned pal
Definition ppu.h:169
unsigned w
Definition ppu.h:177
unsigned h
Definition ppu.h:176
Structure representing a scissor (clipping) command for the PPU (Pixel Processing Unit).
Definition ppu.h:536
unsigned code
Definition ppu.h:538
signed w
Definition ppu.h:544
signed x
Definition ppu.h:541
signed y
Definition ppu.h:540
unsigned na0
Definition ppu.h:537
signed h
Definition ppu.h:543
Structure representing a palette setting command for the PPU (Pixel Processing Unit).
Definition ppu.h:275
unsigned pidx1
Definition ppu.h:282
unsigned pidx8
Definition ppu.h:290
unsigned wmask
Definition ppu.h:277
unsigned pidx6
Definition ppu.h:287
unsigned pidx0
Definition ppu.h:281
unsigned reserved
Definition ppu.h:278
unsigned pidx11
Definition ppu.h:293
unsigned pidx10
Definition ppu.h:292
unsigned pidx7
Definition ppu.h:288
unsigned pidx3
Definition ppu.h:284
unsigned pidx4
Definition ppu.h:285
unsigned pidx2
Definition ppu.h:283
unsigned pidx15
Definition ppu.h:297
unsigned palsel
Definition ppu.h:276
unsigned pidx9
Definition ppu.h:291
unsigned pidx12
Definition ppu.h:294
unsigned pidx5
Definition ppu.h:286
unsigned pidx14
Definition ppu.h:296
unsigned code
Definition ppu.h:279
unsigned pidx13
Definition ppu.h:295
Structure representing a sprite drawing command for the PPU (Pixel Processing Unit).
Definition ppu.h:216
unsigned vfp
Definition ppu.h:222
unsigned srcwtile
Definition ppu.h:225
unsigned srcxtile
Definition ppu.h:232
unsigned na2
Definition ppu.h:227
unsigned hfp
Definition ppu.h:226
unsigned na1
Definition ppu.h:223
unsigned code
Definition ppu.h:219
unsigned srcytile
Definition ppu.h:229
unsigned srchtile
Definition ppu.h:221
signed y
Definition ppu.h:235
unsigned pal
Definition ppu.h:217
unsigned na3
Definition ppu.h:230
unsigned na4
Definition ppu.h:233
unsigned na0
Definition ppu.h:218
signed x
Definition ppu.h:236
Structure representing a view offset command for the PPU (Pixel Processing Unit).
Definition ppu.h:588
signed y
Definition ppu.h:592
unsigned na0
Definition ppu.h:589
unsigned code
Definition ppu.h:590
signed x
Definition ppu.h:593