amiga_boottest

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/main.c	Wed Feb 21 18:00:45 2018 +0200
     1.3 @@ -0,0 +1,59 @@
     1.4 +#include "hwregs.h"
     1.5 +#include "intr.h"
     1.6 +#include "copper.h"
     1.7 +
     1.8 +void wait_vpos(int x);
     1.9 +void wait_vblank(void);
    1.10 +
    1.11 +#define BPLSZ  (320 / 8 * 256)
    1.12 +static unsigned char fb0[BPLSZ];
    1.13 +
    1.14 +int main(void)
    1.15 +{
    1.16 +	uint32_t fb0_addr = (uint32_t)fb0;
    1.17 +
    1.18 +	REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER);
    1.19 +
    1.20 +	REG_DMACON = CLRBITS(DMA_ALL);
    1.21 +	REG_BPLCON0 = BPLCON0_COUNT(0) | BPLCON0_COLOR;
    1.22 +	REG_BPLCON1 = 0;
    1.23 +	REG_DIWSTART = 0x2981;
    1.24 +	REG_DIWSTOP = 0x29c1;
    1.25 +	REG_DDFSTART = 0x38;
    1.26 +	REG_DDFSTOP = 0xd0;
    1.27 +
    1.28 +	REG_COLOR0 = 0x00f;
    1.29 +	REG_COLOR1 = 0xff0;
    1.30 +
    1.31 +	init_copper(0, 0);
    1.32 +
    1.33 +	wait_vblank();
    1.34 +	add_copper(COPPER_MOVE(REGN_BPL1PTH, fb0_addr >> 16));
    1.35 +	add_copper(COPPER_MOVE(REGN_BPL1PTL, fb0_addr));
    1.36 +
    1.37 +	add_copper(COPPER_VWAIT(64));
    1.38 +	add_copper(COPPER_MOVE(REGN_COLOR0, 0xf00));
    1.39 +	add_copper(COPPER_VWAIT(70));
    1.40 +	add_copper(COPPER_MOVE(REGN_COLOR0, 0x00f));
    1.41 +
    1.42 +	add_copper(COPPER_END);
    1.43 +
    1.44 +	fb0[128 * 320 / 8] = 8;
    1.45 +
    1.46 +	REG_DMACON = SETBITS(DMA_COPPER | DMA_MASTER);
    1.47 +	enable_intr();
    1.48 +
    1.49 +	for(;;);
    1.50 +	return 0;
    1.51 +}
    1.52 +
    1.53 +void wait_vpos(int x)
    1.54 +{
    1.55 +	x <<= 8;
    1.56 +	while((REG32_VPOSR & 0x1ff00) < x);
    1.57 +}
    1.58 +
    1.59 +void wait_vblank(void)
    1.60 +{
    1.61 +	wait_vpos(300);
    1.62 +}