English Amiga Board


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

 
 
Thread Tools
Old 09 September 2011, 22:51   #1
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 40
Posts: 1,920
Filling with the blitter...

Hi,

I'm trying to fill an area of the screen, but it doesn't seem to be working. I'm probably doing something stupid (so feel free to point it out! ), but can't seem to spot it

I did try searching online for some example code, but all I could find were lots of pages from the Amiga HRM - I already have the real thing.


Here's my code...
Code:
    lea.l    screen+572+8000,a0    ;destination
    move.w    #26,d0            ;modulo, was #28
    move.w    #$2D87,d1        ;BLTSIZE, hhhhhhhhhhwwwwww
                    ;         0001100100000111
                    ;TEMP:      0010110110000111=$2B87
                    ;      width=7 words,
                    ;      height=100 lines
                    ;set to $1907 after debugging done
                    ;$2D87 is perfection! ;)
    jsr    fillscreen
    rts

fillscreen:
        ;- descending mode must be used
        ;- set inclusive (bit #3) or exclusive (bit #4) in BLTCON1
        ;- set bit #2 of BLTCON1 to fill area outside of lines

    btst    #6,DMACONR        ;safety check
.waitblit
    btst    #6,DMACONR        ;blitter ready?
    bne    .waitblit
    move.l    a0,BLTDPTH        ;a0=destination address and source
    move.l    a0,BLTCPTH
    move.w    d0,BLTDMOD        ;d0=modulo (e.g. 36 for lowres)
*    clr.w    BLTCON1            ;d1=size of area, in BLTSIZE format
    bset    #1,BLTCON1        ;descending mode
    bset    #2,BLTCON1        ;fill carry input
    bset    #3,BLTCON1        ;inclusive fill enable
    move.w    #$0301,BLTCON0        ;use D & C, LF=2 (not A&B)
*    move.w    #$FFFF,BLTAFWM
*    move.w    #$FFFF,BLTALWM
    move.w    d1,BLTSIZE
    rts
Once working I will remove the bset's and combine them into a move.w


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 10 September 2011, 02:14   #2
victim
Registered User
 
Join Date: Mar 2009
Location: N/A
Posts: 21
Hi Lonewolf10,

in your fill mode combination, you don't need the modulo value
In this case, it is simply cleared and your BLTCON1 was not correct set.

try this code for filling one bitplane with the size 320*256

Code:
Fill:
        btst.b    #6,$dff002
FillIn: 
        btst.b    #6,$dff002
        bne.s     FillIn
        move.l    PlaneBufferWork(pc),a0
        lea.l       256*40(a0),a0
        move.l    #0,$dff064        ;clear modulo A and D
        move     #%0000100111110000,$dff040    ;boolean minterms
        move     #%0000000000010010,$dff042    ;descending and fill mode
        move.l    a0,$dff050        ;source A
        move.l    a0,$dff054        ;destination    D
        move     #256*64+20,$dff058
        rts

PlaneBufferWork:     dc.l    Buffer1
Buffer1:                  blk.b    320*256/8,0
Regards,
victim

Quote:
Originally Posted by Lonewolf10 View Post
Hi,

I'm trying to fill an area of the screen, but it doesn't seem to be working. I'm probably doing something stupid (so feel free to point it out! ), but can't seem to spot it

I did try searching online for some example code, but all I could find were lots of pages from the Amiga HRM - I already have the real thing.


Here's my code...
Code:
    lea.l    screen+572+8000,a0    ;destination
    move.w    #26,d0            ;modulo, was #28
    move.w    #$2D87,d1        ;BLTSIZE, hhhhhhhhhhwwwwww
                    ;         0001100100000111
                    ;TEMP:      0010110110000111=$2B87
                    ;      width=7 words,
                    ;      height=100 lines
                    ;set to $1907 after debugging done
                    ;$2D87 is perfection! ;)
    jsr    fillscreen
    rts

fillscreen:
        ;- descending mode must be used
        ;- set inclusive (bit #3) or exclusive (bit #4) in BLTCON1
        ;- set bit #2 of BLTCON1 to fill area outside of lines

    btst    #6,DMACONR        ;safety check
.waitblit
    btst    #6,DMACONR        ;blitter ready?
    bne    .waitblit
    move.l    a0,BLTDPTH        ;a0=destination address and source
    move.l    a0,BLTCPTH
    move.w    d0,BLTDMOD        ;d0=modulo (e.g. 36 for lowres)
*    clr.w    BLTCON1            ;d1=size of area, in BLTSIZE format
    bset    #1,BLTCON1        ;descending mode
    bset    #2,BLTCON1        ;fill carry input
    bset    #3,BLTCON1        ;inclusive fill enable
    move.w    #$0301,BLTCON0        ;use D & C, LF=2 (not A&B)
*    move.w    #$FFFF,BLTAFWM
*    move.w    #$FFFF,BLTALWM
    move.w    d1,BLTSIZE
    rts
Once working I will remove the bset's and combine them into a move.w


Regards,
Lonewolf10

Last edited by victim; 11 September 2011 at 14:51.
victim is offline  
Old 10 September 2011, 08:34   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 44
Posts: 23,123
Two problems. Quick hints:
1) bset reads before writing.
2) data size is not a word.
Toni Wilen is offline  
Old 10 September 2011, 22:13   #4
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 40
Posts: 1,920
Thanks for the help guys, it's working now


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 10 September 2011, 23:35   #5
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,765
Know your Miniterns
Photon is offline  
Old 11 September 2011, 03:00   #6
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 40
Posts: 1,920
Quote:
Originally Posted by Photon View Post
Know your Miniterns



Regards,
Lonewolf10
Lonewolf10 is offline  
Old 11 September 2011, 14:48   #7
victim
Registered User
 
Join Date: Mar 2009
Location: N/A
Posts: 21
Mistakes are often the best teachers.

One man's meat is another man's poison.



Quote:
Originally Posted by Photon View Post
Know your Miniterns
victim is offline  
Old 13 September 2011, 14:30   #8
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,449
Quote:
Originally Posted by Toni Wilen View Post
Two problems. Quick hints:
1) bset reads before writing.
Apropos, also be careful with CLR, which reads before it writes on the 68000. IIRC this was fixed with the 68010.
phx 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
CPU Filling vs. Blitter Filling Routine victim Coders. General 18 26 January 2014 02:15
Please help me!! Blitter pain! h0ffman Coders. Asm / Hardware 5 15 June 2013 18:59
Did Starglider use the blitter? mc6809e Retrogaming General Discussion 8 04 February 2012 15:19
Blitter filling routine used in games Codetapper Coders. General 2 26 January 2012 10:20
Blitter nasty or not? JackAsser Coders. Tutorials 5 28 March 2010 22:45

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:07.


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