;From: Output a test pattern to the display
;To: perSbaglio ;)
;By: Andrea Del Signore sejerpz at tin.it

org 0x3400

start:
	ld a,0x7
	out (0x5),a
	ld a,0x30
	out (0x70), a
	
	ld a,0x1f
	out (0xee),a
	
	ld a, 0x18
	out (0x2),a

	;image data
	ld h,image >> 8
	ld l,image & 0xff

	;page count = 4
	ld b,4
	ld e, 0xB3
page:	
	;lcd programming mode
	in a,(0xee)
	and 0xFE
	out (0xee),a

	; set page (b)
	ld a,e		
	ld (0x8000), a

	;lcd set column lo 0
	ld a,0x00
	ld (0x8000), a

	;lcd set column hi 0
	ld a,0x10
	ld (0x8000), a

	;lcd data write mode
	in a,(0xee)
	or 0x01
	out (0xee),a

	;column counter = 132
	ld c,0x84

loop:
	ld a,(hl)
	ld (0x8001),a
	dec c
	inc hl
	jp  NZ,loop

	dec e
	djnz page

	ret

image:
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x04,0x08
	defb 0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x01,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0x06,0x0C,0x0C,0x0C
	defb 0x0E,0x07,0x03,0x00,0x01,0x07,0x06,0x0C,0x0C,0x0C,0x0C,0x0E,0x07,0x03,0x00,0x00
	defb 0x0F,0x0F,0x06,0x0C,0x0C,0x0C,0x00,0x1C,0x3E,0x73,0x63,0x63,0x63,0x61,0x31,0x00
	defb 0x00,0x00,0x00,0xFF,0xFF,0x06,0x0C,0x0C,0x0C,0x0E,0x07,0x03,0x00,0x00,0x06,0x0C
	defb 0x0C,0x0C,0x0E,0x07,0x03,0x00,0x00,0x03,0x07,0x0E,0x0C,0x0C,0x0C,0x06,0x0F,0x0F
	defb 0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xCF,0xCF,0x00,0x00,0x01,0x07,0x06,0x0C
	defb 0x0C,0x0C,0x0C,0x06,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x30,0xC0,0x00
	defb 0x00,0x00,0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00,0x3C,0x7E,0x3C,0x00,0x00,0x00
	defb 0x00,0x00,0xC0,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF
	defb 0x18,0x0C,0x0C,0x0C,0x1C,0xF8,0xF0,0x00,0xE0,0xF8,0xD8,0xCC,0xCC,0xCC,0xCC,0xCC
	defb 0xCC,0xD8,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0x0C,0x0C,0x0C
	defb 0x0C,0x9C,0xF8,0xF0,0x00,0x00,0x00,0xFC,0xFC,0x18,0x0C,0x0C,0x0C,0x1C,0xF8,0xF0
	defb 0x00,0x78,0x7C,0xCC,0xCC,0xCC,0xD8,0xFC,0xFC,0x00,0x00,0xF0,0xF9,0x1C,0x0C,0x0C
	defb 0x0C,0x19,0xFF,0xFE,0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0x00,0x00
	defb 0xE0,0xF8,0x18,0x0C,0x0C,0x0C,0x0C,0x18,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0xE0,0x18,0x06,0x01,0x00,0xC0,0x20,0x10,0x18,0x08,0x0C,0x0C,0x04,0x04,0x04,0x04
	defb 0x04,0x08,0x10,0x00,0x00,0x01,0x06,0x18,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
	defb 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x10,0x10,0x10
	defb 0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
endimage:
