I think I may have answered my own question.
Finally reads from video memory by the cpu are working now
when everything is clocked at the same pixel clock @25MHz!
First to explain my usage of clocks inside the FPGA. I use 3 separate taps off of an internal PLL for flexibility. The clock signal going to the SyncRAM is phase shifted 90deg:
Code:
PLL_BASE
#(.BANDWIDTH ("OPTIMIZED"),
.CLK_FEEDBACK ("CLKFBOUT"),
.COMPENSATION ("SYSTEM_SYNCHRONOUS"),
.DIVCLK_DIVIDE (2), //100MHz/2=50MHz*14=700MHz/10=70MHz for 1024x768
.CLKFBOUT_MULT (14), //100MHz/2=50MHz*14=700MHz/28=25MHz for 640x480
.CLKFBOUT_PHASE (0.000), //100MHz/2=50MHz*18=900MHz/60=15MHz for 320x200
.CLKOUT0_DIVIDE (28), //video pixel clk
.CLKOUT0_PHASE (0.000),
.CLKOUT0_DUTY_CYCLE (0.500),
.CLKOUT1_DIVIDE (28), //cpu&system clk
.CLKOUT1_PHASE (0.000),
.CLKOUT1_DUTY_CYCLE (0.500),
.CLKOUT2_DIVIDE (28), //SyncRAM clk
.CLKOUT2_PHASE (90.000),
.CLKOUT2_DUTY_CYCLE (0.500),
.CLKIN_PERIOD (10.0),
.REF_JITTER (0.010))
CLK0 goes to the HVSync module and offchip to the VideoDAC
CLK1 goes to the cpu, reset logic, BRAMs.
CLK2 goes offchip to the SyncRAM.
The bit of software that copies/pastes a chunk (76x76pixel cube) of video memory starting at (300,375) to (400,375):
Code:
LDA #300
STA SCRLO ;x position
LDA #375
STA SCRHI ;y position
LDX #76 ;use X reg for easy test for end of y position
CHSH2 LDY #$00
LDWi $0064 ;LDW #100
CHSH LDA (SCRLO),Y
STAiw (SCRLO),W ;STA (SCRLO),W
INW
INY
CPY #76
BNE CHSH
INC SCRHI
DEX
BNE CHSH2