Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Area-Commands (graphicslib) OLD!
#1
Hallo Leute,

hier mal eine alte Lib für BB2 von mir. Wenn ich mich recht erinnere, funktionierte die recht gut, evtl. gab es auch mal Speicherlecks (Chipmem) oder so, kann mich nicht mehr erinnern.
Wäre schön, wenn da mal jemand drüber schauen könnte.

Code:
;
; RayAreaGfxLib
; programmed for BlitzBasic 2 by Frank Brandis
; (c)opyright 1995 by Frank Brandis
;
; maximum of areasteps = 360 !!!!
;



#rayarealib=22

; graphics
#_allocraster=-492 ;d0=(d0,d1)
#_freeraster =-498 ;   (a0,d0,d1)
#_inittmpras =-468 ;   (a0,a1,d0)
#_initarea   =-282 ;   (a0,a1,d0)

#_areamove   =-252 ;d0=(a1,d0,d1)
#_areadraw   =-258 ;d0=(a1,d0,d1)
#_areaend    =-264 ;   (a1)
#_areaellipse=-186 ;d0=(a1,d0,d1,d2,d3) ;only os3 ????? i dunno ..
#_drawellipse=-180 ;   (a1,d0,d1,d2,d3)
#_setapen    =-342 ;   (a1,d0)


; exec
#_allocmem   =-198 ;d0=(d0,d1)
#_freemem    =-210 ;   (a1,d0)

!libheader {#rayarealib,0,0,0,0}

!astatement
!args {#word,#word,#word}
!libs {#graphicslib,#la6}
!subs {_areastart,0,0}
!name {"Area","x,y,col        ;start of filled polygon"}

!astatement
!args {#word,#word}
!libs {#graphicslib,#la6}
!subs {_areastep,0,0}
!name {"AreaStep","x,y    ;next coord of filled polygon"}

!astatement
!args
!libs {#graphicslib,#la6}
!subs {_areafill,0,0}
!name {"AreaFill","       ;closing the polygon"}

!astatement
!args {#word,#word,#word,#word,#word}
!libs {#graphicslib,#la6}
!subs {_areacirc,0,0}
!name {"WCirclef","x,y,xrad,yrad,col"} ;doesn`t work (areaellipse_)

!astatement
!args {#long,#word,#word,#word,#word}
!libs
!subs {_setptrn,0,0}
!name {"Pattern","*rp,areaptrn1,areaptrn2,areaptrn3,areaptrn4"}

!afunction {#long}
!args {#long,#long,#long,#word}
!libs {#graphicslib,#la0,#execlib,#la1}
!subs {_areainit,0,0}
!name {"AreaInit","(*rp,width,height,maxcoords)  TRUE if success"}

!afunction {#long}
!args
!libs {#execlib,#la6}
!subs {_areafinit,0,0}
!name {"AreaFinit","  BOOLEAN TRUE if success"}

!astatement
!args {#long,#word}
!libs
!subs {_linepat,0,0}
!name {"LinePattern","*rp,pattval    ;pattval could be %1100110011001100"}

!astatement
!args {#long,#long,#byte}
!libs
!subs {_setptrna,0,0}
!name {"PatternA","*rp,&patdef,patsize; user pattern def, patsize must be one of x^2 !!"}

!astatement
!args {#long,#byte}
!libs
!subs {_setolpen,0,0}
!name {"OutlinePen","*rp,colour  ;"}

!astatement
!args {#long,#byte}
!libs
!subs {_oline,0,0}
!name {"Outline","*rp,bool.b     ;   0 or 1,switches areaborders off or on"}
.

!libfin

._areastart
LEA  rastprt(pc),a0
MOVE.l      (a0),a1   ;rp here  :)

MOVEM.l    d0/d1,-(a7);x coord retten
MOVE.l        d2,d0   ;colour nach d0
JSR    _setapen(a6)

MOVEM.l    (a7)+,d0/d1   ;x coord rest.

JSR   _areamove(a6)   ;AreaMove_ *rp,x,y
RTS

._areastep
LEA  rastprt(pc),a0
MOVE.l      (a0),a1
JSR   _areadraw(a6)   ;AreaDraw_ *rp,x,y
RTS

._areacirc
LEA  rastprt(pc),a0
MOVE.l      (a0),a1   ;*rp in a1

MOVEM.l    d0-d3,-(a7);x coord wegen lvosetapen_ retten
MOVE.l        d4,d0   ;color nach d0
JSR     _setapen(a6)

MOVEM.l    (a7)+,d0-d3;x coord rest.

; JSR _areaellipse(a6) ;AreaEllipse_ *rp,x,y,rx,ry  ,col
JSR _drawellipse(a6)
JSR     _areaend(a6)  ;AreaEnd_ *rp
RTS
RTS

._areafill
LEA  rastprt(pc),a0
MOVE.l      (a0),a1
JSR    _areaend(a6)   ;AreaEnd_ *rp
RTS

.
._areainit
LEA      gfxbas(pc),a2
MOVE.l           a0,(a2)
LEA     execbas(pc),a2
MOVE.l           a1,(a2)

LEA     rastprt(pc),a1         ;rastport sichern
MOVE.l           d0,(a1)

MOVE.l           d3,d0         ;max. areasteps
ADD.l            #1,d0         ;ein schritt zu maxsteps hinzu
MULU             #5,d0         ;mal 5,wegen rasteralloc.
LEA      msteps(pc),a0
MOVE.l           d0,(a0)       ;als maxsteps sichern


LEA        widt(pc),a1
MOVE.w           d1,(a1)
MOVE.w           d1,d0         ;width, should be windows max width
LEA        heit(pc),a1
MOVE.l           d2,(a1)
MOVE.l           d2,d1         ;height, should be windows max height
LEA      gfxbas(pc),a1
MOVE.l         (a1),a6
JSR   _allocraster(a6)
LEA         ras(pc),a1
MOVE.l           d0,(a1)       ;ras.l=AllocRaster_(640,256)
CMP.l #0,d0:BEQ noinit

LEA        widt(pc),a0        ;
MOVE.l         (a0),d0        ;
DIVU             #8,d0        ;
LEA        heit(pc),a0        ;
MOVE.l         (a0),d1        ;
MULU             d1,d0        ; MOVE.l #$14000,d0   ;(640/8)*256)

LEA         ras(pc),a0
MOVE.l         (a0),a1
LEA      tmpras(pc),a0
JSR    _inittmpras(a6)   ;err.l=InitTmpRas_(tmpras,buf.l,(640/8)*256)


LEA     execbas(pc),a0
MOVE.l         (a0),a6
LEA      msteps(pc),a1
MOVE.l         (a1),d0
MOVE.l      #$10001,d1
JSR      _allocmem(a6)
LEA        buff(pc),a0
MOVE.l           d0,(a0)     ;buff$=String$(" ",(msteps+1)*5)

CMP.l #0,d0:BEQ  noinit

LEA      gfxbas(pc),a0
MOVE.l         (a0),a6
LEA        buff(pc),a0
MOVE.l         (a0),a1
LEA     areainf(pc),a0  ;eigene structur
MOVE.l         #360,d0
JSR      _initarea(a6)  ;err.l=InitArea_(*ai.AreaInfo,&buff$,360)

LEA     rastprt(pc),a0
MOVE.l         (a0),a1
LEA      tmpras(pc),a0
MOVE.l           a0,SizeOf.RastPort\TmpRas(a1)     ;*rp\TmpRas=tmpras
LEA     areainf(pc),a0
MOVE.l           a0,SizeOf.RastPort\AreaInfo(a1)   ;*rp\AreaInfo=*ai
MOVEQ            #1,d0
BRA okinit
noinit:
MOVEQ           #0,d0
okinit:
RTS

._areafinit

LEA        widt(pc),a0   ;
MOVE.l         (a0),d0   ;MOVE.w         #640,d0
LEA        heit(pc),a0   ;
MOVE.l         (a0),d1   ;MOVE.w         #256,d1
LEA      gfxbas(pc),a0
MOVE.l         (a0),a6
LEA         ras(pc),a1
MOVE.l         (a1),a0
JSR    _freeraster(a6)   ;FreeRaster_ *ras,640,256

LEA     execbas(pc),a0
MOVE.l         (a0),a6
LEA      msteps(pc),a0   ;
MOVE.l         (a0),d0

LEA        buff(pc),a0   ;
MOVE.l         (a0),a1
JSR       _freemem(a6)
; d0=result
RTS

.
._setptrn
MOVE.l       d0,a1
LEA   patt1(pc),a0
MOVE.w       d1,(a0)+
MOVE.w       d2,(a0)+
MOVE.w       d3,(a0)+
MOVE.w       d4,(a0)

LEA   patt1(pc),a0
MOVE.l       a0,SizeOf.RastPort\AreaPtrn(a1)
MOVE.b       #2,SizeOf.RastPort\AreaPtSz(a1) ;heavy error last version
RTS

._setptrna
MOVE.l       d0,a1    ;rastprt
MOVE.l       d1,SizeOf.RastPort\AreaPtrn(a1)
MOVE.b       d2,SizeOf.RastPort\AreaPtSz(a1)
RTS

._linepat
MOVE.l d0,a1
MOVE.w d1,SizeOf.RastPort\LinePtrn(a1)
RTS

._setolpen
MOVE.l d0,a1
MOVE.b d1,SizeOf.RastPort\AOlPen(a1)
; MOVE.w SizeOf.RastPort\Flags(a1),d0
; BSET   #3,d0
; MOVE.w d0,SizeOf.RastPort\Flags(a1)
RTS

._oline
MOVE.l  d0,a1
SUB.l   d0,d0
MOVE.w SizeOf.RastPort\Flags(a1),d0
CMP.b   #0,d1
BEQ dof
BSET    #3,d0
bck:MOVE.w d0,SizeOf.RastPort\Flags(a1)
RTS
dof:BCLR #3,d0:BRA bck

tmpras:  ;struct
Dc.l 0
Dc.l 0

areainf:Dcb.l 8,0

execbas:Dc.l 0
gfxbas: Dc.l 0
rastprt:Dc.l 0
ras:    Dc.l 0
msteps: Dc.l 0
buff:   Dc.l 0
widt:   Dc.w 0
heit:   Dc.w 0

patt1:  Dc.w 0,0,0,0
Even
Zitieren


Nachrichten in diesem Thema

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 5 Gast/Gäste