home *** CD-ROM | disk | FTP | other *** search
- ** Revision Header * Header built automatically - do not edit! *************
- *
- * (C) Copyright 1991 by Olaf `Olsen' Barthel, all rights reserved
- *
- * Name .....: Plot.asm
- * Created ..: Monday 26-Aug-91 11:20
- * Revision .: 1
- *
- * Date Author Comment
- * ========= ======== ====================
- * 26-Aug-91 Olsen Created this file!
- *
- ****************************************************************************
-
- include "graphics/gfx.i"
-
- csect text,0,0,1,2
-
- xdef _Plot
- xdef _Test
-
- ; VOID __asm Plot(register __a0 struct BitMap *,register __d0 WORD X,register __d1 WORD Y,register __d2 WORD Colour);
- ;
- ; Fast pixel drawing routine, somewhat equivalent to
- ; graphics.library/WritePixel.
- ;
- ; Register usage is as follows:
- ;
- ; d1 = Byte offset into bitplane
- ; d2 = Pixel colour
- ; d3 = Number of bitplanes
- ; d4 = Line modulo/pixel number
- ; a0 = Pointer to array of bitplanes
- ; a1 = Pointer to bitplane
-
- _Plot: movem.l d3/d4,-(sp) ; Save registerrs
-
- moveq #0,d4 ; Clear d3 & d4
- move.l d4,d3
-
- move.w bm_BytesPerRow(a0),d4 ; Get line modulo
- move.b bm_Depth(a0),d3 ; Get bitmap depth
- lea.l bm_Planes(a0),a0 ; Get array of planes
-
- mulu.l d4,d1 ; Multiply Y-position by modulo
- move.l d0,d4 ; Save X-position
- lsr #3,d0 ; Get byte offset of X-position
- add d0,d1 ; Add byte offsets
- not d4 ; Get bit number
- subq #1,d3 ; One plane less (for dbra)
-
- loop move.l (a0)+,a1 ; Get next plane
- lsr.b #1,d2 ; Clear or set the pixel?
- bcc clear
- bset d4,0(a1,d1) ; Set pixel
- dbra d3,loop ; Loop until all planes are done
-
- exit movem.l (sp)+,d3/d4 ; Restore registers
- rts
-
- clear bclr d4,0(a1,d1) ; Clear pixel
- dbra d3,loop ; Loop until all planes are done
- bra exit
-
- ; BYTE __asm Test(register __a0 struct BitMap *,register __d0 WORD X,register __d1 WORD Y);
- ;
- ; Fast pixel reading routine, somewhat equivalent to
- ; graphics.library/ReadPixel, returns 1 if there is a pixel in
- ; the given position in bitmap, else 0.
- ;
- ; Register usage is as follows:
- ;
- ; d1 = Byte offset into bitplane
- ; d3 = Number of bitplanes
- ; d4 = Line modulo/pixel number
- ; a0 = Pointer to array of bitplanes
- ; a1 = Pointer to bitplane
-
- _Test: movem.l d3/d4,-(sp) ; Save registerrs
-
- moveq #0,d4 ; Clear d3 & d4
- move.l d4,d3
-
- move.w bm_BytesPerRow(a0),d4 ; Get line modulo
- move.b bm_Depth(a0),d3 ; Get bitmap depth
- lea.l bm_Planes(a0),a0 ; Get array of planes
-
- mulu.l d4,d1 ; Multiply Y-position by modulo
- move.l d0,d4 ; Save X-position
- lsr #3,d0 ; Get byte offset of X-position
- add d0,d1 ; Add byte offsets
- not d4 ; Get bit number
- sub.w #1,d3 ; One plane less (for dbra)
- moveq #0,d0 ; So we have valid return code
-
- tloop move.l (a0)+,a1 ; Get next plane
- btst d4,0(a1,d1) ; Is a pixel in this position?
- bne.s go ; Yes, there is
- dbra d3,tloop ; Test next plane
-
- movem.l (sp)+,d3/d4 ; Restore registers
- rts
-
- go moveq #1,d0 ; Got a pixel
-
- movem.l (sp)+,d3/d4 ; Restore registers
- rts
-
- end
-