Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Picture without badlines.
2018-02-08 10:15
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....
 
2019-11-12 11:18
ready.

Registered: Feb 2003
Posts: 441
here's my IRQ to avoid ALL badlines but still show bitmap:
IRQ0
PHA
lda $01
pha
lda #$35
sta $01
LDA $DC04 ;inverted CIA timer raster stabilizer to compensate jitter
EOR #63
LSR
STA *+4
BPL *+2
.FILL 30-14, $EA
BCC *+2
BIT $EA
lda $dc04
lda #$3e ;$3a
sta $d011
CLC
bit $ea
INC $D019
d012_pointer
lda d012_pointer_tbl ;4
sta $d012 ;4
lda #$3f ;$3b
dec d012_pointer+1 ;6
.fill 9, $ea
sta $d011
bpl IRQ0_000 ;2
lda #d012_pointer_max ;2
sta d012_pointer+1 ;4
dec frame_update_delay ;6
bne IRQ0_000 ;2
lda #frame_update_delay_max
sta frame_update_delay
cli
lda $d018
eor #BMP_OFFS/$0400^BMP_OFFS_A/$0400
sta $d018
dec $01
jsr FRAME_UPDATE
inc $01
IRQ0_000
pla
sta $01
IRQ0_A
PLA
RTI
d012_pointer_max= 24
.ALIGN (* & $FF00) + $0100
d012_pointer_tbl
.for N=25, N>=0, N=N-1
.byte $25+N*8+1
.next
frame_update_delay .byte frame_update_delay_max
frame_update_delay_max = 10

there are some part not really needed to avoid badlines, but are needed in the rest of my code.
2019-11-12 13:05
ready.

Registered: Feb 2003
Posts: 441
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.
2019-11-12 13:44
Krill

Registered: Apr 2002
Posts: 2825
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.
2019-11-12 14:02
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 ?)
2019-11-12 19:42
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.
2019-11-12 23:58
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.
2019-11-13 08:17
Oswald

Registered: Apr 2002
Posts: 5017
the greetings part in here Smart Girls Hate Booze has such a bitmap screen, maybe you can peek from it.
2019-11-13 09:23
Krill

Registered: Apr 2002
Posts: 2825
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.
2019-11-13 09:49
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!
2019-11-13 10:00
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
Previous - 1 | 2 | 3 | 4 | 5 | 6 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Core/VPN
Guests online: 78
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.06 sec.