A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / c2p issue

 

Author Message
Cosmos Amiga
Member
#1 - Posted: 6 Oct 2019 18:35 - Edited
Reply Quote
I have a little issue when I insert this c2p into AmiQuake2

Like this, I get only 1 line on the top of the screen...

But when I insert a addq.w #4,a1 anywhere in this routine, I have now the full screen, but not clear...
AQ2 Glitchs


Where I'm wrong ?

Thanks,

_c2p8_reloc
movem.l d2-d7/a2/a6,-(sp)

movem.l bm_Planes(a0),d0-d7

lea _c2p8(PC),a2
sub.l d0,d1

move.l d1,__c2p8_p1-_c2p8+4(a2)
sub.l d0,d2

move.l d2,__c2p8_p2-_c2p8+4(a2)
sub.l d0,d3

move.l d3,__c2p8_p3-_c2p8+4(a2)
sub.l d0,d4

move.l d4,__c2p8_p4-_c2p8+4(a2)
sub.l d0,d5

move.l d5,__c2p8_p5-_c2p8+4(a2)
sub.l d0,d6

move.l d6,__c2p8_p6-_c2p8+4(a2)
sub.l d0,d7

move.l d7,__c2p8_p7-_c2p8+4(a2)

move.l 4.w,a6 ; _ExecBase

jsr _LVOCacheClearU(a6)

move.l a2,d0

movem.l (sp)+,d2-d7/a2/a6

rts






; a0 - chunky
; a1 - bitplanes

_c2p8
lea 64000(a0),a2 ; 320 x 200

_c2pheartloop
move.l (a0)+,d0 ; pobieramy piksele grupy 0

move.l (a0)+,d1 ; pobieramy piksele grupy 4

move.l (a0)+,d2 ; pobieramy piksele grupy 2

move.l (a0)+,d3 ; pobieramy piksele grupy 6

; Dzielimy na plany 0-3 i 4-7

move.l d0,d4
and.l #$F0F0F0F0,d4 ; d4 = plany 4-7 grupa 0

eor.l d4,d0 ; d0 = plany 0-3 grupa 0
move.l d1,d5

and.l #$F0F0F0F0,d5 ; d5 = plany 4-7 grupa 4
eor.l d5,d1 ; d1 = plany 0-3 grupa 4

move.l d2,d6
and.l #$F0F0F0F0,d6 ; d6 = plany 4-7 grupa 2

eor.l d6,d2 ; d2 = plany 0-3 grupa 2
move.l d3,d7

and.l #$F0F0F0F0,d7 ; d7 = plany 4-7 grupa 6
eor.l d7,d3 ; d3 = plany 0-3 grupa 6

; Laczymy grupy pikseli 0+4 i 2+6

lsl.l #4,d0
or.l d0,d1 ; d1 = plany 0-3 grupa 0+4

lsl.l #4,d2
or.l d2,d3 ; d3 = plany 0-3 grupa 2+6

lsr.l #4,d5
or.l d4,d5 ; d5 = plany 4-7 grupa 0+4

lsr.l #4,d7
or.l d6,d7 ; d7 = plany 4-7 grupa 2+6

; Dzielimy na plany 0-1 i 2-3

move.l d1,d0
and.l #$CCCCCCCC,d0 ; d0 = plany 2-3 grupa 0+4

eor.l d0,d1 ; d1 = plany 0-1 grupa 0+4
move.l d3,d2

and.l #$CCCCCCCC,d2 ; d2 = plany 2-3 grupa 2+6
eor.l d2,d3 ; d3 = plany 0-1 grupa 2+6

move.l d5,d4
and.l #$CCCCCCCC,d4 ; d4 = plany 6-7 grupa 0+4

eor.l d4,d5 ; d5 = plany 4-5 grupa 0+4
move.l d7,d6

and.l #$CCCCCCCC,d6 ; d6 = plany 6-7 grupa 2+6
eor.l d6,d7 ; d7 = plany 4-5 grupa 2+6

; Laczymy grupy pikseli 0+2+4+6

lsr.l #2,d2
or.l d0,d2 ; d2 = plany 2-3 grupa 0+2+4+6

lsl.l #2,d1
or.l d1,d3 ; d3 = plany 0-1 grupa 0+2+4+6

lsr.l #2,d6
or.l d4,d6 ; d6 = plany 6-7 grupa 0+2+4+6

lsl.l #2,d5
or.l d5,d7 ; d7 = plany 4-5 grupa 0+2+4+6

; Zapisujemy w rejestrach

move.l d2,a4
move.l d3,a3

move.l d6,a5
move.l d7,a6

; To samo powtarzamy dla nieparzystych pikseli i laczymy

move.l (a0)+,d0 ; pobieramy piksele grupy 1

move.l (a0)+,d1 ; pobieramy piksele grupy 5

move.l (a0)+,d2 ; pobieramy piksele grupy 3

move.l (a0)+,d3 ; pobieramy piksele grupy 7

; Dzielimy na plany 0-3 i 4-7

move.l d0,d4
and.l #$F0F0F0F0,d4 ; d4 = plany 4-7 grupa 1

eor.l d4,d0 ; d0 = plany 0-3 grupa 1
move.l d1,d5

and.l #$F0F0F0F0,d5 ; d5 = plany 4-7 grupa 5
eor.l d5,d1 ; d1 = plany 0-3 grupa 5

move.l d2,d6
and.l #$F0F0F0F0,d6 ; d6 = plany 4-7 grupa 3

eor.l d6,d2 ; d2 = plany 0-3 grupa 3
move.l d3,d7

and.l #$F0F0F0F0,d7 ; d7 = plany 4-7 grupa 7
eor.l d7,d3 ; d3 = plany 0-3 grupa 7

; Laczymy grupy pikseli 1+5 i 3+7

lsl.l #4,d0
or.l d0,d1 ; d1 = plany 0-3 grupa 1+5

lsl.l #4,d2
or.l d2,d3 ; d3 = plany 0-3 grupa 3+7

lsr.l #4,d5
or.l d4,d5 ; d5 = plany 4-7 grupa 1+5

lsr.l #4,d7
or.l d6,d7 ; d7 = plany 4-7 grupa 3+7

; Dzielimy na plany 0-1 i 2-3

move.l d1,d0
and.l #$CCCCCCCC,d0 ; d0 = plany 2-3 grupa 1+5

eor.l d0,d1 ; d1 = plany 0-1 grupa 1+5
move.l d3,d2

and.l #$CCCCCCCC,d2 ; d2 = plany 2-3 grupa 3+7
eor.l d2,d3 ; d3 = plany 0-1 grupa 3+7

move.l d5,d4
and.l #$CCCCCCCC,d4 ; d4 = plany 6-7 grupa 1+5

eor.l d4,d5 ; d5 = plany 4-5 grupa 1+5
move.l d7,d6

and.l #$CCCCCCCC,d6 ; d6 = plany 6-7 grupa 3+7
eor.l d6,d7 ; d7 = plany 4-5 grupa 3+7

; Laczymy grupy pikseli 1+3+5+7

lsr.l #2,d2
or.l d0,d2 ; d2 = plany 2-3 grupa 1+3+5+7

lsl.l #2,d1
or.l d1,d3 ; d3 = plany 0-1 grupa 1+3+5+7

lsr.l #2,d6
or.l d4,d6 ; d6 = plany 6-7 grupa 1+3+5+7

lsl.l #2,d5
or.l d5,d7 ; d7 = plany 4-5 grupa 1+3+5+7


; Laczymy piksele parzyste i nieparzyste. Wynik zapisujemy w pamieci.

; Dzielimy

move.l d3,d1
and.l #$AAAAAAAA,d1 ; d1 = plan 1 grupa 1+3+5+7

eor.l d1,d3 ; d3 = plan 0 grupa 1+3+5+7
move.l a3,d0

move.l d0,d4
and.l #$AAAAAAAA,d4 ; d4 = plan 1 grupa 0+2+4+6

eor.l d4,d0 ; d0 = plan 0 grupa 0+2+4+6
add.l d0,d0

or.l d0,d3 ; d3 = plan 0

move.l d3,(a1)

lsr.l #1,d1
or.l d1,d4 ; d4 = plan 1

__c2p8_p1
move.l d4,$12341234.l(a1)
move.l d2,d1

and.l #$AAAAAAAA,d1 ; d1 = plan 3 grupa 1+3+5+7
eor.l d1,d2 ; d2 = plan 2 grupa 1+3+5+7

move.l a4,d0
move.l d0,d4

and.l #$AAAAAAAA,d4 ; d4 = plan 3 grupa 0+2+4+6
eor.l d4,d0 ; d0 = plan 2 grupa 0+2+4+6

add.l d0,d0
or.l d0,d2 ; d2 = plan 2

__c2p8_p2
move.l d2,$12341234.l(a1)
lsr.l #1,d1

or.l d1,d4 ; d4 = plan 3

__c2p8_p3
move.l d4,$12341234.l(a1)
move.l d7,d1

and.l #$AAAAAAAA,d1
eor.l d1,d7

move.l a6,d0
move.l d0,d4

and.l #$AAAAAAAA,d4
eor.l d4,d0

add.l d0,d0
or.l d0,d7 ; d7 = plan 4

__c2p8_p4
move.l d7,$12341234.l(a1)
lsr.l #1,d1

or.l d1,d4 ; d4 = plan 5

__c2p8_p5
move.l d4,$12341234.l(a1)
move.l d6,d1

and.l #$AAAAAAAA,d1
eor.l d1,d6

move.l a5,d0
move.l d0,d4

and.l #$AAAAAAAA,d4
eor.l d4,d0

add.l d0,d0
or.l d0,d6 ; d6 = plan 6

__c2p8_p6
move.l d6,$12341234.l(a1)
lsr.l #1,d1

or.l d1,d4 ; d4 = plan 7

__c2p8_p7
move.l d4,$12341234.l(a1)
cmp.l a2,a0

blt.w _c2pheartloop

rts
Cosmos Amiga
Member
#2 - Posted: 7 Oct 2019 05:49 - Edited
Reply Quote
My first try was to add the addq.w #4,a1 right after the __c2p8_p7 move.l d4,$12341234.l(a1), but then nothing at all on screen...
rloaderror
Member
#3 - Posted: 9 Oct 2019 02:41
Reply Quote
Just a guess. If your assembler has optimizations enabled it might find a spot to rearrange or substitute one piece of code for another in this file. This can mess up the self modifying code as suddenly it might modify something unexpected. So try turning off optimization for this source file. (I had such a problem earlier with another c2p featuring smc and disabling assembly optimizations worked for me)
todi
Member
#4 - Posted: 9 Oct 2019 08:41
Reply Quote
Maybe a long shot, but also check that your bitplanes are 8 byte aligned. If you have set FMODE: BPAGEM = 1 &| BLP32 = 1, this kind artifact can appear
noname
Member
#5 - Posted: 9 Oct 2019 09:55
Reply Quote
"Best" c2p (my guess) is not necessarily best on all levels.
Cosmos Amiga
Member
#6 - Posted: 9 Oct 2019 14:20 - Edited
Reply Quote
Optimizations disable, of course !

What do you mean exactly with your "bitplanes 8 byte aligned" ?

This polich c2p is tiny, so take less code cache than the other...
todi
Member
#7 - Posted: 9 Oct 2019 19:53
Reply Quote
If you set FMODE datafetch you have to align your bitplane pointer, ex.

jsr _LVOAllocMem(a6)
add.l #7,d0
and.l #$fffffff8,d0

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0