Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


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

Registered: Apr 2002
Posts: 5017
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.
2019-01-03 00:47
Martin Piper

Registered: Nov 2007
Posts: 634
What does it do on real hardware?
2019-01-03 00:54
Oswald

Registered: Apr 2002
Posts: 5017
results are some on real hw. btw the code does run only every 2nd line as indicated by the raster coloring.
2019-01-03 07:59
Flavioweb

Registered: Nov 2011
Posts: 447
Looks to me like a mix of last line repeat, fld and linecrunch... in this order.
Last char line is repeated then 1 line fld is inserted then vic restart draw "next line" with "old data" but crunching first line of the new char...
...if this make some sense...
2019-01-03 12:08
Oswald

Registered: Apr 2002
Posts: 5017
"crunching first line of the new char."

thats still something that was never seen before. cant be fld because there would be empty lines between. the misalignment is also present in bitmap mode:

2019-01-04 08:52
Martin Piper

Registered: Nov 2007
Posts: 634
Can you post the prg?
There is also what looks like a 0xff glitch on the top chars STU which is interesting.
2019-01-04 09:35
chatGPZ

Registered: Dec 2001
Posts: 11116
+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: 5017
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: 110
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: 5017
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: 634
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.
 
... 5 posts hidden. Click here to view all posts....
 
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
the mad-zap/Royal Cr..
jmin
Scrap/Genesis Project
Mason/Unicess
ΛΛdZ
mutetus/Ald ^ Ons
Isildur/Samar
sailor/Triad
moraff/Panic/Gorbat ..
rexbeng
Guests online: 165
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 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (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 NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

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