
//[i] color english_UL,
LOAD ModuleLib system\language\english_UL.txt,

ST7920_12864_ram
[
	public link io []
	
	command io -> io,
	command =
	LOAD CurrentDir command.txt,
	
	//=============================================
	//[i] function OS_init,
	public V OS_init:
		//命令执行器初始化
		command OS_init,
	
		//转换到文本模式
		command send_command 0x30,
		command send_command 0x30,
		command send_command 0x0c,
		command send_command 0x01,
		command send_command 0x06,
	
		//转换到图形模式
		command send_command 0x34,
		command send_command 0x36,
	end.
	
	//=============================================
	//[i] function fill_data,
	public V fill_data (N8 DATA):
		N8 addr = 0x80,
		repeat 32 times,
			command send_command addr,
			command send_command 0x80,
			repeat 32 times,
				command send_data DATA,
				...
			addr + 1,
			...
	end.
	
	//=============================================
	//向坐标 (x,y) 处写一个字
	//[i] function write_word,
	public V write_word (N8 x) (N8 y) (N16 data):
		//先转换坐标
		if y >= 32,
			y - 32,
			x + 8.
		command send_command (0x80 + y),
		command send_command (0x80 + x),
		command send_data (data 8(N8)), //先发送高字节
		command send_data (data 0(N8)), //再发送低字节
	end.
	
	//=============================================
	//读取坐标 (x,y) 处的一个字(双字节)
	//[i] function read_word,
	public N16 read_word (N8 x) (N8 y):
		//先转换坐标
		if y >= 32,
			y - 32,
			x + 8.
		command send_command (0x80 + y),
		command send_command (0x80 + x),
		N16 word,
		word 0(N8) = command read_data, //一定要空读一次，舍弃读到的字节
		word 8(N8) = command read_data, //先读高字节
		word 0(N8) = command read_data, //再读低字节
		return word,
	end.
]






















