20 May 2009, 12:15 | #1 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
Behaviour of COPJMP2?
Sorry to post again with a problem so soon but I'm pulling my hair out on this one. According to the HW manual writing to COPJMP2 should force the copper to load it's PC with the address of COP2LC (exactly as writing to COPJMP1 forces pc=COP1LC). I'm using WinUAE as a standard Amiga500 and finding that for some reason my COPJMP2 instructions are not executing properly. Issue is explained in the copperlist at the bottom in comments. I've attached the full code in case the issue lies with startup code or something... Would be very grateful for any suggestions:
Code:
; includes include exec/types.i include hardware/custom.i include hardware/dmabits.i include hardware/hw_examples.i include exec/exec_lib.i include graphics/graphics_lib.i SIGBREAKF_CTRL_C equ $1000 ActiView equ $22 copinit equ $26 AttnFlags equ $128 SECTION main,code_c ; load into chip ram ; startup code ; open graphics.lib main move.l $4.w,a6 ; a0 = SysBase lea gfxname,a1 ; Open graphics.library moveq #0,d0 ; Any version jsr _LVOOpenLibrary(a6) move.l d0,gfxbase ; Save the current display move.l gfxbase,a6 ; a6 = gfxbase move.l ActiView(a6),oldview ; Save copper list sub.l a1,a1 ; a1 = null jsr _LVOLoadView(a6) ; Load a NULL view jsr _LVOWaitTOF(a6) ; Wait for top of video frame jsr _LVOWaitTOF(a6) ; Wait again in case interlaced ; demo code lea CUSTOM,a0 ; a0 = base address of custom chip registers lea newcop1,a1 ; a1 = address of copperlist 1 move.l a1,COP1LC(a0) ; Load copperlist address to COP1 lea newcop2,a2 ; a2 = address of copperlist 2 move.l a2,COP2LC(a0) ; Load copperlist address to COP2 ; wait for a CTRL-C move.l 4,a6 ; system base move.l #SIGBREAKF_CTRL_C,d0 ; signal on CTRL-C jsr _LVOWait(a6) ; wait for this signal ; closedown code ; restore the system display move.l gfxbase,a6 jsr _LVOWaitTOF(a6) jsr _LVOWaitTOF(a6) ; Wait for top of video frame move.l oldview,a1 ; a1 = old copperlist jsr _LVOLoadView(a6) ; Reload the old view move.l copinit(a6),$dff080 ; Bang it into COP1LC ; close libraries move.l $4.w,a6 ; A6 = ExecBase move.l gfxbase(pc),a1 jsr _LVOCloseLibrary(a6) ; close graphics.library ; exit exit moveq #0,d0 rts ; data even gfxname dc.b "graphics.library",0 gfxbase dc.l 0 oldview dc.l 0 ; copper list newcop1 dc.w COLOR00,$0002 dc.w $01df,$87fe ; Mask vertical position with %111 dc.w COLOR00,$0004 dc.w $02df,$87fe ;...vertical count from %000 to %111 dc.w COLOR00,$0006 dc.w $03df,$87fe ;...and update color each time dc.w COLOR00,$0008 dc.w $04df,$87fe ;...wait for horiz >=223 to be off screen dc.w COLOR00,$000a dc.w $05df,$87fe ; Blue bars for Vp <=127 and 256 <= Vp dc.w COLOR00,$000c dc.w $06df,$87fe dc.w COLOR00,$000e dc.w $07df,$87fe dc.w COLOR00,$000f dc.w $7f01,$7f01 ; Skip if Vp >= 127 dc.w COPJMP1,$0 ; Force copper pc jump to COP1LC newcop2 dc.w COLOR00,$00020 ; Same mask but need to count from dc.w $81df,$87fe dc.w COLOR00,$00040 dc.w $82df,$87fe ;... %10000000 to %10000111 dc.w COLOR00,$00060 dc.w $83df,$87fe ;...since the MSB is always unmasked dc.w COLOR00,$00080 dc.w $84df,$87fe ; Green bars for 128 <= Vp <=255 dc.w COLOR00,$000a0 dc.w $85df,$87fe dc.w COLOR00,$000c0 dc.w $86df,$87fe dc.w COLOR00,$000e0 dc.w $87df,$87fe dc.w COLOR00,$000f0 dc.w $ff01, $fe01 ; Skip if Vp >= 255 (PAL lines 256 to 312) .crazy dc.w COPJMP2,$0 ; Force copper pc jump to COP2LC!!!! dc.w COPJMP1,$0 ; Force copper pc jump to COP1LC dc.w $FFFF,$FFFE ; Endless wait (just in case cooper gets here) ; The COPJMP2 instruction at .crazy does not have the desired effect ; there is no looping and the copper remains inactive until the next TOF |
20 May 2009, 14:42 | #2 |
Used Register
Join Date: Nov 2008
Location: Headvillage / The Nethervoids
Age: 50
Posts: 103
|
Doesn't the COPJMP1 right after the COPJMP2 spoil al the fun?
I'm just getting back to all this stuff myself since like 18 years or so, but my guess is that COPJMP1 (right before $FFFF,$FFFE) needs to go. I'm sure one of the experts will have a better answer... Good luck. EDIT: Never mind, missed the skip instruction... Last edited by Vortex; 20 May 2009 at 14:45. Reason: typo |
20 May 2009, 16:33 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
I think OS vertical blank interrupt sets COP2LC. Your example works if interrupts are disabled.
I guess it also works if you set COP2LC before starting the loop.. (probably not really compatible way either..) |
20 May 2009, 18:14 | #4 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
Thanks Toni. I think that might be it. Actually it is quite easy to dispense with COPLOC2 all together, at the expense of having the cooper a bit more busy after Vp>127 'falling through' all the wait instructions intended for Vp<127. The ammended code below works fine.
By the way, the great looking copper bars in demos, are they usually done with a loop like this or just by having a big copperlist as long as the height of the screen? Code:
; copper list newcop1 dc.w COLOR00,$0002 dc.w $01df,$87fe ; Mask vertical position with %111 dc.w COLOR00,$0004 ;...vertical count from %000 to %111 dc.w $02df,$87fe ;...and update color each time dc.w COLOR00,$0006 ;...wait for horiz >=223 to be off screen dc.w $03df,$87fe dc.w COLOR00,$0008 dc.w $04df,$87fe dc.w COLOR00,$000a dc.w $05df,$87fe ; Blue bars for Vp <=127 and 256 <= Vp dc.w COLOR00,$000c dc.w $06df,$87fe dc.w COLOR00,$000e dc.w $07df,$87fe dc.w COLOR00,$000f dc.w $7f01,$7f01 ; Skip if Vp >= 127 dc.w COPJMP1,$0 ; Force copper pc jump to COP1LC dc.w COLOR00,$00020 ; now we are in zone 128 <= Vp <=255 dc.w $81df,$87fe dc.w COLOR00,$00040 ; Same mask but need to count from dc.w $82df,$87fe ; ... %10000000 to %10000111 dc.w COLOR00,$00060 ; ...since the MSB is always unmasked dc.w $83df,$87fe dc.w COLOR00,$00080 dc.w $84df,$87fe dc.w COLOR00,$000a0 ; Green bars for 128 <= Vp <=255 dc.w $85df,$87fe dc.w COLOR00,$000c0 dc.w $86df,$87fe dc.w COLOR00,$000e0 dc.w $87df,$87fe dc.w COLOR00,$000f0 dc.w COPJMP1,$0 ; Force copper pc jump to COP1LC dc.w $FFFF,$FFFE ; Endless wait-just in case cooper gets here |
20 May 2009, 18:35 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copy protection behaviour | Anna | Nostalgia & memories | 27 | 15 September 2018 23:34 |
Keyrah - Odd behaviour... | ElectroBlaster | support.Hardware | 0 | 22 April 2013 19:19 |
Zip file behaviour | Mclane | support.WinUAE | 4 | 18 December 2012 11:02 |
Strange A1200 behaviour | manicx | support.Hardware | 39 | 09 November 2005 08:32 |
|
|