Re: A86: Finished routines... Standard Delay


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

Re: A86: Finished routines... Standard Delay




i made a bunch of optimizations to your fading code.  you can definitely learn
some tricks by studying the difference between this and the original code.
note that this is untested.



title_screen:
	xor a			; sets contrast to zero
	out (2),a			; leaves contrast byte alone

	ld bc,$0115		;do both x and y at once
	ld (_penCol),bc		; x=21, 1
	ld hl,titlestring		; load the title string
	call _vputs		; output the title string
	ld bc,$3816
	ld (_penCol),bc
	ld hl,email
	call _vputs		; omit this if email comes right after titlestring
	call _screen_fade_in
	call _screen_fade_out
	jr _screen_fade_in


;this label is never called!
;don't even bother leaving this in.  just do jp _clrWindow in the calling
code.
clean_up:
	jp _clrWindow		;$4a86

screen_fade_out:
	ld a,($c008)
fade_out:
	call _delay_some
	dec a		;compare to 0 along with lowering counter
	out (2),a		
	jr nz,fade_out	;not done yet
	ret

screen_fade_in:
	xor a
	ld hl,$c008
fade_in:
	call _delay_some
	inc a
	out (2),a
	cp (hl)
	jr nz,fade_in
	ret

delay_some:
	ld b,$14		; delay seed
begin_delay_loop
	halt			;nop might be a better choice than halt
	djnz _begin_delay_loop
	ret