View Single Post
Old 29 March 2014, 21:44   #3
Herpes
... aka Amix73
 
Herpes's Avatar
 
Join Date: Jan 2009
Location: Austria
Posts: 87
Quote:
Originally Posted by Leffmann View Post
How are you calculating the A shift value and the C pointer? I'm guessing that's where your error is.

The A shift value must be set to X1%16, and the C pointer must point to the word in memory where the first pixel, (X1, Y1), is plotted.
Hm, well I think these computations are correct. I appreciate your help since I got stuck. I add some code - maybe you see my error at once.

Code:
    move.w    d0,d4    ; copy x1 to work with
    move.w    d1,d5    ; 4: copy y1 to work with
    moveq    #planewidth_bytes,d6
    mulu    d6,d5    ; plane-width in bytes * y1-coordinate
    add.w    d5,a0    ; add vertical offset to plane address
    lsr.w    #3,d4    ; horizontal word-offset [bytes] => div by 8 not 16
    andi.w    #$fffe,d4    ; and mask out the pixel shift
    add.w    d4,a0    ; correct address
    ...    
    ; determine the pixel-shift of the start point within the first word
    ; d0=x1
    andi.l    #$f,d0            ; det. horizontal pixel-offset for point1

    ; the infamous eor trick :D
    move.w    d0,d5            ; copy pixel shift
    eor.b    #$f,d5            ; shape it for filling

    ror.l    #4,d0            ; bring to pos 12-15 for Blitcon0
    ...
    
    WAITBLT
    bchg      d5,(a0)            ; eor trick
    move.l    d3,$62(a6)        ; B,A-MOD:2*A, 2*(a-B)
    move.w    d6,$52(a6)        ; A-POTH (lo): 2*A-B
    move.l    a0,$48(a6)        ; C-POTH
    move.l    a4,$54(a6)        ; D-POTH for filling polygons point to scratch
    move.l    d0,$40(a6)        ; BLTCON
    move.w    d2,$58(a6)        ; BLTSIZE
    rts
It is evident, that the eor trick - does not work properly - most likely understood it wrong.

But when I remove the EOR-Trick and DON'T draw the first pixel since I set BLTDPT to a scratch area - it works (you can see the filled square in prev. post).

Currently it does the following (at least I would like it to):
The line-draw mode must be set to EOR as well.
the pixel shift is between 0-15 so what one gets with EOR.B $F,d5 is the invert of the pixel shift value in d5 e.g. pix-shift=5 => $A. Then you just bchg this value in the start-word of point-1 which leads to a 0 if the bit was already set (and therefor it will be drawn with the blitter) OR leads to a 1 if the bit was not NOT set (and therefor it will NOT be drawn with the blitter).

Where am I wrong?
Thanks for your help.
Herpes is offline  
 
Page generated in 0.06910 seconds with 11 queries