| ??? 10/19/01 16:00 Read: times |
#15874 - RE: Converting my o/p to drive LCD disp |
j.guy,
point out the improvement in your code to me. Here's both versions performing the same scope of function: My code: ;----- org 0100h msg0: DB "TX1234.5",EOT ... msg255: DB "TXnnnn.n",EOT display_line_R2: mov a,r2 ;0-255 subroutine input mov b,#9 mul a,b mov dph,a mov dpl,b inc dph ;left this out (for 0100h table) call search_table ret ;----- your code: DISPLAY_LINE_JR: ;displays 0-256 msgs mov a,r2 ;0-255 subroutine input CLR C MOV DPTR,#DOPES RLC A ; is >= 128 ? JNC JR1 ; no INC DPH ; yes, add 128*2 to dptr JR1: ADD A,DPL ; A = DPL + (index&127) * 2 MOD DPL,A JNC JR2 ; if carry from dpl, add to dph INC DPH JR2: ; now have string address in dptr, ;;;missing code: dptr addresses ;;;only the DOPES ENTRY that ;;;still must be loaded into ;;;the dptr so the following ;;;call can be made ;;;example: clr a ;;;example: movc a,@a+dptr ;get DOPE msb ;;;example: mov r2,a ;hold ;;;example: inc dptr ;;;example: movc a,@a+dptr ;get DOPE lsb ;;;example: mov dpl,a ;;;example: mov dph,r2 CALL SEARCH_TABLE RET ORG NN00h DOPES: DW MSG0 ;word pointer to msg ... DW MSG255 ORG NM00h MSG0: DB "TX1234.5",EOT ... MSG255: DB "TXnnnn.n",EOT ;----- I just don't see the advantage in your algorithm. duh |



