This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
qdosmsq:pe:wspt [2009/02/16 17:03]
george.gwilt created
qdosmsq:pe:wspt [2014/04/08 11:06] (current)
george.gwilt Clarification of sprite positioning
Line 1: Line 1:
 +====== IOP.WSPT, IOP.WBLB & IOP.SPRY ======
 +These Traps write a sprite or a blob to a position in a window.
 +^Trap^Value in D0.B^Action^
 +|IOP.WSPT|$76|Writes a sprite|
 +|IOP.WBLB|$73|Writes a blob|
 +|IOP.SPRY|$77|Sprays pixels|
 +^Call Parameters^^Return Parameters^^
 +|D0.B|See above|D0.L|Error code|
 +|D1.L|x,y coordinates|D1.L|Preserved|
 +|D2.L|0 or number of pixels|D2.L|Preserved|
 +|A0.L|Window channel ID|A0.L|Preserved|
 +|A1.L|Pointer to sprite or blob|A1.L|Preserved|
 +|A2.L|Pointer to pattern (for blob)|A2.L|Preserved|
 +===== Errors =====
 +|ERR_NO|Channel not open|
 +|ERR_OR|Out of range|
 +|ERR_BP|Bad parameter|
 +===== Notes =====
 +  *The x,y pixel coordinates,​ which define where the origin of the sprite will be placed, in D1.L are relative to the window in A0.
 +  *Internal sprites can be written by setting a small number in A1 instead of an address. See the table below.
 +  *IOP.SPRY randomly sprays D2.L pixels onto a blob.
 +  *A2.L is not used for IOP.WSPT.
 +  *For GD2 colours eg modes 32 and 33 IOP.SPRY is not implemented. If it is used it will return the error "bad parameter"​. This Trap does however work with mode 4.
 +==== Sprite Table ====
 +|SP.NULL|$02|empty window|
 +|SP.MODE|$03|wrong mode (4 or 8)|
 +|SP.KEY|$04|keyboard entry|
 +|SP.BUSY|$05|no entry sign|
 +|SP.WMOVE|$06|window move|
 +|SP.WSIZE|$07|window change size|
 +===== Example =====
 +The example shows how to write a move sprite. We assume that A0 contains the window channel ID.
 +wrt_mve ​  ​movea.w ​  #​6,​a1 ​     ; "Move sprite"​ code
 +          move.l ​   #$a000a,d1 ; Print at 10,10
 +          moveq     #​-1,​d3 ​    ; Timeout
 +          moveq     #​$76,​d0 ​   ; IOP.WSPT
 +          trap      #3         ; Write the sprite