| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
Picture without badlines.
In the last part of Time Machine by Booze Design HCL says that the picture looks very colorful despite not having any badlines. How is that possible to have pictures without badlines ? Lack of badlines causes FLD effect, right ? |
|
... 39 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2969 |
Quoting ready.So we get a half badline. Seems like you're inadvertently triggering delayed DMA. If done right, every line really has the full 63 cycles. |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
Quote: investigating deeper into what really happens, I found that the badline kind of starts, so that it steals the cycles from the CPU but then it is aborted by $d011 first write, so that the VIC does not get color info from the screen. This can be checked by running the code above. IRQ starts with $d012=N and $DC04 = $3f or so depending on the jitter given by last instruction executed outside of IRQ. Note: $DC04 = $3f means raster is on the left of screen. Then $d012 becomes N+1 before executing LDA #$3E, but in such moment $DC04=$0a, so raster is almost at the right side of screen. All cycles in between were stolen from CPU. So we get a half badline.
This is a piece of code from my part that does this effect. There's 4 sprites on the line
!for line,0,164{
stx $d017
!if (line >= 250-135){
lda #$0 + ((line + 7 ) & 7 )
}else{
lda #$38 + ((line + 7 ) & 7 )
}
sta $d011
lda sinus_read + (((line*4) + 0)&255)
sta $d000
lda sinus_read + (((line*4) + 1)&255)
sta $d002
lda sinus_read + (((line*4) + 2)&255)
sta $d004
lda sinus_read + (((line*4) + 3)&255)
sta $d006
lda #3 //free 6 cycles
sta $d021 //for something....
sty $d017
}
My loop is 52 cycles, exactly how many cycles the CPU has on a non-badline line with 4 sprites enabled. Not sure why are you losing some cycles.
BTW. This is different kind of "picture without badlines", the Booze part I mentioned in the first post does FPD, so I think it's different (repeating the last line of a char ?) |
| |
ready.
Registered: Feb 2003 Posts: 441 |
I still can get it right then. I understood I must trigger a badline at RC=7. Using screen position = %011, RC=7 at raster $37, $3F, $47,... I guess that if screen position changes, also the condition RC=7 happens at a different rasterline, because the end of a char block is moved vertically.
So I set my first IRQ to set $d011=$3F at raster=$037 and cycle 55. This forces a badline.
Next thing is to restore $d011 to $3b, which ensures that RC=7 happens at raster $37, $3F, $47,.... But it will also provide a badline at raster $3b, $43,.... which is unwanted of course.
So I can't get out of it. What I am missing? Tried to analyze some code of demos posted above but I couldn't really get into it, since there were also other $d011 tricks mixed in the middle. |
| |
ready.
Registered: Feb 2003 Posts: 441 |
I also tried to use this approach in my code:
https://codebase64.org/doku.php?id=base:repeating_char-lines&s[..
Also Oswald seems to use the same, as stated in a post from this:
https://csdb.dk/forums/index.php?roomid=11&topicid=119133&first..
The problem is that the code I linked doubles both text screen and bitmap screen, so all I get is the first 8 piexls line of the bitmap repeated through the whole screen. I want to repeat just the text (thus color in bimtap mode) screen. |
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
the greetings part in here Smart Girls Hate Booze has such a bitmap screen, maybe you can peek from it. |
| |
Krill
Registered: Apr 2002 Posts: 2969 |
Quoting ready.I understood I must trigger a badline at RC=7. Using screen position = %011, RC=7 at raster $37, $3F, $47,... The fake badline condition must be triggered in every line (within the correct cycle window), thus $d011 needs to be written to in every line, just as Golara does. See also https://codebase64.org/doku.php?id=base:linecrunch. |
| |
ready.
Registered: Feb 2003 Posts: 441 |
ok, I was expecting it could be done just for a few lines, triggering an irq every 8 rows. Since I need to run a background program, I need the irq to steal as little cycles as possible. Then I guess my first approach will just do fine. The whole need for this effect was to save memory getting rid of the screen RAM, to be able to alternate 2 bitmaps in the same bank.
Thanks a lot for the support! |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
Quote: ok, I was expecting it could be done just for a few lines, triggering an irq every 8 rows. Since I need to run a background program, I need the irq to steal as little cycles as possible. Then I guess my first approach will just do fine. The whole need for this effect was to save memory getting rid of the screen RAM, to be able to alternate 2 bitmaps in the same bank.
Thanks a lot for the support!
This effect only makes sense if you need all the cycles every line, like me, I needed to change 4 sprite X positions and stretch them (2 writes to d017), had to get rid of the badlines. I don't think you can manipulate badlines just to avoid them stealing cycles from your non-irq code. Besides, if you add up all the cycles the badline takes, you get 1000 cycles per frame. A full frame has 19656 cycles, so all the badline steal only 5% of the raster time |
| |
ready.
Registered: Feb 2003 Posts: 441 |
In fact, Golara, I was not seeking for extra cycles by removing badlines. My goal is to get rid of screen RAM due to memory constraints, so I can use 1 single VIC bank for 2 bitmaps, without screen RAM. And with the code I posted I succeeded in that. On the practical side, I have half badlines allover the screen. |
| |
Krill
Registered: Apr 2002 Posts: 2969 |
Something doesn't quite add up then. If you're getting any kind of badline DMA, colour information should be read and applied. Can you post a binary of your code? |
Previous - 1 | 2 | 3 | 4 | 5 - Next |