fixed a few minor bugs and added experimental code to do video page copies by DMA
This commit is contained in:
@@ -98,6 +98,8 @@
|
|||||||
.equ INT_SOURCE_GPT1,61 // GPT1 timer interrupt
|
.equ INT_SOURCE_GPT1,61 // GPT1 timer interrupt
|
||||||
.equ INT_SOURCE_GPT0,62 // GPT0 timer interrupt
|
.equ INT_SOURCE_GPT0,62 // GPT0 timer interrupt
|
||||||
|
|
||||||
|
// Atari register equates (provided by FPGA)
|
||||||
|
.equ vbasehi, 0xffff8201
|
||||||
|
|
||||||
//mmu ---------------------------------------------------
|
//mmu ---------------------------------------------------
|
||||||
/* Register read/write macros */
|
/* Register read/write macros */
|
||||||
@@ -156,6 +158,13 @@
|
|||||||
#define writethrough_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(00)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
#define writethrough_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(00)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
||||||
#define copyback_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(01)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
#define copyback_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(01)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
||||||
#define nocache_precise_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(10)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
#define nocache_precise_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(10)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X)
|
||||||
|
|
||||||
|
// equates for (experimental) video page copying via Coldfire DMA
|
||||||
|
.equ MCD_SINGLE_DMA, 0x100
|
||||||
|
.equ MCD_TT_FLAGS_CW, 0x2
|
||||||
|
.equ MCD_TT_FLAGS_RL, 0x1
|
||||||
|
.equ MCD_TT_FLAGS_SP, 0x4
|
||||||
|
.equ DMA_ALWAYS, 0
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
@@ -534,12 +543,16 @@ irq4: // vbl
|
|||||||
irq5: // acp
|
irq5: // acp
|
||||||
irq 0x74,5,0x20
|
irq 0x74,5,0x20
|
||||||
|
|
||||||
irq6: // mfp
|
irq6: // MFP interrupt from FPGA
|
||||||
move.w #0x2700,sr // disable interrupt
|
move.w #0x2700,sr // disable interrupt
|
||||||
subq.l #8,a7
|
subq.l #8,a7
|
||||||
movem.l d0/a5,(a7) // save registers
|
movem.l d0/a5,(a7) // save registers
|
||||||
lea MCF_EPORT_EPFR,a5
|
|
||||||
move.b #0x40,(a5) // clear int6
|
lea MCF_EPORT_EPFR,a5 // clear int6 from edge port
|
||||||
|
bset #6,(a5)
|
||||||
|
|
||||||
|
// there was a potential bug here befor: would also clear all other edge port interrupts that might have happened...
|
||||||
|
// move.b #0x40,(a5) // clear int6 from edge port
|
||||||
|
|
||||||
// screen adr change timed out?
|
// screen adr change timed out?
|
||||||
move.l _video_sbt,d0
|
move.l _video_sbt,d0
|
||||||
@@ -590,7 +603,26 @@ irq6_sca_pn1c:
|
|||||||
move.l d3,a0
|
move.l d3,a0
|
||||||
add.l #0x60000000,a0
|
add.l #0x60000000,a0
|
||||||
move.l d3,a1
|
move.l d3,a1
|
||||||
move.l #0x10000,d4 // die ganze page
|
move.l #0x10000,d4 // one whole page (1 MB)
|
||||||
|
|
||||||
|
#ifndef _DO_CPU_COPY
|
||||||
|
|
||||||
|
// experiment: do video page copy using Coldfire DMA
|
||||||
|
|
||||||
|
clr.l -(sp) // no special functions
|
||||||
|
move.l MCD_SINGLE_DMA|MCD_TT_FLAGS_CW|MCD_TT_FLAGS_RL|MCD_TT_FLAGS_SP,-(sp)
|
||||||
|
mov3q #7,-(sp) // highest DMA priority
|
||||||
|
move.l #DMA_ALWAYS,-(sp) // do memory to memory DMA
|
||||||
|
move.l #4,-(sp) // copy 4 bytes at a time
|
||||||
|
move.l #0x100000,-(sp) // copy 1 Megabyte
|
||||||
|
move.w #4,-(sp) // destination increment
|
||||||
|
move.l a1,-(sp) // destination adress
|
||||||
|
move.w #4,-(sp) // source increment
|
||||||
|
move.l a0,-(sp) // source adress
|
||||||
|
mov3q #1,-(sp) // channel 1
|
||||||
|
jsr _MCD_startDma
|
||||||
|
lea 10 * 4(sp),sp // adjust stack
|
||||||
|
#else
|
||||||
irq6_vcd0_loop:
|
irq6_vcd0_loop:
|
||||||
move.l (a0)+,(a1)+ // page copy
|
move.l (a0)+,(a1)+ // page copy
|
||||||
move.l (a0)+,(a1)+
|
move.l (a0)+,(a1)+
|
||||||
@@ -599,6 +631,8 @@ irq6_vcd0_loop:
|
|||||||
subq.l #1,d4
|
subq.l #1,d4
|
||||||
bne irq6_vcd0_loop
|
bne irq6_vcd0_loop
|
||||||
nop
|
nop
|
||||||
|
#endif /* _DO_CPU_COPY */
|
||||||
|
|
||||||
irq6_sca_pn:
|
irq6_sca_pn:
|
||||||
add.l #0x00100000,d3 // next
|
add.l #0x00100000,d3 // next
|
||||||
cmp.l #0x00d00000,d3 // ende?
|
cmp.l #0x00d00000,d3 // ende?
|
||||||
@@ -608,7 +642,7 @@ irq6_sca_pn:
|
|||||||
move.l d0,_video_tlb // anfangszustand wieder herstellen
|
move.l d0,_video_tlb // anfangszustand wieder herstellen
|
||||||
clr.l _video_sbt // zeit löschen
|
clr.l _video_sbt // zeit löschen
|
||||||
|
|
||||||
movem.l (a7),d0-d4/a0-a1 // register zurück
|
movem.l (a7),d0-d4/a0-a1 // restore registers
|
||||||
lea 28(a7),a7
|
lea 28(a7),a7
|
||||||
irq6_non_sca:
|
irq6_non_sca:
|
||||||
// test auf acsi dma -----------------------------------------------------------------
|
// test auf acsi dma -----------------------------------------------------------------
|
||||||
@@ -827,24 +861,27 @@ psc3_fertig:
|
|||||||
* general purpose timer 0 (GPT0): video change, later also others
|
* general purpose timer 0 (GPT0): video change, later also others
|
||||||
*/
|
*/
|
||||||
handler_gpt0:
|
handler_gpt0:
|
||||||
move #0x2700,sr
|
move #0x2700,sr // disable interrupts
|
||||||
// halt
|
|
||||||
lea -28(a7),a7
|
lea -28(a7),a7 // save registers
|
||||||
movem.l d0-d4/a0-a1,(a7)
|
movem.l d0-d4/a0-a1,(a7)
|
||||||
mvz.b 0xffff8201,d0 // l<EFBFBD>schen und high byt
|
|
||||||
cmp.w #2,d0
|
mvz.b vbasehi,d0 // screen base address high
|
||||||
blt video_chg_end
|
cmp.w #2,d0 // lower than 0x200000?
|
||||||
cmp.w #0xd0,d0 // normale addresse
|
blt video_chg_end // yes
|
||||||
blt sca_other // nein->
|
cmp.w #0xd0,d0 // 0xd00000? - normal Falcon video area, map to 60d00000 (FPGA video memory)
|
||||||
|
blt sca_other //
|
||||||
|
|
||||||
lea MCF_SLT0_SCNT,a0
|
lea MCF_SLT0_SCNT,a0
|
||||||
move.l (a0),d4
|
move.l (a0),_video_sbt // save time
|
||||||
move.l d4,_video_sbt // time sichern
|
|
||||||
sca_other:
|
sca_other:
|
||||||
lsl.l #8,d0
|
lsl.l #8,d0 // build screen start address from Atari register contents
|
||||||
move.b 0xffff8203,d0 // mid byt
|
move.b 0xffff8203,d0 // mid byt
|
||||||
lsl.l #8,d0
|
lsl.l #8,d0
|
||||||
move.b 0xffff820d,d0 // low byt
|
move.b 0xffff820d,d0 // low byt
|
||||||
move.l d0,d3
|
move.l d0,d3
|
||||||
|
|
||||||
video_chg_1page:
|
video_chg_1page:
|
||||||
// test ob page schon gesetzt
|
// test ob page schon gesetzt
|
||||||
moveq #20,d4
|
moveq #20,d4
|
||||||
@@ -855,7 +892,7 @@ video_chg_1page:
|
|||||||
bne video_chg_2page // schon gesetzt gewesen? ja->weg
|
bne video_chg_2page // schon gesetzt gewesen? ja->weg
|
||||||
move.l d4,_video_tlb
|
move.l d4,_video_tlb
|
||||||
bsr cpusha // cache leeren
|
bsr cpusha // cache leeren
|
||||||
// daten copieren
|
|
||||||
video_copy_data:
|
video_copy_data:
|
||||||
move.l d4,_video_tlb
|
move.l d4,_video_tlb
|
||||||
and.l #0x00f00000,d0
|
and.l #0x00f00000,d0
|
||||||
@@ -863,6 +900,27 @@ video_copy_data:
|
|||||||
move.l a0,a1
|
move.l a0,a1
|
||||||
add.l #0x60000000,a1
|
add.l #0x60000000,a1
|
||||||
move.l #0x10000,d4 // die ganze page
|
move.l #0x10000,d4 // die ganze page
|
||||||
|
|
||||||
|
#ifndef _DO_CPU_COPY
|
||||||
|
|
||||||
|
// experiment: do video page copy using Coldfire DMA
|
||||||
|
|
||||||
|
move.l d0,-(sp) // save d0
|
||||||
|
clr.l -(sp) // no special functions
|
||||||
|
move.l MCD_SINGLE_DMA|MCD_TT_FLAGS_CW|MCD_TT_FLAGS_RL|MCD_TT_FLAGS_SP,-(sp)
|
||||||
|
mov3q #7,-(sp) // highest DMA priority
|
||||||
|
move.l #DMA_ALWAYS,-(sp) // do memory to memory DMA
|
||||||
|
move.l #4,-(sp) // copy 4 bytes at a time
|
||||||
|
move.l #0x100000,-(sp) // copy 1 Megabyte
|
||||||
|
move.w #4,-(sp) // destination increment
|
||||||
|
move.l a1,-(sp) // destination adress
|
||||||
|
move.w #4,-(sp) // source increment
|
||||||
|
move.l a0,-(sp) // source adress
|
||||||
|
mov3q #1,-(sp) // channel 1
|
||||||
|
jsr _MCD_startDma
|
||||||
|
lea 10 * 4(sp),sp // adjust stack
|
||||||
|
move.l (sp)+,d0 // restore d0
|
||||||
|
#else
|
||||||
video_copy_data_loop:
|
video_copy_data_loop:
|
||||||
move.l (a0)+,(a1)+
|
move.l (a0)+,(a1)+
|
||||||
move.l (a0)+,(a1)+
|
move.l (a0)+,(a1)+
|
||||||
@@ -870,6 +928,8 @@ video_copy_data_loop:
|
|||||||
move.l (a0)+,(a1)+
|
move.l (a0)+,(a1)+
|
||||||
subq.l #1,d4
|
subq.l #1,d4
|
||||||
bne video_copy_data_loop
|
bne video_copy_data_loop
|
||||||
|
#endif
|
||||||
|
|
||||||
// eintrag suchen
|
// eintrag suchen
|
||||||
move.l d0,MCF_MMU_MMUAR // addresse
|
move.l d0,MCF_MMU_MMUAR // addresse
|
||||||
move.l #0x106,d4
|
move.l #0x106,d4
|
||||||
@@ -905,14 +965,12 @@ video_chg_2page:
|
|||||||
bset.l d2,d4 // setzen als ge<EFBFBD>ndert
|
bset.l d2,d4 // setzen als ge<EFBFBD>ndert
|
||||||
beq video_copy_data // nein nochmal
|
beq video_copy_data // nein nochmal
|
||||||
video_chg_end:
|
video_chg_end:
|
||||||
// int pending l<EFBFBD>schen
|
lea MCF_GPT0_GMS,a0 // clear interrupt
|
||||||
lea MCF_GPT0_GMS,a0
|
|
||||||
bclr.b #0,3(a0)
|
bclr.b #0,3(a0)
|
||||||
nop
|
nop
|
||||||
bset.b #0,3(a0)
|
bset.b #0,3(a0)
|
||||||
|
|
||||||
movem.l (a7),d0-d4/a0-a1
|
movem.l (a7),d0-d4/a0-a1 // restore saved registers
|
||||||
lea 28(a7),a7
|
lea 28(a7),a7
|
||||||
//--------------------------------------------------------------------------------------------------------
|
rte
|
||||||
RTE
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user