MateoC's code:

Code:

Display_Org:
   ld   a,3      ; adjust origin drawing mode
   ld   hl,$1038
   call   Write_Display_Control
   jr   Full_Window

Display_Normal:
   ld   a,3      ; normal drawing mode
   ld   hl,$10B8
   call   Write_Display_Control

Full_Window:
   ld   a,$50      ; Set minimum Y
   ld   hl,0
   call   Write_Display_Control

   inc   a      ; Set maximum Y
   ld   l,239
   call   Write_Display_Control

   ld   l,0      ; Set minimum X
   inc   a
   call   Write_Display_Control

   inc   a      ; Set maximum X
   ld   hl,319

Write_Display_Control:
   out   ($10),a
   out   ($10),a
   ld   c,$11
   out   (c),h
   out   (c),l
        ret


Questions:
1. Under label "Display_Org" why is the specific number $1038 loaded into HL?
2. Under label "Display_Window" why does reg A start at $50?
3. Under label "Write_Display_Control" why is reg A output to port $10 twice?

Sorry if the answers seem obvious, this LCD is really throwing me for a loop.
Hi GregAStar, it might be worth looking at the LCD datasheet which can be found here: http://www.displayfuture.com/Display/datasheet/controller/ILI9335.pdf

Or for some community information here: http://wikiti.brandonw.net/index.php?title=84PCSE:LCD_Controller

Write_Display_Control is a routine that writes a value in HL to the LCD REGISTER in A via the LCD control/data ports ($10 & $11). You use this to change settings for the LCD.

With regards to your questions the $1038 is the default LCD ENTRY MODE value. ENTRY MODE allows you to set various settings for the LCD like RGB/BGR, vert/horz increment, colour mode etc: http://wikiti.brandonw.net/index.php?title=84PCSE:LCD_Controller#03:_Entry_Mode

A starts at $50 because that is the WINDOW HORIZONTAL ADDRESS START. You will see that A is increased after each write, that is because $50,$51,$52,$53 are the LCD WINDOW address registers; this is how you set the 'window' that you want to write data to in the LCD. In this case the routine is drawing FULL SCREEN, so you will see the values 0,239,0,319 since it is a 320x240 LCD. Note that the LCD is actually portrait, as in, it is on its side - which is why your HORIZONTAL values are 0-239 ... even though that's the height.

And as far as writing A twice, the write to the control port takes a 16-bit value however only 8-bits are considered by the LCD. Initially we used to write a 0 and A however the 'writing A twice' optimisation was found and has been standard ever since.

I recommend have a read over the WikiTI page and if you have any more questions please let me know.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement