⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sed1335f.lib

📁 Zword公司的Rabbit2000系列相关文件
💻 LIB
📖 第 1 页 / 共 2 页
字号:
		
		buf_size = XMEM_BUF_SIZE;
#asm  
		ld    a,xpc  				; Save-off current XPC value
		push  af

		ld		a,(glbuf_xpc)		; Get glBuf XPC value
		ld    xpc,a					; Mapped in glBuf into the 0xE000 block

		ld		hl,(glPageAddr)	; HL = LCD Write Addr
		ld		de,SEDCR				; BC = LCD Command Reg
		ld		a,046h				; WRITE CURSOR		
		ioe	ld (de),a  			
		dec	de
		TCYC_DELAY
		
		ld    a,l
		ioe	ld (de),a  			
		TCYC_DELAY
		
		ld    a,h
		ioe	ld (de),a  			
		TCYC_DELAY

		inc	de						; WRITE MEMORY Command
		ld		a,042h
		ioe	ld (de),a  			;
		dec	de						; BC = LCD Data Wr/LCD Status Rd

		ld    hl,(glbuf_offset)	; Get glBuf offset within 0xE000 block
		ld		bc,(buf_size)		; BC = Byte Counter

		ld    a,(animation)
		cp    a,0
		jr    z,.noanimation

.animation:
		bit   4,h					; Test if HL exceeded 0xF000 boundary
		jr    z,.skipXPC1			; 
		res   4,h					; Set glBuf offset back to 0xE000 range
		ld    a,xpc					; Get XPC value
		inc   a						; Bump XPC to point to next 4K block
		ld    xpc,a					; Update XPC register
		
.skipXPC1:
		TCYC_DELAY
		ioe 	ldi					; IO(DE) = MEM(HL++), --B	
		dec	e						; Restore DE address	

		TCYC_DELAY				
		ioe	ldi					; IO(DE) = MEM(HL++), --B		
		dec	e						; Restore DE address
	
		ld		a,b					; Continue til Done
		or		c
		jr		nz,.animation
		jr    .bufferdone

.noanimation:
		bit   4,h					; Test if HL exceeded 0xF000 boundary
		jr    z,mem_wait			; 
		res   4,h					; Set glBuf offset back to 0xE000 range
		ld    a,xpc					; Get XPC value
		inc   a						; Bump XPC to point to next 4K block
		ld    xpc,a					; Update XPC register
		
align even
mem_wait:
		ioe	ld a, (de)  		; Wait for memory Busy Flag, D6 = 0
		and	0x40					; Wait For Memory Ready
		TCYC_DELAY
		jr		nz,mem_wait

		TCYC_DELAY
		ioe 	ldi					; IO(DE) = MEM(HL++), --B						
		dec	e						; Restore DE address						

		TCYC_DELAY
		ioe	ldi					; IO(DE) = MEM(HL++), --B
		dec	e						; Restore DE address	

		TCYC_DELAY
		ioe 	ldi					; IO(DE) = MEM(HL++), --B
		dec	e						; Restore DE address							

		TCYC_DELAY
		ioe	ldi					; IO(DE) = MEM(HL++), --B
		dec	e						; Restore DE address	

		ld		a,b					; Continue til Done
		or		c
		jr		nz,.noanimation

.bufferdone:		
		ld		hl,glPageAddr+1	; HL = &MSB(Hidden Page Addr)
		ld		a,0x40				; Swap Visible/Hidden Page Address
		xor	a,(hl)
		ld		(hl),a
		ld		a,0x10				; If Page 0 Hidden, Show Page 1
		jr		z,sync					
		ld		a,0x04				; If Page 1 Hidden, Show Page 0

sync:	;*** Wait for Frame Sync to Eliminate Shear ***;
		push	af						; Save display Page 
		ld		bc,SEDDR				; Wait for CMD.6 == 0

align even
wait2:		
		ioe	ld a, (bc)			; Wait for memory Busy Flag, D6 = 0
		and	a,0x40
		TCYC_DELAY
		jr		nz,wait2
				
		inc	bc						; Send Page control command
		ld		a,059h
		ioe	ld (bc),a 			  
		TCYC_DELAY

		pop	af						; Restrieve display Page
		dec	bc						; Swap display pages 
		ioe	ld (bc),a			; out	(c),a

		pop   af						; Retrieve XPC value
		ld   	xpc,a             ; Restore XPC
#endasm
}


/*** BeginHeader _glPlotRealtime */
useix root void _glPlotRealtime (char pixel, long phydispAddr);
/*** EndHeader */

/* START _FUNCTION DESCRIPTION *******************************************
_glPlotRealtime				<SED1335F.LIB>

SYNTAX:	      void _glPlotRealtime (char pixel, long phydispAddr)

DESCRIPTION:   This function takes a byte of data and writes it to the
               LCD specified by the dipslay address. This function is
               non-reentrant and is an internal function. 

PARAMETER1:    LCD pixel byte to be written to the LCD display.
PARAMETER2:    Physical address of where to write the pixel data on
               the LCD display.
   
RETURN VALUE:	None.
			
SEE ALSO:		graphic.lib, _glInit, _glDispOnOff, _glContrast,
               _glBackLight

END DESCRIPTION **********************************************************/

nodebug
useix root void _glPlotRealtime (char pixel, long phydispAddr)
{
		static int dispAddr;	
#asm 
		; Calculate pixel display address 
		c		dispAddr = (int) (phydispAddr - glBuf);
		
		ld		bc,(dispAddr)
		ld    hl,0x0000
		ld    a,(glPageAddr+1)	
		cp    0x00
		jr    nz,writeadr		
		ld    hl,0x4000
		
writeadr:				
		add   hl,bc					;Add pixel offset to base address
								
		ld		de,SEDCR				; Write Cursor location
		ld		a,046h				; Load reg with cursor command		
		ioe	ld (de),a  				
		dec	de
		TCYC_DELAY
		
		ld    a,l
		ioe	ld (de),a  				
		TCYC_DELAY
		
		ld    a,h
		ioe	ld (de),a  					

		; Write pixel data to display memory
		inc	de							; WRITE MEMORY
		ld		a,042h
		ioe	ld (de),a
		TCYC_DELAY		

		; Restore Registers for Graphic routine
sync:	;*** Wait for Frame Sync to Eliminate Shear ***;
		ld		de,SEDDR				; Wait for CMD.6 == 0

align even		
wait1:
		ioe	ld a, (de)			; Read LCD chip status
		and	a,0x40
		TCYC_DELAY
		jr		nz,wait1

		ld    a,(ix+pixel)
		ioe 	ld (de),a
#endasm
}



/*** BeginHeader glAnimation  */
void glAnimation (int OnOff);
/*** EndHeader */

/* START FUNCTION DESCRIPTION *******************************************
glAnimation				<SED1335F.LIB>

SYNTAX:	      void glAnimation(int OnOff);

DESCRIPTION:   This function is used to enable/disable the graphic
               animation mode. The animation mode is defaulted OFF
               when the graphic driver is executed. This function
               is  non-reentrant.        

					Note:
					-----
               The animation mode is intended to be used for special 
               effects only. When using this mode, raster lines will be 
               produced in your display image which may be undesirable
               for some applications, please use with caution. 
                                       
PARAMETER1:    0 = Animation mode disabled.
               1 = Animation mode enabled.
   
RETURN VALUE:	None.
			
SEE ALSO:		graphic.lib

END DESCRIPTION **********************************************************/

nodebug
void glAnimation(int OnOff)
{
	animation = OnOff;
}


/*** BeginHeader glRealtime  */
void glRealtime (int OnOff);
/*** EndHeader */

/* START FUNCTION DESCRIPTION *******************************************
glRealtime				<SED1335F.LIB>

SYNTAX:	      void glRealtime(int OnOff);

DESCRIPTION:   This function is used to enable/disable realtime 
               mode for the glPlotDot function. The glPlotDot
               realtime mode is defaulted OFF when the graphic
               driver is executed. This function is non-reentrant.        
                                       
PARAMETER1:    0 = Realtime mode disabled.
               1 = Realtime mode enabled.
   
RETURN VALUE:	None.
			
SEE ALSO:		graphic.lib, glPlotDot

END DESCRIPTION **********************************************************/

nodebug
void glRealtime(int OnOff)
{
	realtime = OnOff;
}


/*** BeginHeader glBackLight */
void glBackLight(int onOff);
/*** EndHeader */

/* START FUNCTION DESCRIPTION *******************************************
glBackLight			<SED1335F.LIB>

SYNTAX:	      void glBackLight(int onOff);

DESCRIPTION:   Sets the backlight to either the ON or OFF state. This
               function is non-reentrant. 

PARAMETER1:    0  sets the backlight OFF.
					1  sets the backlight ON.             
    
RETURN VALUE:	None.
			
SEE ALSO:		glSetContrast, graphic.lib

END DESCRIPTION **********************************************************/

nodebug
void glBackLight(int onOff)
{
	if(onOff == 1)
		WrExtPort(0xA004, 0x01);
	else
		WrExtPort(0xA004, 0x00);
}

/*** BeginHeader glSetContrast */
void glSetContrast(int contrast);
/*** EndHeader */

/* START FUNCTION DESCRIPTION *******************************************
glSetContrast				<SED1335F.LIB>

SYNTAX:	      void glSetContrast(int contrast);

DESCRIPTION:   Sets the contrast, if the circuitry is installed.

					This function is non-reentrant and is an internal function,
					which is called by the function glContrast located in the
					graphic library. This function is non-reentrant. 

PARAMETER:		Low to high values (0 - 31) will give you low to high
               contrast, repectively. (Most common setting is 20)   
    
RETURN VALUE:	None.
			
SEE ALSO:		glBackLight, graphic.lib

END DESCRIPTION **********************************************************/

nodebug
void glSetContrast(int contrast)
{
	static current_contrast, initialized;
	auto int orig_contrast, i;
	
	#GLOBAL_INIT{initialized = 0;}

	if ((contrast < 0) || (contrast > 31))
	{
		return;
	}

	orig_contrast = contrast;		
	if(!initialized)
	{
		// Initialize clock and chip select high...due to uP reset cycle
		WrExtPort(0xA008,  0x00);
		WrExtPort(0xA00A,  0x01);

		// Assert chip select and set chip to count-up
		WrExtPort(0xA009,  0x01);	
		WrExtPort(0xA008,  0x01);

		// Clock trim pot to max limit 
		for(i=0; i<32;i++)
		{
			WrExtPort(0xA00A,  0x00);
			WrExtPort(0xA00A,  0x01);
		}
		WrExtPort(0xA008,  0x00);
		initialized = TRUE;
		current_contrast = 0;
	}

	if(contrast > current_contrast)
	{
		// Set Counter direction and then assert chip select
		WrExtPort(0xA009,  0x00);
		WrExtPort(0xA008,  0x01);

		while(contrast > current_contrast)
		{
			WrExtPort(0xA00A,  0x00);
			WrExtPort(0xA00A,  0x01);
			contrast--;
		}
		WrExtPort(0xA008,  0x00);
	}
	else if(contrast < current_contrast)
	{
		// Set Counter direction and then assert chip select
		WrExtPort(0xA009,  0x01);	
		WrExtPort(0xA008,  0x01);
		
		while(contrast < current_contrast)
		{
			WrExtPort(0xA00A,  0x00);
			WrExtPort(0xA00A,  0x01);
			contrast++;
		}
		WrExtPort(0xA008,  0x00);		
	}
	current_contrast = orig_contrast;
}

/*** BeginHeader glDispOnOff */
void glDispOnOff(int onOff);
/*** EndHeader */

/* START _FUNCTION DESCRIPTION *******************************************
glDispOnOff			<SED1335F.LIB>

SYNTAX:	      void glDispOnOff(int onOff);

DESCRIPTION:	glDispOnOff is currently not supported...The graphic
               library requires that you provide a NULL function
	            if the feature isn't supported.

END DESCRIPTION **********************************************************/

nodebug
void glDispOnOff(int onOff)
{
	
}

/*** BeginHeader */
#endif
/*** EndHeader */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -