Article View: comp.sys.amiga.tech
Article #3678Re: Blit routine
From: Jeff Bevis
Date: Wed, 30 May 1990 02:17
Date: Wed, 30 May 1990 02:17
61 lines
3198 bytes
3198 bytes
In article <67293.AA67293@slaka.sirius.se>, micke@slaka.sirius.se (Mikael Karlsson) writes:
>Does anybody out there in netland have a blit routine that gives me
>more control over the blitter than the currently available functions
>AND takes care of all the fuss (WaitBlit, OwnBlitter, etc)?
>
In assembly or C?
I just got Sooooo frustrated with BlitMaskBitMapBlahBlahBlah() etc... that
I took a dive into the OwnBlitter() {do satanic things} DisownBlitter()
realm. It was, indeed, exhilarating to do the naughty stuff I never let
myself do before! (Well, to be fair, I call any writing directy to I/O
naughty -- even if in an amiable fashion.)
Basically, the code does this (it's torn from a mix of C & asm):
(include appropriate files here, like hardware/blit.i)
movea.l _GfxBase,a6
jsr _LVOOwnBlitter(a6) ; own the blitter
jsr _LVOWaitBlit(a6) ; wait before playing
lea _custom,a0 ; regs def'd in custom.i
move.w #$ffff,bltafwm(a0) ; first word mask
move.w #$ffff,bltalwm(a0) ; last word mask
move.w #$0fca,bltcon0(a0) ; blit ctrl & minterm
move.w #$0000,bltcon1(a0) ; more blit ctrl
move.w #0,bltamod(a0) ; mask modulo is 0
move.w #0,bltbmod(a0) ; same for source image
move.w #36,bltcmod(a0) ; dest modulo is 40-4
move.w #36,bltdmod(a0) ; same
loop:
< figure out addresses for this blit >
jsr _LVOWaitBlit(a6) ; wait for last blit to end
move.l #DESTADDR,bltdpt(a0) ; destination of blit (WR)
move.l #DESTADDR,bltcpt(a0) ; ditto, but read (RD)
move.l #SOURCEADDR,bltbpt(a0) ; the source image (RD)
move.l #MASKADDR,bltapt(a0) ; the image mask (RD)
move.w #$0602,bltsize(a0) ; cause blit to start
< branch to loop until done blitting all planes >
jsr LVODisownBlitter(a6) ; give back what you have
; stolen (Time Bandits)
END
This is part of a program I'm currently tinkering with -- it has to blit
64 32x24x5 images, using masks, into a 320x200 screen -- really fast. It
does. The modulos for the destination are 36 because the source image is
4 bytes wide and the screen is 40 bytes 'wide'. 40-4==36.
This is exactly how I blit. No shifts, no fancy stuff, but I can do anything.
(I make no claims about the above code except to say that it works for me)
-------------------------------------------------------------------------------
"Three is never equal to four, except for very large values of three."
-------------------------------------------------------------------------------
Jeff Bevis Purdue Univeristy School of Electrical Engineering
bevis@en.ecn.purdue.edu Give me Amiga or nothing at all.
-------------------------------------------------------------------------------
Technical Details
Message-ID:
<9005300217.AA26553@en.ecn.purdue.edu>Path:
arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!EE.ECN.PURDUE.EDU!bevisReferences:
<67293.AA67293@slaka.sirius.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!EE.ECN.PURDUE.EDU!bevis From: bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) Newsgroups: comp.sys.amiga.tech Subject: Re: Blit routine Message-ID: <9005300217.AA26553@en.ecn.purdue.edu> Date: 30 May 90 02:17:37 GMT References: <67293.AA67293@slaka.sirius.se> Sender: daemon@ucbvax.BERKELEY.EDU Organization: Purdue University Engineering Computer Network Lines: 61