1
0
mirror of https://frontier.innolan.net/github/AmigaExamples.git synced 2026-01-12 01:12:29 +00:00

Tweaked copper list to work with SAE

This commit is contained in:
alpine9000
2016-02-29 14:00:06 +11:00
parent af98b0e4a1
commit 1f72da2c19
4 changed files with 26 additions and 57 deletions

View File

@ -1,5 +1,5 @@
MAKEADF=../tools/makeadf
FLOPPY=bin/image.adf
FLOPPY=bin/copper_bars.adf
EXTRA=out/copper-list.s
MODULE=copper.s
@ -10,5 +10,5 @@ out/copper-list.s: out/copper_gen
./out/copper_gen > out/copper-list.s
out/copper_gen: copper_gen.c
gcc copper_gen.c -o out/copper_gen
gcc $(HOST_CFLAGS) copper_gen.c -o out/copper_gen

View File

@ -8,7 +8,7 @@ SCREEN_HEIGHT equ 256
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
SCREEN_BIT_DEPTH equ 1
SCREEN_RES equ 8 ; 8=lo resolution, 4=hi resolution
RASTER_X_START equ $81 ; Hard coded coordinates from hardware manual
RASTER_X_START equ $81 ; hard coded coordinates from hardware manual
RASTER_Y_START equ $2c
RASTER_X_STOP equ RASTER_X_START+SCREEN_WIDTH
RASTER_Y_STOP equ RASTER_Y_START+SCREEN_HEIGHT
@ -44,6 +44,7 @@ entry:
bra.b .mainLoop
copper:
dc.w $1fc,0 ;slow fetch mode, AGA compatibility
copperBitPlanePtr:
dc.w BPL1PTH,0 ; address of the bitplane will be poked once we know it
dc.w BPL1PTL,0

View File

@ -3,66 +3,31 @@
#include <stdio.h>
#include <math.h>
typedef struct {
float r;
float g;
float b;
} color;
#define numColors 50
color colors[numColors];
void
makeColorGradient()
int
main(int argc, char** argv)
{
float frequencyr = 02;
float frequencyg = 02;
float frequencyb = 02;
float phase1 = 0.1, phase2 = 0.1, phase3 = 0.1;
char* hpos = "07";
int firstVisibleScanLine = 0x2c; // hard coded value from AHRM
float numLines = 312; // PAL only
float frequencyr = 0.3, frequencyg = 0.3, frequencyb = 0.3;
float phase1 = 0, phase2 = 2, phase3 = 4;
float center = 0x7;
float width = 0x7;
float len = numColors;
for (int i = 0; i < len; ++i) {
color* c = &colors[i];
c->r = sin(frequencyr*i + phase1) * width + center;
c->g = sin(frequencyg*i + phase2) * width + center;
c->b = sin(frequencyb*i + phase3) * width + center;
}
}
int
main()
{
makeColorGradient();
int lines = 312;
color start = { 0x0, 0x0, 0x0};
color end = { 0xF, 0xF, 0xF};
color current = {0};
int count = lines-0x2c;
int from = 0, to = 1;
int segment = count/((sizeof(colors)/sizeof(color))-1);
for (int i = 0, y = 0; i < count; i++) {
if (i != 0 && i % segment == 0) {
from++;
to++;
}
float distance = (float)((i)%segment)/segment;
color* start = &colors[from];
color* end = &colors[to];
current.r = start->r + ((end->r-start->r)*distance);
current.g = start->g + ((end->g-start->g)*distance);
current.b = start->b + ((end->b-start->b)*distance);
if (0x2c+i <= 255) {
printf("\tdc.w $%xdf,$fffe\n\tdc.w COLOR00,$%x%x%x\n",0x2c+i, (int)(current.r+0.5), (int)(current.g+0.5), (int)(current.b+0.5));
for (int i = 0, line = firstVisibleScanLine; i < (numLines-firstVisibleScanLine); ++i, ++line) {
unsigned char r = (sin(frequencyr*i + phase1) * width + center) + 0.5;
unsigned char g = (sin(frequencyg*i + phase2) * width + center) + 0.5;
unsigned char b = (sin(frequencyb*i + phase3) * width + center) + 0.5;
if (line <= 255) {
printf("\tdc.w $%x%s,$fffe\n\tdc.w COLOR00,$%x%x%x\n",line, hpos, r, g, b);
if (0x2c+i == 255) {
printf(".greaterThan255Hack:\n");
printf("\tdc.w $%xdf,$fffe\n",line);
}
} else {
printf("\tdc.w $%xdf,$fffe\n\tdc.w COLOR00,$%x%x%x\n",y++, (int)(current.r+0.5), (int)(current.g+0.5), (int)(current.b+0.5));
printf("\tdc.w $%x%s,$fffe\n\tdc.w COLOR00,$%x%x%x\n", line-256, hpos,r, g, b);
}
}
return 0;

View File

@ -1,3 +1,6 @@
HOST_WARNINGS=-pedantic-errors -Wfatal-errors -Wall -Werror -Wextra -Wno-unused-parameter -Wshadow
HOST_CFLAGS=-g $(HOST_WARNINGS)
all: bin out $(MAKEADF) $(FLOPPY)
gdrive: all