First the contrast is adjusted on pin3 of PORTD using PWM on the lines 9-11. With 127 about half of the maximum (0-255) is set.
Config PORTD.3 = output
Config Timer2 = Pwm , Compare B Pwm = Clear Up , Prescale = 8
Compare2B = 127
Program test4b tests the display with output on the picture above:
Following functions are provided, the last parameter is color: Cls Pset 32 , 110 , BK Line(0 , 0) -(130 , 130) , B Box(10 , 30) -(60 , 100) , R Boxfill(0 , 0) -(60 , 10) , G Circle(30 , 30) , 10 , B Lcdat 100 , 0 , "12345678" , B , gray
There are 4 includes in the test4b. First of them the color definitions, which I have obtained by testing, because the color values, which I found in internet weren't suitable. With &B11111111 I got purple instead of white, with &B00000000 I got dark blue instead of black. Also the CLS function made background purple. I don't know, why it works in such a way.
Second include provides initialisation of the display configuration. Most of the options are set by default, but I have set them, because we easy make a change without affecting the source code.
The last two, after the program end are inline ASM declarations of two fonts.