Re: A86: Contrast


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

Re: A86: Contrast




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