Skip to Content
Amiga Assembly Library v41.21 — Motorola 68020 shared library for Commodore Amiga
DocumentationGraphicsRemoveBitPlanes

RemoveBitPlanes

Synopsis

num = RemoveBitPlanes(bm, num) D0 A0 D0

C Prototype

ULONG RemoveBitPlanes(struct BitMap *bm, ULONG num);

Description

Removes a specified number of bitplanes from a BitMap structure. The planes are physically removed from the BitMap structure, and the memory they occupied is freed. For each plane removed, the bm_Depth field of the BitMap is decremented, and the plane pointer is cleared.

Inputs

  • bm — Address of an initialized BitMap structure.
  • num — Number of bitplanes to remove. This can be equal to the total number of planes present in the BitMap, meaning all planes can be removed. The important thing is that num must be equal to or less than the value in the bm_Depth field; otherwise, this function fails.

Result

  • num — If NULL, no planes were removed, or the number of planes to remove was too high relative to the bm_Depth field. Otherwise, indicates the number of planes that were successfully removed.

Notes

This function currently does not use graphics.library/GetBitMapAttr() — it will be updated in future versions of the library.

See Also

  • AddBitPlanes
  • graphics.library/FreeBitMap(), FreeRaster(), GetBitMapAttr()

Implementation

The original 68020 assembly implementation:

; (06-10-1994) --- num = RemoveBitPlanes(bm, num) (a0,d0) _LVORemoveBitPlanes movem.l d2-d4/a2-a6,-(sp) moveq #0,d3 move.w d0,d4 ; num of raster... subq.w #1,d4 sub.b bm_Depth(a0),d0 bpl.s FalExit movem.w bm_BytesPerRow(a0),d2-d3 mulu.w d3,d2 ; D2 = amount of memory to free lea bm_Depth(a0),a3 ; A3^Point to depth field move.b (a3),d3 ext.w d3 lea bm_Planes(a0,d3.w*4),a2 ; Start to added bitplanes... moveq #0,d3 ; bitplanes counter suba.l a4,a4 ; Clear planeptr move.l ab_ExecBase(a6),a6 RVB_LOP move.l -(a2),a1 subq.b #1,(a3) move.l a4,(a2) ; Clear planeptr move.l d2,d0 jsr _LVOFreeMem(a6) addq.b #1,d3 dbf d4,RVB_LOP RVBExit move.l d3,d0 movem.l (sp)+,d2-d4/a2-a6 rts
Last updated on