English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 22 July 2021, 19:42   #1
defor
Registered User
 
Join Date: Jun 2020
Location: Brno
Posts: 90
Copper WAIT, copper SKIP and $80/$100 vpos problem

Hello!
I've recently wanted to try myself how to construct a copper list with SKIP instructions. You know, that simple famous 8x8 copper chunky screen allowing CPU to set colors of 40 8x8 "pixels" (no overscan) by writing just 40 words per line -- hence the use of SKIP copper instructions.
And therefore, inevitably, I've encountered a problem of two boundaries: vpos=$80 and vpos=$100. The first one results (as far as I understand it) from the fact that 7th bit cannot be masked out in WAIT/SKIP instruction (that bit is reserved for blitter-wait test). The second one is the obvious result of having just 8 bits for vpos test.
To fight the $80 problem I've created two macros for copper list construction:
Code:
        macro    COPPER_LINE
            dc.w        COP2LCH,0,COP2LCL,0
            dc.w        $0039,$80fe
            rept        10
                dc.w        COLOR00,$f00^\2,COLOR00,$0f0^\2,COLOR00,$00f^\2,COLOR00,$ff0^\2
            endr
            dc.w        $00df,$80fe
            dc.w        (((\1+8)&$ff)<<8)|$01,$ff01,COPJMP2,0
        endm

        macro    COPPER_LINE_128
            dc.w        COP2LCH,0,COP2LCL,0
            dc.w        $8039,$80fe
            rept        10
                dc.w        COLOR00,$f00^\2,COLOR00,$0f0^\2,COLOR00,$00f^\2,COLOR00,$ff0^\2
            endr
            dc.w        $80df,$80fe
            dc.w        (((\1+8)&$ff)<<8)|$8001,$ff01,COPJMP2,0
         endm
The first macro is used for rows below $80 boundary, the second one for all rows $80+. It works.
I use them in the following way:
Code:
Copper:
            dc.w        BPLCON0,0,BPLCON1,0,BPLCON2,0
            dc.w        COLOR00,$fff
            dc.w        $5801,$fffe
.firstLine
            COPPER_LINE $58,$000
.firstLineEnd
            COPPER_LINE $60,$fff
            COPPER_LINE $68,$000
            COPPER_LINE $70,$fff
            COPPER_LINE $78,$000
            COPPER_LINE_128 $80,$fff
            COPPER_LINE_128 $88,$000
            COPPER_LINE_128 $90,$fff
            COPPER_LINE_128 $98,$000
            COPPER_LINE_128 $a0,$fff
            COPPER_LINE_128 $a8,$000
            COPPER_LINE_128 $b0,$fff
            COPPER_LINE_128 $b8,$000
            COPPER_LINE_128 $c0,$fff
            COPPER_LINE_128 $c8,$000
            COPPER_LINE_128 $d0,$fff
            COPPER_LINE_128 $d8,$000
            COPPER_LINE_128 $e0,$fff
            COPPER_LINE_128 $e8,$000
            COPPER_LINE_128 $f0,$faf
            ;COPPER_LINE_128 $f8,$000
.linesEnd
            dc.w        COLOR00,$fff
            dc.w        $ffff,$fffe
Possibly looks kind of wild and I presume it could be written in a much cleaner way, but it works and it's just a testing anyway...
Initialization is done by something like this:
Code:
Init:
            ; Initialization of copper jumps!
            ; Relies on a specific command order in ONE_COPPER_LINE macro!
            lea.l        Copper\.firstLine,a0
            lea.l        8(a0),a1    ; offset from line beginning to line jump address
            move.w       #Copper\.firstLineEnd-Copper\.firstLine,d1    ; skip to next line
            move.w       #(Copper\.linesEnd-Copper\.firstLine)/(Copper\.firstLineEnd-Copper\.firstLine)-1,d2    ;no.lines - 1

.1          move.l       a1,d0
            move.w       d0,6(a0)
            swap         d0
            move.w       d0,2(a0)
            add.w        d1,a0
            add.w        d1,a1
            dbf          d2,.1

            move.l       #Copper,CopperAddress
            rts
My problem is that I don't know how to handle $100 boundary in this scenario. My lines of pixels are aligned to $80 boundary so I can swap from COPPER_LINE to COPPER_LINE_128 macro. Following fixed height of 8 lines for every "pixel", it reaches line $100 exactly for SKIP instruction $0001,$ff01 which obviously doesn't work as the condition is true for $f8-$ff lines (or any other previous lines). I know that the standard way how to handle it in usual copper-lists is to add the WAIT instruction $ffdf,$fffe -- the last copper wait position before vpos wraps around. However I can't do that in my macro -- it's independent on vpos.


So my question is: How do you usually do it? What is your technique to get over $100 boundary in similar scenario? Do you reduce one line height to 7 lines so that you can start with $00 vpos? Or do you construct the copper list in some special way?
Or maybe the solution is very simple and I can't see it? ...not the first time



P.S.: This is how the screen looks like.



defor is offline  
Old 22 July 2021, 21:53   #2
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Code:
         macro COPPER_LINE_255
	    dc.w        $1fe,$1fe,$1fe,$1fe
            dc.w        $8039,$80fe
            rept        10
                dc.w        $180,$f00^\2,$180,$0f0^\2,$180,$00f^\2,$180,$ff0^\2
            endr
            dc.w        $80df,$80fe
            dc.w        $1fe,$1fe,$1fe,$1fe
         endm
Code:
...
            COPPER_LINE_128 $e8,$000
            COPPER_LINE_128 $f0,$fff
            COPPER_LINE_128 $f7,$000
            COPPER_LINE_255 $ff,$000
 	    COPPER_LINE $00,$fff
	    COPPER_LINE $08,$000
            COPPER_LINE $10,$fff
            COPPER_LINE $18,$000
...
ross is offline  
Old 23 July 2021, 08:32   #3
defor
Registered User
 
Join Date: Jun 2020
Location: Brno
Posts: 90
I see! Thank you Ross!
defor is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copper SKIP/WAIT timing roondar Coders. Asm / Hardware 5 05 February 2021 17:46
copper skip and copjmp2 Rock'n Roll Coders. Asm / Hardware 4 24 April 2020 19:51
Copper SKIP instruction sparhawk Coders. Asm / Hardware 21 15 January 2020 16:21
Copper Wait Problem sandruzzo support.WinUAE 13 18 May 2016 21:54
Copper Wait Problem sandruzzo Coders. Asm / Hardware 2 17 May 2016 10:30

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 11:57.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09306 seconds with 13 queries