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 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 *copperlistSpritePointers[8];
|
||||
|
||||
#define offsetof(s, m) &((struct s *)0)->m
|
||||
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
|
||||
|
||||
copperlist = prepareNewCopperlist();
|
||||
copperlist = prepareNewCopperlist(10000);
|
||||
|
||||
currentCopperlist = addDisplayToCopperlist(
|
||||
copperlist,
|
||||
|
|
|
@ -7,9 +7,15 @@
|
|||
|
||||
extern struct Custom far custom;
|
||||
|
||||
uint16_t * prepareNewCopperlist(void) {
|
||||
uint16_t *copperlist = AllocMem(
|
||||
COPPERLIST_SIZE,
|
||||
uint16_t copperlistSize;
|
||||
|
||||
uint16_t * prepareNewCopperlist(uint16_t size_b) {
|
||||
uint16_t *copperlist;
|
||||
|
||||
copperlistSize = size_b;
|
||||
|
||||
copperlist = AllocMem(
|
||||
copperlistSize,
|
||||
MEMF_CHIP | MEMF_CLEAR
|
||||
);
|
||||
|
||||
|
@ -24,5 +30,5 @@ void setCopperlist(uint16_t *copperlist) {
|
|||
}
|
||||
|
||||
void freeCopperlist(uint16_t *copperlist) {
|
||||
FreeMem(copperlist, COPPERLIST_SIZE);
|
||||
FreeMem(copperlist, copperlistSize);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#ifndef __COPPER_H__
|
||||
#define __COPPER_H__
|
||||
|
||||
#define COPPERLIST_SIZE (10000)
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
uint16_t * prepareNewCopperlist(void);
|
||||
uint16_t * prepareNewCopperlist(uint16_t size_b);
|
||||
void setCopperlist(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* addDisplayToCopperlist(
|
||||
uint16_t *copperlist,
|
||||
struct ScreenSetup *,
|
||||
struct CurrentScreen *,
|
||||
struct ScreenDefinition *,
|
||||
struct ActiveScreenBufferDetails *,
|
||||
void *copperlistBitplanePointers
|
||||
);
|
||||
extern void updateDisplayInCopperList(
|
||||
struct ScreenSetup *,
|
||||
struct CurrentScreen *,
|
||||
struct ScreenDefinition *,
|
||||
struct ActiveScreenBufferDetails *,
|
||||
void *copperlistBitplanePointers
|
||||
);
|
||||
extern uint16_t* addColorsToCopperlist(uint16_t *copperlist, color_t[], int count);
|
||||
|
|
|
@ -56,22 +56,22 @@ RestoreRegister MACRO
|
|||
MOVE.W Old\1,\1(A0)
|
||||
ENDM
|
||||
|
||||
STRUCTURE ScreenSetup,0
|
||||
UWORD ScreenSetup_width
|
||||
UWORD ScreenSetup_height
|
||||
UWORD ScreenSetup_bitplanes
|
||||
ULONG ScreenSetup_memoryStart
|
||||
UWORD ScreenSetup_byteWidth
|
||||
UWORD ScreenSetup_nextBitplaneAdvance
|
||||
UWORD ScreenSetup_nextBufferAdvance
|
||||
ULONG ScreenSetup_copperlistBitplanePointers
|
||||
LABEL ScreenSetup_SIZEOF
|
||||
STRUCTURE ScreenDefinition,0
|
||||
UWORD ScreenDefinition_width
|
||||
UWORD ScreenDefinition_height
|
||||
UWORD ScreenDefinition_bitplanes
|
||||
ULONG ScreenDefinition_memoryStart
|
||||
UWORD ScreenDefinition_byteWidth
|
||||
UWORD ScreenDefinition_nextBitplaneAdvance
|
||||
UWORD ScreenDefinition_nextBufferAdvance
|
||||
ULONG ScreenDefinition_copperlistBitplanePointers
|
||||
LABEL ScreenDefinition_SIZEOF
|
||||
|
||||
STRUCTURE CurrentScreen,0
|
||||
UWORD CurrentScreen_currentBuffer
|
||||
CurrentScreen_planes EQU SOFFSET
|
||||
STRUCTURE ActiveScreenBufferDetails,0
|
||||
UWORD ActiveScreenBufferDetails_currentBuffer
|
||||
ActiveScreenBufferDetails_planes EQU SOFFSET
|
||||
SOFFSET SET SOFFSET+(8*4)
|
||||
LABEL CurrentScreen_SIZEOF
|
||||
LABEL ActiveScreenBufferDetails_SIZEOF
|
||||
|
||||
BPLCON0_COLOR EQU $200
|
||||
|
||||
|
@ -178,8 +178,8 @@ _initializeCopperlist:
|
|||
RTS
|
||||
|
||||
; @stack *copperlist Pointer to copperlist
|
||||
; @stack ScreenSetup Pointer to screenSetup struct
|
||||
; @stack CurrentScreen Pointer to currentScreen struct
|
||||
; @stack ScreenDefinition Pointer to screenSetup struct
|
||||
; @stack ActiveScreenBufferDetails Pointer to currentScreen struct
|
||||
; @stack copperlistBitplanePointers Pointer to bitplane pointers within the copper list [[high, low], ...]
|
||||
STRUCTURE updateDisplayInCopperList,4
|
||||
ULONG updateDisplayInCopperList_screenSetup
|
||||
|
@ -194,9 +194,9 @@ _updateDisplayInCopperList:
|
|||
MOVE.L D0,A2
|
||||
; a2 has copperlistBitplanePointers
|
||||
|
||||
MOVE.W ScreenSetup_bitplanes(A0),D1
|
||||
MOVE.W ScreenDefinition_bitplanes(A0),D1
|
||||
SUBQ #1,D1
|
||||
LEA CurrentScreen_planes(A1),A1
|
||||
LEA ActiveScreenBufferDetails_planes(A1),A1
|
||||
; a1 has planes
|
||||
|
||||
.continue:
|
||||
|
@ -247,13 +247,13 @@ _setUpEmptySpritesInCopperlist:
|
|||
RTS
|
||||
|
||||
; @stack *copperlist Pointer to copperlist
|
||||
; @stack ScreenSetup Pointer to screenSetup struct
|
||||
; @stack CurrentScreen Pointer to currentScreen struct
|
||||
; @stack copperlistBitplanePointers Pointer to currentScreen struct
|
||||
; @stack ScreenDefinition Pointer to screenDefinition struct
|
||||
; @stack ActiveScreenBufferDetails Pointer to activeScreenBufferDetails struct
|
||||
; @stack copperlistBitplanePointers Pointer to copperlistBitplanePointers struct
|
||||
STRUCTURE AddDisplayToCopperListParams,4
|
||||
ULONG AddDisplayToCopperListParams_copperlistPtr
|
||||
ULONG AddDisplayToCopperListParams_screenSetupPtr
|
||||
ULONG AddDisplayToCopperListParams_currentScreenPtr
|
||||
ULONG AddDisplayToCopperListParams_screenDefinitionPtr
|
||||
ULONG AddDisplayToCopperListParams_activeScreenBufferDetailsPtr
|
||||
ULONG AddDisplayToCopperListParams_copperlistBitplanePointersPtr
|
||||
_addDisplayToCopperlist:
|
||||
MOVE.L A7,A0
|
||||
|
@ -261,16 +261,16 @@ _addDisplayToCopperlist:
|
|||
; A2,D2,D3
|
||||
MOVEM.L A2-A4/D2-D4,-(SP)
|
||||
MOVE.L AddDisplayToCopperListParams_copperlistPtr(A0),A1 ; copperlist
|
||||
MOVE.L AddDisplayToCopperListParams_screenSetupPtr(A0),A2 ; screenSetup
|
||||
MOVE.L AddDisplayToCopperListParams_currentScreenPtr(A0),A3 ; currentScreen
|
||||
MOVE.L AddDisplayToCopperListParams_screenDefinitionPtr(A0),A2 ; screenDefinition
|
||||
MOVE.L AddDisplayToCopperListParams_activeScreenBufferDetailsPtr(A0),A3 ; currentScreen
|
||||
MOVE.L AddDisplayToCopperListParams_copperlistBitplanePointersPtr(A0),A4 ; copperlistBitplanePointers
|
||||
|
||||
LEA CurrentScreen_planes(A3),A3
|
||||
LEA ActiveScreenBufferDetails_planes(A3),A3
|
||||
; a3 contains address to planes
|
||||
|
||||
|
||||
MOVEQ #0,D0
|
||||
MOVE.W ScreenSetup_bitplanes(A2),D0
|
||||
MOVE.W ScreenDefinition_bitplanes(A2),D0
|
||||
; d0 is num of bitplanes
|
||||
|
||||
; set up bplpt
|
||||
|
|
Loading…
Reference in New Issue