home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 August - Disc 3
/
chip_20018103_hu.iso
/
amiga
/
chiputil
/
dragndrop14b.lha
/
Dragndrop_demo.lha
/
DragnDrop
/
Display_IFF.p
next >
Wrap
Text File
|
1999-03-30
|
8KB
|
238 lines
{* NewProc=DisplayIFF[&Name,Modus,ScreenNr,X,Y][A0,LokalMode,LRp,PosLeft,PosTop]*}
{* IncVar: Lokalmode,Anzahl,Rot,Gruen,Blau,BM_Laenge,BytesperRow,Planes*}
{* IncVar: BitPlanegroesse,LokalScreen,LRP,BildBreite,Bildhoehe,Skip,MaxHoehe*}
{* IncVar: PosLeft,PosTop*}
{* IncSysBlock: Buffer,1024*}
Normal= 0
Kein_CLS= 1
Keine_CMAP= 2
Play_Anim= 3
CNOP 0,4
BMHD:
Breite: dc.w 0
Hoehe: dc.w 0
Posx: dc.w 0
Posy: dc.w 0
Tiefe: dc.b 0
Maske: dc.b 0
Packart:dc.b 0,0
Trans: dc.w 0
dc.b 0,0
PageX: dc.w 0
PageY: dc.w 0
Bitmap:
BPR: dc.w 0
Rows: dc.w 0
dc.b 0
Tiefe1: dc.b 0
dc.w 0
plane1: dc.l 0
plane2: dc.l 0
plane3: dc.l 0
plane4: dc.l 0
plane5: dc.l 0
plane6: dc.l 0
plane7: dc.l 0
plane8: dc.l 0
Cnop 0,4
DisplayIFF:
SBlock==0
DBlock==0
FH=Open(a0,#Mode_old)
CheckF FH,.Error
If Lokalmode=#Normal { SetRGB32(Viewport,0,0,0,0)
SetAPen(LRp,0)
RectFill(LRp,0,0,639,279) }
Read(FH,#Buffer,4)
If Buffer##"FORM" --> .ErrorClose1
Read(FH,#Buffer,4)
Read(FH,#Buffer,4)
If Buffer##"ILBM" --> .ErrorClose1
Read(FH,#Buffer,4)
If Buffer##"BMHD" --> .ErrorClose1
Read(FH,#anzahl,4)
Read(FH,#BMHD,anzahl)
Clr.l d0
If Lokalmode=#PLAY_Anim {
Move.l #44,PosLeft
Move.l #0,PosTop
}
Move.w Breite,d0
Move.l d0,BildBreite
Move.w Hoehe,d0
Move.l d0,Bildhoehe
If BildHoehe<MaxHoehe --> .Schleife
Move.l MaxHoehe,BildHoehe
.Schleife:
{* Flush *}
Anzahl=Read(FH,#Buffer,4)
If Anzahl##4 --> .ende
Read(FH,#anzahl,4)
If Buffer=#"CMAP" {
Read(FH,#Buffer,anzahl)
If LokalMode=#Keine_CMAP --> .Schleife
move.l Anzahl,d7
divu.l #3,d7
subq.l #1,d7
Lea Buffer,a4
Moveq.l #-1,d4
.CMAP1: Clr.l d1
Clr.l d2
Clr.l d3
addq.l #1,d4
move.b (a4)+,d1
move.b (a4)+,d2
move.b (a4)+,d3
ROR.l #8,d1
ROR.l #8,d2
ROR.l #8,d3
SetRGB32(Viewport,D4,D1,D2,D3)
If D4##255 --> .Cmap1
bra .Schleife
}
If Buffer=#"BODY" {
{* Flush *}
SBlock=Allocmem(Anzahl,#MEMF_any)
CheckF SBlock,.errorclose1
Read(FH,Sblock,anzahl)
clr.l d0
clr.l d1
move.W Breite,d0
divu.w #8,d0
swap d0
cmpi.w #0,d0
beq.s .body1
addi.l #$00010000,d0
.body1:
{* Flush *}
swap.w d0
andi.l #$FFFF,d0
move.l d0,BytesperRow
move.w hoehe,d1
mulu.l d1,d0
clr.w d1
move.b Tiefe,d1
mulu.l d1,d0
move.l d0,BM_laenge
DBlock=AllocMem(BM_Laenge,#MEMF_ANY)
CheckF Dblock,.Errorclose2
move.l sblock,a0
move.l dblock,a1
move.l a1,a2
add.l BM_laenge,a2
.Body2: clr.w d0
cmp.l a1,a2
ble.s .Bodyende
move.b (a0)+,d0
tst.b d0
bpl.s .plus ; nicht gleiche
neg.b d0
move.b (a0)+,d1
.Body3: move.b d1,(a1)+
dbra d0,.Body3
bra.s .body2
.plus: move.b (a0)+,(a1)+
dbra d0,.plus
bra.s .body2
.Bodyende:
{* Flush *}
Freemem(SBlock,Anzahl)
Move.l DBlock,SBlock ; Tausche Source<->Ziel
DBlock=AllocMem(BM_Laenge,#MEMF_Chip)
CheckF Dblock,.Errorclose3
clr.l d1
move.l Bytesperrow,d7
Move.l d7,d0
move.w Hoehe,d1
mulu.l d0,d1
move.l d1,BitPlaneGroesse
move.l d7,d1
; Lsr.l #2,d7
subq.l #1,d7
move.l d7,d6
clr.l d0
move.b tiefe,D0
move.l d0,Planes
subq.l #1,d0
mulu.l d1,d0
move.l d0,skip
For I= 1 to Planes
Move.l Sblock,a0
Move.l I,d0
Subq.l #1,d0
move.l BytesPerRow,d1
mulu.l d1,d0
add.l d0,a0
Move.l Dblock,a1
Move.l I,d0
Subq.l #1,d0
move.l BitPlanegroesse,d1
mulu.l d1,d0
add.l d0,a1
move.w hoehe,d5
subq.l #1,d5
.body5: Move.b (a0)+,(a1)+
dbra d6,.Body5
add.l Skip,a0
move.l d7,d6
dbra d5,.Body5
Next I
Freemem(sblock,BM_Laenge)
If LokalMode##PLAY_Anim {
Close(FH)
}
move.l BytesperRow,d0
move.w d0,BPR
move.w hoehe,Rows
move.b tiefe,tiefe1
Move.l Bitplanegroesse,d0
move.l DBlock,a0
move.l #plane1,a1
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
add.l d0,a0
move.l a0,(a1)+
BltBitMapRastport(#Bitmap,0,0,LRp,PosLeft,PosTop,BildBreite,Bildhoehe,$C0)
Freemem(Dblock,BM_Laenge)
If LokalMode=#Play_Anim --> .Schleife
RTS
}
Read(FH,#Buffer,anzahl)
Bra .Schleife
.Error: Move.l #0,d0
RTS
.errorClose3:
{* Flush *}
FreeMem(Dblock,BM_laenge)
bra.s .ErrorClose1
.errorClose2:
{* Flush *}
FreeMem(Sblock,Anzahl)
.ErrorClose1:
{* Flush *}
Close(FH)
bra.s .error
.ende:
{* Flush *}
Close(FH)
RTS