33 lines
1.0 KiB
C
33 lines
1.0 KiB
C
#include <kernel.h>
|
|
#include <dma.h>
|
|
#include <draw.h>
|
|
#include <graph.h>
|
|
#include <gs_psm.h>
|
|
#include <packet.h>
|
|
|
|
int main(void)
|
|
{
|
|
framebuffer_t frame = {
|
|
.address = 0,
|
|
.width = 640,
|
|
.height = 448,
|
|
.psm = GS_PSM_32,
|
|
.mask = 0
|
|
};
|
|
zbuffer_t depth = { .enable = 0, .address = 0, .zsm = 0, .mask = 0 };
|
|
packet_t *packet = packet_init(32, PACKET_NORMAL);
|
|
|
|
frame.address = graph_vram_allocate(frame.width, frame.height, frame.psm, GRAPH_ALIGN_PAGE);
|
|
dma_channel_initialize(DMA_CHANNEL_GIF, NULL, 0);
|
|
dma_channel_fast_waits(DMA_CHANNEL_GIF);
|
|
graph_initialize(frame.address, frame.width, frame.height, frame.psm, 0, 0);
|
|
|
|
qword_t *command = draw_setup_environment(packet->data, 0, &frame, &depth);
|
|
command = draw_clear(command, 0, 0, 0, frame.width, frame.height, 18, 42, 96);
|
|
command = draw_finish(command);
|
|
dma_channel_send_normal(DMA_CHANNEL_GIF, packet->data, command - packet->data, 0, 0);
|
|
draw_wait_finish();
|
|
|
|
for (;;) graph_wait_vsync();
|
|
}
|