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


Forums > C64 Coding > Misaligned Char reads ?!
2019-01-02 23:56
Oswald

Registered: Apr 2002
Posts: 4365
Misaligned Char reads ?!

I was just fooling and found this.

the code does this:

near but well before the left border edge :

lda $d012 ;8
clc ;10
adc #$02 ;12
and #7 ;14
ora #$18 ;16
sta $d011

and 8 cycles after that:

lda $d012 ;8
clc ;10
adc #$00 ;12
and #7 ;14
ora #$18 ;16
sta $d011 ;20

as I add #2 to d011 in the first write I thought this could be used to rotate the characters, because the misalignment is exactly 2 lines, but the misalignment stays 2 even if I write 3 to d011 (while trying 0-7 in the 2nd d011 write, well most cases results in fld), or change starting rasterline 1 line lower, etc.

anyone can explain this?





yeah.. only tested in emulator. 3.3 x64sc has same results as older vice and non sc.
 
... 5 posts hidden. Click here to view all posts....
 
2019-01-04 09:35
Groepaz

Registered: Dec 2001
Posts: 9021
+1 for prg. also source please, this looks like a good candidate for a regression test :)
2019-01-04 11:06
Oswald

Registered: Apr 2002
Posts: 4365
as is, this was originally ment to test if repeating 2 lines from the top char row endlessly is possible. Long after achieving the goal I returned to it with some random hacking and stumbled upon the result above.


d018tab	= $1e00
dd00tab	= $1f00

ysize	= 200

	*= $1000
	sei
	lda #$7f
	sta $dc0d
	lda #$01
	sta $d01a
	lda $dc0d
	lda $dd0d
	lda #$1b
	sta $d011
	lda #$36
	sta $d012
	lda #$35
	sta $01
	lda #<irq1
	sta $fffe
	lda #>irq1
	sta $ffff
	
	ldx #$00
-	txa
	sta $db00,x
	dex
	bne -
	
	.for ue=0,ue<25,ue=ue+1
	lda #$28+ue
	sta $0410+ue*40
	.next
	;jmp *
	lda #3
	sta $dd00
u	
	ldx #200
-	txa
	and #%00000001
	sta d018tab,x
	dex
	bne -
	
	ldx #$27
-	txa	
	sta $0400,x
	dex
	bpl -
	lda ($01,x)
	bit $eaea
	cli
	jmp u
	
	
irq1	
	pha
	txa
	pha
	tya
	pha
	
	inc $d019
	inc $d020

	lda $d012
-	cmp $d012
	beq -

	ldx #12
	dex
	bne *-1
	nop
	nop
	nop
	;nop
	
	ldx #$00
	
rloop	ldy d018tab,x	;4
	lda $d012	;8
	clc	;10
	adc #$04	;12
	and #7	;14
	ora #$18	;16
	sta $d011 	;20
	sty $d020	;24
	
	;bit $eaea	;28
	;bit $eaea	;32
	;bit $eaea	;36
	;bit $eaea	;40
	;bit $eaea	;44
	;bit $ea	;47
	;bit $ea	;50
	;bit $eaea	
	;bit $ea	
	;bit $ea	
	;nop	;52
	
	ldy d018tab,x	;4
	lda $d012	;8
	clc	;10
	adc #$00	;12
	and #7	;14
	ora #$18	;16
	sta $d011 	;20
	sty $d020	;24
	
	;bit $eaea	;28
	;bit $eaea	;32
	nop
	nop
	bit $eaea	;36
	bit $eaea	;40
	bit $eaea	;44
	bit $eaea	;48
	bit $eaea	;52
	bit $eaea	;56
	
	bit $eaea
	
	inx	;58
	cpx #ysize/2	;60
	bne rloop	;63
	
	dec $d020
	
	lda #<irq2
	sta $fffe
	lda #>irq2
	sta $ffff
	
	lda #$ff
	sta $d012
	inc $d020
	pla
	tay
	pla
	tax
	pla
	rti

irq2	
	pha
	txa
	pha
	tya
	pha
	
	inc $d019
	inc $d020
	lda #$1b
	sta $d011
	lda #$2
	sta $d020
	
	lda #<irq1
	sta $fffe
	lda #>irq1
	sta $ffff
	
	lda #3
	sta $dd00
	lda #20
	sta 53272
	
	lda #$33
	sta $d012
	
	pla
	tay
	pla
	tax
	pla
	rti
	
2019-01-04 15:20
Scan

Registered: Dec 2015
Posts: 77
I don't have an explanation for what I'm looking at, but I only looked briefly and will examine closer using C64Debugger in the evening. But I see something off in the comments with the cycle counting.
	ldy d018tab,x	;4
	lda $d012	;8
	clc	;10
	adc #$00	;12
	and #7	;14
	ora #$18	;16
	sta $d011 	;20 (introduce badline condition)
	sty $d020	;24 
	
	;bit $eaea	;28
	;bit $eaea	;32
	nop
	nop
	bit $eaea	;36
	bit $eaea	;40
	bit $eaea	;44
	bit $eaea	;48
	bit $eaea	;52
	bit $eaea	;56
This part will introduce a badline, but the cycle counting in the comments assumes it's not a badline and that the VIC won't stall the CPU.
2019-01-04 15:35
Oswald

Registered: Apr 2002
Posts: 4365
dont rely on the comments, they are leftovers, garbage, random lines were insterted etc.
2019-01-04 19:32
Martin Piper

Registered: Nov 2007
Posts: 397
The lda ($01,x) could introduce introduce memory read, CIA or VIC ack, issues.

However probably not related to this effect.

I'm currently puzzled.
2019-01-05 07:21
Oswald

Registered: Apr 2002
Posts: 4365
* this originally repeated top 2 pixel lines of the first char row, the 2nd d011 write was an lda before I came back to this, what I've changed was to reinstall the 2nd d011 write and I removed the delay between those 2 d011 writes. then some random hacking of d011 values, maybe delay too dont remember.

My current theory is that there is 2 chars of vsp and maybe that can be connected to 2 lines of misalignment in the char reads. tho I dont rule out that whats visible is just a mere mix of already known VIC effects.
2019-01-05 15:57
Krill

Registered: Apr 2002
Posts: 1108
This appears to be a combination of repeated char rows and FLI, in this order.

Note that the apparent misalignment is 1 rasterline (not 2), such that a char seems to be rotated upwards by a line, with its first line displayed at its bottom.

Emphasis on "seems", as there is neither actual rotation nor misaligned char reads.

Look at the first and second char rows. The chars in the first row are displayed normally, while the first rasterline of the second char row shows the first line of the chars in the first row. Which means there are 9 rasterlines with the content of the first char row at the top of the screen.

Now, when going from a char row to the next, there is no badline initially, and the chars are repeated for the first rasterline of a char row.
In the next rasterline, DMA is forced by triggering a badline condition, but late enough to trigger FLI rather than a normal badline (note the 3 $ff chars).
Starting with the second rasterline of a char row, updated content is displayed, i.e., the new char row.
The first line will finally be displayed in the next char row.
2019-01-05 16:38
Martin Piper

Registered: Nov 2007
Posts: 397
How about these few lines of apparent 0xff?
2019-01-05 16:55
Krill

Registered: Apr 2002
Posts: 1108
FLI DMA is triggered a few cycles later there.

The timing is off for a few lines until it eventually settles thanks to repeated FLI DMA triggering (which can be used for stable raster purposes).

Note that you can control the amount of repeated chars (the first two columns in the original picture) and thus move the 3 $ff chars by adding or removing cycles in the loop.
2019-01-05 17:18
Oswald

Registered: Apr 2002
Posts: 4365
ah Gunnar you got it ! :) row doubling cancelled by fli.
Previous - 1 | 2 - 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
Twilight/ex- ARCADE ..
JackAsser/Booze Design
Viza/Hokuto Force
Guests online: 51
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.6)
9 C=Bit 18  (9.6)
10 X Marks the Spot  (9.5)
Top onefile Demos
1 Smile to the Sky  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.4)
4 FMX Music Demo  (9.4)
5 Crystal Gazer  (9.4)
6 Rewind  (9.4)
7 Pandemoniac Part 2 o..  (9.4)
8 Official X2018 Report  (9.4)
9 Arok 20 Invitation  (9.4)
10 Party Horse  (9.3)
Top Groups
1 PriorArt  (9.7)
2 Performers  (9.5)
3 Oxyron  (9.5)
4 Booze Design  (9.4)
5 Censor Design  (9.3)
Top Coders
1 Sailor  (10)
2 Antonio Savona  (10)
3 Axis  (9.8)
4 CRT  (9.8)
5 Graham  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.069 sec.