amiga_boottest

view src/main.c @ 1:48093e4bd99a

stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Feb 2018 18:00:45 +0200
parents
children 58ebd84822e7
line source
1 #include "hwregs.h"
2 #include "intr.h"
3 #include "copper.h"
5 void wait_vpos(int x);
6 void wait_vblank(void);
8 #define BPLSZ (320 / 8 * 256)
9 static unsigned char fb0[BPLSZ];
11 int main(void)
12 {
13 uint32_t fb0_addr = (uint32_t)fb0;
15 REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
17 REG_DMACON = CLRBITS(DMA_ALL);
18 REG_BPLCON0 = BPLCON0_COUNT(0) | BPLCON0_COLOR;
19 REG_BPLCON1 = 0;
20 REG_DIWSTART = 0x2981;
21 REG_DIWSTOP = 0x29c1;
22 REG_DDFSTART = 0x38;
23 REG_DDFSTOP = 0xd0;
25 REG_COLOR0 = 0x00f;
26 REG_COLOR1 = 0xff0;
28 init_copper(0, 0);
30 wait_vblank();
31 add_copper(COPPER_MOVE(REGN_BPL1PTH, fb0_addr >> 16));
32 add_copper(COPPER_MOVE(REGN_BPL1PTL, fb0_addr));
34 add_copper(COPPER_VWAIT(64));
35 add_copper(COPPER_MOVE(REGN_COLOR0, 0xf00));
36 add_copper(COPPER_VWAIT(70));
37 add_copper(COPPER_MOVE(REGN_COLOR0, 0x00f));
39 add_copper(COPPER_END);
41 fb0[128 * 320 / 8] = 8;
43 REG_DMACON = SETBITS(DMA_COPPER | DMA_MASTER);
44 enable_intr();
46 for(;;);
47 return 0;
48 }
50 void wait_vpos(int x)
51 {
52 x <<= 8;
53 while((REG32_VPOSR & 0x1ff00) < x);
54 }
56 void wait_vblank(void)
57 {
58 wait_vpos(300);
59 }