Hi,
Does anyone know how to efficiently manipulate LCD memory bits and bytes in Holtek MCU?
I am trying to program an HT23B60 where the LCD memory is located at the 15th RAM bank from 0x80 to 0xfb (i.e., 0x0f80-0x0ffb). If the absolute address assignment is done with a char pointer, it works fine. If only a bit is set or cleared, then the compiler seems to generate some non-optimal but okay code. But when an array of LCD memory is cleared or filled, the generated code seems incorrect. (Is the lower 4-bit of bank pointer BP set to '1111'? Or do I get it wrong?; the .LST is appended at the end of this posting.)
Any idea about how to program efficiently with absolute address RAM bits and bytes in general, and LCD memory array in particular?
Thanks,
* The FAQ 58 "How to map bits onto a RAM variable?" doesn't work here. (http://www.hitech.com.au/support/faqs.php#faq58)
-- HT-IDE3000 Version 6.6 SP1 HI-TECH C COMPILER (Holtek MCU) V9.03PL1 HI-TECH Software Macro Assembler (Holtek MCU) V9.03PL1
#define LCD_Mem 0x0f80 #define LCD_DATA 0x01
*(char*)LCD_Mem = LCD_DATA; // This is okay. 581 ;TEST.C: 228: *(char*)0x0f80 = 0x01; 582 01E4 0F80 mov a,128 583 01E5 0083 mov [mp1],a 584 01E6 0F0F mov a,15 585 01E7 0584 orm a,[bp] 586 01E8 0F01 mov a,1 587 01E9 0082 mov [iar1],a 588 01EA 0FE0 mov a,224 589 01EB 0684 andm a,[bp]
*(char*)(LCD_Mem+1) |= LCD_DATA; // generates some redundant code??
590 ;TEST.C: 236: *(char*)(0x0f80+1) |= 0x01; 591 01EC 0F81 mov a,129 592 01ED 0083 mov [mp1],a 593 01EE 0F0F mov a,15 594 01EF 0584 orm a,[bp] 595 01F0 0F01 mov a,1 596 01F1 0582 orm a,[iar1] 597 01F2 0704 mov a,[bp] 598 01F3 0EE0 and a,224 599 01F4 0484 xorm a,[bp] 600 01F5 0584 orm a,[bp] 601 01F6 0702 mov a,[iar1] 602 01F7 0081 mov [mp0],a 603 01F8 0FE0 mov a,224 604 01F9 0684 andm a,[bp]
for (n = 0; n<120; n++) ((char*)LCD_Mem)[n] = 0xff; // The asm code seems dubious.
620 ;TEST.C: 232: for (n = 0; n<120; n++) ((char*)0 + x0f80)[n] = 0xff; 621 0208 5F35 clr [_n] 622 0209 2A17 jmp l44 623 020A l41: 624 020A 4735 mov a,[_n] 625 020B 40B8 mov [??_main+2],a 626 020C 5F39 clr [??_main+3] 627 020D 0F80 mov a,3968 628 020E 4338 add a,[??_main+2] 629 020F 0083 mov [mp1],a 630 0210 4739 mov a,[??_main+3] 631 0211 0584 orm a,[bp] 632 0212 0FFF mov a,-1 633 0213 0082 mov [iar1],a 634 0214 0FE0 mov a,224 635 0215 0684 andm a,[bp] 636 0216 54B5 inc [_n] 637 0217 l44: 638 0217 4735 mov a,[_n] 639 0218 0A78 sub a,120 640 0219 380A snz [status].0 641 021A 2A0A jmp l41
|