Re: A82: Any help you need, just ask me :)


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

Re: A82: Any help you need, just ask me :)



Dines: Perhaps you can help me with my NASR? My program compiles fine,
the problem is that the sprite "disappears" when I press left or right to
move it. (This program is being made for ASH) I'll add some comments to
my source.




	ld HL, Sprite

	ld DE, (PROGRAM_ADDR)	; load program address
	add HL, DE		; add to get actual sprite address

	ld DE, GRAPH_MEM + (1*12) + (40/8)
	ex DE, HL	; switch the registers

;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;				First Row
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	ld A, (DE)	; row 1

> loads the byte at location DE into A

	ld B, A

> Store the byte into B now

	ld C, 0

> Clear C so it's "clean" when rotating

	ld A, (offset) ; A = offset counter

	push BC		; needed due to push at end of djnz

> This doesn't serve any purpose, but I need it the way I have the loop
structured


Offset_1_Loop:
	pop BC		; restore BC as sprites
		
	srl B		; shift 
	rr C		; rotate thru carry

	dec A		; dec counter
	push BC		; save BC as sprites
	ld B, A		; restore counter
	djnz Offset_1_Loop	; Loop until B (offset) = 0

	pop BC		; restore BC as sprites

	ld A, B		; first block of shift
	or (HL)
	ld (HL), A	

	inc HL		; next 8x8 block (COL) in graph_mem

	ld A, C	
	or (HL)		; second block of shift
	ld (HL), A	

	ld BC, 11		; 11, not 12 to get to next ROW in
graph_mem
	add HL, BC	
	inc DE		; next byte (ROW) in sprite

This goes on 6 more times to load the entire sprite. (it's only 7 rows
long) Everything's the same except the DJNZ loop name and the arg. in
DJNZ. So what am I assuming is happening that isn't? Thanks for any help
you can give.


		-Scoobie


References: