English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 20 April 2007, 14:30   #41
bobbybearing
Zone Friend
bobbybearing's Avatar
 
Join Date: Oct 2003
Location: France
Age: 44
Posts: 162
lsl and add are quicker than mulu. But you can also precalc your sintab if you have to mul *40 each time...
bobbybearing is offline  
AdSense AdSense  
Old 20 April 2007, 15:35   #42
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Thanks for the confirmation. Yeah - I thought about precalculating the sine table values before but I didn't cos it seemed like cheating!

Instead I sat down with my calculator this morning and worked out a way to multiply by 40 using shifts and adds.

Definitely going to keep precalcs in mind though - might edge me closer to getting a one pixel sine copy working...
pmc is offline  
Old 20 April 2007, 19:24   #43
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Erm... Just checked out the two pixel version at home and it's not right - there's a glitch in the top right hand corner of the sine scroller. I didn't notice this on my laptop at work but I do notice it on my PC at home.

I even tried the two pixel version with a pre calc'd sine table but the glitch is still there! Aaaarrrghhh! I just can't seem to make the routine fast enough so that it looks right with anything other than a four pixel sine copy.

Think it's gonna have to be double buffering or bust!
pmc is offline  
Old 20 April 2007, 21:32   #44
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 36
Posts: 2,284
Quote:
Originally Posted by pmc
Think it's gonna have to be double buffering or bust!
Dude, double buffering always! Even triple buffering sometimes if your routine flops over a frame
musashi5150 is offline  
Old 21 April 2007, 01:33   #45
bobbybearing
Zone Friend
bobbybearing's Avatar
 
Join Date: Oct 2003
Location: France
Age: 44
Posts: 162
yep, it's that I had said : all 1 or 2 pixels sinuscroll works with double or triple buffering
bobbybearing is offline  
Old 21 April 2007, 01:55   #46
AGN
Registered User
 
Join Date: Aug 2004
Location: Poland
Posts: 142
Quote:
Originally Posted by pmc
I even tried the two pixel version with a pre calc'd sine table but the glitch is still there! Aaaarrrghhh! I just can't seem to make the routine fast enough so that it looks right with anything other than a four pixel sine copy.
Maybe it's fast enough but interrupt starts at vbl instead of particular line.
Code:
@@ -330,6 +330,7 @@
        and.w   #%0000000000010000,intreqr(a5)          ;did the copper cause the interrupt?
        beq     interrupt_done                  ;nope, jump back out of my interrupt code
        move.w  #%0000000000010000,intreq(a5)           ;yep, clear the copper interrupt bit and continue with the interrupt code
+       move.w  #$00f0,cust_regs+color00

 clear_dis_scrn:
        btst    #6,dmaconr(a5)                  ;blitter ready?
@@ -547,6 +548,8 @@
        rts

 interrupt_done:
+       move.w  #$0f00,cust_regs+color00
+
        movem.l (sp)+,d0-d7/a0-a6                       ;end of interrupt, restore registers
        move.l  cop_int_address,-(sp)           ;stick the return address on the stack
        rts                             ;and return to it
@@ -1087,6 +1090,7 @@
        dc.w    $9d01,$ff00,color01,$0fa0
        dc.w    $9e01,$ff00,color01,$0fa0
        dc.w    $9f01,$ff00,color01,$0fa0
+       dc.w    intreq,$8010            ;triggers the copper interrupt
        dc.w    $a001,$ff00,color01,$0f90
        dc.w    $a101,$ff00,color01,$0f90
        dc.w    $a201,$ff00,color01,$0f90
@@ -1129,7 +1133,8 @@
        dc.w    $c701,$ff00,color01,$0f00
        dc.w    $c801,$ff00,color00,$000f               ;start of the second copper bar
        dc.w    $ca01,$ff00,color00,$0000               ;end of the second copper bar
-       dc.w    $ffdf,$fffe,intreq,$8010                ;triggers the copper interrupt
+       dc.w    $ffdf,$fffe
+       dc.w    $3001,$ff00,color00,$0fff               ;end of the second copper bar
        dc.w    $ffff,$fffe

 credits:       dc.b    "$VER: Sinescroll V2.12 with UltraEdit32 V13.00, assembled with Devpac V3.02 under WinUAE 1.4.1.0 April 2007)"
AGN is offline  
Old 21 April 2007, 02:43   #47
AGN
Registered User
 
Join Date: Aug 2004
Location: Poland
Posts: 142
Quote:
Originally Posted by pmc
Yeah - I thought about precalculating the sine table values before but I didn't cos it seemed like cheating!
Data at 'sin_table' is a precalc itself. You should use system/math libs to create these values. :P
AGN is offline  
Old 21 April 2007, 02:46   #48
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 36
Posts: 2,284
I guess if you only needed a few more rasters you could get the Copper to trigger a Level3 INT before the VBlank... (As long as the display isn't still being drawn by the CPU).
musashi5150 is offline  
Old 21 April 2007, 17:43   #49
korruptor
TDI
korruptor's Avatar
 
Join Date: Feb 2007
Location: DUNDEE
Posts: 122
pmc: I've dropped my source into the zone. It's not double buffered and the sine is pre-calced but it might be worth a read. It took me a while to get it working so there're probably bugs.
korruptor is offline  
Old 21 April 2007, 19:14   #50
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
@mushashi5150 & bobbybearing - As you can read below, it actually turns out that the routine not being double buffered isn't the problem. However, your advice has always been good advice so who am I to go against it? Double buffered it now is!

@AGN - Hmmm... good idea and something I hadn't thought of - if I need to, I can shift the start of the interrupt somewhere else other then the VBL... Regarding the sine table itself being a precalc - gimme a break, most of my hair's fallen out just getting this far!!

@korruptor - thanks for posting your source, nice one. Bugs? Who's routines don't have bugs? As you can read below, certainly not mine! You got it working, that's the main thing...

I lifted the double buffering code out of the sinescroller source on flashtro.com and implemented it into my routine.

Double buffering isn't the problem. With or without the double buffering, there's still the glitch in the top right hand corner of the sinescroll display. Something else is wrong.

Also, there's now a mismatch between the master and temporary sine pointers. If I disable sine, as per AGN's suggestion of sticking a 255 in at the second position in the sine table, weird things happen. I get a flat scroller for half of the screen and then it breaks into a random sine pattern for the other half. As far as I can tell, these problems have only occurred since the routine was converted to a two pixel sine copy.
pmc is offline  
Old 21 April 2007, 20:14   #51
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 36
Posts: 2,284
Quote:
Originally Posted by pmc
With or without the double buffering, there's still the glitch in the top right hand corner of the sinescroll display
I had a glitchy scroller once and the problem was the Blitter masks not being set correctly - scratched my head for quite a while on that one. And of course be sure to WaitBlit() before poking any registers (but I'm sure you're probably already doing that).
musashi5150 is offline  
Old 21 April 2007, 20:59   #52
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Quote:
Also, there's now a mismatch between the master and temporary sine pointers. If I disable sine, as per AGN's suggestion of sticking a 255 in at the second position in the sine table, weird things happen. I get a flat scroller for half of the screen and then it breaks into a random sine pattern for the other half.

Scratch the above, that was happening on the four pixel version too.

I went right back to my original working four pixel routine. Then I added or changed everything that I've added or changed between that routine and the two pixel version, assembling and running after each change, including new things like adding double buffering. Everything works fine up to this point.

The top right graphics glitch problem *only* happens when I then increase from four sine blits to eight for the two pixel copy in the sine blit loop... Very odd...
pmc is offline  
Old 21 April 2007, 22:24   #53
AGN
Registered User
 
Join Date: Aug 2004
Location: Poland
Posts: 142
Quote:
Originally Posted by pmc
Regarding the sine table itself being a precalc - gimme a break, most of my hair's fallen out just getting this far!!
Which means that having *40 values in table is not cheating.
Quote:
Originally Posted by pmc
Double buffering isn't the problem. With or without the double buffering, there's still the glitch in the top right hand corner of the sinescroll display. Something else is wrong.
My bet: broken logic in frame flipping.
Quote:
Originally Posted by pmc
Also, there's now a mismatch between the master and temporary sine pointers. If I disable sine, as per AGN's suggestion of sticking a 255 in at the second position in the sine table, weird things happen.
You don't need 2 pointers for sine table in d.buffer mode.

Put code in zone.

AGN is offline  
Old 22 April 2007, 01:51   #54
AGN
Registered User
 
Join Date: Aug 2004
Location: Poland
Posts: 142
Quote:
Originally Posted by korruptor
pmc: I've dropped my source into the zone. It's not double buffered and the sine is pre-calced but it might be worth a read. It took me a while to get it working so there're probably bugs.
It works on 68000@7MHz?
AGN is offline  
Old 22 April 2007, 12:11   #55
bobbybearing
Zone Friend
bobbybearing's Avatar
 
Join Date: Oct 2003
Location: France
Age: 44
Posts: 162
without double buf, with winuae, perhaps check Immediate Blitter or cycle exact cpu-blitter
bobbybearing is offline  
Old 22 April 2007, 12:48   #56
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Quote:
Originally Posted by AGN
You don't need 2 pointers for sine table in d.buffer mode.
Yes, you're right - I've gradually realised that I don't need two sine pointers - I'm changing my code to only use one. Once I've got the sine code changed I'll post an updated source.
pmc is offline  
Old 22 April 2007, 15:53   #57
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Sine code has been changed now. Only one sine pointer is used. Instead, an offset value is added each iteration. Still not sure if this is *the* proper way to do it but it seems to work. Still got the top right graphics glitch. Anyways, new version posted to the zone...
pmc is offline  
Old 22 April 2007, 16:02   #58
bobbybearing
Zone Friend
bobbybearing's Avatar
 
Join Date: Oct 2003
Location: France
Age: 44
Posts: 162
have no time atm, but great work!
bobbybearing is offline  
Old 22 April 2007, 16:24   #59
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
@bobbybearing - no worries, man - and thanks.

@korruptor - had some time so checked out your source just now. Looks like it needs to be double buffered for running on 68000 - I get some flickering running it as if it's on an ECS A500+ under WinUAE - but with that amendment done it'll look great. Top man. Only other prob I had was that it didn't quit properly for me after I pressed the left mouse button...
pmc is offline  
Old 22 April 2007, 19:02   #60
AGN
Registered User
 
Join Date: Aug 2004
Location: Poland
Posts: 142
Quote:
Originally Posted by pmc
Sine code has been changed now.
I don't like You.
Code:
@@ -235,12 +235,12 @@
 ** Equates - Library offsets **

 execbase       equ      4
-openlibrary:   equ     -552
-closelibrary:  equ     -414
-forbid:        equ     -132
-permit:        equ     -138
-sys_cop_offset:        equ      38
-cop_int_vect:  equ     $6c
+openlibrary    equ     -552
+closelibrary   equ     -414
+forbid equ     -132
+permit equ     -138
+sys_cop_offset equ      38
+cop_int_vect   equ     $6c

 ** Code **

@@ -431,7 +431,7 @@
 sin_copy_setup:
        lea     scroll_screen,a0                        ;first word of the scrollplane as the source
        suba.w  #2600,a6                        ;first word of the displayed screen as the destination
-       moveq.b #19,d2                  ;display is 320 bits wide, which is 40 bytes which, is 20 words. 20 words need to be blitted to complete one display. Set counter to number required minus one cos this is a dbra loop
+       moveq   #19,d2                  ;display is 320 bits wide, which is 40 bytes which, is 20 words. 20 words need to be blitted to complete one display. Set counter to number required minus one cos this is a dbra loop

 sin_blits:
        bsr     get_offset                      ;first we need to use a sin value to offset where we start copying into the displayed screen
Quote:
Originally Posted by pmc
Still got the top right graphics glitch.
Race condition. Your code is not able to update copper list before its execution.
Code:
@@ -1035,6 +1035,7 @@
        dc.w    ddfstrt,$0038,ddfstop,$00d0
        dc.w    bpl1mod,$0000,bpl2mod,$0000
        dc.w    color00,$0000,color01,$0fff
+       dc.w    $0101,$ff00
        dc.w    bpl1pth
 plane1_h:      dc.w    0                       ;where the screen bitmap address gets put
        dc.w    bpl1ptl
AGN is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a sine effect bobster Coders. Tutorials 16 17 October 2012 13:11
Sine scroller - dycp blazeb Coders. Asm / Hardware 6 02 May 2012 11:08
Flickering sine scroller pmc Coders. Tutorials 4 24 June 2009 10:19
Help with sine regression Ed Cruse Coders. General 14 30 June 2008 02:15

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:37.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.35603 seconds with 12 queries