amiga_boottest
diff src/main.c @ 4:995d42b33974
serial output
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 23 Feb 2018 13:29:37 +0200 |
parents | 555b986cc420 |
children |
line diff
1.1 --- a/src/main.c Thu Feb 22 14:46:32 2018 +0200 1.2 +++ b/src/main.c Fri Feb 23 13:29:37 2018 +0200 1.3 @@ -2,9 +2,14 @@ 1.4 #include "intr.h" 1.5 #include "copper.h" 1.6 #include "rng.h" 1.7 +#include "serial.h" 1.8 1.9 -#define BPLSZ (320 / 8 * 256) 1.10 -static unsigned char fb0[BPLSZ]; 1.11 +#define SCR_W 336 1.12 +#define SCR_H 256 1.13 +#define HMOD ((SCR_W - 320) / 8) 1.14 + 1.15 +#define BPLSZ (SCR_W / 8 * SCR_H) 1.16 +static unsigned char fb0[BPLSZ + 3 * SCR_W]; 1.17 1.18 extern uint16_t dbgval; 1.19 1.20 @@ -29,8 +34,7 @@ 1.21 : "a0", "d0") 1.22 1.23 static uint32_t coplist[] = { 1.24 - COPPER_MOVE(REGN_BPL1PTH, 0), 1.25 - COPPER_MOVE(REGN_BPL1PTL, 0), 1.26 + 0, 0, 0, 0, /* placeholder of bitplane pointer setting */ 1.27 1.28 COPPER_MOVE(REGN_COLOR0, 0x234), 1.29 COPPER_VWAIT(15), 1.30 @@ -52,22 +56,31 @@ 1.31 { 1.32 int32_t x = 0, y = 0; 1.33 1.34 + ser_init(38400); 1.35 + ser_print("Amiga debug console initialized\n"); 1.36 + 1.37 REG_INTENA = SETBITS(INTEN_VERTB | INTEN_MASTER); 1.38 1.39 REG_DMACON = CLRBITS(DMA_ALL); 1.40 - REG_BPLCON0 = BPLCON0_COUNT(1) | BPLCON0_COLOR; 1.41 - REG_BPLCON1 = 0; 1.42 + REG_BPLCON0 = BPLCON0_COUNT(2) | BPLCON0_COLOR; 1.43 + REG_BPLCON1 = 0xfa; 1.44 + REG_BPL1MOD = HMOD - 2; 1.45 + REG_BPL2MOD = HMOD - 2; 1.46 REG_DIWSTART = 0x2981; 1.47 REG_DIWSTOP = 0x29c1; 1.48 - REG_DDFSTART = 0x38; 1.49 + REG_DDFSTART = 0x30; 1.50 REG_DDFSTOP = 0xd0; 1.51 1.52 REG_COLOR0 = 0x235; 1.53 - REG_COLOR1 = 0x2f5; 1.54 + REG_COLOR1 = 0x2e5; 1.55 + REG_COLOR2 = 0x113; 1.56 + REG_COLOR3 = 0x2e5; 1.57 1.58 wait_vblank(); 1.59 - coplist[0] = COPPER_MOVE(REGN_BPL1PTH, (uint32_t)fb0 >> 16); 1.60 - coplist[1] = COPPER_MOVE(REGN_BPL1PTL, (uint32_t)fb0); 1.61 + coplist[0] = COPPER_MOVE(REGN_BPL1PTH, ((uint32_t)fb0 + 3 * SCR_W / 8) >> 16); 1.62 + coplist[1] = COPPER_MOVE(REGN_BPL1PTL, (uint32_t)fb0 + 3 * SCR_W / 8); 1.63 + coplist[2] = COPPER_MOVE(REGN_BPL2PTH, (uint32_t)fb0 >> 16); 1.64 + coplist[3] = COPPER_MOVE(REGN_BPL2PTL, (uint32_t)fb0); 1.65 REG32_COP1LC = (uint32_t)coplist; 1.66 REG_COPJMP1 = 0; 1.67 1.68 @@ -105,11 +118,15 @@ 1.69 py = 128 - (x >> 11); 1.70 1.71 if(py >= 0) { 1.72 - pptr = fb0 + (py * 320 + px) / 8; 1.73 + pptr = fb0 + (py * SCR_W + px) / 8; 1.74 *pptr = *pptr | (0x80 >> (px & 7)); 1.75 } 1.76 1.77 - wait_vblank(); 1.78 + if((REG_CIAA_PORTA & CIAA_PA_FIR0) == 0) { 1.79 + ser_print("restarting fractal\n"); 1.80 + wait_vblank(); 1.81 + clear_bpl(fb0); 1.82 + } 1.83 } 1.84 1.85 return 0;