Post by Jonathan Cauldwell on Dec 5, 2020 18:47:06 GMT
Putting jp iniob in a user routine will reset all objects to their starting positions, regardless of the screen you are on, if that's what you want.
A user routine to reset a specific object could look like this (warning, this is untested):
; USER argument is passed to the user routine in the accumulator.
call findob ; find object details. ld d,h ; copy address to destination. ld e,l inc hl ; skip to initial position of object. inc hl inc hl ld bc,3 ; 3 bytes for screen, x and y. ldir ; copy to current status bytes. ret
Post by Jonathan Cauldwell on Dec 5, 2020 19:07:46 GMT
While I'm on the subject, if you wanted a user routine to put any item on a specified screen at a particular position try this one. Set the screen number up in A, the coordinates in B and C (Y and X respectively), then use USER n to put object n there. If the object is on screen you'll either have to have the player get it first or redraw the screen yourself after. Again, this is untested:
call findob ; find object details. ex de,hl ; make address our destination. ld hl,vara ; variables with new details. ld bc,3 ; 3 bytes for screen and position. ldir ; set new screen and position. ret
If you wanted to use (say) P, Q and R instead just change vara to varp.