a186@mindlink.UUCP (Harvey Taylor) (10/19/90)
In <1990Oct19.144611.15253@ecn.purdue.edu>, adnan@en.ecn.purdue.edu [Adnan Q Khan] writes: | | Even though I don't know C, I've been trying to follow C examples to | understand the procedure of simply displaying a sprite. Your spritedata has to be in chip ram. | I don't understand how to use the ChangeSprite library routine. ChangeSprite( vp, ss, si) a0 a1 a2 where vp - pointer to ViewPort structure that this sprite is ss - pointer to SimpleSprite structure si - pointer to SpriteImage structure Do yourself a favour & get a copy of the Autodocs from CATS. -harvey "Once a nation pledges its safety to an absolute weapon, it becomes essential to believe in an absolute enemy." - Blackett Harvey Taylor Meta Media Productions uunet!van-bc!rsoft!mindlink!Harvey_Taylor a186@mindlink.UUCP
adnan@en.ecn.purdue.edu (Adnan Q Khan) (10/19/90)
I have been programming in assembly language for about 5 months.
Mainly because I don't have enough to buy a C compiler.
Recently, I have been programming graphics, opening screens and
windows to use the graphics library routines.
So far, it's been going great. Now I'm trying to program sprites.
This is a very big problem for me!!
Even though I don't know C, I've been trying to follow C examples to
understand the procedure of simply displaying a sprite.
I don't understand how to use the ChangeSprite library routine.
Here is the program that I wrote:
Can anyone tell me what the problem is?
;A part of the rectangle fill program
;Press the joystick button to close the window.
OpenScreen=-198
CloseScreen=-66
OpenLib=-408
CloseLibrary=-414
Execbase=4
MoveScreen=-162
OpenWindow=-204
CloseWindow=-72
rectfill=-306
SetDrMd=-354
SetAPen=-342
DrawEllipse=-180
_Move=-240
Draw=-246
ChangeSprite=-420
MoveSprite=-426
GetSprite=-408
fire=$bfe001
run:
bsr opengfxlib
; bsr openmathffplib
; bsr openmathtranslib
bsr openint
bsr scropen
bsr openwind
bsr DisplaySprite
bra loop
DisplaySprite:
move.l gfxbase,a6
move.l simplesprite,a0
move.l #5,d0 ;-1=next available sprite
jsr GetSprite(a6)
; move.l d0,spritenum
; lea posctldata,a5
; move.l a5,posctlptr
; move.w $ffff,$00dff096 ;no need to set sprite bit
move.l screenhd,a0
move.l simplesprite,a1
move.l spritedata,a2
jsr ChangeSprite(a6)
rts
loop:
tst.b fire
bpl ende
bra loop
ende:
bsr closegfx
; bsr closemathffp
; bsr closemathtrans
bsr windclose
bsr scrclose
bsr closeint
rts
opengfxlib:
move.l execbase,a6
lea gfxname,a1
jsr OpenLib(a6)
move.l d0,gfxbase
rts
openmathffplib:
move.l ExecBase,a6
lea mathffpname,a1
jsr OpenLib(a6)
move.l d0,mathffpbase
rts
openmathtranslib:
move.l ExecBase,a6
lea mathtransname,a1
jsr OpenLib(a6)
move.l d0,mathtransbase
rts
openint:
move.l ExecBase,a6
lea IntName,a1
jsr OpenLib(a6)
move.l d0,intbase
rts
closeint:
move.l ExecBase,a6
move.l intbase,a1
jsr CloseLibrary(a6)
rts
closegfx:
move.l ExecBase,a6
move.l gfxbase,a1
jsr CloseLibrary(a6)
rts
closemathffp:
move.l ExecBase,a6
move.l mathffpbase,a1
jsr CloseLibrary(a6)
rts
closemathtrans:
move.l ExecBase,a6
move.l mathtransbase,a1
jsr CloseLibrary(a6)
rts
OpenWind:
move.l intbase,a6
lea windowdef,a0
jsr openwindow(a6)
move.l d0,windowhd
move.l windowhd,a0
move.l 50(a0),rastport
rts
Scropen:
move.l intbase,a6
lea screen_defs,a0
jsr openscreen(a6)
move.l d0,screenhd
rts
scrclose:
move.l intbase,a6
move.l screenhd,a0
jsr CloseScreen(a6)
rts
windclose:
move.l intbase,a6
move.l windowhd,a0
jsr CloseWindow(a6)
rts
Align
screen_defs:
dc.w 0,0,320,200,3 ;LtEdge,TopEdge,Wid,Ht,Depth
dc.b 1,3 ;DetailPen,BlockPen
dc.w 16384,15 ;ViewMode(16384=Sprites On),Type
dc.l 0,sname,0,0 ;Font,Title,GadgetPtr,BitMapPtr
windowdef:
dc.w 0,0,320,200
dc.b 1,3
dc.l $200,$100f,0,0,windowname
screenhd: dc.l 0
dc.l 0
dc.w 50,30,320,200,15
windowname: dc.b 'Adnan',0
Align
Intbase: dc.l 0
gfxbase: dc.l 0
mathffpbase: dc.l 0
mathtransbase: dc.l 0
windowhd: dc.l 0
IntName: dc.b 'intuition.library',0
gfxname: dc.b 'graphics.library',0
mathffpname: dc.b 'mathffp.library',0
mathtransname: dc.b 'mathtrans.library',0
rastport: dc.l 0
Align
sname: dc.b 'Our Screen',0
Align
simplesprite:
dc.l 0 ;posctldata
dc.w 5 ;ht
dc.w 160,100 ;x,y
dc.w 5 ;spritenum
spritedata:
dc.l 0
dc.l $ffffffff,$ffff0000,$0000ffff
dc.l $ffffffff,$ffff0000
dc.l 0
posctldata: dc.l $6d607200
posctlptr: dc.l 0
spritenum: dc.l 0
end