From: kon@cs.titech.ac.jp (Narihito Kon)
Subject: Re: Sharp PC-E500's LCDC
Organization: Tokyo Institute of Tech., Dept. of Computer Science, Japan
Date: Mon, 12 Oct 1992 07:02:12 GMT

  I show two example programs of controlling PC-E500's LCDC. The
former is for putting 240x32 dots graphic on LCD, and the latter is
for getting one ( reverse function of "put" ). The display buffer
which is used in the program is assumed as following form:

	Top                         Top+239
  (0,0)	#...........................#
Top+240 #...........................# Top+479
Top+480	#...........................# Top+719
Top+720	#...........................# <- Top+959 (239,31)

In the above '#' means 1 line of vertical 8dots. The display has
240x32 dots and a byte can hold 8dots, so you need 240*32/8=960bytes
of display buffer for put/get all of the display.

-------------------- FROM HERE --------------------
		pre_on
;
_work1:		equ	0			;use (bp) to (bp+2)
_work2:		equ	3			;use (bp+3) to (bp+5)
;----------------------------------------------------------------------
;
;		Function: Put bitmap graphic on display
;
;		Entry: Set top adrs of display buffer (960bytes) to Xreg
;		
;----------------------------------------------------------------------
put:		pushu	imr
		mv	(bp+_work1+1),4
		mv	(bp+_work1),[($e6)+8]	;get display offset
		or	(bp+_work1),$b8
l0:		mv	[$2000],(bp+_work1)	;Set X page
		mvw	(bp+_work2),$3840
		mv	a,$40
		mv	[$2000],a		;Set Y adrs
		mv	y,$2006
l1:		mv	a,[x++]
		mv	[y],a
		dec	(bp+_work2)
		jrnz	l1
		mv	y,$200a
l2:		mv	a,[x++]
		mv	[y],a
		dec	(bp+_work2+1)
		jrnz	l2
		add	(bp+_work1),4
		and	(bp+_work1),7
		or	(bp+_work1),$b8
		mv	[$2000],(bp+_work1)	;Set X page
		mv	a,120
		add	x,a
		mvw	(bp+_work2),$3840
		mv	a,$40
		mv	[$2000],a		;Set Y adrs
		mv	y,$2006
l3:		mv	a,[--x]
		mv	[y],a
		dec	(bp+_work2)
		jrnz	l3
		mv	y,$200a
l4:		mv	a,[--x]
		mv	[y],a
		dec	(bp+_work2+1)
		jrnz	l4
		sub	(bp+_work1),3
		and	(bp+_work1),7
		or	(bp+_work1),$b8
		mv	a,120
		add	x,a
		dec	(bp+_work1+1)
		jrnz	l0
		mv	ba,0
		popu	imr
		ret
;----------------------------------------------------------------------
;
;		Function: Get bitmap graphic from the display
;
;		Entry: Set top adrs of display buffer (960bytes) to Xreg
;		
;----------------------------------------------------------------------
get:		pushu	imr
		mv	(bp+!src_work1+1),4
		mv	(bp+!src_work1),[($e6)+8]
		or	(bp+!src_work1),$b8
l0:		mv	[$2000],(bp+!src_work1)	;Set X page
		mvw	(bp+!src_work2),$3941
		mv	a,$40
		mv	[$2000],a		;Set Y adrs
		mv	y,$2007
		mv	a,[y]
		jr	l1_1
l1:		mv	a,[y]
		mv	[x++],a
l1_1:		dec	(bp+!src_work2)
		jrnz	l1
		mv	y,$200b
		mv	a,[y]
		jr	l2_1
l2:		mv	a,[y]
		mv	[x++],a
l2_1:		dec	(bp+!src_work2+1)
		jrnz	l2
		add	(bp+!src_work1),4
		and	(bp+!src_work1),7
		or	(bp+!src_work1),$b8
		mv	[$2000],(bp+!src_work1)	;Set X page
		mv	a,120
		add	x,a
		mvw	(bp+!src_work2),$3941
		mv	a,$40
		mv	[$2000],a		;Set Y adrs
		mv	y,$2007
		mv	a,[y]
		jr	l3_1
l3:		mv	a,[y]
		mv	[--x],a
l3_1:		dec	(bp+!src_work2)
		jrnz	l3
		mv	y,$200b
		mv	a,[y]
		jr	l4_1
l4:		mv	a,[y]
		mv	[--x],a
l4_1:		dec	(bp+!src_work2+1)
		jrnz	l4
		sub	(bp+!src_work1),3
		and	(bp+!src_work1),7
		or	(bp+!src_work1),$b8
		mv	a,120
		add	x,a
		dec	(bp+!src_work1+1)
		jrnz	l0
		mv	ba,0
		popu	imr
		ret
-------------------- TO HERE --------------------

  I hope this will help someone.

--
--
Narihito Kon
Dept. of Computer Science, Tokyo Institute of Tech., Japan
E-Mail : kon@cs.titech.ac.jp
HAM    : JK1OSG @ JR1YTD
Newsgroups: comp.sys.handhelds