diff --git a/cores/c16/ted.v b/cores/c16/ted.v index 86aecf3..3c4de92 100644 --- a/cores/c16/ted.v +++ b/cores/c16/ted.v @@ -634,7 +634,7 @@ always @(posedge clk) // DMA and Charpos latch delay trick always @(posedge clk) begin - if(latch_charposition) + if(hpos_392) begin if(VertSubCount==6) CharPosLatch<=1; // CharPosLatch signal activates in line 6 and signals that videocounter (DMA counter) has been latched. It is used in line 7 for character position latch. @@ -651,7 +651,7 @@ always @(posedge clk) // Character Position Reload register $FF1A/$FF1B CharPosReload[7:0]<=data_in; else if(hpos_392 & videoline==EOS) // clear character position reload at last line CharPosReload<=0; - else if(CharPosLatch & latch_charposition & VertSubActive) // latch character position at 7th line of a character row if videocunter was latched in previous 6th row + else if(CharPosLatch & latch_charposition & enabledisplay) // latch character position at 7th line of a character row if videocunter was latched in previous 6th row CharPosReload<=CharPosition; end @@ -741,7 +741,9 @@ always @(posedge clk) begin if(hpos_392 & videoline==EOS) // clear videocounter reload register at last line videocounter_reload<=0; - else if(VertSubCount==6 && latch_charposition && VertSubActive) // Latch videocounter position at 6th line of a character row + else if(inc_videocounter && hcounter_next == 9'd432 && tick8) // if the videocounter running when it's reloaded, that affects the reload value (HSP in Alpharay) + videocounter_reload<=videocounter+1'd1; + else if(VertSubCount==6 && latch_charposition && enabledisplay) // Latch videocounter position at 6th line of a character row videocounter_reload<=videocounter; end