More clarity work
This commit is contained in:
parent
1d7e327194
commit
c1d9f23026
11
main.c
11
main.c
|
@ -28,8 +28,15 @@ volatile short *dbg = (volatile short *)0x100;
|
||||||
|
|
||||||
struct ScreenDefinition screenDefinition;
|
struct ScreenDefinition screenDefinition;
|
||||||
struct ActiveScreenBufferDetails activeScreenBufferDetails;
|
struct ActiveScreenBufferDetails activeScreenBufferDetails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The locations within the copperlist data where the bitplanes are referenced.
|
||||||
|
* We change these areas of memory directly to implement double buffering.
|
||||||
|
* Addresses are to the high, then low, word of the plane memory address in the copperlist.
|
||||||
|
*
|
||||||
|
* @see addDisplayToCopperlist
|
||||||
|
*/
|
||||||
void *copperlistBitplanePointers[8][2];
|
void *copperlistBitplanePointers[8][2];
|
||||||
void *copperlistSpritePointers[8];
|
|
||||||
|
|
||||||
#define offsetof(s, m) &((struct s *)0)->m
|
#define offsetof(s, m) &((struct s *)0)->m
|
||||||
uint16_t custom_color = (uint16_t)offsetof(Custom, color);
|
uint16_t custom_color = (uint16_t)offsetof(Custom, color);
|
||||||
|
@ -130,7 +137,7 @@ int main(void) {
|
||||||
|
|
||||||
// blitter copy the first bitplane row down to the second
|
// blitter copy the first bitplane row down to the second
|
||||||
|
|
||||||
copperlist = prepareNewCopperlist();
|
copperlist = prepareNewCopperlist(10000);
|
||||||
|
|
||||||
currentCopperlist = addDisplayToCopperlist(
|
currentCopperlist = addDisplayToCopperlist(
|
||||||
copperlist,
|
copperlist,
|
||||||
|
|
|
@ -7,9 +7,15 @@
|
||||||
|
|
||||||
extern struct Custom far custom;
|
extern struct Custom far custom;
|
||||||
|
|
||||||
uint16_t * prepareNewCopperlist(void) {
|
uint16_t copperlistSize;
|
||||||
uint16_t *copperlist = AllocMem(
|
|
||||||
COPPERLIST_SIZE,
|
uint16_t * prepareNewCopperlist(uint16_t size_b) {
|
||||||
|
uint16_t *copperlist;
|
||||||
|
|
||||||
|
copperlistSize = size_b;
|
||||||
|
|
||||||
|
copperlist = AllocMem(
|
||||||
|
copperlistSize,
|
||||||
MEMF_CHIP | MEMF_CLEAR
|
MEMF_CHIP | MEMF_CLEAR
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,5 +30,5 @@ void setCopperlist(uint16_t *copperlist) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeCopperlist(uint16_t *copperlist) {
|
void freeCopperlist(uint16_t *copperlist) {
|
||||||
FreeMem(copperlist, COPPERLIST_SIZE);
|
FreeMem(copperlist, copperlistSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
#ifndef __COPPER_H__
|
#ifndef __COPPER_H__
|
||||||
#define __COPPER_H__
|
#define __COPPER_H__
|
||||||
|
|
||||||
#define COPPERLIST_SIZE (10000)
|
|
||||||
|
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
uint16_t * prepareNewCopperlist(void);
|
uint16_t * prepareNewCopperlist(uint16_t size_b);
|
||||||
void setCopperlist(uint16_t *copperlist);
|
void setCopperlist(uint16_t *copperlist);
|
||||||
void freeCopperlist(uint16_t *copperlist);
|
void freeCopperlist(uint16_t *copperlist);
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,13 @@ extern void initializeCopperlist(void *copperlist);
|
||||||
extern uint16_t* endCopperlist(uint16_t *copperlist);
|
extern uint16_t* endCopperlist(uint16_t *copperlist);
|
||||||
extern uint16_t* addDisplayToCopperlist(
|
extern uint16_t* addDisplayToCopperlist(
|
||||||
uint16_t *copperlist,
|
uint16_t *copperlist,
|
||||||
struct ScreenSetup *,
|
struct ScreenDefinition *,
|
||||||
struct CurrentScreen *,
|
struct ActiveScreenBufferDetails *,
|
||||||
void *copperlistBitplanePointers
|
void *copperlistBitplanePointers
|
||||||
);
|
);
|
||||||
extern void updateDisplayInCopperList(
|
extern void updateDisplayInCopperList(
|
||||||
struct ScreenSetup *,
|
struct ScreenDefinition *,
|
||||||
struct CurrentScreen *,
|
struct ActiveScreenBufferDetails *,
|
||||||
void *copperlistBitplanePointers
|
void *copperlistBitplanePointers
|
||||||
);
|
);
|
||||||
extern uint16_t* addColorsToCopperlist(uint16_t *copperlist, color_t[], int count);
|
extern uint16_t* addColorsToCopperlist(uint16_t *copperlist, color_t[], int count);
|
||||||
|
|
|
@ -56,22 +56,22 @@ RestoreRegister MACRO
|
||||||
MOVE.W Old\1,\1(A0)
|
MOVE.W Old\1,\1(A0)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
STRUCTURE ScreenSetup,0
|
STRUCTURE ScreenDefinition,0
|
||||||
UWORD ScreenSetup_width
|
UWORD ScreenDefinition_width
|
||||||
UWORD ScreenSetup_height
|
UWORD ScreenDefinition_height
|
||||||
UWORD ScreenSetup_bitplanes
|
UWORD ScreenDefinition_bitplanes
|
||||||
ULONG ScreenSetup_memoryStart
|
ULONG ScreenDefinition_memoryStart
|
||||||
UWORD ScreenSetup_byteWidth
|
UWORD ScreenDefinition_byteWidth
|
||||||
UWORD ScreenSetup_nextBitplaneAdvance
|
UWORD ScreenDefinition_nextBitplaneAdvance
|
||||||
UWORD ScreenSetup_nextBufferAdvance
|
UWORD ScreenDefinition_nextBufferAdvance
|
||||||
ULONG ScreenSetup_copperlistBitplanePointers
|
ULONG ScreenDefinition_copperlistBitplanePointers
|
||||||
LABEL ScreenSetup_SIZEOF
|
LABEL ScreenDefinition_SIZEOF
|
||||||
|
|
||||||
STRUCTURE CurrentScreen,0
|
STRUCTURE ActiveScreenBufferDetails,0
|
||||||
UWORD CurrentScreen_currentBuffer
|
UWORD ActiveScreenBufferDetails_currentBuffer
|
||||||
CurrentScreen_planes EQU SOFFSET
|
ActiveScreenBufferDetails_planes EQU SOFFSET
|
||||||
SOFFSET SET SOFFSET+(8*4)
|
SOFFSET SET SOFFSET+(8*4)
|
||||||
LABEL CurrentScreen_SIZEOF
|
LABEL ActiveScreenBufferDetails_SIZEOF
|
||||||
|
|
||||||
BPLCON0_COLOR EQU $200
|
BPLCON0_COLOR EQU $200
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@ _initializeCopperlist:
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
; @stack *copperlist Pointer to copperlist
|
; @stack *copperlist Pointer to copperlist
|
||||||
; @stack ScreenSetup Pointer to screenSetup struct
|
; @stack ScreenDefinition Pointer to screenSetup struct
|
||||||
; @stack CurrentScreen Pointer to currentScreen struct
|
; @stack ActiveScreenBufferDetails Pointer to currentScreen struct
|
||||||
; @stack copperlistBitplanePointers Pointer to bitplane pointers within the copper list [[high, low], ...]
|
; @stack copperlistBitplanePointers Pointer to bitplane pointers within the copper list [[high, low], ...]
|
||||||
STRUCTURE updateDisplayInCopperList,4
|
STRUCTURE updateDisplayInCopperList,4
|
||||||
ULONG updateDisplayInCopperList_screenSetup
|
ULONG updateDisplayInCopperList_screenSetup
|
||||||
|
@ -194,9 +194,9 @@ _updateDisplayInCopperList:
|
||||||
MOVE.L D0,A2
|
MOVE.L D0,A2
|
||||||
; a2 has copperlistBitplanePointers
|
; a2 has copperlistBitplanePointers
|
||||||
|
|
||||||
MOVE.W ScreenSetup_bitplanes(A0),D1
|
MOVE.W ScreenDefinition_bitplanes(A0),D1
|
||||||
SUBQ #1,D1
|
SUBQ #1,D1
|
||||||
LEA CurrentScreen_planes(A1),A1
|
LEA ActiveScreenBufferDetails_planes(A1),A1
|
||||||
; a1 has planes
|
; a1 has planes
|
||||||
|
|
||||||
.continue:
|
.continue:
|
||||||
|
@ -247,13 +247,13 @@ _setUpEmptySpritesInCopperlist:
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
; @stack *copperlist Pointer to copperlist
|
; @stack *copperlist Pointer to copperlist
|
||||||
; @stack ScreenSetup Pointer to screenSetup struct
|
; @stack ScreenDefinition Pointer to screenDefinition struct
|
||||||
; @stack CurrentScreen Pointer to currentScreen struct
|
; @stack ActiveScreenBufferDetails Pointer to activeScreenBufferDetails struct
|
||||||
; @stack copperlistBitplanePointers Pointer to currentScreen struct
|
; @stack copperlistBitplanePointers Pointer to copperlistBitplanePointers struct
|
||||||
STRUCTURE AddDisplayToCopperListParams,4
|
STRUCTURE AddDisplayToCopperListParams,4
|
||||||
ULONG AddDisplayToCopperListParams_copperlistPtr
|
ULONG AddDisplayToCopperListParams_copperlistPtr
|
||||||
ULONG AddDisplayToCopperListParams_screenSetupPtr
|
ULONG AddDisplayToCopperListParams_screenDefinitionPtr
|
||||||
ULONG AddDisplayToCopperListParams_currentScreenPtr
|
ULONG AddDisplayToCopperListParams_activeScreenBufferDetailsPtr
|
||||||
ULONG AddDisplayToCopperListParams_copperlistBitplanePointersPtr
|
ULONG AddDisplayToCopperListParams_copperlistBitplanePointersPtr
|
||||||
_addDisplayToCopperlist:
|
_addDisplayToCopperlist:
|
||||||
MOVE.L A7,A0
|
MOVE.L A7,A0
|
||||||
|
@ -261,16 +261,16 @@ _addDisplayToCopperlist:
|
||||||
; A2,D2,D3
|
; A2,D2,D3
|
||||||
MOVEM.L A2-A4/D2-D4,-(SP)
|
MOVEM.L A2-A4/D2-D4,-(SP)
|
||||||
MOVE.L AddDisplayToCopperListParams_copperlistPtr(A0),A1 ; copperlist
|
MOVE.L AddDisplayToCopperListParams_copperlistPtr(A0),A1 ; copperlist
|
||||||
MOVE.L AddDisplayToCopperListParams_screenSetupPtr(A0),A2 ; screenSetup
|
MOVE.L AddDisplayToCopperListParams_screenDefinitionPtr(A0),A2 ; screenDefinition
|
||||||
MOVE.L AddDisplayToCopperListParams_currentScreenPtr(A0),A3 ; currentScreen
|
MOVE.L AddDisplayToCopperListParams_activeScreenBufferDetailsPtr(A0),A3 ; currentScreen
|
||||||
MOVE.L AddDisplayToCopperListParams_copperlistBitplanePointersPtr(A0),A4 ; copperlistBitplanePointers
|
MOVE.L AddDisplayToCopperListParams_copperlistBitplanePointersPtr(A0),A4 ; copperlistBitplanePointers
|
||||||
|
|
||||||
LEA CurrentScreen_planes(A3),A3
|
LEA ActiveScreenBufferDetails_planes(A3),A3
|
||||||
; a3 contains address to planes
|
; a3 contains address to planes
|
||||||
|
|
||||||
|
|
||||||
MOVEQ #0,D0
|
MOVEQ #0,D0
|
||||||
MOVE.W ScreenSetup_bitplanes(A2),D0
|
MOVE.W ScreenDefinition_bitplanes(A2),D0
|
||||||
; d0 is num of bitplanes
|
; d0 is num of bitplanes
|
||||||
|
|
||||||
; set up bplpt
|
; set up bplpt
|
||||||
|
|
Loading…
Reference in New Issue