Re: A86: Contrast


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

Re: A86: Contrast




There's just one problem with this. It doesn't check whether 'a' is a valid 
number. If you have the contrast on one and decrease it two steps your calc 
will crash (or at least do something unpredicted). The same goes for the 
upper limit.

>From: BlAsTo1414@aol.com
>Reply-To: assembly-86@lists.ticalc.org
>To: assembly-86@lists.ticalc.org
>Subject: Re: A86: Contrast
>Date: Wed, 12 May 1999 21:58:38 EDT
>
>
>i wrote a contrast changer a while back heres the code.  hope it helps.
>
>start:
>	call 	_clrLCD		;clear the screen
>	call	_homeup		;put cursor in top left corner
>getkey:
>	call 	_getkey		;start getkey routine
>	cp		kUp		;check for addition key
>	jp		z,cadd		;if addition key is pressed, jump
>	cp		kDown		;check for subtraction key
>	jp		z,csub		;if it is pushed, jump
>	cp		kExit		;check for enter key
>	jp		z,exit		;if pushed, jump
>	jr		getkey		;if no key is pushed, repeat steps
>cadd:
>	ld a,($C008)	; load contrast value
>	inc a			; increase the contrast
>	ld ($C008),a	; write it back to memory
>	out (2),a		; and to the port
>	jr start
>csub:
>	ld a,1
>	ld a,($C008)	; load contrast value
>	sbc a,1			; decrease the contrast
>	ld ($C008),a	; write it back to memory
>	out (2),a		; and to the port
>	jr start
>exit:
>	call	_clrLCD		;clear the screen
>	call	_homeup		;return the cursor
>	ret					;return th ti-os
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com