Re: A83: I need more help.


[Prev][Next][Index][Thread]

Re: A83: I need more help.




O.K.   here you get it :)

it was a matter of destroing reg's...
I made som changes in your Show_Sprite routine...
When you do all those add's you use b, which is a part of bc..
so bc wil after your add's not point where you want..

instead of the add's I put 3 sla's...   that is shift left arithmetical.
that is the absolute best way to multiply with 2.
and 3 of them is then, 2*2*2 = 8

so this is what it should be:

Show_Sprite:

	ld a, (Sprite)                                  ; Get sprite
	ld hl, Sprite_Data                              ; Get sprite start address
	ld bc, 0                                        ; Set sprite Number

;I commeted theese out..
;	add a, a                                        ; (have to double it)
;
;	ld b, a          ;Here you destroy the b-part of bc..
;	add a, b
;	add a, b
;	add a, b
;	add a, b
;	add a, b
;	add a, b
;	add a, b

	sla a			;here I multiply with 8
	sla a 
	sla a

	ld c, a                                         ; Now we've got the
_right_ offset in BC :)
	add hl, bc                                      ; Get final address in HL

	ld a, 0                                         ; Set cords to upper left
	ld e, a

	call DRWSPR                                     ; Show sprite
	ret                                             ; Return

Nice to be of some help :)
//Olle


References: