Move blitter commoon stuff to blitter header
This commit is contained in:
parent
c76af7faf8
commit
bd035eaea1
11
bun.c
11
bun.c
|
@ -13,6 +13,7 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "bun.h"
|
#include "bun.h"
|
||||||
#include "system/system.h"
|
#include "system/system.h"
|
||||||
|
#include "system/blitter.h"
|
||||||
|
|
||||||
#define COOL_BUN_WIDTH (32)
|
#define COOL_BUN_WIDTH (32)
|
||||||
#define COOL_BUN_WIDTH_BYTES (COOL_BUN_WIDTH / 8)
|
#define COOL_BUN_WIDTH_BYTES (COOL_BUN_WIDTH / 8)
|
||||||
|
@ -40,16 +41,8 @@
|
||||||
// linked as raw bytes in assembler
|
// linked as raw bytes in assembler
|
||||||
extern unsigned char chip coolbun[];
|
extern unsigned char chip coolbun[];
|
||||||
|
|
||||||
#define BLTCON0( \
|
|
||||||
minterm, aChan, bChan, cChan, dChan, shift \
|
|
||||||
) (minterm + (aChan << 11) + (bChan << 10) + (cChan << 9) + (dChan << 8) + (shift << 12))
|
|
||||||
#define BLTCON1(descending, shift) ((descending << 1) + (shift << 12))
|
|
||||||
|
|
||||||
extern struct Custom far custom;
|
extern struct Custom far custom;
|
||||||
|
|
||||||
#define BLITTER_ASCENDING (0)
|
|
||||||
#define BLITTER_DESCENDING (1)
|
|
||||||
|
|
||||||
struct BunClear {
|
struct BunClear {
|
||||||
uint16_t memoryStartOffsetBytes;
|
uint16_t memoryStartOffsetBytes;
|
||||||
uint16_t widthWords;
|
uint16_t widthWords;
|
||||||
|
@ -373,7 +366,7 @@ void clearCurrentBuns(
|
||||||
|
|
||||||
if (!hasBunClear[bunRenderer->activeScreenBufferDetails->currentBuffer]) return;
|
if (!hasBunClear[bunRenderer->activeScreenBufferDetails->currentBuffer]) return;
|
||||||
|
|
||||||
bltcon0 = 0xc0 + (1 << 8);
|
bltcon0 = BLTCON0(0xc0, 0, 0, 0, 1, 0);
|
||||||
|
|
||||||
for (bun = 0; bun < BUN_COUNT; ++bun) {
|
for (bun = 0; bun < BUN_COUNT; ++bun) {
|
||||||
currentBunClear = &bunClearForScreen[bunRenderer->activeScreenBufferDetails->currentBuffer][bun];
|
currentBunClear = &bunClearForScreen[bunRenderer->activeScreenBufferDetails->currentBuffer][bun];
|
||||||
|
|
22
main.c
22
main.c
|
@ -29,6 +29,16 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "bun.h"
|
#include "bun.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This barely gets 50fps but I'm leaving it for now. Potential improvements:
|
||||||
|
*
|
||||||
|
* [ ] Topaz re-rendering is limited to squares or rows that changed in the last frame.
|
||||||
|
* I tried this once but I need a more precise way of redrawing those areas.
|
||||||
|
* [ ] Cool bun clears and re-renders happen in the same pass.
|
||||||
|
* This would likely mean extending the cool bun art to have a blank word on the left,
|
||||||
|
* and enough blank rows above and below to cover clearing areas above and below.
|
||||||
|
*/
|
||||||
|
|
||||||
extern struct Custom far custom;
|
extern struct Custom far custom;
|
||||||
extern struct CIA far ciaa;
|
extern struct CIA far ciaa;
|
||||||
|
|
||||||
|
@ -61,20 +71,17 @@ extern uint8_t chip MaskBitplane[];
|
||||||
#define TOPAZ_WIDTH_BYTES (TOPAZ_WIDTH_PIXELS / 8)
|
#define TOPAZ_WIDTH_BYTES (TOPAZ_WIDTH_PIXELS / 8)
|
||||||
#define TOPAZ_WIDTH_WORDS (TOPAZ_WIDTH_PIXELS / 16)
|
#define TOPAZ_WIDTH_WORDS (TOPAZ_WIDTH_PIXELS / 16)
|
||||||
|
|
||||||
#define BLTSIZE(w, h) (w + (h << 6))
|
|
||||||
|
|
||||||
void renderTopaz(void) {
|
void renderTopaz(void) {
|
||||||
int plane;
|
int plane;
|
||||||
|
|
||||||
uint16_t bltcon0, bltcmod;
|
uint16_t bltcmod;
|
||||||
uint8_t *bltbpt;
|
uint8_t *bltbpt;
|
||||||
|
|
||||||
bltcon0 = 0xca + (1 << 8) + (1 << 9) + (1 << 10) + (1 << 11);
|
|
||||||
bltcmod = screenDefinition.byteWidth - TOPAZ_WIDTH_BYTES;
|
bltcmod = screenDefinition.byteWidth - TOPAZ_WIDTH_BYTES;
|
||||||
bltbpt = TopazBitplanes;
|
bltbpt = TopazBitplanes;
|
||||||
|
|
||||||
for (plane = 0; plane < 3; ++plane) {
|
for (plane = 0; plane < 3; ++plane) {
|
||||||
custom.bltcon0 = bltcon0;
|
custom.bltcon0 = BLTCON0(0xca, 1, 1, 1, 1, 0);
|
||||||
custom.bltcon1 = 0;
|
custom.bltcon1 = 0;
|
||||||
custom.bltafwm = 0xffff;
|
custom.bltafwm = 0xffff;
|
||||||
custom.bltalwm = 0xffff;
|
custom.bltalwm = 0xffff;
|
||||||
|
@ -99,15 +106,14 @@ void renderTopaz(void) {
|
||||||
void renderMostlyTopaz(void) {
|
void renderMostlyTopaz(void) {
|
||||||
int plane;
|
int plane;
|
||||||
|
|
||||||
uint16_t bltcon0, bltcmod;
|
uint16_t bltcmod;
|
||||||
uint8_t *bltbpt;
|
uint8_t *bltbpt;
|
||||||
|
|
||||||
bltcon0 = 0xca + (1 << 8) + (1 << 9) + (1 << 10) + (1 << 11);
|
|
||||||
bltcmod = screenDefinition.byteWidth - TOPAZ_WIDTH_BYTES;
|
bltcmod = screenDefinition.byteWidth - TOPAZ_WIDTH_BYTES;
|
||||||
bltbpt = TopazBitplanes;
|
bltbpt = TopazBitplanes;
|
||||||
|
|
||||||
for (plane = 0; plane < 2; ++plane) {
|
for (plane = 0; plane < 2; ++plane) {
|
||||||
custom.bltcon0 = bltcon0;
|
custom.bltcon0 = BLTCON0(0xca, 1, 1, 1, 1, 0);
|
||||||
custom.bltcon1 = 0;
|
custom.bltcon1 = 0;
|
||||||
custom.bltafwm = 0xffff;
|
custom.bltafwm = 0xffff;
|
||||||
custom.bltalwm = 0xffff;
|
custom.bltalwm = 0xffff;
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
#ifndef __BLITTER_H__
|
#ifndef __BLITTER_H__
|
||||||
#define __BLITTER_H__
|
#define __BLITTER_H__
|
||||||
|
|
||||||
#include "types.h"
|
#define BLTSIZE(w, h) (w + (h << 6))
|
||||||
#include "screen.h"
|
#define BLTCON0( \
|
||||||
|
minterm, aChan, bChan, cChan, dChan, shift \
|
||||||
|
) (minterm + (aChan << 11) + (bChan << 10) + (cChan << 9) + (dChan << 8) + (shift << 12))
|
||||||
|
#define BLTCON1(descending, shift) ((descending << 1) + (shift << 12))
|
||||||
|
|
||||||
|
#define BLITTER_ASCENDING (0)
|
||||||
|
#define BLITTER_DESCENDING (1)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue